summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@koziol.gov>2020-06-26 23:57:38 (GMT)
committerQuincey Koziol <koziol@koziol.gov>2020-06-26 23:57:38 (GMT)
commite767f44e953047297fece364218147c908e8b585 (patch)
treed4b6909f14b78bb732b6947adc46ac3cd3ca54f6 /java
parent949649a2b6e00297cbdc49437e70a27e455e92d2 (diff)
parenta08ab621febde7b09e4d86eab80cb029c123e9f6 (diff)
downloadhdf5-e767f44e953047297fece364218147c908e8b585.zip
hdf5-e767f44e953047297fece364218147c908e8b585.tar.gz
hdf5-e767f44e953047297fece364218147c908e8b585.tar.bz2
Merge remote-tracking branch 'origin/develop' into monotonic_timer
Diffstat (limited to 'java')
-rw-r--r--java/CMakeLists.txt23
-rw-r--r--java/Makefile.am17
-rw-r--r--java/examples/CMakeLists.txt12
-rw-r--r--java/examples/Makefile.am2
-rw-r--r--java/examples/datasets/CMakeLists.txt116
-rw-r--r--java/examples/datasets/JavaDatasetExample.sh.in (renamed from java/examples/datasets/runExample.sh.in)165
-rw-r--r--java/examples/datasets/Makefile.am8
-rw-r--r--java/examples/datatypes/CMakeLists.txt72
-rw-r--r--java/examples/datatypes/H5Ex_T_Float.java4
-rw-r--r--java/examples/datatypes/H5Ex_T_FloatAttribute.java4
-rw-r--r--java/examples/datatypes/JavaDatatypeExample.sh.in (renamed from java/examples/datatypes/runExample.sh.in)99
-rw-r--r--java/examples/datatypes/Makefile.am8
-rw-r--r--java/examples/groups/CMakeLists.txt93
-rw-r--r--java/examples/groups/H5Ex_G_Intermediate.java14
-rw-r--r--java/examples/groups/H5Ex_G_Iterate.java5
-rw-r--r--java/examples/groups/H5Ex_G_Traverse.java32
-rw-r--r--java/examples/groups/H5Ex_G_Visit.java28
-rw-r--r--java/examples/groups/JavaGroupExample.sh.in (renamed from java/examples/groups/runExample.sh.in)105
-rw-r--r--java/examples/groups/Makefile.am8
-rw-r--r--java/examples/intro/CMakeLists.txt86
-rw-r--r--java/examples/intro/JavaIntroExample.sh.in (renamed from java/examples/intro/runExample.sh.in)66
-rw-r--r--java/examples/intro/Makefile.am8
-rw-r--r--java/lib/ext/slf4j-nop-1.7.25.jarbin0 -> 4007 bytes
-rw-r--r--java/lib/ext/slf4j-nop-1.7.5.jarbin4091 -> 0 bytes
-rw-r--r--java/lib/ext/slf4j-simple-1.7.25.jarbin0 -> 15257 bytes
-rw-r--r--java/lib/ext/slf4j-simple-1.7.5.jarbin10680 -> 0 bytes
-rw-r--r--java/lib/slf4j-api-1.7.25.jarbin0 -> 41203 bytes
-rw-r--r--java/lib/slf4j-api-1.7.5.jarbin26084 -> 0 bytes
-rw-r--r--java/src/CMakeLists.txt8
-rw-r--r--java/src/Makefile.am12
-rw-r--r--java/src/hdf/CMakeLists.txt6
-rw-r--r--java/src/hdf/hdf5lib/CMakeLists.txt19
-rw-r--r--java/src/hdf/hdf5lib/H5.java1715
-rw-r--r--java/src/hdf/hdf5lib/HDF5Constants.java153
-rw-r--r--java/src/hdf/hdf5lib/HDFArray.java5
-rw-r--r--java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java (renamed from java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java)5
-rw-r--r--java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java9
-rw-r--r--java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java (renamed from java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java)5
-rw-r--r--java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java9
-rw-r--r--java/src/hdf/hdf5lib/exceptions/HDF5Exception.java2
-rw-r--r--java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java28
-rw-r--r--java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java102
-rw-r--r--java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java123
-rw-r--r--java/src/hdf/hdf5lib/structs/H5L_info_t.java35
-rw-r--r--java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java36
-rw-r--r--java/src/hdf/hdf5lib/structs/H5O_info_t.java38
-rw-r--r--java/src/hdf/hdf5lib/structs/H5O_native_info_t.java52
-rw-r--r--java/src/hdf/hdf5lib/structs/H5O_token_t.java45
-rw-r--r--java/src/hdf/hdf5lib/structs/H5_ih_info_t.java18
-rw-r--r--java/src/hdf/overview.html26
-rw-r--r--java/src/jni/CMakeLists.txt58
-rw-r--r--java/src/jni/Makefile.am5
-rw-r--r--java/src/jni/exceptionImp.c222
-rw-r--r--java/src/jni/exceptionImp.h18
-rw-r--r--java/src/jni/h5Constants.c136
-rw-r--r--java/src/jni/h5Imp.c109
-rw-r--r--java/src/jni/h5aImp.c2185
-rw-r--r--java/src/jni/h5aImp.h161
-rw-r--r--java/src/jni/h5dImp.c2612
-rw-r--r--java/src/jni/h5dImp.h20
-rw-r--r--java/src/jni/h5eImp.c634
-rw-r--r--java/src/jni/h5fImp.c675
-rw-r--r--java/src/jni/h5fImp.h45
-rw-r--r--java/src/jni/h5gImp.c247
-rw-r--r--java/src/jni/h5iImp.c234
-rw-r--r--java/src/jni/h5jni.h390
-rw-r--r--java/src/jni/h5lImp.c1002
-rw-r--r--java/src/jni/h5oImp.c1179
-rw-r--r--java/src/jni/h5oImp.h82
-rw-r--r--java/src/jni/h5pACPLImp.c36
-rw-r--r--java/src/jni/h5pACPLImp.h27
-rw-r--r--java/src/jni/h5pDAPLImp.c325
-rw-r--r--java/src/jni/h5pDAPLImp.h112
-rw-r--r--java/src/jni/h5pDCPLImp.c1415
-rw-r--r--java/src/jni/h5pDCPLImp.h396
-rw-r--r--java/src/jni/h5pDXPLImp.c505
-rw-r--r--java/src/jni/h5pDXPLImp.h209
-rw-r--r--java/src/jni/h5pFAPLImp.c1977
-rw-r--r--java/src/jni/h5pFAPLImp.h537
-rw-r--r--java/src/jni/h5pFCPLImp.c572
-rw-r--r--java/src/jni/h5pFCPLImp.h207
-rw-r--r--java/src/jni/h5pGAPLImp.c36
-rw-r--r--java/src/jni/h5pGAPLImp.h27
-rw-r--r--java/src/jni/h5pGCPLImp.c227
-rw-r--r--java/src/jni/h5pGCPLImp.h99
-rw-r--r--java/src/jni/h5pImp.c5850
-rw-r--r--java/src/jni/h5pImp.h1382
-rw-r--r--java/src/jni/h5pLAPLImp.c240
-rw-r--r--java/src/jni/h5pLAPLImp.h107
-rw-r--r--java/src/jni/h5pLCPLImp.c36
-rw-r--r--java/src/jni/h5pLCPLImp.h27
-rw-r--r--java/src/jni/h5pOCPLImp.c211
-rw-r--r--java/src/jni/h5pOCPLImp.h99
-rw-r--r--java/src/jni/h5pOCpyPLImp.c92
-rw-r--r--java/src/jni/h5pOCpyPLImp.h61
-rw-r--r--java/src/jni/h5pStrCPLImp.c74
-rw-r--r--java/src/jni/h5pStrCPLImp.h45
-rw-r--r--java/src/jni/h5plImp.c198
-rw-r--r--java/src/jni/h5rImp.c986
-rw-r--r--java/src/jni/h5rImp.h130
-rw-r--r--java/src/jni/h5sImp.c1675
-rw-r--r--java/src/jni/h5sImp.h7
-rw-r--r--java/src/jni/h5tImp.c1499
-rw-r--r--java/src/jni/h5tImp.h9
-rw-r--r--java/src/jni/h5util.c4577
-rw-r--r--java/src/jni/h5util.h43
-rw-r--r--java/src/jni/h5vlImp.c289
-rw-r--r--java/src/jni/h5vlImp.h118
-rw-r--r--java/src/jni/h5zImp.c29
-rw-r--r--java/src/jni/nativeData.c1342
-rw-r--r--java/test/CMakeLists.txt300
-rw-r--r--java/test/JUnit-interface.ert2
-rw-r--r--java/test/JUnit-interface.txt664
-rw-r--r--java/test/Makefile.am32
-rw-r--r--java/test/TestAll.java5
-rw-r--r--java/test/TestH5.java173
-rw-r--r--java/test/TestH5A.java20
-rw-r--r--java/test/TestH5D.java2
-rw-r--r--java/test/TestH5Dparams.java11
-rw-r--r--java/test/TestH5Dplist.java22
-rw-r--r--java/test/TestH5E.java292
-rw-r--r--java/test/TestH5Edefault.java214
-rw-r--r--java/test/TestH5Eparams.java282
-rw-r--r--java/test/TestH5Eregister.java3
-rw-r--r--java/test/TestH5F.java112
-rw-r--r--java/test/TestH5Fbasic.java27
-rw-r--r--java/test/TestH5Fparams.java48
-rw-r--r--java/test/TestH5G.java31
-rw-r--r--java/test/TestH5Gbasic.java2
-rw-r--r--java/test/TestH5Giterate.java5
-rw-r--r--java/test/TestH5Lbasic.java55
-rw-r--r--java/test/TestH5Lcreate.java48
-rw-r--r--java/test/TestH5Obasic.java330
-rw-r--r--java/test/TestH5Ocreate.java77
-rw-r--r--java/test/TestH5Oparams.java60
-rw-r--r--java/test/TestH5P.java128
-rw-r--r--java/test/TestH5PData.java2
-rw-r--r--java/test/TestH5Pfapl.java30
-rw-r--r--java/test/TestH5Pfaplhdfs.java138
-rw-r--r--java/test/TestH5Pfapls3.java159
-rw-r--r--java/test/TestH5Pvirtual.java33
-rw-r--r--java/test/TestH5R.java486
-rw-r--r--java/test/TestH5Sbasic.java2
-rw-r--r--java/test/TestH5T.java2
-rw-r--r--java/test/TestH5Tparams.java11
-rw-r--r--java/test/TestH5VL.java173
-rw-r--r--java/test/TestH5Z.java33
-rw-r--r--java/test/junit.sh.in936
-rw-r--r--java/test/testfiles/JUnit-TestH5.txt17
-rw-r--r--java/test/testfiles/JUnit-TestH5A.txt34
-rw-r--r--java/test/testfiles/JUnit-TestH5D.txt25
-rw-r--r--java/test/testfiles/JUnit-TestH5Dparams.txt24
-rw-r--r--java/test/testfiles/JUnit-TestH5Dplist.txt8
-rw-r--r--java/test/testfiles/JUnit-TestH5E.txt11
-rw-r--r--java/test/testfiles/JUnit-TestH5Edefault.txt32
-rw-r--r--java/test/testfiles/JUnit-TestH5Eparams.txt19
-rw-r--r--java/test/testfiles/JUnit-TestH5Eregister.txt11
-rw-r--r--java/test/testfiles/JUnit-TestH5F.txt16
-rw-r--r--java/test/testfiles/JUnit-TestH5Fbasic.txt22
-rw-r--r--java/test/testfiles/JUnit-TestH5Fparams.txt16
-rw-r--r--java/test/testfiles/JUnit-TestH5Fswmr.txt8
-rw-r--r--java/test/testfiles/JUnit-TestH5G.txt17
-rw-r--r--java/test/testfiles/JUnit-TestH5Gbasic.txt33
-rw-r--r--java/test/testfiles/JUnit-TestH5Giterate.txt7
-rw-r--r--java/test/testfiles/JUnit-TestH5Lbasic.txt23
-rw-r--r--java/test/testfiles/JUnit-TestH5Lcreate.txt42
-rw-r--r--java/test/testfiles/JUnit-TestH5Lparams.txt44
-rw-r--r--java/test/testfiles/JUnit-TestH5Obasic.txt45
-rw-r--r--java/test/testfiles/JUnit-TestH5Ocopy.txt9
-rw-r--r--java/test/testfiles/JUnit-TestH5Ocreate.txt22
-rw-r--r--java/test/testfiles/JUnit-TestH5Oparams.txt38
-rw-r--r--java/test/testfiles/JUnit-TestH5P.txt89
-rw-r--r--java/test/testfiles/JUnit-TestH5PData.txt8
-rw-r--r--java/test/testfiles/JUnit-TestH5PL.txt8
-rw-r--r--java/test/testfiles/JUnit-TestH5Pfapl.txt41
-rw-r--r--java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt9
-rw-r--r--java/test/testfiles/JUnit-TestH5Pfapls3.txt10
-rw-r--r--java/test/testfiles/JUnit-TestH5Plist.txt10
-rw-r--r--java/test/testfiles/JUnit-TestH5Pvirtual.txt17
-rw-r--r--java/test/testfiles/JUnit-TestH5R.txt28
-rw-r--r--java/test/testfiles/JUnit-TestH5S.txt29
-rw-r--r--java/test/testfiles/JUnit-TestH5Sbasic.txt22
-rw-r--r--java/test/testfiles/JUnit-TestH5T.txt19
-rw-r--r--java/test/testfiles/JUnit-TestH5Tbasic.txt11
-rw-r--r--java/test/testfiles/JUnit-TestH5Tparams.txt78
-rw-r--r--java/test/testfiles/JUnit-TestH5VL.txt13
-rw-r--r--java/test/testfiles/JUnit-TestH5Z.txt9
187 files changed, 28318 insertions, 16829 deletions
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
index 68860be..416e495 100644
--- a/java/CMakeLists.txt
+++ b/java/CMakeLists.txt
@@ -1,8 +1,9 @@
-cmake_minimum_required(VERSION 3.2.2)
-PROJECT ( HDF5_JAVA C Java )
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_JAVA C Java)
set (CMAKE_MODULE_PATH "${HDF_RESOURCES_DIR};${HDF_RESOURCES_EXT_DIR}")
find_package (Java)
+
#-----------------------------------------------------------------------------
# Include some macros for reusable code
#-----------------------------------------------------------------------------
@@ -10,13 +11,12 @@ include (${HDF_RESOURCES_DIR}/UseJava.cmake)
message (STATUS "JAVA: JAVA_HOME=$ENV{JAVA_HOME} JAVA_ROOT=$ENV{JAVA_ROOT}")
find_package (JNI)
-message ("JNI_LIBRARIES=${JNI_LIBRARIES}")
-message ("JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
+message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
+message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
-INCLUDE_DIRECTORIES ( ${JNI_INCLUDE_DIRS} )
if (WIN32)
- set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre8")
+ set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre")
else ()
set (HDF_JRE_DIRECTORY "/usr/lib/jvm/jre")
endif ()
@@ -25,31 +25,32 @@ endif ()
# Include the main src and config directories
#-----------------------------------------------------------------------------
set (HDF5_JAVA_INCLUDE_DIRECTORIES
+ ${JNI_INCLUDE_DIRS}
${HDF5_JAVA_JNI_SRC_DIR}
${JAVA_INCLUDE_PATH}
${JAVA_INCLUDE_PATH2}
)
-INCLUDE_DIRECTORIES (${HDF5_JAVA_INCLUDE_DIRECTORIES})
-set (CMAKE_JAVA_INCLUDE_PATH "")
+set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${HDF5_JAVA_INCLUDE_DIRECTORIES}")
+set (CMAKE_JAVA_INCLUDE_PATH "")
#-----------------------------------------------------------------------------
# Traverse source subdirectory
#-----------------------------------------------------------------------------
-add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/src ${HDF5_JAVA_BINARY_DIR}/src)
+add_subdirectory (src)
#-----------------------------------------------------------------------------
# Build the Java Examples
#-----------------------------------------------------------------------------
if (HDF5_BUILD_EXAMPLES)
- add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/examples ${HDF5_JAVA_BINARY_DIR}/examples)
+ add_subdirectory (examples)
endif ()
#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if (BUILD_TESTING)
- add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/test ${HDF5_JAVA_BINARY_DIR}/test)
+ add_subdirectory (test)
endif ()
#-----------------------------------------------------------------------------
diff --git a/java/Makefile.am b/java/Makefile.am
index 7d0e2f0..4426e3e 100644
--- a/java/Makefile.am
+++ b/java/Makefile.am
@@ -10,7 +10,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-#
+#
# This makefile mostly just reinvokes make in the various subdirectories
# but does so in the correct order. You can alternatively invoke make from
# each subdirectory manually.
@@ -23,13 +23,26 @@
include $(top_srcdir)/config/commence.am
+if BUILD_TESTS_CONDITIONAL
+ TESTSERIAL_DIR =test
+ TESTEXAMPLES_DIR =examples
+else
+ TESTSERIAL_DIR=
+ TESTEXAMPLES_DIR=
+endif
+
## Only recurse into subdirectories if the Java (JNI) interface is enabled.
if BUILD_JAVA_CONDITIONAL
# Mark this directory as part of the JNI API
JAVA_API=yes
-SUBDIRS=src test examples
+SUBDIRS=src $(TESTSERIAL_DIR) $(TESTEXAMPLES_DIR)
+
+# Test with just the native connector, with a single pass-through connector
+# and with a doubly-stacked pass-through.
+VOL_LIST = native "pass_through under_vol=0;under_info={}" \
+ "pass_through under_vol=505;under_info={under_vol=0;under_info={}}"
endif
diff --git a/java/examples/CMakeLists.txt b/java/examples/CMakeLists.txt
index a1a7483..3412c40 100644
--- a/java/examples/CMakeLists.txt
+++ b/java/examples/CMakeLists.txt
@@ -1,7 +1,7 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDFJAVA_EXAMPLES)
+cmake_minimum_required (VERSION 3.12)
+project (HDFJAVA_EXAMPLES Java)
-add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/datasets datasets)
-add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/datatypes datatypes)
-add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/groups groups)
-add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/intro intro)
+add_subdirectory (datasets)
+add_subdirectory (datatypes)
+add_subdirectory (groups)
+add_subdirectory (intro)
diff --git a/java/examples/Makefile.am b/java/examples/Makefile.am
index 8ca49f2..054407c 100644
--- a/java/examples/Makefile.am
+++ b/java/examples/Makefile.am
@@ -10,7 +10,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-#
+#
# This makefile mostly just reinvokes make in the various subdirectories
# but does so in the correct order. You can alternatively invoke make from
# each subdirectory manually.
diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt
index d698cfd..fc4acc4 100644
--- a/java/examples/datasets/CMakeLists.txt
+++ b/java/examples/datasets/CMakeLists.txt
@@ -1,13 +1,8 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDFJAVA_EXAMPLES_DATASETS Java)
+cmake_minimum_required (VERSION 3.12)
+project (HDFJAVA_EXAMPLES_DATASETS Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
-INCLUDE_DIRECTORIES (
- ${HDF5_JAVA_JNI_BINARY_DIR}
- ${HDF5_JAVA_HDF5_LIB_DIR}
-)
-
set (HDF_JAVA_EXAMPLES
H5Ex_D_Alloc
H5Ex_D_Checksum
@@ -15,13 +10,9 @@ set (HDF_JAVA_EXAMPLES
H5Ex_D_Compact
H5Ex_D_External
H5Ex_D_FillValue
- H5Ex_D_Gzip
H5Ex_D_Hyperslab
H5Ex_D_ReadWrite
- H5Ex_D_Shuffle
- H5Ex_D_Szip
H5Ex_D_UnlimitedAdd
- H5Ex_D_UnlimitedGzip
H5Ex_D_UnlimitedMod
H5Ex_D_Nbit
H5Ex_D_Transform
@@ -29,7 +20,26 @@ set (HDF_JAVA_EXAMPLES
H5Ex_D_Soint
)
-if (WIN32)
+set (HDF_JAVA_ZLIB_EXAMPLES
+ H5Ex_D_Gzip
+ H5Ex_D_Shuffle
+ H5Ex_D_UnlimitedGzip
+)
+
+set (HDF_JAVA_SZIP_EXAMPLES
+ H5Ex_D_Szip
+)
+
+# detect whether the encoder is present.
+ if (H5_HAVE_FILTER_DEFLATE)
+ set (${HDF_JAVA_EXAMPLES} ${HDF_JAVA_EXAMPLES} ${HDF_JAVA_ZLIB_EXAMPLES})
+ endif ()
+
+ if (H5_HAVE_FILTER_SZIP)
+ set (${HDF_JAVA_EXAMPLES} ${HDF_JAVA_EXAMPLES} ${HDF_JAVA_SZIP_EXAMPLES})
+ endif (H5_HAVE_FILTER_SZIP)
+
+if (WIN32 OR MINGW)
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
else ()
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
@@ -61,81 +71,49 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH})
set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}")
endforeach ()
-MACRO (ADD_H5_TEST resultfile resultcode)
- if (CMAKE_BUILD_TYPE MATCHES Debug)
- if (WIN32)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
- else ()
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
- endif ()
- endif ()
- add_test (
- NAME JAVA_datasets-${resultfile}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
- -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}"
- -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}"
- -D "TEST_PROGRAM=examples.datasets.${resultfile}"
- -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
- -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
- -D "TEST_OUTPUT=datasets/${resultfile}.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=datasets/${resultfile}.txt"
- -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
- )
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (JAVA_datasets-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_datasets-${resultfile}")
-ENDMACRO ()
-
-if (BUILD_TESTING)
-
-# detect whether the encoder is present.
- if (H5_HAVE_FILTER_DEFLATE)
- set (USE_FILTER_DEFLATE "true")
- endif ()
-
- if (H5_HAVE_FILTER_SZIP)
- set (USE_FILTER_SZIP "true")
- endif (H5_HAVE_FILTER_SZIP)
+if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL)
+ get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;")
foreach (example ${HDF_JAVA_EXAMPLES})
- if (${example} STREQUAL "H5Ex_D_External")
+ if (example STREQUAL "H5Ex_D_External")
add_test (
NAME JAVA_datasets-${example}-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
+ COMMAND ${CMAKE_COMMAND} -E remove
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.data
)
else ()
add_test (
NAME JAVA_datasets-${example}-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
+ COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (JAVA_datasets-${example}-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
+
add_test (
NAME JAVA_datasets-${example}-copy-objects
- COMMAND ${CMAKE_COMMAND}
- -E copy_if_different
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datasets.${example}.txt
${HDFJAVA_EXAMPLES_DATASETS_BINARY_DIR}/${example}.txt
)
set_tests_properties (JAVA_datasets-${example}-copy-objects PROPERTIES DEPENDS JAVA_datasets-${example}-clear-objects)
- set (last_test "JAVA_datasets-${example}-copy-objects")
- if (${example} STREQUAL "H5Ex_D_Szip")
- if (USE_FILTER_SZIP)
- ADD_H5_TEST (${example} 0)
- endif ()
- else ()
- ADD_H5_TEST (${example} 0)
- endif ()
+ add_test (
+ NAME JAVA_datasets-${example}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
+ -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}"
+ -D "TEST_ARGS:STRING=${CMD_ARGS}"
+ -D "TEST_PROGRAM=examples.datasets.${example}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
+ -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
+ -D "TEST_OUTPUT=datasets/${example}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=datasets/${example}.txt"
+ -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
+ )
+ set_tests_properties (JAVA_datasets-${example} PROPERTIES
+ DEPENDS JAVA_datasets-${example}-copy-objects
+ )
endforeach ()
endif ()
diff --git a/java/examples/datasets/runExample.sh.in b/java/examples/datasets/JavaDatasetExample.sh.in
index 21c3439..ae79416 100644
--- a/java/examples/datasets/runExample.sh.in
+++ b/java/examples/datasets/JavaDatasetExample.sh.in
@@ -52,12 +52,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_LIBRARY_FILES="
-$HDFLIB_HOME/slf4j-api-1.7.5.jar
-$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar
$top_builddir/src/.libs/libhdf5.*
$top_builddir/java/src/jni/.libs/libhdf5_java.*
$top_builddir/java/src/$JARFILE
"
+LIST_JAR_TESTFILES="
+$HDFLIB_HOME/slf4j-api-1.7.25.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
+"
LIST_DATA_FILES="
$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Alloc.txt
$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Checksum.txt
@@ -83,6 +85,7 @@ $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Soint.txt
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARTESTFILES="$LIST_JAR_TESTFILES"
COPY_LIBFILES_TO_BLDLIBDIR()
{
@@ -110,6 +113,30 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
fi
done
+ # copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARTESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
}
CLEAN_LIBFILES_AND_BLDLIBDIR()
@@ -117,11 +144,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar`
+ SDIR=$HDFLIB_HOME
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDLIBDIR
+ for tstfile in $COPY_JARTESTFILES
+ do
+ $RM $BLDLIBDIR/tstfile
+ done
fi
}
@@ -183,7 +213,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
-CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE""
+CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
TEST=/usr/bin/test
if [ ! -x /usr/bin/test ]
@@ -215,20 +245,18 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then
fi
case $os_name in
- Darwin)
- DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH
- LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
- ;;
*)
LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH
- ;;
+ ;;
esac
export LD_LIBRARY_PATH
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Alloc"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Alloc > H5Ex_D_Alloc.out)
+TESTING examples.datasets.H5Ex_D_Alloc
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Alloc > H5Ex_D_Alloc.out
+)
if diff H5Ex_D_Alloc.out examples.datasets.H5Ex_D_Alloc.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_Alloc"
else
@@ -237,7 +265,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Checksum"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Checksum > H5Ex_D_Checksum.out)
+TESTING examples.datasets.H5Ex_D_Checksum
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Checksum > H5Ex_D_Checksum.out
+)
if diff H5Ex_D_Checksum.out examples.datasets.H5Ex_D_Checksum.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_Checksum"
else
@@ -246,7 +277,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Chunk"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Chunk > H5Ex_D_Chunk.out)
+TESTING examples.datasets.H5Ex_D_Chunk
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Chunk > H5Ex_D_Chunk.out
+)
if diff H5Ex_D_Chunk.out examples.datasets.H5Ex_D_Chunk.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_Chunk"
else
@@ -255,7 +289,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Compact"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Compact > H5Ex_D_Compact.out)
+TESTING examples.datasets.H5Ex_D_Compact
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Compact > H5Ex_D_Compact.out
+)
if diff H5Ex_D_Compact.out examples.datasets.H5Ex_D_Compact.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_Compact"
else
@@ -264,7 +301,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_External"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_External > H5Ex_D_External.out)
+TESTING examples.datasets.H5Ex_D_External
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_External > H5Ex_D_External.out
+)
if diff H5Ex_D_External.out examples.datasets.H5Ex_D_External.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_External"
else
@@ -273,7 +313,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_FillValue"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_FillValue > H5Ex_D_FillValue.out)
+TESTING examples.datasets.H5Ex_D_FillValue
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_FillValue > H5Ex_D_FillValue.out
+)
if diff H5Ex_D_FillValue.out examples.datasets.H5Ex_D_FillValue.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_FillValue"
else
@@ -281,17 +324,25 @@ else
nerrors="`expr $nerrors + 1`"
fi
-echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Gzip"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Gzip > H5Ex_D_Gzip.out)
-if diff H5Ex_D_Gzip.out examples.datasets.H5Ex_D_Gzip.txt > /dev/null; then
- echo " PASSED datasets.H5Ex_D_Gzip"
-else
- echo "**FAILED** datasets.H5Ex_D_Gzip"
- nerrors="`expr $nerrors + 1`"
+if test $USE_FILTER_DEFLATE = "yes"; then
+ echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Gzip"
+ TESTING examples.datasets.H5Ex_D_Gzip
+ (
+ $RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Gzip > H5Ex_D_Gzip.out
+ )
+ if diff H5Ex_D_Gzip.out examples.datasets.H5Ex_D_Gzip.txt > /dev/null; then
+ echo " PASSED datasets.H5Ex_D_Gzip"
+ else
+ echo "**FAILED** datasets.H5Ex_D_Gzip"
+ nerrors="`expr $nerrors + 1`"
+ fi
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Hyperslab"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Hyperslab > H5Ex_D_Hyperslab.out)
+TESTING examples.datasets.H5Ex_D_Hyperslab
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Hyperslab > H5Ex_D_Hyperslab.out
+)
if diff H5Ex_D_Hyperslab.out examples.datasets.H5Ex_D_Hyperslab.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_Hyperslab"
else
@@ -300,7 +351,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_ReadWrite"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_ReadWrite > H5Ex_D_ReadWrite.out)
+TESTING examples.datasets.H5Ex_D_ReadWrite
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_ReadWrite > H5Ex_D_ReadWrite.out
+)
if diff H5Ex_D_ReadWrite.out examples.datasets.H5Ex_D_ReadWrite.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_ReadWrite"
else
@@ -308,18 +362,26 @@ else
nerrors="`expr $nerrors + 1`"
fi
-echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Shuffle"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Shuffle > H5Ex_D_Shuffle.out)
-if diff H5Ex_D_Shuffle.out examples.datasets.H5Ex_D_Shuffle.txt > /dev/null; then
- echo " PASSED datasets.H5Ex_D_Shuffle"
-else
- echo "**FAILED** datasets.H5Ex_D_Shuffle"
- nerrors="`expr $nerrors + 1`"
+if test $USE_FILTER_DEFLATE = "yes"; then
+ echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Shuffle"
+ TESTING examples.datasets.H5Ex_D_Shuffle
+ (
+ $RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Shuffle > H5Ex_D_Shuffle.out
+ )
+ if diff H5Ex_D_Shuffle.out examples.datasets.H5Ex_D_Shuffle.txt > /dev/null; then
+ echo " PASSED datasets.H5Ex_D_Shuffle"
+ else
+ echo "**FAILED** datasets.H5Ex_D_Shuffle"
+ nerrors="`expr $nerrors + 1`"
+ fi
fi
if test $USE_FILTER_SZIP = "yes"; then
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Szip"
- ($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Szip > H5Ex_D_Szip.out)
+ TESTING examples.datasets.H5Ex_D_Szip
+ (
+ $RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Szip > H5Ex_D_Szip.out
+ )
if diff H5Ex_D_Szip.out examples.datasets.H5Ex_D_Szip.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_Szip"
else
@@ -329,7 +391,10 @@ if test $USE_FILTER_SZIP = "yes"; then
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedAdd"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedAdd > H5Ex_D_UnlimitedAdd.out)
+TESTING examples.datasets.H5Ex_D_UnlimitedAdd
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedAdd > H5Ex_D_UnlimitedAdd.out
+)
if diff H5Ex_D_UnlimitedAdd.out examples.datasets.H5Ex_D_UnlimitedAdd.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_UnlimitedAdd"
else
@@ -338,7 +403,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedGzip"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedGzip > H5Ex_D_UnlimitedGzip.out)
+TESTING examples.datasets.H5Ex_D_UnlimitedGzip
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedGzip > H5Ex_D_UnlimitedGzip.out
+)
if diff H5Ex_D_External.out examples.datasets.H5Ex_D_External.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_UnlimitedGzip"
else
@@ -347,7 +415,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedMod"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedMod > H5Ex_D_UnlimitedMod.out)
+TESTING examples.datasets.H5Ex_D_UnlimitedMod
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedMod > H5Ex_D_UnlimitedMod.out
+)
if diff H5Ex_D_UnlimitedMod.out examples.datasets.H5Ex_D_UnlimitedMod.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_UnlimitedMod"
else
@@ -356,7 +427,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Nbit"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Nbit > H5Ex_D_Nbit.out)
+TESTING examples.datasets.H5Ex_D_Nbit
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Nbit > H5Ex_D_Nbit.out
+)
if diff H5Ex_D_Nbit.out examples.datasets.H5Ex_D_Nbit.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_Nbit"
else
@@ -365,7 +439,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Transform"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Transform > H5Ex_D_Transform.out)
+TESTING examples.datasets.H5Ex_D_Transform
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Transform > H5Ex_D_Transform.out
+)
if diff H5Ex_D_Transform.out examples.datasets.H5Ex_D_Transform.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_Transform"
else
@@ -374,7 +451,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Sofloat"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Sofloat > H5Ex_D_Sofloat.out)
+TESTING examples.datasets.H5Ex_D_Sofloat
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Sofloat > H5Ex_D_Sofloat.out
+)
if diff H5Ex_D_Sofloat.out examples.datasets.H5Ex_D_Sofloat.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_Sofloat"
else
@@ -383,7 +463,10 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Soint"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Soint > H5Ex_D_Soint.out)
+TESTING examples.datasets.H5Ex_D_Soint
+(
+$RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Soint > H5Ex_D_Soint.out
+)
if diff H5Ex_D_Soint.out examples.datasets.H5Ex_D_Soint.txt > /dev/null; then
echo " PASSED datasets.H5Ex_D_Soint"
else
diff --git a/java/examples/datasets/Makefile.am b/java/examples/datasets/Makefile.am
index 18100a6..c5b8a5d 100644
--- a/java/examples/datasets/Makefile.am
+++ b/java/examples/datasets/Makefile.am
@@ -28,13 +28,13 @@ classes:
pkgpath = examples/datasets
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
-CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
+CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
jarfile = jar$(PACKAGE_TARNAME)datasets.jar
AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation
-TESTPACKAGE =
+TESTPACKAGE =
noinst_JAVA = \
H5Ex_D_Alloc.java \
@@ -63,10 +63,10 @@ noinst_DATA = $(jarfile)
.PHONY: classes
-check_SCRIPTS = runExample.sh
+check_SCRIPTS = JavaDatasetExample.sh
TEST_SCRIPT = $(check_SCRIPTS)
-CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh
+CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class JavaDatasetExample.sh
clean:
rm -rf $(JAVAROOT)/*
diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt
index 8569b8b..bd4f483 100644
--- a/java/examples/datatypes/CMakeLists.txt
+++ b/java/examples/datatypes/CMakeLists.txt
@@ -1,13 +1,8 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDFJAVA_EXAMPLES_DATATYPES Java)
+cmake_minimum_required (VERSION 3.12)
+project (HDFJAVA_EXAMPLES_DATATYPES Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
-INCLUDE_DIRECTORIES (
- ${HDF5_JAVA_JNI_BINARY_DIR}
- ${HDF5_JAVA_HDF5_LIB_DIR}
-)
-
set (HDF_JAVA_EXAMPLES
H5Ex_T_Array
H5Ex_T_ArrayAttribute
@@ -29,7 +24,7 @@ set (HDF_JAVA_EXAMPLES
H5Ex_T_VLString
)
-if (WIN32)
+if (WIN32 OR MINGW)
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
else ()
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
@@ -61,54 +56,39 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH})
set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}")
endforeach ()
-MACRO (ADD_H5_TEST resultfile resultcode)
- if (CMAKE_BUILD_TYPE MATCHES Debug)
- if (WIN32)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
- else ()
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
- endif ()
- endif ()
- add_test (
- NAME JAVA_datatypes-${resultfile}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
- -D "TEST_PROGRAM=examples.datatypes.${resultfile}"
- -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}"
- -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}"
- -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
- -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
- -D "TEST_OUTPUT=datatypes/${resultfile}.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=datatypes/${resultfile}.txt"
- -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
- )
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (JAVA_datatypes-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_datatypes-${resultfile}")
-ENDMACRO ()
+if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL)
+ get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;")
-if (BUILD_TESTING)
foreach (example ${HDF_JAVA_EXAMPLES})
add_test (
NAME JAVA_datatypes-${example}-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
+ COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (JAVA_datatypes-${example}-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
+
add_test (
NAME JAVA_datatypes-${example}-copy-objects
- COMMAND ${CMAKE_COMMAND}
- -E copy_if_different
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datatypes.${example}.txt
${HDFJAVA_EXAMPLES_DATATYPES_BINARY_DIR}/${example}.txt
)
set_tests_properties (JAVA_datatypes-${example}-copy-objects PROPERTIES DEPENDS JAVA_datatypes-${example}-clear-objects)
- set (last_test "JAVA_datatypes-${example}-copy-objects")
- ADD_H5_TEST (${example} 0)
+ add_test (
+ NAME JAVA_datatypes-${example}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
+ -D "TEST_PROGRAM=examples.datatypes.${example}"
+ -D "TEST_ARGS:STRING=${CMD_ARGS}"
+ -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
+ -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
+ -D "TEST_OUTPUT=datatypes/${example}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=datatypes/${example}.txt"
+ -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
+ )
+ set_tests_properties (JAVA_datatypes-${example} PROPERTIES
+ DEPENDS JAVA_datatypes-${example}-copy-objects
+ )
endforeach ()
endif ()
diff --git a/java/examples/datatypes/H5Ex_T_Float.java b/java/examples/datatypes/H5Ex_T_Float.java
index f677479..f15f774 100644
--- a/java/examples/datatypes/H5Ex_T_Float.java
+++ b/java/examples/datatypes/H5Ex_T_Float.java
@@ -22,6 +22,8 @@
package examples.datatypes;
import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
@@ -173,7 +175,7 @@ public class H5Ex_T_Float {
}
// Output the data to the screen.
- DecimalFormat df = new DecimalFormat("#,##0.0000");
+ DecimalFormat df = new DecimalFormat("#,##0.0000", new DecimalFormatSymbols(Locale.US));
System.out.println(DATASETNAME + ":");
for (int indx = 0; indx < dims[0]; indx++) {
System.out.print(" [");
diff --git a/java/examples/datatypes/H5Ex_T_FloatAttribute.java b/java/examples/datatypes/H5Ex_T_FloatAttribute.java
index 2e706d9..12831bc 100644
--- a/java/examples/datatypes/H5Ex_T_FloatAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_FloatAttribute.java
@@ -22,6 +22,8 @@
package examples.datatypes;
import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.Locale;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
@@ -201,7 +203,7 @@ public class H5Ex_T_FloatAttribute {
}
// Output the data to the screen.
- DecimalFormat df = new DecimalFormat("#,##0.0000");
+ DecimalFormat df = new DecimalFormat("#,##0.0000", new DecimalFormatSymbols(Locale.US));
System.out.println(ATTRIBUTENAME + ":");
for (int indx = 0; indx < dims[0]; indx++) {
System.out.print(" [");
diff --git a/java/examples/datatypes/runExample.sh.in b/java/examples/datatypes/JavaDatatypeExample.sh.in
index 32e9ade..447512a 100644
--- a/java/examples/datatypes/runExample.sh.in
+++ b/java/examples/datatypes/JavaDatatypeExample.sh.in
@@ -49,12 +49,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_LIBRARY_FILES="
-$HDFLIB_HOME/slf4j-api-1.7.5.jar
-$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar
$top_builddir/src/.libs/libhdf5.*
$top_builddir/java/src/jni/.libs/libhdf5_java.*
$top_builddir/java/src/$JARFILE
"
+LIST_JAR_TESTFILES="
+$HDFLIB_HOME/slf4j-api-1.7.25.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
+"
LIST_DATA_FILES="
$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Array.txt
$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt
@@ -80,6 +82,7 @@ $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_VLString.txt
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARTESTFILES="$LIST_JAR_TESTFILES"
COPY_LIBFILES_TO_BLDLIBDIR()
{
@@ -107,6 +110,30 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
fi
done
+ # copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARTESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
}
CLEAN_LIBFILES_AND_BLDLIBDIR()
@@ -114,11 +141,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar`
+ SDIR=$HDFLIB_HOME
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDLIBDIR
+ for tstfile in $COPY_JARTESTFILES
+ do
+ $RM $BLDLIBDIR/tstfile
+ done
fi
}
@@ -179,7 +209,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
-CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE""
+CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
TEST=/usr/bin/test
if [ ! -x /usr/bin/test ]
@@ -211,11 +241,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then
fi
case $os_name in
- Darwin)
- DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH
- LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
- ;;
*)
LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH
;;
@@ -224,7 +249,8 @@ esac
export LD_LIBRARY_PATH
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Array"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Array > H5Ex_T_Array.out)
+TESTING examples.datatypes.H5Ex_T_Array
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Array > H5Ex_T_Array.out)
if diff H5Ex_T_Array.out examples.datatypes.H5Ex_T_Array.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_Array"
else
@@ -233,7 +259,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ArrayAttribute"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ArrayAttribute > H5Ex_T_ArrayAttribute.out)
+TESTING examples.datatypes.H5Ex_T_ArrayAttribute
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ArrayAttribute > H5Ex_T_ArrayAttribute.out)
if diff H5Ex_T_ArrayAttribute.out examples.datatypes.H5Ex_T_ArrayAttribute.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_ArrayAttribute"
else
@@ -242,7 +269,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Bit"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Bit > H5Ex_T_Bit.out)
+TESTING examples.datatypes.H5Ex_T_Bit
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Bit > H5Ex_T_Bit.out)
if diff H5Ex_T_Bit.out examples.datatypes.H5Ex_T_Bit.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_Bit"
else
@@ -251,7 +279,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_BitAttribute"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_BitAttribute > H5Ex_T_BitAttribute.out)
+TESTING examples.datatypes.H5Ex_T_BitAttribute
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_BitAttribute > H5Ex_T_BitAttribute.out)
if diff H5Ex_T_BitAttribute.out examples.datatypes.H5Ex_T_BitAttribute.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_BitAttribute"
else
@@ -260,7 +289,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Commit"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Commit > H5Ex_T_Commit.out)
+TESTING examples.datasets.H5Ex_T_Commit
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Commit > H5Ex_T_Commit.out)
if diff H5Ex_T_Commit.out examples.datatypes.H5Ex_T_Commit.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_Commit"
else
@@ -269,7 +299,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Compound"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Compound > H5Ex_T_Compound.out)
+TESTING examples.datatypes.H5Ex_T_Compound
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Compound > H5Ex_T_Compound.out)
if diff H5Ex_T_Compound.out examples.datatypes.H5Ex_T_Compound.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_Compound"
else
@@ -278,7 +309,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_CompoundAttribute"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_CompoundAttribute > H5Ex_T_CompoundAttribute.out)
+TESTING examples.datatypes.H5Ex_T_CompoundAttribute
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_CompoundAttribute > H5Ex_T_CompoundAttribute.out)
if diff H5Ex_T_CompoundAttribute.out examples.datatypes.H5Ex_T_CompoundAttribute.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_CompoundAttribute"
else
@@ -287,7 +319,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Float"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Float > H5Ex_T_Float.out)
+TESTING examples.datatypes.H5Ex_T_Float
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Float > H5Ex_T_Float.out)
if diff H5Ex_T_Float.out examples.datatypes.H5Ex_T_Float.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_Float"
else
@@ -296,7 +329,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_FloatAttribute"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_FloatAttribute > H5Ex_T_FloatAttribute.out)
+TESTING examples.datatypes.H5Ex_T_FloatAttribute
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_FloatAttribute > H5Ex_T_FloatAttribute.out)
if diff H5Ex_T_FloatAttribute.out examples.datatypes.H5Ex_T_FloatAttribute.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_FloatAttribute"
else
@@ -305,7 +339,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Integer"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Integer > H5Ex_T_Integer.out)
+TESTING examples.datatypes.H5Ex_T_Integer
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Integer > H5Ex_T_Integer.out)
if diff H5Ex_T_Integer.out examples.datatypes.H5Ex_T_Integer.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_Integer"
else
@@ -314,7 +349,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_IntegerAttribute"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_IntegerAttribute > H5Ex_T_IntegerAttribute.out)
+TESTING examples.datatypes.H5Ex_T_IntegerAttribute
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_IntegerAttribute > H5Ex_T_IntegerAttribute.out)
if diff H5Ex_T_IntegerAttribute.out examples.datatypes.H5Ex_T_IntegerAttribute.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_IntegerAttribute"
else
@@ -323,7 +359,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReference"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReference > H5Ex_T_ObjectReference.out)
+TESTING examples.datatypes.H5Ex_T_ObjectReference
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReference > H5Ex_T_ObjectReference.out)
if diff H5Ex_T_ObjectReference.out examples.datatypes.H5Ex_T_ObjectReference.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_ObjectReference"
else
@@ -332,7 +369,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReferenceAttribute"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReferenceAttribute > H5Ex_T_ObjectReferenceAttribute.out)
+TESTING examples.datatypes.H5Ex_T_ObjectReferenceAttribute
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReferenceAttribute > H5Ex_T_ObjectReferenceAttribute.out)
if diff H5Ex_T_ObjectReferenceAttribute.out examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_ObjectReferenceAttribute"
else
@@ -341,7 +379,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Opaque"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Opaque > H5Ex_T_Opaque.out)
+TESTING examples.datatypes.H5Ex_T_Opaque
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Opaque > H5Ex_T_Opaque.out)
if diff H5Ex_T_Opaque.out examples.datatypes.H5Ex_T_Opaque.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_Opaque"
else
@@ -350,7 +389,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_OpaqueAttribute"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_OpaqueAttribute > H5Ex_T_OpaqueAttribute.out)
+TESTING examples.datatypes.H5Ex_T_OpaqueAttribute
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_OpaqueAttribute > H5Ex_T_OpaqueAttribute.out)
if diff H5Ex_T_OpaqueAttribute.out examples.datatypes.H5Ex_T_OpaqueAttribute.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_OpaqueAttribute"
else
@@ -359,7 +399,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_String"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_String > H5Ex_T_String.out)
+TESTING examples.datatypes.H5Ex_T_String
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_String > H5Ex_T_String.out)
if diff H5Ex_T_String.out examples.datatypes.H5Ex_T_String.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_String"
else
@@ -368,7 +409,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_StringAttribute"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_StringAttribute > H5Ex_T_StringAttribute.out)
+TESTING examples.datatypes.H5Ex_T_StringAttribute
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_StringAttribute > H5Ex_T_StringAttribute.out)
if diff H5Ex_T_StringAttribute.out examples.datatypes.H5Ex_T_StringAttribute.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_StringAttribute"
else
@@ -377,7 +419,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_VLString"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_VLString > H5Ex_T_VLString.out)
+TESTING examples.datatypes.H5Ex_T_VLString
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_VLString > H5Ex_T_VLString.out)
if diff H5Ex_T_VLString.out examples.datatypes.H5Ex_T_VLString.txt > /dev/null; then
echo " PASSED datatypes.H5Ex_T_VLString"
else
diff --git a/java/examples/datatypes/Makefile.am b/java/examples/datatypes/Makefile.am
index 71f7769..f695528 100644
--- a/java/examples/datatypes/Makefile.am
+++ b/java/examples/datatypes/Makefile.am
@@ -28,13 +28,13 @@ classes:
pkgpath = examples/datatypes
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
-CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
+CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
jarfile = jar$(PACKAGE_TARNAME)datatypes.jar
AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation
-TESTPACKAGE =
+TESTPACKAGE =
noinst_JAVA = \
H5Ex_T_Array.java \
@@ -63,10 +63,10 @@ noinst_DATA = $(jarfile)
.PHONY: classes
-check_SCRIPTS = runExample.sh
+check_SCRIPTS = JavaDatatypeExample.sh
TEST_SCRIPT = $(check_SCRIPTS)
-CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh
+CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class JavaDatatypeExample.sh
clean:
rm -rf $(JAVAROOT)/*
diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt
index bb5f80f..c2c7d0f 100644
--- a/java/examples/groups/CMakeLists.txt
+++ b/java/examples/groups/CMakeLists.txt
@@ -1,13 +1,8 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDFJAVA_EXAMPLES_GROUPS Java)
+cmake_minimum_required (VERSION 3.12)
+project (HDFJAVA_EXAMPLES_GROUPS Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
-INCLUDE_DIRECTORIES (
- ${HDF5_JAVA_JNI_BINARY_DIR}
- ${HDF5_JAVA_HDF5_LIB_DIR}
-)
-
set (HDF_JAVA_EXAMPLES
H5Ex_G_Create
H5Ex_G_Iterate
@@ -18,7 +13,7 @@ set (HDF_JAVA_EXAMPLES
H5Ex_G_Visit
)
-if (WIN32)
+if (WIN32 OR MINGW)
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
else ()
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
@@ -60,69 +55,55 @@ foreach (h5_file ${HDF_JAVA_TEST_FILES})
endforeach ()
add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list})
-MACRO (ADD_H5_TEST resultfile resultcode)
- if (CMAKE_BUILD_TYPE MATCHES Debug)
- if (WIN32)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
- else ()
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
- endif ()
- endif ()
- add_test (
- NAME JAVA_groups-${resultfile}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
- -D "TEST_PROGRAM=examples.groups.${resultfile}"
- -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}"
- -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}"
- -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
- -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
- -D "TEST_OUTPUT=groups/${resultfile}.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=groups/${resultfile}.txt"
- -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
- )
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (JAVA_groups-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_groups-${resultfile}")
-ENDMACRO ()
+if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL)
+ get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;")
-if (BUILD_TESTING)
foreach (example ${HDF_JAVA_EXAMPLES})
- if (NOT ${example} STREQUAL "H5Ex_G_Iterate" AND NOT ${example} STREQUAL "H5Ex_G_Visit")
- if (${example} STREQUAL "H5Ex_G_Compact")
+ if (NOT example STREQUAL "H5Ex_G_Iterate" AND NOT example STREQUAL "H5Ex_G_Visit")
+ if (example STREQUAL "H5Ex_G_Compact")
add_test (
- NAME JAVA_groups-${example}-clear-h5s
- COMMAND ${CMAKE_COMMAND}
- -E remove
+ NAME JAVA_groups-${example}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}1.h5
${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}2.h5
)
else ()
add_test (
- NAME JAVA_groups-${example}-clear-h5s
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
+ NAME JAVA_groups-${example}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
endif ()
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (JAVA_groups-${example}-clear-h5s PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_groups-${example}-clear-h5s")
+ else ()
+ add_test (
+ NAME JAVA_groups-${example}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E echo "${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 exists"
+ )
endif ()
+
add_test (
NAME JAVA_groups-${example}-copy-objects
- COMMAND ${CMAKE_COMMAND}
- -E copy_if_different
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.groups.${example}.txt
${HDFJAVA_EXAMPLES_GROUPS_BINARY_DIR}/${example}.txt
)
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_groups-${example}-copy-objects")
- ADD_H5_TEST (${example} 0)
+ set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS JAVA_groups-${example}-clear-objects)
+ add_test (
+ NAME JAVA_groups-${example}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
+ -D "TEST_PROGRAM=examples.groups.${example}"
+ -D "TEST_ARGS:STRING=${CMD_ARGS}"
+ -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
+ -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
+ -D "TEST_OUTPUT=groups/${example}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=groups/${example}.txt"
+ -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
+ )
+ set_tests_properties (JAVA_groups-${example} PROPERTIES
+ DEPENDS JAVA_groups-${example}-copy-objects
+ )
endforeach ()
endif ()
diff --git a/java/examples/groups/H5Ex_G_Intermediate.java b/java/examples/groups/H5Ex_G_Intermediate.java
index f7d5a50..e97e5f8 100644
--- a/java/examples/groups/H5Ex_G_Intermediate.java
+++ b/java/examples/groups/H5Ex_G_Intermediate.java
@@ -19,8 +19,8 @@ package examples.groups;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5O_iterate_cb;
import hdf.hdf5lib.callbacks.H5O_iterate_t;
+import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t;
import hdf.hdf5lib.structs.H5O_info_t;
import java.util.ArrayList;
@@ -53,9 +53,9 @@ public class H5Ex_G_Intermediate {
// Print all the objects in the file_ids to show that intermediate group_ids have been created.
System.out.println("Objects in the file_id:");
- // H5O_iterate_t iter_data = null;
- H5O_iterate_t iter_data = new H5O_iter_data();
- H5O_iterate_cb iter_cb = new H5O_iter_callback();
+ // H5O_iterate_opdata_t iter_data = null;
+ H5O_iterate_opdata_t iter_data = new H5O_iter_data();
+ H5O_iterate_t iter_cb = new H5O_iter_callback();
H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, iter_data);
}
@@ -92,12 +92,12 @@ public class H5Ex_G_Intermediate {
}
}
- private class H5O_iter_data implements H5O_iterate_t {
+ private class H5O_iter_data implements H5O_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- private class H5O_iter_callback implements H5O_iterate_cb {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) {
+ private class H5O_iter_callback implements H5O_iterate_t {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5O_iter_data) op_data).iterdata.add(id);
diff --git a/java/examples/groups/H5Ex_G_Iterate.java b/java/examples/groups/H5Ex_G_Iterate.java
index 3c9ca82..5acbf65 100644
--- a/java/examples/groups/H5Ex_G_Iterate.java
+++ b/java/examples/groups/H5Ex_G_Iterate.java
@@ -19,6 +19,7 @@ package examples.groups;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.structs.H5O_token_t;
import java.util.EnumSet;
import java.util.HashMap;
@@ -75,8 +76,8 @@ public class H5Ex_G_Iterate {
String[] oname = new String[count];
int[] otype = new int[count];
int[] ltype = new int[count];
- long[] orefs = new long[count];
- H5.H5Gget_obj_info_all(file_id, DATASETNAME, oname, otype, ltype, orefs, HDF5Constants.H5_INDEX_NAME);
+ H5O_token_t[] otokens = new H5O_token_t[count];
+ H5.H5Gget_obj_info_all(file_id, DATASETNAME, oname, otype, ltype, otokens, HDF5Constants.H5_INDEX_NAME);
// Get type of the object and display its name and type.
for (int indx = 0; indx < otype.length; indx++) {
diff --git a/java/examples/groups/H5Ex_G_Traverse.java b/java/examples/groups/H5Ex_G_Traverse.java
index 2a2cba3..6225a9e 100644
--- a/java/examples/groups/H5Ex_G_Traverse.java
+++ b/java/examples/groups/H5Ex_G_Traverse.java
@@ -25,22 +25,22 @@ package examples.groups;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5L_iterate_cb;
import hdf.hdf5lib.callbacks.H5L_iterate_t;
+import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t;
import hdf.hdf5lib.structs.H5L_info_t;
import hdf.hdf5lib.structs.H5O_info_t;
import examples.groups.H5Ex_G_Iterate.H5O_type;
-class opdata implements H5L_iterate_t {
+class opdata implements H5L_iterate_opdata_t {
int recurs;
opdata prev;
- long addr;
+ H5O_token_t obj_token;
}
public class H5Ex_G_Traverse {
private static String FILE = "h5ex_g_traverse.h5";
- public static H5L_iterate_cb iter_cb = new H5L_iter_callbackT();
+ public static H5L_iterate_t iter_cb = new H5L_iter_callbackT();
private static void OpenGroup() {
long file_id = -1;
@@ -54,7 +54,7 @@ public class H5Ex_G_Traverse {
infobuf = H5.H5Oget_info(file_id);
od.recurs = 0;
od.prev = null;
- od.addr = infobuf.addr;
+ od.obj_token = infobuf.token;
}
}
catch (Exception e) {
@@ -64,7 +64,7 @@ public class H5Ex_G_Traverse {
// Print the root group and formatting, begin iteration.
try {
System.out.println("/ {");
- // H5L_iterate_cb iter_cb = new H5L_iter_callbackT();
+ // H5L_iterate_t iter_cb = new H5L_iter_callbackT();
H5.H5Literate(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb, od);
System.out.println("}");
}
@@ -87,8 +87,8 @@ public class H5Ex_G_Traverse {
}
}
-class H5L_iter_callbackT implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+class H5L_iter_callbackT implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
H5O_info_t infobuf;
int return_val = 0;
@@ -105,7 +105,7 @@ class H5L_iter_callbackT implements H5L_iterate_cb {
switch (H5O_type.get(infobuf.type)) {
case H5O_TYPE_GROUP:
System.out.println("Group: " + name + " { ");
- // Check group address against linked list of operator
+ // Check group object token against linked list of operator
// data structures. We will always run the check, as the
// reference count cannot be relied upon if there are
// symbolic links, and H5Oget_info_by_name always follows
@@ -114,7 +114,7 @@ class H5L_iter_callbackT implements H5L_iterate_cb {
// links, however it could still fail if an object's
// reference count was manually manipulated with
// H5Odecr_refcount.
- if (group_check(od, infobuf.addr)) {
+ if (group_check(od, infobuf.token)) {
for (int i = 0; i < spaces; i++)
System.out.print(" ");
System.out.println(" Warning: Loop detected!");
@@ -127,8 +127,8 @@ class H5L_iter_callbackT implements H5L_iterate_cb {
opdata nextod = new opdata();
nextod.recurs = od.recurs + 1;
nextod.prev = od;
- nextod.addr = infobuf.addr;
- H5L_iterate_cb iter_cb2 = new H5L_iter_callbackT();
+ nextod.obj_token = infobuf.token;
+ H5L_iterate_t iter_cb2 = new H5L_iter_callbackT();
return_val = H5.H5Literate_by_name(group, name, HDF5Constants.H5_INDEX_NAME,
HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb2, nextod, HDF5Constants.H5P_DEFAULT);
}
@@ -153,13 +153,13 @@ class H5L_iter_callbackT implements H5L_iterate_cb {
return return_val;
}
- public boolean group_check(opdata od, long target_addr) {
- if (od.addr == target_addr)
- return true; // Addresses match
+ public boolean group_check(opdata od, H5O_token_t target_token) {
+ if (od.obj_token.equals(target_token))
+ return true; // Object tokens match
else if (od.recurs == 0)
return false; // Root group reached with no matches
else
- return group_check(od.prev, target_addr); // Recursively examine the next node
+ return group_check(od.prev, target_token); // Recursively examine the next node
}
}
diff --git a/java/examples/groups/H5Ex_G_Visit.java b/java/examples/groups/H5Ex_G_Visit.java
index f91c707..4255316 100644
--- a/java/examples/groups/H5Ex_G_Visit.java
+++ b/java/examples/groups/H5Ex_G_Visit.java
@@ -23,10 +23,10 @@ package examples.groups;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5L_iterate_cb;
import hdf.hdf5lib.callbacks.H5L_iterate_t;
-import hdf.hdf5lib.callbacks.H5O_iterate_cb;
+import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t;
import hdf.hdf5lib.callbacks.H5O_iterate_t;
+import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t;
import hdf.hdf5lib.structs.H5L_info_t;
import hdf.hdf5lib.structs.H5O_info_t;
@@ -55,13 +55,13 @@ public class H5Ex_G_Visit {
// Begin iteration using H5Ovisit
System.out.println("Objects in the file:");
- H5O_iterate_t iter_data = new H5O_iter_data();
- H5O_iterate_cb iter_cb = new H5O_iter_callback();
+ H5O_iterate_opdata_t iter_data = new H5O_iter_data();
+ H5O_iterate_t iter_cb = new H5O_iter_callback();
H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, iter_data);
System.out.println();
// Repeat the same process using H5Lvisit
- H5L_iterate_t iter_data2 = new H5L_iter_data();
- H5L_iterate_cb iter_cb2 = new H5L_iter_callback();
+ H5L_iterate_opdata_t iter_data2 = new H5L_iter_data();
+ H5L_iterate_t iter_cb2 = new H5L_iter_callback();
System.out.println("Links in the file:");
H5.H5Lvisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb2, iter_data2);
@@ -91,12 +91,12 @@ public class H5Ex_G_Visit {
}
}
- private class H5L_iter_data implements H5L_iterate_t {
+ private class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- private class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ private class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data) op_data).iterdata.add(id);
@@ -107,8 +107,8 @@ public class H5Ex_G_Visit {
// Get type of the object and display its name and type. The name of the object is passed to this
// function by the Library.
infobuf = H5.H5Oget_info_by_name(group, name, HDF5Constants.H5P_DEFAULT);
- H5O_iterate_cb iter_cbO = new H5O_iter_callback();
- H5O_iterate_t iter_dataO = new H5O_iter_data();
+ H5O_iterate_t iter_cbO = new H5O_iter_callback();
+ H5O_iterate_opdata_t iter_dataO = new H5O_iter_data();
ret = iter_cbO.callback(group, name, infobuf, iter_dataO);
}
catch (Exception e) {
@@ -119,12 +119,12 @@ public class H5Ex_G_Visit {
}
}
- private class H5O_iter_data implements H5O_iterate_t {
+ private class H5O_iter_data implements H5O_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- private class H5O_iter_callback implements H5O_iterate_cb {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) {
+ private class H5O_iter_callback implements H5O_iterate_t {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5O_iter_data) op_data).iterdata.add(id);
diff --git a/java/examples/groups/runExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in
index 3732e7f..acc606f 100644
--- a/java/examples/groups/runExample.sh.in
+++ b/java/examples/groups/JavaGroupExample.sh.in
@@ -34,13 +34,13 @@ nerrors=0
# where the libs exist
HDFLIB_HOME="$top_srcdir/java/lib"
BLDLIBDIR="$top_builddir/hdf5/lib"
-BLDREFDIR="./groups"
+BLDITERDIR="./groups"
BLDDIR="."
HDFTEST_HOME="$top_srcdir/java/examples/groups"
JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar
TESTJARFILE=jar@PACKAGE_TARNAME@groups.jar
test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
-test -d $BLDREFDIR || mkdir -p $BLDREFDIR
+test -d $BLDITERDIR || mkdir -p $BLDITERDIR
######################################################################
# library files
@@ -51,13 +51,15 @@ test -d $BLDREFDIR || mkdir -p $BLDREFDIR
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_LIBRARY_FILES="
-$HDFLIB_HOME/slf4j-api-1.7.5.jar
-$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar
$top_builddir/src/.libs/libhdf5.*
$top_builddir/java/src/jni/.libs/libhdf5_java.*
$top_builddir/java/src/$JARFILE
"
-LIST_REF_FILES="
+LIST_JAR_TESTFILES="
+$HDFLIB_HOME/slf4j-api-1.7.25.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
+"
+LIST_ITER_FILES="
$HDFTEST_HOME/h5ex_g_iterate.h5
$HDFTEST_HOME/h5ex_g_visit.h5
"
@@ -75,6 +77,7 @@ $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Visit.txt
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARTESTFILES="$LIST_JAR_TESTFILES"
COPY_LIBFILES_TO_BLDLIBDIR()
{
@@ -102,6 +105,30 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
fi
done
+ # copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARTESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
}
CLEAN_LIBFILES_AND_BLDLIBDIR()
@@ -109,11 +136,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar`
+ SDIR=$HDFLIB_HOME
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDLIBDIR
+ for tstfile in $COPY_JARTESTFILES
+ do
+ $RM $BLDLIBDIR/tstfile
+ done
fi
}
@@ -149,24 +179,17 @@ COPY_DATAFILES_TO_BLDDIR()
CLEAN_DATAFILES_AND_BLDDIR()
{
- $RM $BLDDIR/examples.groups.H5Ex_G_*.txt
- $RM $BLDDIR/H5Ex_G_*.out
- $RM $BLDDIR/H5Ex_G_*.h5
- SDIR=`$DIRNAME $tstfile`
- INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
- INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'`
- if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then SDIR=`$DIRNAME $tstfile`
- $RM $BLDDIR/h5ex_g_iterate.h5
- $RM $BLDDIR/h5ex_g_visit.h5
- fi
+ $RM $BLDDIR/examples.groups.H5Ex_G_*.txt
+ $RM $BLDDIR/H5Ex_G_*.out
+ $RM $BLDDIR/H5Ex_G_*.h5
}
-COPY_REFFILES="$LIST_REF_FILES"
+COPY_ITERFILES="$LIST_ITER_FILES"
-COPY_REFFILES_TO_BLDREFDIR()
+COPY_ITERFILES_TO_BLDITERDIR()
{
# copy test files. Used -f to make sure get a new copy
- for tstfile in $COPY_REFFILES
+ for tstfile in $COPY_ITERFILES
do
# ignore '#' comment
echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
@@ -177,9 +200,9 @@ COPY_REFFILES_TO_BLDREFDIR()
# make cp fail
SDIR=`$DIRNAME $tstfile`
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
- INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $CP -f $tstfile $BLDREFDIR
+ $CP -f $tstfile $BLDITERDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
@@ -191,16 +214,16 @@ COPY_REFFILES_TO_BLDREFDIR()
done
}
-CLEAN_REFFILES_AND_BLDREFDIR()
+CLEAN_ITERFILES_AND_BLDITERDIR()
{
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
SDIR=`$DIRNAME $HDFTEST_HOME/h5ex_g_iterate.h5`
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
- INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDREFDIR
+ $RM $BLDITERDIR
fi
}
@@ -223,9 +246,9 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
# prepare for test
COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
-COPY_REFFILES_TO_BLDREFDIR
+COPY_ITERFILES_TO_BLDITERDIR
-CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE""
+CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
TEST=/usr/bin/test
if [ ! -x /usr/bin/test ]
@@ -257,11 +280,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then
fi
case $os_name in
- Darwin)
- DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH
- LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
- ;;
*)
LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH
;;
@@ -270,7 +288,8 @@ esac
export LD_LIBRARY_PATH
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Create"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Create > H5Ex_G_Create.out)
+TESTING examples.groups.H5Ex_G_Create
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Create > H5Ex_G_Create.out)
if diff H5Ex_G_Create.out examples.groups.H5Ex_G_Create.txt > /dev/null; then
echo " PASSED groups.H5Ex_G_Create"
else
@@ -279,7 +298,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Iterate"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Iterate > H5Ex_G_Iterate.out)
+TESTING examples.groups.H5Ex_G_Iterate
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Iterate > H5Ex_G_Iterate.out)
if diff H5Ex_G_Iterate.out examples.groups.H5Ex_G_Iterate.txt > /dev/null; then
echo " PASSED groups.H5Ex_G_Iterate"
else
@@ -288,7 +308,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Compact"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Compact > H5Ex_G_Compact.out)
+TESTING examples.groups.H5Ex_G_Compact
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Compact > H5Ex_G_Compact.out)
if diff H5Ex_G_Compact.out examples.groups.H5Ex_G_Compact.txt > /dev/null; then
echo " PASSED groups.H5Ex_G_Compact"
else
@@ -297,7 +318,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Corder"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Corder > H5Ex_G_Corder.out)
+TESTING examples.groups.H5Ex_G_Corder
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Corder > H5Ex_G_Corder.out)
if diff H5Ex_G_Corder.out examples.groups.H5Ex_G_Corder.txt > /dev/null; then
echo " PASSED groups.H5Ex_G_Corder"
else
@@ -306,7 +328,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Intermediate"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Intermediate > H5Ex_G_Intermediate.out)
+TESTING examples.groups.H5Ex_G_Intermediate
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Intermediate > H5Ex_G_Intermediate.out)
if diff H5Ex_G_Intermediate.out examples.groups.H5Ex_G_Intermediate.txt > /dev/null; then
echo " PASSED groups.H5Ex_G_Intermediate"
else
@@ -315,7 +338,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Phase"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Phase > H5Ex_G_Phase.out)
+TESTING examples.groups.H5Ex_G_Phase
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Phase > H5Ex_G_Phase.out)
if diff H5Ex_G_Phase.out examples.groups.H5Ex_G_Phase.txt > /dev/null; then
echo " PASSED groups.H5Ex_G_Phase"
else
@@ -324,7 +348,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Visit"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Visit > H5Ex_G_Visit.out)
+TESTING examples.groups.H5Ex_G_Visit
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Visit > H5Ex_G_Visit.out)
if diff H5Ex_G_Visit.out examples.groups.H5Ex_G_Visit.txt > /dev/null; then
echo " PASSED groups.H5Ex_G_Visit"
else
@@ -333,9 +358,9 @@ else
fi
# Clean up temporary files/directories
+CLEAN_ITERFILES_AND_BLDITERDIR
CLEAN_LIBFILES_AND_BLDLIBDIR
CLEAN_DATAFILES_AND_BLDDIR
-CLEAN_REFFILES_AND_BLDREFDIR
# Report test results and exit
if test $nerrors -eq 0 ; then
diff --git a/java/examples/groups/Makefile.am b/java/examples/groups/Makefile.am
index 08721e0..d5824e8 100644
--- a/java/examples/groups/Makefile.am
+++ b/java/examples/groups/Makefile.am
@@ -28,13 +28,13 @@ classes:
pkgpath = examples/groups
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
-CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
+CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
jarfile = jar$(PACKAGE_TARNAME)groups.jar
AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation
-TESTPACKAGE =
+TESTPACKAGE =
noinst_JAVA = \
H5Ex_G_Create.java \
@@ -53,10 +53,10 @@ noinst_DATA = $(jarfile)
.PHONY: classes
-check_SCRIPTS = runExample.sh
+check_SCRIPTS = JavaGroupExample.sh
TEST_SCRIPT = $(check_SCRIPTS)
-CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh
+CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class JavaGroupExample.sh
clean:
rm -rf $(JAVAROOT)/*
diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt
index 9dc4dd7..6cb1e16 100644
--- a/java/examples/intro/CMakeLists.txt
+++ b/java/examples/intro/CMakeLists.txt
@@ -1,13 +1,8 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDFJAVA_EXAMPLES_INTRO Java)
+cmake_minimum_required (VERSION 3.12)
+project (HDFJAVA_EXAMPLES_INTRO Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
-INCLUDE_DIRECTORIES (
- ${HDF5_JAVA_JNI_BINARY_DIR}
- ${HDF5_JAVA_HDF5_LIB_DIR}
-)
-
set (HDF_JAVA_EXAMPLES
H5_CreateAttribute
H5_CreateDataset
@@ -18,7 +13,7 @@ set (HDF_JAVA_EXAMPLES
H5_ReadWrite
)
-if (WIN32)
+if (WIN32 OR MINGW)
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
else ()
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
@@ -50,68 +45,41 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH})
set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}")
endforeach ()
-foreach (example ${HDF_JAVA_OBJECT_EXAMPLES})
- file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt
- "Main-Class: examples.intro.${example}
-"
- )
- add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java)
- get_target_property (${example}_JAR_FILE ${example} JAR_FILE)
-# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples)
- get_target_property (${example}_CLASSPATH ${example} CLASSDIR)
- add_dependencies (${example} ${HDFJAVA_H5_LIB_TARGET})
-endforeach ()
-
-MACRO (ADD_H5_TEST resultfile resultcode)
- if (CMAKE_BUILD_TYPE MATCHES Debug)
- if (WIN32)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
- else ()
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
- endif ()
- endif ()
- add_test (
- NAME JAVA_intro-${resultfile}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
- -D "TEST_PROGRAM=examples.intro.${resultfile}"
- -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}"
- -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}"
- -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
- -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
- -D "TEST_OUTPUT=intro/${resultfile}.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=intro/${resultfile}.txt"
- -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
- )
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (JAVA_intro-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "JAVA_intro-${resultfile}")
-ENDMACRO ()
-
-if (BUILD_TESTING)
+if (BUILD_TESTING AND HDF5_TEST_EXAMPLES AND HDF5_TEST_SERIAL)
+ get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;")
foreach (example ${HDF_JAVA_EXAMPLES})
add_test (
NAME JAVA_intro-${example}-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
+ COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5
)
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (JAVA_intro-${example}-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
+
add_test (
NAME JAVA_intro-${example}-copy-objects
- COMMAND ${CMAKE_COMMAND}
- -E copy_if_different
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.intro.${example}.txt
${HDFJAVA_EXAMPLES_INTRO_BINARY_DIR}/${example}.txt
)
set_tests_properties (JAVA_intro-${example}-copy-objects PROPERTIES DEPENDS JAVA_intro-${example}-clear-objects)
- set (last_test "JAVA_intro-${example}-copy-objects")
- ADD_H5_TEST (${example} 0)
+
+ add_test (
+ NAME JAVA_intro-${example}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
+ -D "TEST_PROGRAM=examples.intro.${example}"
+ -D "TEST_ARGS:STRING=${CMD_ARGS}"
+ -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
+ -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}"
+ -D "TEST_OUTPUT=intro/${example}.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=intro/${example}.txt"
+ -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
+ )
+ set_tests_properties (JAVA_intro-${example} PROPERTIES
+ DEPENDS JAVA_intro-${example}-copy-objects
+ )
endforeach ()
endif ()
diff --git a/java/examples/intro/runExample.sh.in b/java/examples/intro/JavaIntroExample.sh.in
index 4533a1b..1886485 100644
--- a/java/examples/intro/runExample.sh.in
+++ b/java/examples/intro/JavaIntroExample.sh.in
@@ -49,12 +49,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_LIBRARY_FILES="
-$HDFLIB_HOME/slf4j-api-1.7.5.jar
-$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar
$top_builddir/src/.libs/libhdf5.*
$top_builddir/java/src/jni/.libs/libhdf5_java.*
$top_builddir/java/src/$JARFILE
"
+LIST_JAR_TESTFILES="
+$HDFLIB_HOME/slf4j-api-1.7.25.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
+"
LIST_DATA_FILES="
$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateDataset.txt
$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateAttribute.txt
@@ -69,6 +71,7 @@ $HDFTEST_HOME/../testfiles/examples.intro.H5_ReadWrite.txt
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARTESTFILES="$LIST_JAR_TESTFILES"
COPY_LIBFILES_TO_BLDLIBDIR()
{
@@ -96,6 +99,30 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
fi
done
+ # copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARTESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
}
CLEAN_LIBFILES_AND_BLDLIBDIR()
@@ -103,11 +130,14 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar`
+ SDIR=$HDFLIB_HOME
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDLIBDIR
+ for tstfile in $COPY_JARTESTFILES
+ do
+ $RM $BLDLIBDIR/tstfile
+ done
fi
}
@@ -168,7 +198,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
-CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE""
+CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
TEST=/usr/bin/test
if [ ! -x /usr/bin/test ]
@@ -200,11 +230,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then
fi
case $os_name in
- Darwin)
- DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH
- LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
- ;;
*)
LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH
;;
@@ -213,7 +238,8 @@ esac
export LD_LIBRARY_PATH
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateDataset"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateDataset > H5_CreateDataset.out)
+TESTING examples.intro.H5_CreateDataset
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateDataset > H5_CreateDataset.out)
if diff H5_CreateDataset.out examples.intro.H5_CreateDataset.txt > /dev/null; then
echo " PASSED intro.H5_CreateDataset"
else
@@ -222,7 +248,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateAttribute"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateAttribute > H5_CreateAttribute.out)
+TESTING examples.intro.H5_CreateAttribute
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateAttribute > H5_CreateAttribute.out)
if diff H5_CreateAttribute.out examples.intro.H5_CreateAttribute.txt > /dev/null; then
echo " PASSED intro.H5_CreateAttribute"
else
@@ -231,7 +258,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateFile"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateFile > H5_CreateFile.out)
+TESTING examples.intro.H5_CreateFile
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateFile > H5_CreateFile.out)
if diff H5_CreateFile.out examples.intro.H5_CreateFile.txt > /dev/null; then
echo " PASSED intro.H5_CreateFile"
else
@@ -240,7 +268,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroup"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroup > H5_CreateGroup.out)
+TESTING examples.intro.H5_CreateGroup
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroup > H5_CreateGroup.out)
if diff H5_CreateGroup.out examples.intro.H5_CreateGroup.txt > /dev/null; then
echo " PASSED intro.H5_CreateGroup"
else
@@ -249,7 +278,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupAbsoluteRelative"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupAbsoluteRelative > H5_CreateGroupAbsoluteRelative.out)
+TESTING examples.intro.H5_CreateGroupAbsoluteRelative
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupAbsoluteRelative > H5_CreateGroupAbsoluteRelative.out)
if diff H5_CreateGroupAbsoluteRelative.out examples.intro.H5_CreateGroupAbsoluteRelative.txt > /dev/null; then
echo " PASSED intro.H5_CreateGroupAbsoluteRelative"
else
@@ -258,7 +288,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupDataset"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupDataset > H5_CreateGroupDataset.out)
+TESTING examples.intro.H5_CreateGroupDataset
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupDataset > H5_CreateGroupDataset.out)
if diff H5_CreateGroupDataset.out examples.intro.H5_CreateGroupDataset.txt > /dev/null; then
echo " PASSED intro.H5_CreateGroupDataset"
else
@@ -267,7 +298,8 @@ else
fi
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_ReadWrite"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_ReadWrite > H5_ReadWrite.out)
+TESTING examples.intro.H5_ReadWrite
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_ReadWrite > H5_ReadWrite.out)
if diff H5_ReadWrite.out examples.intro.H5_ReadWrite.txt > /dev/null; then
echo " PASSED intro.H5_ReadWrite"
else
diff --git a/java/examples/intro/Makefile.am b/java/examples/intro/Makefile.am
index 95743d9..8c3716a 100644
--- a/java/examples/intro/Makefile.am
+++ b/java/examples/intro/Makefile.am
@@ -28,13 +28,13 @@ classes:
pkgpath = examples/intro
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
-CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
+CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
jarfile = jar$(PACKAGE_TARNAME)intro.jar
AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation
-TESTPACKAGE =
+TESTPACKAGE =
noinst_JAVA = \
H5_CreateAttribute.java \
@@ -52,10 +52,10 @@ noinst_DATA = $(jarfile)
.PHONY: classes
-check_SCRIPTS = runExample.sh
+check_SCRIPTS = JavaIntroExample.sh
TEST_SCRIPT = $(check_SCRIPTS)
-CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh
+CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class JavaIntroExample.sh
clean:
rm -rf $(JAVAROOT)/*
diff --git a/java/lib/ext/slf4j-nop-1.7.25.jar b/java/lib/ext/slf4j-nop-1.7.25.jar
new file mode 100644
index 0000000..78c7295
--- /dev/null
+++ b/java/lib/ext/slf4j-nop-1.7.25.jar
Binary files differ
diff --git a/java/lib/ext/slf4j-nop-1.7.5.jar b/java/lib/ext/slf4j-nop-1.7.5.jar
deleted file mode 100644
index e55bdd8..0000000
--- a/java/lib/ext/slf4j-nop-1.7.5.jar
+++ /dev/null
Binary files differ
diff --git a/java/lib/ext/slf4j-simple-1.7.25.jar b/java/lib/ext/slf4j-simple-1.7.25.jar
new file mode 100644
index 0000000..b29ca12
--- /dev/null
+++ b/java/lib/ext/slf4j-simple-1.7.25.jar
Binary files differ
diff --git a/java/lib/ext/slf4j-simple-1.7.5.jar b/java/lib/ext/slf4j-simple-1.7.5.jar
deleted file mode 100644
index 9dece31..0000000
--- a/java/lib/ext/slf4j-simple-1.7.5.jar
+++ /dev/null
Binary files differ
diff --git a/java/lib/slf4j-api-1.7.25.jar b/java/lib/slf4j-api-1.7.25.jar
new file mode 100644
index 0000000..7e62f13
--- /dev/null
+++ b/java/lib/slf4j-api-1.7.25.jar
Binary files differ
diff --git a/java/lib/slf4j-api-1.7.5.jar b/java/lib/slf4j-api-1.7.5.jar
deleted file mode 100644
index 8766455..0000000
--- a/java/lib/slf4j-api-1.7.5.jar
+++ /dev/null
Binary files differ
diff --git a/java/src/CMakeLists.txt b/java/src/CMakeLists.txt
index 3f93f39..0bfbaf7 100644
--- a/java/src/CMakeLists.txt
+++ b/java/src/CMakeLists.txt
@@ -1,8 +1,8 @@
-cmake_minimum_required(VERSION 3.2.2)
-PROJECT ( HDF5_JAVA_SRC C Java )
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_JAVA_SRC C)
#-----------------------------------------------------------------------------
# Traverse source subdirectory
#-----------------------------------------------------------------------------
-add_subdirectory (${HDF5_JAVA_SRC_SOURCE_DIR}/jni ${HDF5_JAVA_SRC_BINARY_DIR}/jni)
-add_subdirectory (${HDF5_JAVA_SRC_SOURCE_DIR}/hdf ${HDF5_JAVA_SRC_BINARY_DIR}/hdf)
+add_subdirectory (jni)
+add_subdirectory (hdf)
diff --git a/java/src/Makefile.am b/java/src/Makefile.am
index 64eef0c..0df48bd 100644
--- a/java/src/Makefile.am
+++ b/java/src/Makefile.am
@@ -10,7 +10,7 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-#
+#
# This makefile mostly just reinvokes make in the various subdirectories
# but does so in the correct order. You can alternatively invoke make from
# each subdirectory manually.
@@ -37,7 +37,7 @@ jarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
hdf5_javadir = $(libdir)
pkgpath = hdf/hdf5lib
-CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$$CLASSPATH
+CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$$CLASSPATH
AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation
@@ -51,10 +51,10 @@ hdf5_java_JAVA = \
${pkgpath}/callbacks/H5D_iterate_t.java \
${pkgpath}/callbacks/H5E_walk_cb.java \
${pkgpath}/callbacks/H5E_walk_t.java \
- ${pkgpath}/callbacks/H5L_iterate_cb.java \
${pkgpath}/callbacks/H5L_iterate_t.java \
- ${pkgpath}/callbacks/H5O_iterate_cb.java \
+ ${pkgpath}/callbacks/H5L_iterate_opdata_t.java \
${pkgpath}/callbacks/H5O_iterate_t.java \
+ ${pkgpath}/callbacks/H5O_iterate_opdata_t.java \
${pkgpath}/callbacks/H5P_cls_close_func_cb.java \
${pkgpath}/callbacks/H5P_cls_close_func_t.java \
${pkgpath}/callbacks/H5P_cls_copy_func_cb.java \
@@ -98,9 +98,13 @@ hdf5_java_JAVA = \
${pkgpath}/structs/H5A_info_t.java \
${pkgpath}/structs/H5E_error2_t.java \
${pkgpath}/structs/H5F_info2_t.java \
+ ${pkgpath}/structs/H5FD_hdfs_fapl_t.java \
+ ${pkgpath}/structs/H5FD_ros3_fapl_t.java \
${pkgpath}/structs/H5G_info_t.java \
${pkgpath}/structs/H5L_info_t.java \
${pkgpath}/structs/H5O_info_t.java \
+ ${pkgpath}/structs/H5O_native_info_t.java \
+ ${pkgpath}/structs/H5O_token_t.java \
${pkgpath}/structs/H5O_hdr_info_t.java \
${pkgpath}/structs/H5AC_cache_config_t.java \
${pkgpath}/H5.java \
diff --git a/java/src/hdf/CMakeLists.txt b/java/src/hdf/CMakeLists.txt
index 84bda53..5660158 100644
--- a/java/src/hdf/CMakeLists.txt
+++ b/java/src/hdf/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_JAVA_HDF)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_JAVA_HDF C)
-add_subdirectory (${HDF5_JAVA_HDF_SOURCE_DIR}/hdf5lib hdf5lib)
+add_subdirectory (hdf5lib)
diff --git a/java/src/hdf/hdf5lib/CMakeLists.txt b/java/src/hdf/hdf5lib/CMakeLists.txt
index c856c04..f3d9b8d 100644
--- a/java/src/hdf/hdf5lib/CMakeLists.txt
+++ b/java/src/hdf/hdf5lib/CMakeLists.txt
@@ -1,14 +1,9 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_JAVA_HDF_HDF5 Java)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_JAVA_HDF_HDF5 Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
-INCLUDE_DIRECTORIES (
- ${HDF5_JAVA_HDF_HDF5_SOURCE_DIR}
- ${HDF5_JAVA_HDF_HDF5_BINARY_DIR}
- ${HDF5_JAVA_LIB_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${HDF5_JAVA_HDF5_LIB_CORENAME}.dir/hdf/hdf5lib
-)
+set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${HDF5_JAVA_HDF_HDF5_SOURCE_DIR};${HDF5_JAVA_HDF_HDF5_BINARY_DIR};${HDF5_JAVA_LIB_DIR};${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${HDF5_JAVA_HDF5_LIB_CORENAME}.dir/hdf/hdf5lib")
SET_GLOBAL_VARIABLE (HDF5_JAVA_SOURCE_PACKAGES
"${HDF5_JAVA_SOURCE_PACKAGES};hdf.hdf5lib.callbacks;hdf.hdf5lib.exceptions;hdf.hdf5lib.structs;hdf.hdf5lib"
@@ -23,10 +18,10 @@ set (HDF5_JAVA_HDF_HDF5_CALLBACKS_SOURCES
callbacks/H5D_iterate_t.java
callbacks/H5E_walk_cb.java
callbacks/H5E_walk_t.java
- callbacks/H5L_iterate_cb.java
callbacks/H5L_iterate_t.java
- callbacks/H5O_iterate_cb.java
+ callbacks/H5L_iterate_opdata_t.java
callbacks/H5O_iterate_t.java
+ callbacks/H5O_iterate_opdata_t.java
callbacks/H5P_cls_close_func_cb.java
callbacks/H5P_cls_close_func_t.java
callbacks/H5P_cls_copy_func_cb.java
@@ -78,10 +73,14 @@ set (HDF5_JAVA_HDF_HDF5_STRUCTS_SOURCES
structs/H5AC_cache_config_t.java
structs/H5E_error2_t.java
structs/H5F_info2_t.java
+ structs/H5FD_ros3_fapl_t.java
+ structs/H5FD_hdfs_fapl_t.java
structs/H5G_info_t.java
structs/H5L_info_t.java
structs/H5O_hdr_info_t.java
structs/H5O_info_t.java
+ structs/H5O_native_info_t.java
+ structs/H5O_token_t.java
)
set (HDF5_JAVA_HDF_HDF5_SOURCES
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 7b5b5c9..1527dc2 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -24,10 +24,10 @@ import hdf.hdf5lib.callbacks.H5D_iterate_cb;
import hdf.hdf5lib.callbacks.H5D_iterate_t;
import hdf.hdf5lib.callbacks.H5E_walk_cb;
import hdf.hdf5lib.callbacks.H5E_walk_t;
-import hdf.hdf5lib.callbacks.H5L_iterate_cb;
import hdf.hdf5lib.callbacks.H5L_iterate_t;
-import hdf.hdf5lib.callbacks.H5O_iterate_cb;
+import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t;
import hdf.hdf5lib.callbacks.H5O_iterate_t;
+import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t;
import hdf.hdf5lib.callbacks.H5P_cls_close_func_cb;
import hdf.hdf5lib.callbacks.H5P_cls_close_func_t;
import hdf.hdf5lib.callbacks.H5P_cls_copy_func_cb;
@@ -50,9 +50,13 @@ import hdf.hdf5lib.structs.H5AC_cache_config_t;
import hdf.hdf5lib.structs.H5A_info_t;
import hdf.hdf5lib.structs.H5E_error2_t;
import hdf.hdf5lib.structs.H5F_info2_t;
+import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t;
+import hdf.hdf5lib.structs.H5FD_ros3_fapl_t;
import hdf.hdf5lib.structs.H5G_info_t;
import hdf.hdf5lib.structs.H5L_info_t;
import hdf.hdf5lib.structs.H5O_info_t;
+import hdf.hdf5lib.structs.H5O_native_info_t;
+import hdf.hdf5lib.structs.H5O_token_t;
/**
* This class is the Java interface for the HDF5 library.
@@ -70,8 +74,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* In general, arguments to the HDF Java API are straightforward translations from the 'C' API described in the HDF
* Reference Manual.
*
- * <center>
- * <table border=2 cellpadding=2>
+ * <table border=1>
* <caption><b>HDF-5 C types to Java types</b> </caption>
* <tr>
* <td><b>HDF-5</b></td>
@@ -107,8 +110,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* <td>Special -- see HDFArray</td>
* </tr>
* </table>
- * </center>
- * <center> <b>General Rules for Passing Arguments and Results</b> </center>
+ * <b>General Rules for Passing Arguments and Results</b>
* <p>
* In general, arguments passed <b>IN</b> to Java are the analogous basic types, as above. The exception is for arrays,
* which are discussed below.
@@ -143,7 +145,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* <p>
* All the routines where this convention is used will have specific documentation of the details, given below.
* <p>
- * <a NAME="ARRAYS"> <b>Arrays</b> </a>
+ * <b>Arrays</b>
* <p>
* HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 API describes the
* layout of the source and destination, and the data for the array passed as a block of bytes, for instance,
@@ -176,7 +178,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* and the parameter <i>data</i> can be any multi-dimensional array of numbers, such as float[][], or int[][][], or
* Double[][].
* <p>
- * <a NAME="CONSTANTS"> <b>HDF-5 Constants</b></a>
+ * <b>HDF-5 Constants</b>
* <p>
* The HDF-5 API defines a set of constants and enumerated values. Most of these values are available to Java programs
* via the class <a href="./hdf.hdf5lib.HDF5Constants.html"> <b>HDF5Constants</b></a>. For example, the parameters for
@@ -196,7 +198,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* The Java application uses both types of constants the same way, the only difference is that the
* <b><i>HDF5CDataTypes</i></b> may have different values on different platforms.
* <p>
- * <a NAME="ERRORS"> <b>Error handling and Exceptions</b></a>
+ * <b>Error handling and Exceptions</b>
* <p>
* The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API is omitted from the
* JHI5. Errors are converted into Java exceptions. This is totally different from the C interface, but is very natural
@@ -214,7 +216,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* exception handlers to print out the HDF-5 error stack.
* <hr>
*
- * @version HDF5 1.11.0 <BR>
+ * @version HDF5 1.13.0 <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 +239,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, 0 };
+ public final static int LIB_VERSION[] = { 1, 13, 0 };
public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib";
@@ -424,7 +426,7 @@ public class H5 implements java.io.Serializable {
private synchronized static native int H5dont_atexit() throws HDF5LibraryException;
/**
- * Turn off error handling By default, the C library prints the error stack of the HDF-5 C library on stdout. This
+ * Turn off error handling. By default, the C library prints the error stack of the HDF-5 C library on stdout. This
* behavior may be disabled by calling H5error_off().
*
* @return a non-negative value if successful
@@ -432,6 +434,12 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5error_off();
/**
+ * Turn on error handling. By default, the C library prints the error stack of the HDF-5 C library on stdout. This
+ * behavior may be reenabled by calling H5error_on().
+ */
+ public synchronized static native void H5error_on();
+
+ /**
* H5garbage_collect collects on all free-lists of all types.
*
* @return a non-negative value if successful
@@ -493,9 +501,9 @@ public class H5 implements java.io.Serializable {
private synchronized static native boolean H5is_library_threadsafe();
// /////// unimplemented ////////
- // H5_DLL herr_t H5free_memory(void *mem);
- // H5_DLL void *H5allocate_memory(size_t size, hbool_t clear);
- // H5_DLL void *H5resize_memory(void *mem, size_t size);
+ // herr_t H5free_memory(void *mem);
+ // void *H5allocate_memory(size_t size, hbool_t clear);
+ // void *H5resize_memory(void *mem, size_t size);
// ////////////////////////////////////////////////////////////
// //
@@ -846,7 +854,8 @@ public class H5 implements java.io.Serializable {
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
- public static long H5Aget_space(long attr_id) throws HDF5LibraryException {
+ public static long H5Aget_space(long attr_id) throws HDF5LibraryException
+ {
long id = _H5Aget_space(attr_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aget_space add {}", id);
@@ -882,7 +891,8 @@ public class H5 implements java.io.Serializable {
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
- public static long H5Aget_type(long attr_id) throws HDF5LibraryException {
+ public static long H5Aget_type(long attr_id) throws HDF5LibraryException
+ {
long id = _H5Aget_type(attr_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aget_type add {}", id);
@@ -912,8 +922,9 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - Name is null.
**/
- public static long H5Aopen(long obj_id, String attr_name, long aapl_id) throws HDF5LibraryException,
- NullPointerException {
+ public static long H5Aopen(long obj_id, String attr_name, long aapl_id)
+ throws HDF5LibraryException, NullPointerException
+ {
long id = _H5Aopen(obj_id, attr_name, aapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aopen add {}", id);
@@ -953,7 +964,8 @@ public class H5 implements java.io.Serializable {
* - Name is null.
**/
public static long H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, long n, long aapl_id,
- long lapl_id) throws HDF5LibraryException, NullPointerException {
+ long lapl_id) throws HDF5LibraryException, NullPointerException
+ {
long id = _H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aopen_by_idx add {}", id);
@@ -988,7 +1000,8 @@ public class H5 implements java.io.Serializable {
* - obj_name is null.
**/
public static long H5Aopen_by_name(long loc_id, String obj_name, String attr_name, long aapl_id, long lapl_id)
- throws HDF5LibraryException, NullPointerException {
+ throws HDF5LibraryException, NullPointerException
+ {
long id = _H5Aopen_by_name(loc_id, obj_name, attr_name, aapl_id, lapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aopen_by_name add {}", id);
@@ -1009,8 +1022,10 @@ public class H5 implements java.io.Serializable {
* IN: Identifier of an attribute to read.
* @param mem_type_id
* IN: Identifier of the attribute datatype (in memory).
- * @param buf
- * IN: Buffer for data to be read.
+ * @param obj
+ * Buffer to store data read from the file.
+ * @param isCriticalPinning
+ * request lock on data reference.
*
* @return a non-negative value if successful
*
@@ -1019,9 +1034,19 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - data buffer is null.
**/
- public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] buf)
+ public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] obj, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
+ public synchronized static int H5Aread(long attr_id, long mem_type_id, byte[] buf) throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException
+ {
+ return H5Aread(attr_id, mem_type_id, obj, true);
+ }
+
/**
* H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with
* mem_type_id. The entire attribute is read into data object from the file.
@@ -1032,31 +1057,145 @@ public class H5 implements java.io.Serializable {
* IN: Identifier of the attribute datatype (in memory).
* @param obj
* IN: Object for data to be read.
+ * @param isCriticalPinning
+ * request lock on data reference.
*
* @return a non-negative value if successful
*
+ * @exception HDF5Exception
+ * - Failure in the data conversion.
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - data buffer is null. See public synchronized static native int H5Aread( )
**/
- public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception,
- NullPointerException {
- HDFArray theArray = new HDFArray(obj);
- byte[] buf = theArray.emptyBytes();
+ public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning)
+ throws HDF5Exception, HDF5LibraryException, NullPointerException
+ {
+ int status = -1;
+ boolean is1D = false;
- // This will raise an exception if there is an error
- int status = H5Aread(attr_id, mem_type_id, buf);
+ Class dataClass = obj.getClass();
+ if (!dataClass.isArray()) {
+ throw (new HDF5JavaException("H5Aread: data is not an array"));
+ }
- // No exception: status really ought to be OK
- if (status >= 0) {
- obj = theArray.arrayify(buf);
+ String cname = dataClass.getName();
+ is1D = (cname.lastIndexOf('[') == cname.indexOf('['));
+ char dname = cname.charAt(cname.lastIndexOf("[") + 1);
+ log.trace("H5Aread: cname={} is1D={} dname={}", cname, is1D, dname);
+
+ if (is1D && (dname == 'B')) {
+ log.trace("H5Aread_dname_B");
+ status = H5Aread(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'S')) {
+ log.trace("H5Aread_dname_S");
+ status = H5Aread_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'I')) {
+ log.trace("H5Aread_dname_I");
+ status = H5Aread_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'J')) {
+ log.trace("H5Aread_dname_J");
+ status = H5Aread_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'F')) {
+ log.trace("H5Aread_dname_F");
+ status = H5Aread_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'D')) {
+ 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)) {
+ log.trace("H5Aread_reg_ref");
+ status = H5Aread_reg_ref(attr_id, mem_type_id, (String[]) obj);
+ }
+ else if (is1D && (dataClass.getComponentType() == String.class)) {
+ log.trace("H5Aread_string type");
+ status = H5Aread_string(attr_id, mem_type_id, (String[]) obj);
+ }
+ else {
+ // Create a data buffer to hold the data into a Java Array
+ HDFArray theArray = new HDFArray(obj);
+ byte[] buf = theArray.emptyBytes();
+ log.trace("H5Aread_else");
+
+ // This will raise an exception if there is an error
+ status = H5Aread(attr_id, mem_type_id, buf, isCriticalPinning);
+
+ // No exception: status really ought to be OK
+ if (status >= 0) {
+ obj = theArray.arrayify(buf);
+ }
+
+ // clean up these: assign 'null' as hint to gc()
+ buf = null;
+ theArray = null;
}
return status;
}
- public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, String[] buf)
+ public synchronized static native int H5Aread_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Aread_double(long attr_id, long mem_type_id, double[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread_double(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Aread_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Aread_float(long attr_id, long mem_type_id, float[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread_float(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Aread_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Aread_int(long attr_id, long mem_type_id, int[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread_int(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Aread_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Aread_long(long attr_id, long mem_type_id, long[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread_long(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Aread_reg_ref(long attr_id, long mem_type_id, String[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static native int H5Aread_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Aread_short(long attr_id, long mem_type_id, short[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread_short(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, Object[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static native int H5Aread_string(long attr_id, long mem_type_id, String[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static native int H5Aread_VLStrings(long attr_id, long mem_type_id, Object[] buf)
throws HDF5LibraryException, NullPointerException;
public synchronized static native int H5AreadComplex(long attr_id, long mem_type_id, String[] buf)
@@ -1117,7 +1256,9 @@ public class H5 implements java.io.Serializable {
* @param mem_type_id
* IN: Identifier of the attribute datatype (in memory).
* @param buf
- * IN: Data to be written.
+ * IN: Buffer with data to be written to the file.
+ * @param isCriticalPinning
+ * IN: request lock on data reference.
*
* @return a non-negative value if successful
*
@@ -1126,9 +1267,21 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - data is null.
**/
- public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf)
+ public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
+ public synchronized static int H5Awrite(long attr_id, long mem_type_id, byte[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj)
+ throws HDF5Exception, HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite(attr_id, mem_type_id, obj, true);
+ }
+
/**
* H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with
* mem_type_id. The entire attribute is written from data object to the file.
@@ -1139,28 +1292,140 @@ public class H5 implements java.io.Serializable {
* IN: Identifier of the attribute datatype (in memory).
* @param obj
* IN: Data object to be written.
+ * @param isCriticalPinning
+ * request lock on data reference.
*
* @return a non-negative value if successful
*
+ * @exception HDF5Exception
+ * - Failure in the data conversion.
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
- * - data object is null. See public synchronized static native int H5Awrite(int attr_id, int
- * mem_type_id, byte[] buf);
+ * - data object is null
**/
- public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj)
- throws HDF5Exception, NullPointerException
+ public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning)
+ throws HDF5Exception, HDF5LibraryException, NullPointerException
{
- HDFArray theArray = new HDFArray(obj);
- byte[] buf = theArray.byteify();
+ int status = -1;
+ boolean is1D = false;
- int retVal = H5Awrite(attr_id, mem_type_id, buf);
- buf = null;
- theArray = null;
- return retVal;
+ Class dataClass = obj.getClass();
+ if (!dataClass.isArray()) {
+ throw (new HDF5JavaException("H5Dwrite: data is not an array"));
+ }
+
+ String cname = dataClass.getName();
+ is1D = (cname.lastIndexOf('[') == cname.indexOf('['));
+ char dname = cname.charAt(cname.lastIndexOf("[") + 1);
+
+ if (is1D && (dname == 'B')) {
+ status = H5Awrite(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'S')) {
+ status = H5Awrite_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'I')) {
+ status = H5Awrite_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'J')) {
+ status = H5Awrite_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'F')) {
+ status = H5Awrite_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'D')) {
+ status = H5Awrite_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dataClass.getComponentType() == String.class)) {
+ log.trace("H5Dwrite_string type");
+ status = H5Awrite_string(attr_id, mem_type_id, (String[]) obj);
+ }
+ else {
+ HDFArray theArray = new HDFArray(obj);
+ byte[] buf = theArray.byteify();
+
+ status = H5Awrite(attr_id, mem_type_id, buf);
+ buf = null;
+ theArray = null;
+ }
+
+ return status;
+ }
+
+ public synchronized static native int H5Awrite_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Awrite_double(long attr_id, long mem_type_id, double[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite_double(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Awrite_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Awrite_float(long attr_id, long mem_type_id, float[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite_float(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Awrite_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Awrite_int(long attr_id, long mem_type_id, int[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite_int(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Awrite_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Awrite_long(long attr_id, long mem_type_id, long[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite_long(attr_id, mem_type_id, buf, true);
}
- public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, String[] buf)
+ public synchronized static native int H5Awrite_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Awrite_short(long attr_id, long mem_type_id, short[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite_short(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Awrite_string(long attr_id, long mem_type_id, String[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, Object[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
+ /**
+ * H5Awrite_VLStrings writes a variable length String dataset, specified by its identifier attr_id, from
+ * the application memory buffer buf into the file.
+ *
+ * ---- contributed by Rosetta Biosoftware
+ *
+ * @param attr_id
+ * Identifier of the attribute read from.
+ * @param mem_type_id
+ * Identifier of the memory datatype.
+ * @param buf
+ * Buffer with data to be written to the file.
+ *
+ * @return a non-negative value if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+
+ public synchronized static native int H5Awrite_VLStrings(long attr_id, long mem_type_id, Object[] buf)
throws HDF5LibraryException, NullPointerException;
/**
@@ -1270,6 +1535,38 @@ public class H5 implements java.io.Serializable {
// ////////////////////////////////////////////////////////////
// //
+ // H5AC: Cache Interface Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // No public Functions
+
+ // ////////////////////////////////////////////////////////////
+ // //
+ // H5B: B-link-tree Interface Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // No public Functions
+
+ // ////////////////////////////////////////////////////////////
+ // //
+ // H5B2: v2 B-tree Interface Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // No public Functions
+
+ // ////////////////////////////////////////////////////////////
+ // //
+ // H5C: Cache Interface Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // No public Functions
+
+ // ////////////////////////////////////////////////////////////
+ // //
// H5D: Datasets Interface Functions //
// //
// ////////////////////////////////////////////////////////////
@@ -1576,8 +1873,8 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - name is null.
**/
- public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException,
- NullPointerException {
+ public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException, NullPointerException
+ {
long id = _H5Dopen2(loc_id, name, dapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Dopen add {}", id);
@@ -1626,12 +1923,14 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
- long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException {
+ long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
- long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException {
+ long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException
+ {
return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true);
}
@@ -1665,7 +1964,8 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException,
- NullPointerException {
+ NullPointerException
+ {
int status = -1;
boolean is1D = false;
@@ -1696,7 +1996,8 @@ public class H5 implements java.io.Serializable {
}
else if (is1D && (dname == 'J')) {
log.trace("H5Dread_dname_J");
- status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj);
+ status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj,
+ isCriticalPinning);
}
else if (is1D && (dname == 'F')) {
log.trace("H5Dread_dname_F");
@@ -1708,20 +2009,17 @@ 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.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);
}
else if (is1D && (dataClass.getComponentType() == String.class)) {
log.trace("H5Dread_string type");
- if (H5.H5Tis_variable_str(mem_type_id)) {
- status = H5Dread_VLStrings(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj);
- }
- else {
- status = H5Dread_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id,
+ status = H5Dread_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id,
(String[]) obj);
- }
}
else {
// Create a data buffer to hold the data into a Java Array
@@ -1750,7 +2048,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dread_double(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -1759,7 +2058,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dread_float(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -1768,7 +2068,8 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dread_int(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -1777,22 +2078,21 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dread_long(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
public synchronized static native int H5Dread_reg_ref(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException;
- public synchronized static native int H5Dread_reg_ref_data(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException;
-
public synchronized static native int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, short[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -1861,7 +2161,10 @@ public class H5 implements java.io.Serializable {
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - buf is null.
+ *
+ * @deprecated As of HDF5 1.12.0 in favor of H5Treclaim
**/
+ @Deprecated
public synchronized static native int H5Dvlen_reclaim(long type_id, long space_id, long xfer_plist_id, byte[] buf)
throws HDF5LibraryException, NullPointerException;
@@ -1896,12 +2199,14 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
- long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException {
+ long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
- long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException {
+ long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException
+ {
return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true);
}
@@ -1935,13 +2240,14 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException,
- NullPointerException {
+ NullPointerException
+ {
int status = -1;
boolean is1D = false;
Class dataClass = obj.getClass();
if (!dataClass.isArray()) {
- throw (new HDF5JavaException("H5Dread: data is not an array"));
+ throw (new HDF5JavaException("H5Dwrite: data is not an array"));
}
String cname = dataClass.getName();
@@ -1974,13 +2280,8 @@ public class H5 implements java.io.Serializable {
}
else if (is1D && (dataClass.getComponentType() == String.class)) {
log.trace("H5Dwrite_string type");
- if (H5.H5Tis_variable_str(mem_type_id)) {
- status = H5Dwrite_VLStrings(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj);
- }
- else {
- status = H5Dwrite_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id,
+ status = H5Dwrite_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id,
(String[]) obj);
- }
}
else {
HDFArray theArray = new HDFArray(obj);
@@ -2003,7 +2304,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -2012,7 +2314,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dwrite_float(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -2021,7 +2324,8 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dwrite_int(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -2030,7 +2334,8 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dwrite_long(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -2039,13 +2344,17 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dwrite_short(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
public synchronized static native int H5Dwrite_string(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException;
+ public synchronized static native int H5DwriteVL(long dataset_id, long mem_type_id, long mem_space_id,
+ long file_space_id, long xfer_plist_id, Object[] buf) throws HDF5LibraryException, NullPointerException;
+
/**
* H5Dwrite_VLStrings writes a (partial) variable length String dataset, specified by its identifier dataset_id, from
* the application memory buffer buf into the file.
@@ -2102,7 +2411,11 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Drefresh(long dset_id) throws HDF5LibraryException;
// /////// unimplemented ////////
- // H5_DLL herr_t H5Ddebug(hid_t dset_id);
+ // herr_t H5Ddebug(hid_t dset_id);
+ // herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes);
+ // herr_t H5Dformat_convert(hid_t dset_id);
+ // herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
+
// herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
// size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data);
// herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id, void *dst_buf);
@@ -2666,6 +2979,19 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Fget_intent(long file_id) throws HDF5LibraryException;
/**
+ * H5Fget_fileno retrieves the "file number" for an open file.
+ *
+ * @param file_id
+ * IN: File identifier for a currently-open HDF5 file
+ *
+ * @return the unique file number for the file.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native long H5Fget_fileno(long file_id) throws HDF5LibraryException;
+
+ /**
* H5Fget_mdc_hit_rate queries the metadata cache of the target file to obtain its hit rate (cache hits / (cache
* hits + cache misses)) since the last time hit rate statistics were reset.
*
@@ -2773,10 +3099,30 @@ public class H5 implements java.io.Serializable {
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - name is null.
+ *
+ * @deprecated As of HDF5 1.10.5 in favor of H5Fis_accessible.
**/
+ @Deprecated
public synchronized static native boolean H5Fis_hdf5(String name) throws HDF5LibraryException, NullPointerException;
/**
+ * H5Fis_accessible determines if the file can be opened with the given fapl.
+ *
+ * @param name
+ * IN: File name to check.
+ * @param file_id
+ * IN: File identifier for a currently-open HDF5 file
+ *
+ * @return true if file is accessible, false if not.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public synchronized static native boolean H5Fis_accessible(String name, long file_id) throws HDF5LibraryException, NullPointerException;
+
+ /**
* H5Fmount mounts the file specified by child_id onto the group specified by loc_id and name using the mount
* properties plist_id.
*
@@ -2906,12 +3252,67 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Fget_mdc_logging_status(long file_id, boolean[] mdc_logging_status)
throws HDF5LibraryException, NullPointerException;
+ /**
+ * H5Fget_dset_no_attrs_hint gets the file-level setting to create minimized dataset object headers.
+ *
+ * @param file_id
+ * IN: Identifier of the target file.
+ *
+ * @return true if the file-level is set to create minimized dataset object headers, false if not.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native boolean H5Fget_dset_no_attrs_hint(long file_id)
+ throws HDF5LibraryException;
+
+ /**
+ * H5Fset_dset_no_attrs_hint sets the file-level setting to create minimized dataset object headers.
+ *
+ * @param file_id
+ * IN: Identifier of the target file.
+ * @param minimize
+ * the minimize hint setting
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native void H5Fset_dset_no_attrs_hint(long file_id, boolean minimize)
+ throws HDF5LibraryException;
+
+
+ /**
+ * H5Fset_libver_bounds sets a different low and high bounds while a file is open.
+ *
+ * @param file_id
+ * IN: Identifier of the target file.
+ * @param low
+ * IN: The earliest version of the library that will be used for writing objects
+ * @param high
+ * IN: The latest version of the library that will be used for writing objects.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native void H5Fset_libver_bounds(long file_id, int low, int high)
+ throws HDF5LibraryException;
// /////// unimplemented ////////
+ // herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa);
+ // herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment);
// ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len);
// herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info);
// ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/);
+ // herr_t H5Fformat_convert(hid_t fid);
+ // herr_t H5Freset_page_buffering_stats(hid_t file_id);
+ // herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2],
+ // unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]);
+ // herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size);
+ // #ifdef H5_HAVE_PARALLEL
+ // herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
+ // herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
+ // #endif /* H5_HAVE_PARALLEL */
// /**
// * H5Fget_vfd_handle returns a pointer to the file handle from the
@@ -2965,6 +3366,41 @@ public class H5 implements java.io.Serializable {
// ////////////////////////////////////////////////////////////
// //
+ // H5FD: File Driver Interface Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // /////// unimplemented ////////
+ // hid_t H5FDregister(const H5FD_class_t *cls);
+ // herr_t H5FDunregister(hid_t driver_id);
+ // H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
+ // herr_t H5FDclose(H5FD_t *file);
+ // int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2);
+ // int H5FDquery(const H5FD_t *f, unsigned long *flags);
+ // haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
+ // herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size);
+ // haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type);
+ // herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa);
+ // haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type);
+ // herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle);
+ // herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/);
+ // herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf);
+ // herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
+ // herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
+ // herr_t H5FDlock(H5FD_t *file, hbool_t rw);
+ // herr_t H5FDunlock(H5FD_t *file);
+ // herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/);
+
+ // ////////////////////////////////////////////////////////////
+ // //
+ // H5FS: File Free Space Interface Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // No public Functions
+
+ // ////////////////////////////////////////////////////////////
+ // //
// H5G: Group Interface Functions //
// //
// ////////////////////////////////////////////////////////////
@@ -3143,8 +3579,8 @@ public class H5 implements java.io.Serializable {
* OUT: Names of all objects under the group, name.
* @param objTypes
* OUT: Types of all objects under the group, name.
- * @param objRef
- * OUT: Reference number of all objects under the group, name.
+ * @param tokens
+ * OUT: Object token of all objects under the group, name.
*
* @return the number of items found
*
@@ -3154,26 +3590,26 @@ public class H5 implements java.io.Serializable {
* - name is null.
*/
public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] objNames, int[] objTypes,
- long[] objRef) throws HDF5LibraryException, NullPointerException {
+ H5O_token_t[] tokens) throws HDF5LibraryException, NullPointerException {
if (objNames == null) {
throw new NullPointerException("H5Gget_obj_info_all(): name array is null");
}
- return H5Gget_obj_info_all(loc_id, name, objNames, objTypes, null, null, objRef, HDF5Constants.H5_INDEX_NAME);
+ return H5Gget_obj_info_all(loc_id, name, objNames, objTypes, null, null, tokens, HDF5Constants.H5_INDEX_NAME);
}
public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] oname, int[] otype,
- int[] ltype, long[] ref, int indx_type) throws HDF5LibraryException, NullPointerException {
- return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, null, ref, indx_type, -1);
+ int[] ltype, H5O_token_t[] tokens, int indx_type) throws HDF5LibraryException, NullPointerException {
+ return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, null, tokens, indx_type, -1);
}
public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] oname, int[] otype,
- int[] ltype, long[] fno, long[] ref, int indx_type) throws HDF5LibraryException, NullPointerException {
- return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, ref, oname.length, indx_type, -1);
+ int[] ltype, long[] fno, H5O_token_t[] tokens, int indx_type) throws HDF5LibraryException, NullPointerException {
+ return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, tokens, indx_type, -1);
}
public synchronized static int H5Gget_obj_info_full(long loc_id, String name, String[] oname, int[] otype,
- int[] ltype, long[] fno, long[] ref, int indx_type, int indx_order) throws HDF5LibraryException,
+ int[] ltype, long[] fno, H5O_token_t[] tokens, int indx_type, int indx_order) throws HDF5LibraryException,
NullPointerException {
if (oname == null) {
throw new NullPointerException("H5Gget_obj_info_full(): name array is null");
@@ -3195,7 +3631,7 @@ public class H5 implements java.io.Serializable {
ltype = new int[otype.length];
if (fno == null)
- fno = new long[ref.length];
+ fno = new long[tokens.length];
if (indx_type < 0)
indx_type = HDF5Constants.H5_INDEX_NAME;
@@ -3204,7 +3640,7 @@ public class H5 implements java.io.Serializable {
indx_order = HDF5Constants.H5_ITER_INC;
log.trace("H5Gget_obj_info_full: oname_len={}", oname.length);
- int status = H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, ref, oname.length, indx_type,
+ int status = H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, tokens, oname.length, indx_type,
indx_order);
for (int indx = 0; indx < oname.length; indx++)
log.trace("H5Gget_obj_info_full: oname={}", oname[indx]);
@@ -3212,7 +3648,7 @@ public class H5 implements java.io.Serializable {
}
private synchronized static native int H5Gget_obj_info_full(long loc_id, String name, String[] oname, int[] otype,
- int[] ltype, long[] fno, long[] ref, int n, int indx_type, int indx_order) throws HDF5LibraryException,
+ int[] ltype, long[] fno, H5O_token_t[] tokens, int n, int indx_type, int indx_order) throws HDF5LibraryException,
NullPointerException;
/**
@@ -3267,8 +3703,8 @@ public class H5 implements java.io.Serializable {
* OUT: Types of all objects under the group, name.
* @param lnkTypes
* OUT: Types of all links under the group, name.
- * @param objRef
- * OUT: Reference number of all objects under the group, name.
+ * @param objToken
+ * OUT: Object token of all objects under the group, name.
* @param objMax
* IN: Maximum number of all objects under the group, name.
*
@@ -3280,7 +3716,7 @@ public class H5 implements java.io.Serializable {
* - name is null.
*/
public synchronized static int H5Gget_obj_info_max(long loc_id, String[] objNames, int[] objTypes, int[] lnkTypes,
- long[] objRef, long objMax) throws HDF5LibraryException, NullPointerException {
+ H5O_token_t[] objToken, long objMax) throws HDF5LibraryException, NullPointerException {
if (objNames == null) {
throw new NullPointerException("H5Gget_obj_info_max(): name array is null");
}
@@ -3305,11 +3741,11 @@ public class H5 implements java.io.Serializable {
throw new HDF5LibraryException("H5Gget_obj_info_max(): name and type array sizes are different");
}
- return H5Gget_obj_info_max(loc_id, objNames, objTypes, lnkTypes, objRef, objMax, objNames.length);
+ return H5Gget_obj_info_max(loc_id, objNames, objTypes, lnkTypes, objToken, objMax, objNames.length);
}
private synchronized static native int H5Gget_obj_info_max(long loc_id, String[] oname, int[] otype, int[] ltype,
- long[] ref, long amax, int n) throws HDF5LibraryException, NullPointerException;
+ H5O_token_t[] tokens, long amax, int n) throws HDF5LibraryException, NullPointerException;
/**
* H5Gn_members report the number of objects in a Group. The 'objects' include everything that will be visited by
@@ -3402,7 +3838,31 @@ public class H5 implements java.io.Serializable {
// ////////////////////////////////////////////////////////////
// //
- // H5I: HDF5 1.8 Identifier Interface API Functions //
+ // H5HF: Fractal Heap Interface Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // No public Functions
+
+ // ////////////////////////////////////////////////////////////
+ // //
+ // H5HG: Global Heap Interface Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // No public Functions
+
+ // ////////////////////////////////////////////////////////////
+ // //
+ // H5HL: Local Heap Interface Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // No public Functions
+
+ // ////////////////////////////////////////////////////////////
+ // //
+ // H5I: HDF5 Identifier Interface API Functions //
// //
// ////////////////////////////////////////////////////////////
@@ -3558,12 +4018,20 @@ public class H5 implements java.io.Serializable {
// hid_t H5Iregister(H5I_type_t type, const void *object);
+ // typedef herr_t (*H5I_free_t)(void *);
// H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func);
// void *H5Iremove_verify(hid_t id, H5I_type_t id_type);
+ // Type of the function to compare objects & keys
+ // typedef int (*H5I_search_func_t)(void *obj, hid_t id, void *key);
// void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key);
+ // Type of the H5Iiterate callback function
+ // typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata);
+ // herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data);
+
+
// //////////////////////////////////////////////////////////////////
// H5L: Link Interface Functions //
// //////////////////////////////////////////////////////////////////
@@ -3874,8 +4342,8 @@ public class H5 implements java.io.Serializable {
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
- public synchronized static native int H5Literate(long grp_id, int idx_type, int order, long idx, H5L_iterate_cb op,
- H5L_iterate_t op_data) throws HDF5LibraryException;
+ public synchronized static native int H5Literate(long grp_id, int idx_type, int order, long idx, H5L_iterate_t op,
+ H5L_iterate_opdata_t op_data) throws HDF5LibraryException;
/**
* H5Literate_by_name iterates through links in a group.
@@ -3906,7 +4374,7 @@ public class H5 implements java.io.Serializable {
* - group_name is null.
**/
public synchronized static native int H5Literate_by_name(long grp_id, String group_name, int idx_type, int order,
- long idx, H5L_iterate_cb op, H5L_iterate_t op_data, long lapl_id) throws HDF5LibraryException,
+ long idx, H5L_iterate_t op, H5L_iterate_opdata_t op_data, long lapl_id) throws HDF5LibraryException,
NullPointerException;
/**
@@ -3953,8 +4421,8 @@ public class H5 implements java.io.Serializable {
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
- public synchronized static native int H5Lvisit(long grp_id, int idx_type, int order, H5L_iterate_cb op,
- H5L_iterate_t op_data) throws HDF5LibraryException;
+ public synchronized static native int H5Lvisit(long grp_id, int idx_type, int order, H5L_iterate_t op,
+ H5L_iterate_opdata_t op_data) throws HDF5LibraryException;
/**
* H5Lvisit_by_name recursively visits all links starting from a specified group.
@@ -3983,7 +4451,7 @@ public class H5 implements java.io.Serializable {
* - group_name is null.
**/
public synchronized static native int H5Lvisit_by_name(long loc_id, String group_name, int idx_type, int order,
- H5L_iterate_cb op, H5L_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException;
+ H5L_iterate_t op, H5L_iterate_opdata_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException;
/**
@@ -4027,6 +4495,15 @@ public class H5 implements java.io.Serializable {
// H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
// void *buf/*out*/, size_t size, hid_t lapl_id);
+ // ////////////////////////////////////////////////////////////
+ // //
+ // H5MM: Memory Management Interface API Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // /////// unimplemented ////////
+ // typedef void *(*H5MM_allocate_t)(size_t size, void *alloc_info);
+ // typedef void (*H5MM_free_t)(void *mem, void *free_info);
// ////////////////////////////////////////////////////////////
// //
@@ -4167,10 +4644,105 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - name is null.
**/
- public synchronized static native H5O_info_t H5Oget_info(long loc_id) throws HDF5LibraryException,
+ public static H5O_info_t H5Oget_info(long loc_id) throws HDF5LibraryException,
+ NullPointerException {
+ return H5Oget_info(loc_id, HDF5Constants.H5O_INFO_ALL);
+ }
+
+ /**
+ * H5Oget_info retrieves the metadata for an object specified by an identifier.
+ *
+ * @param loc_id
+ * IN: Identifier for target object
+ * @param fields
+ * IN: Object fields to select
+ *
+ * @return object information
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public synchronized static native H5O_info_t H5Oget_info(long loc_id, int fields) throws HDF5LibraryException,
NullPointerException;
/**
+ * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name.
+ *
+ * @param loc_id
+ * IN: File or group identifier specifying location of group in which object is located
+ * @param name
+ * IN: Relative name of group
+ * @param lapl_id
+ * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as
+ * H5P_DEFAULT.)
+ *
+ * @return object information
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public static H5O_info_t H5Oget_info_by_name(long loc_id, String name, long lapl_id)
+ throws HDF5LibraryException, NullPointerException {
+ return H5Oget_info_by_name(loc_id, name, HDF5Constants.H5O_INFO_ALL, lapl_id);
+ }
+
+ /**
+ * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name.
+ *
+ * @param loc_id
+ * IN: File or group identifier specifying location of group in which object is located
+ * @param name
+ * IN: Relative name of group
+ * @param fields
+ * IN: Object fields to select
+ * @param lapl_id
+ * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as
+ * H5P_DEFAULT.)
+ *
+ * @return object information
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public synchronized static native H5O_info_t H5Oget_info_by_name(long loc_id, String name, int fields, long lapl_id)
+ throws HDF5LibraryException, NullPointerException;
+
+ /**
+ * H5Oget_info_by_idx retrieves the metadata for an object, identifying the object by an index position.
+ *
+ * @param loc_id
+ * IN: File or group identifier
+ * @param group_name
+ * IN: Name of group, relative to loc_id, in which object is located
+ * @param idx_type
+ * IN: Type of index by which objects are ordered
+ * @param order
+ * IN: Order of iteration within index
+ * @param n
+ * IN: Object to open
+ * @param lapl_id
+ * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as
+ * H5P_DEFAULT.)
+ *
+ * @return object information
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public static H5O_info_t H5Oget_info_by_idx(long loc_id, String group_name, int idx_type,
+ int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException {
+ return H5Oget_info_by_idx(loc_id, group_name, idx_type, order, n, HDF5Constants.H5O_INFO_ALL, lapl_id);
+ }
+
+ /**
* H5Oget_info_by_idx retrieves the metadata for an object, identifying the object by an index position.
*
* @param loc_id
@@ -4183,6 +4755,8 @@ public class H5 implements java.io.Serializable {
* IN: Order of iteration within index
* @param n
* IN: Object to open
+ * @param fields
+ * IN: Object fields to select
* @param lapl_id
* IN: Access property list identifier for the link pointing to the object (Not currently used; pass as
* H5P_DEFAULT.)
@@ -4195,10 +4769,50 @@ public class H5 implements java.io.Serializable {
* - name is null.
**/
public synchronized static native H5O_info_t H5Oget_info_by_idx(long loc_id, String group_name, int idx_type,
- int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException;
+ int order, long n, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException;
/**
- * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name.
+ * H5Oget_native_info retrieves the native HDF5-specific metadata for an HDF5 object specified by an identifier.
+ * Native HDF5-specific metadata includes things like object header information and object storage layout information.
+ *
+ * @param loc_id
+ * IN: Identifier for target object
+ *
+ * @return object information
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public static H5O_native_info_t H5Oget_native_info(long loc_id) throws HDF5LibraryException,
+ NullPointerException {
+ return H5Oget_native_info(loc_id, HDF5Constants.H5O_NATIVE_INFO_ALL);
+ }
+
+ /**
+ * H5Oget_native_info retrieves the native HDF5-specific metadata for an HDF5 object specified by an identifier.
+ * Native HDF5-specific metadata includes things like object header information and object storage layout information.
+ *
+ * @param loc_id
+ * IN: Identifier for target object
+ * @param fields
+ * IN: Object fields to select
+ *
+ * @return object information
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public synchronized static native H5O_native_info_t H5Oget_native_info(long loc_id, int fields) throws HDF5LibraryException,
+ NullPointerException;
+
+ /**
+ * H5Oget_native_info_by_name retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object
+ * by location and relative name. Native HDF5-specific metadata includes things like object header information and
+ * object storage layout information.
*
* @param loc_id
* IN: File or group identifier specifying location of group in which object is located
@@ -4215,10 +4829,99 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - name is null.
**/
- public synchronized static native H5O_info_t H5Oget_info_by_name(long loc_id, String name, long lapl_id)
+ public static H5O_native_info_t H5Oget_native_info_by_name(long loc_id, String name, long lapl_id)
+ throws HDF5LibraryException, NullPointerException {
+ return H5Oget_native_info_by_name(loc_id, name, HDF5Constants.H5O_NATIVE_INFO_ALL, lapl_id);
+ }
+
+ /**
+ * H5Oget_native_info_by_name retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object
+ * by location and relative name. Native HDF5-specific metadata includes things like object header information and
+ * object storage layout information.
+ *
+ * @param loc_id
+ * IN: File or group identifier specifying location of group in which object is located
+ * @param name
+ * IN: Relative name of group
+ * @param fields
+ * IN: Object fields to select
+ * @param lapl_id
+ * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as
+ * H5P_DEFAULT.)
+ *
+ * @return object information
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public synchronized static native H5O_native_info_t H5Oget_native_info_by_name(long loc_id, String name, int fields, long lapl_id)
throws HDF5LibraryException, NullPointerException;
/**
+ * H5Oget_native_info_by_idx retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object
+ * by an index position. Native HDF5-specific metadata includes things like object header information and
+ * object storage layout information.
+ *
+ * @param loc_id
+ * IN: File or group identifier
+ * @param group_name
+ * IN: Name of group, relative to loc_id, in which object is located
+ * @param idx_type
+ * IN: Type of index by which objects are ordered
+ * @param order
+ * IN: Order of iteration within index
+ * @param n
+ * IN: Object to open
+ * @param lapl_id
+ * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as
+ * H5P_DEFAULT.)
+ *
+ * @return object information
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public static H5O_native_info_t H5Oget_native_info_by_idx(long loc_id, String group_name, int idx_type,
+ int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException {
+ return H5Oget_native_info_by_idx(loc_id, group_name, idx_type, order, n, HDF5Constants.H5O_NATIVE_INFO_ALL, lapl_id);
+ }
+
+ /**
+ * H5Oget_native_info_by_idx retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object
+ * by an index position. Native HDF5-specific metadata includes things like object header information and
+ * object storage layout information.
+ *
+ * @param loc_id
+ * IN: File or group identifier
+ * @param group_name
+ * IN: Name of group, relative to loc_id, in which object is located
+ * @param idx_type
+ * IN: Type of index by which objects are ordered
+ * @param order
+ * IN: Order of iteration within index
+ * @param n
+ * IN: Object to open
+ * @param fields
+ * IN: Object fields to select
+ * @param lapl_id
+ * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as
+ * H5P_DEFAULT.)
+ *
+ * @return object information
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public synchronized static native H5O_native_info_t H5Oget_native_info_by_idx(long loc_id, String group_name, int idx_type,
+ int order, long n, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException;
+
+ /**
* H5Olink creates a new hard link to an object in an HDF5 file.
*
* @param obj_id
@@ -4292,8 +4995,68 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - name is null.
**/
- public synchronized static native int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_cb op,
- H5O_iterate_t op_data) throws HDF5LibraryException, NullPointerException;
+ public static int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_t op, H5O_iterate_opdata_t op_data)
+ throws HDF5LibraryException, NullPointerException {
+ return H5Ovisit(obj_id, idx_type, order, op, op_data, HDF5Constants.H5O_INFO_ALL);
+ }
+
+ /**
+ * H5Ovisit recursively visits all objects accessible from a specified object.
+ *
+ * @param obj_id
+ * IN: Identifier of the object at which the recursive iteration begins.
+ * @param idx_type
+ * IN: Type of index
+ * @param order
+ * IN: Order of iteration within index
+ * @param op
+ * IN: Callback function passing data regarding the object to the calling application
+ * @param op_data
+ * IN: User-defined pointer to data required by the application for its processing of the object
+ * @param fields
+ * IN: Object fields to select
+ *
+ * @return returns the return value of the first operator that returns a positive value, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public synchronized static native int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_t op,
+ H5O_iterate_opdata_t op_data, int fields) throws HDF5LibraryException, NullPointerException;
+
+ /**
+ * H5Ovisit_by_name recursively visits all objects starting from a specified object.
+ *
+ * @param loc_id
+ * IN: File or group identifier
+ * @param obj_name
+ * IN: Relative path to the object
+ * @param idx_type
+ * IN: Type of index
+ * @param order
+ * IN: Order of iteration within index
+ * @param op
+ * IN: Callback function passing data regarding the object to the calling application
+ * @param op_data
+ * IN: User-defined pointer to data required by the application for its processing of the object
+ * @param lapl_id
+ * IN: Link access property list identifier
+ *
+ * @return returns the return value of the first operator that returns a positive value, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+ public static int H5Ovisit_by_name(long loc_id, String obj_name, int idx_type, int order,
+ H5O_iterate_t op, H5O_iterate_opdata_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException {
+ return H5Ovisit_by_name(loc_id, obj_name, idx_type, order, op, op_data, HDF5Constants.H5O_INFO_ALL, lapl_id);
+ }
/**
* H5Ovisit_by_name recursively visits all objects starting from a specified object.
@@ -4310,6 +5073,8 @@ public class H5 implements java.io.Serializable {
* IN: Callback function passing data regarding the object to the calling application
* @param op_data
* IN: User-defined pointer to data required by the application for its processing of the object
+ * @param fields
+ * IN: Object fields to select
* @param lapl_id
* IN: Link access property list identifier
*
@@ -4322,7 +5087,7 @@ public class H5 implements java.io.Serializable {
* - name is null.
**/
public synchronized static native int H5Ovisit_by_name(long loc_id, String obj_name, int idx_type, int order,
- H5O_iterate_cb op, H5O_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException;
+ H5O_iterate_t op, H5O_iterate_opdata_t op_data, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException;
/**
@@ -4364,26 +5129,28 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Oincr_refcount(long object_id) throws HDF5LibraryException;
/**
- * H5Oopen_by_addr opens a group, dataset, or named datatype using its address within an HDF5 file.
+ * H5Oopen_by_token opens a group, dataset, or named datatype using its object token within an HDF5 file.
*
* @param loc_id IN: File or group identifier
- * @param addr IN: Object's address in the file
+ * @param token IN: Object's token in the file
*
* @return an object identifier for the opened object
*
* @exception HDF5LibraryException - Error from the HDF-5 Library.
**/
- public static long H5Oopen_by_addr(long loc_id, long addr) throws HDF5LibraryException {
- long id = _H5Oopen_by_addr(loc_id, addr);
+ public static long H5Oopen_by_token(long loc_id, H5O_token_t token) throws HDF5LibraryException {
+ long id = _H5Oopen_by_token(loc_id, token);
+
if (id > 0) {
- log.trace("OPEN_IDS: H5Oopen_by_addr add {}", id);
+ log.trace("OPEN_IDS: H5Oopen_by_token add {}", id);
OPEN_IDS.add(id);
log.trace("OPEN_IDS: {}", OPEN_IDS.size());
}
+
return id;
}
- private synchronized static native long _H5Oopen_by_addr(long loc_id, long addr)
+ private synchronized static native long _H5Oopen_by_token(long loc_id, H5O_token_t token)
throws HDF5LibraryException, NullPointerException;
/**
@@ -4443,7 +5210,15 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static native void H5Orefresh(long object_id) throws HDF5LibraryException;
+ public synchronized static native void H5Odisable_mdc_flushes(long object_id);
+ public synchronized static native void H5Oenable_mdc_flushes(long object_id);
+ public synchronized static native boolean H5Oare_mdc_flushes_disabled(long object_id);
+
// /////// unimplemented ////////
+ // herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2,
+ // int *cmp_value);
+ // herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str);
+ // herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token);
// ////////////////////////////////////////////////////////////
// //
@@ -4451,7 +5226,7 @@ public class H5 implements java.io.Serializable {
// //
// ////////////////////////////////////////////////////////////
- // Generic property list routines
+ // /////// Generic property list routines ///////
/**
* H5Pget_class_name retrieves the name of a generic property list class
@@ -4728,6 +5503,27 @@ public class H5 implements java.io.Serializable {
private synchronized static native long _H5Pcopy(long plist) throws HDF5LibraryException;
+ // Define property list class callback function pointer types
+ // typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data);
+ // typedef herr_t (*H5P_cls_copy_func_t)(hid_t new_prop_id, hid_t old_prop_id, void *copy_data);
+ // typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data);
+
+ // Define property list callback function pointer types
+ // typedef herr_t (*H5P_prp_cb1_t)(const char *name, size_t size, void *value);
+ // typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, void *value);
+ // typedef H5P_prp_cb1_t H5P_prp_create_func_t;
+ // typedef H5P_prp_cb2_t H5P_prp_set_func_t;
+ // typedef H5P_prp_cb2_t H5P_prp_get_func_t;
+ // typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size);
+ // typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value);
+ // typedef H5P_prp_cb2_t H5P_prp_delete_func_t;
+ // typedef H5P_prp_cb1_t H5P_prp_copy_func_t;
+ // typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size);
+ // typedef H5P_prp_cb1_t H5P_prp_close_func_t;
+
+ // Define property list iteration function type
+ // typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data);
+
public static long H5Pcreate_class_nocb(long parent_class, String name) throws HDF5LibraryException {
long id = _H5Pcreate_class_nocb(parent_class, name);
if (id > 0) {
@@ -4767,7 +5563,7 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Piterate(long plist, int[] idx, H5P_iterate_cb op, H5P_iterate_t op_data) throws HDF5LibraryException;
- // Object creation property list (OCPL) routines
+ // /////// Object creation property list (OCPL) routines ///////
/**
* H5Pget_attr_phase_change retrieves attribute storage phase change thresholds.
@@ -5071,7 +5867,7 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Pset_fletcher32(long plist) throws HDF5LibraryException,
NullPointerException;
- // File creation property list (FCPL) routines
+ // /////// File creation property list (FCPL) routines ///////
/**
* H5Pget_userblock retrieves the size of a user block in a file creation property list.
@@ -5480,7 +6276,7 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, IllegalArgumentException;
- // File access property list (FAPL) routines
+ // /////// File access property list (FAPL) routines ///////
/**
* H5Pget_alignment retrieves the current settings for alignment properties from a file access property list.
@@ -5860,6 +6656,42 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Pset_metadata_read_attempts(long plist_id, long attempts)
throws HDF5LibraryException;
+ /**
+ * H5Pget_evict_on_close retrieves the file access property list setting that determines whether an HDF5 object
+ * will be evicted from the library's metadata cache when it is closed.
+ *
+ * @param fapl_id
+ * IN: File access property list identifier
+ *
+ * @return indication if the object will be evicted on close.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ *
+ **/
+ public synchronized static native boolean H5Pget_evict_on_close(long fapl_id)
+ throws HDF5LibraryException;
+
+ /**
+ * H5Pset_evict_on_close controls the library's behavior of evicting metadata associated with a closed object.
+ *
+ * @param fapl_id
+ * IN: File access property list identifier
+ * @param evict_on_close
+ * IN: Whether the HDF5 object should be evicted on close.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ *
+ **/
+ public synchronized static native void H5Pset_evict_on_close(long fapl_id, boolean evict_on_close)
+ throws HDF5LibraryException;
+
+ // ///// unimplemented /////
+ // herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info);
+ // herr_t H5Pget_vol_id(hid_t plist_id, hid_t *vol_id);
+ // herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info);
+
// Dataset creation property list (DCPL) routines //
/**
@@ -6066,6 +6898,36 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static native String H5Pget_virtual_dsetname(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException;
+// ///// unimplemented /////
+// /**
+// * H5Pget_vds_file_cache_size retrieves the size of the vds link open file cache.
+// *
+// * @param fapl_id
+// * IN: File access property list identifier
+// *
+// * @return VDS link open file cache size in number of files.
+// *
+// * @exception HDF5LibraryException
+// * - Error from the HDF-5 Library.
+// *
+// **/
+// public synchronized static native int H5Pget_vds_file_cache_size(long fapl_id) throws HDF5LibraryException;
+//
+// /**
+// * H5Pset_vds_file_cache_size sets the number of files that can be held open in an vds link open file cache.
+// *
+// * @param fapl_id
+// * IN: File access property list identifier
+// * @param efc_size
+// * IN: VDS link open file cache size in number of files.
+// *
+// * @exception HDF5LibraryException
+// * - Error from the HDF-5 Library.
+// *
+// **/
+// public synchronized static native void H5Pset_vds_file_cache_size(long fapl_id, int efc_size)
+// throws HDF5LibraryException;
+
/**
* H5Pget_external returns information about an external file.
*
@@ -6285,7 +7147,67 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Pset_fill_time(long plist_id, int fill_time) throws HDF5LibraryException,
NullPointerException;
- // Dataset access property list (DAPL) routines //
+ /**
+ * H5Pset_chunk_opts Sets the edge chunk option in a dataset creation property list.
+ *
+ * @param dcpl_id
+ * IN: Dataset creation property list identifier
+ * @param opts
+ * IN: Edge chunk option flag. Valid values are:
+ * H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS - filters are not applied to partial edge chunks.
+ * 0 - Disables option; partial edge chunks will be compressed.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library
+ **/
+ public synchronized static native void H5Pset_chunk_opts(long dcpl_id, int opts) throws HDF5LibraryException;
+
+ /**
+ * H5Pget_chunk_opts retrieves the edge chunk option setting stored in the dataset creation property list .
+ *
+ * @param dcpl_id
+ * IN: Dataset creation property list
+
+ * @return The edge chunk option setting.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library
+ **/
+ public synchronized static native int H5Pget_chunk_opts(long dcpl_id) throws HDF5LibraryException;
+
+ /**
+ * H5Pget_dset_no_attrs_hint accesses the flag for whether or not datasets created by the given dcpl
+ * will be created with a "minimized" object header.
+ *
+ * @param dcpl_id
+ * IN: Dataset creation property list
+ *
+ * @return true if the given dcpl is set to create minimized dataset object headers, false if not.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native boolean H5Pget_dset_no_attrs_hint(long dcpl_id)
+ throws HDF5LibraryException;
+
+
+ /**
+ * H5Pset_dset_no_attrs_hint sets the dcpl to minimize (or explicitly to not minimized) dataset object
+ * headers upon creation.
+ *
+ * @param dcpl_id
+ * IN: Dataset creation property list
+ *
+ * @param minimize
+ * the minimize hint setting
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native void H5Pset_dset_no_attrs_hint(long dcpl_id, boolean minimize)
+ throws HDF5LibraryException;
+
+ // /////// Dataset access property list (DAPL) routines ///////
/**
* Retrieves the maximum possible number of elements in the meta data cache and the maximum possible number of bytes
@@ -6388,12 +7310,76 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static native long H5Pget_virtual_printf_gap(long dapl_id) throws HDF5LibraryException;
+ /**
+ * H5Pget_virtual_prefix Retrieves prefix applied to virtual file paths.
+ *
+ * @param dapl_id
+ * IN: Link access property list identifier
+ *
+ * @return the prefix to be applied to virtual file paths.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ *
+ **/
+ public synchronized static native String H5Pget_virtual_prefix(long dapl_id)
+ throws HDF5LibraryException;
+
+ /**
+ * H5Pset_virtual_prefix Sets prefix to be applied to virtual file paths.
+ *
+ * @param dapl_id
+ * IN: Dataset access property list identifier
+ * @param prefix
+ * IN: Prefix to be applied to virtual file paths
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - prefix is null.
+ *
+ **/
+ public synchronized static native void H5Pset_virtual_prefix(long dapl_id, String prefix)
+ throws HDF5LibraryException, NullPointerException;
+
+ /**
+ * H5Pget_efile_prefix Retrieves prefix applied to external file paths.
+ *
+ * @param dapl_id
+ * IN: Link access property list identifier
+ *
+ * @return the prefix to be applied to external file paths.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ *
+ **/
+ public synchronized static native String H5Pget_efile_prefix(long dapl_id)
+ throws HDF5LibraryException;
+
+ /**
+ * H5Pset_efile_prefix Sets prefix to be applied to external file paths.
+ *
+ * @param dapl_id
+ * IN: Dataset access property list identifier
+ * @param prefix
+ * IN: Prefix to be applied to external file paths
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - prefix is null.
+ *
+ **/
+ public synchronized static native void H5Pset_efile_prefix(long dapl_id, String prefix)
+ throws HDF5LibraryException, NullPointerException;
+
// public synchronized static native void H5Pset_append_flush(long plist_id, int ndims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException;
// public synchronized static native void H5Pget_append_flush(long plist_id, int dims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException;
- // Dataset xfer property list (DXPL) routines //
+ // /////// Dataset xfer property list (DXPL) routines ///////
/**
* H5Pget_data_transform retrieves the data transform expression previously set in the dataset transfer property
@@ -6544,7 +7530,7 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Pset_hyper_vector_size(long dxpl_id, long vector_size)
throws HDF5LibraryException, NullPointerException;
- // Link creation property list (LCPL) routines //
+ // /////// Link creation property list (LCPL) routines ///////
/**
* H5Pget_create_intermediate_group determines whether property is set to enable creating missing intermediate
@@ -6579,7 +7565,7 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Pset_create_intermediate_group(long lcpl_id, boolean crt_intermed_group)
throws HDF5LibraryException;
- // Group creation property list (GCPL) routines //
+ // /////// Group creation property list (GCPL) routines ///////
/**
* H5Pget_local_heap_size_hint Retrieves the anticipated size of the local heap for original-style groups.
@@ -6736,14 +7722,14 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Pset_link_creation_order(long gcpl_id, int crt_order_flags)
throws HDF5LibraryException;
- // String creation property list (STRCPL) routines //
+ // /////// String creation property list (STRCPL) routines ///////
public synchronized static native int H5Pget_char_encoding(long plist_id) throws HDF5LibraryException;
public synchronized static native void H5Pset_char_encoding(long plist_id, int encoding)
throws HDF5LibraryException;
- // Link access property list (LAPL) routines //
+ // /////// Link access property list (LAPL) routines ///////
/**
* H5Pget_nlinks retrieves the maximum number of soft or user-defined link traversals allowed, nlinks, before the
@@ -6896,7 +7882,7 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Pset_elink_acc_flags(long lapl_id, int flags) throws HDF5LibraryException,
IllegalArgumentException;
- // Object copy property list (OCPYPL) routines //
+ // /////// Object copy property list (OCPYPL) routines ///////
/**
* H5Pget_copy_object retrieves the properties to be used when an object is copied.
@@ -6927,35 +7913,7 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int copy_options)
throws HDF5LibraryException;
- // Other/Older property list routines //
-
- /**
- * H5Pget_version retrieves the version information of various objects for a file creation property list.
- *
- * @param plist
- * IN: Identifier of the file creation property list.
- * @param version_info
- * OUT: version information.
- *
- * <pre>
- * version_info[0] = boot // boot block version number
- * version_info[1] = freelist // global freelist version
- * version_info[2] = stab // symbol tabl version number
- * version_info[3] = shhdr // shared object header version
- * </pre>
- * @return a non-negative value, with the values of version_info initialized, if successful
- *
- * @exception HDF5LibraryException
- * - Error from the HDF-5 Library.
- * @exception NullPointerException
- * - version_info is null.
- * @exception IllegalArgumentException
- * - version_info is illegal.
- **/
- public synchronized static native int H5Pget_version(long plist, int[] version_info) throws HDF5LibraryException,
- NullPointerException, IllegalArgumentException;
-
- // file drivers property list routines //
+ // /////// file drivers property list routines ///////
public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] backing_store)
throws HDF5LibraryException, NullPointerException;
@@ -7007,6 +7965,10 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Pset_fapl_family(long fapl_id, long memb_size, long memb_fapl_id)
throws HDF5LibraryException, NullPointerException;
+ public synchronized static native int H5Pset_fapl_hdfs(long fapl_id, H5FD_hdfs_fapl_t fapl_conf) throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static native H5FD_hdfs_fapl_t H5Pget_fapl_hdfs(long fapl_id) throws HDF5LibraryException, NullPointerException;
+
/**
* H5Pget_fapl_multi Sets up use of the multi I/O driver.
*
@@ -7091,6 +8053,10 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Pset_fapl_windows(long fapl_id) throws HDF5LibraryException, NullPointerException;
+ public synchronized static native int H5Pset_fapl_ros3(long fapl_id, H5FD_ros3_fapl_t fapl_conf) throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static native H5FD_ros3_fapl_t H5Pget_fapl_ros3(long fapl_id) throws HDF5LibraryException, NullPointerException;
+
// /////// unimplemented ////////
// Generic property list routines //
@@ -7102,20 +8068,34 @@ public class H5 implements java.io.Serializable {
// File creation property list (FCPL) routines //
// File access property list (FAPL) routines //
- // herr_t H5Pset_driver( hid_t plist_id, hid_t new_driver_id, const void *new_driver_info )
- // const void *H5Pget_driver_info( hid_t plist_id )
- // herr_t H5Pget_multi_type ( hid_t fapl_id, H5FD_mem_t *type )
- // herr_t H5Pset_multi_type ( hid_t fapl_id, H5FD_mem_t type )
+ // herr_t H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info)
+ // const void *H5Pget_driver_info(hid_t plist_id)
+ // herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type)
+ // herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type)
// herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr);
// herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len);
// herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr);
// herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr);
// herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size);
// herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size);
+ // #ifdef H5_HAVE_PARALLEL
+ // herr_t H5Pset_all_coll_metadata_ops(hid_t accpl_id, hbool_t is_collective);
+ // herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective);
+ // herr_t H5Pset_coll_metadata_write(hid_t fapl_id, hbool_t is_collective);
+ // herr_t H5Pget_coll_metadata_write(hid_t fapl_id, hbool_t *is_collective);
+ // #endif /* H5_HAVE_PARALLEL */
+ // herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr);
+ // herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/);
+ // herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per);
+ // herr_t H5Pget_page_buffer_size(hid_t fapl_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc);
+ // herr_t H5Pset_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t func, void *user_data);
+ // herr_t H5Pget_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t *func, void **user_data);
// Dataset creation property list (DCPL) routines //
// Dataset access property list (DAPL) routines //
+ // herr_t H5Pset_append_flush (hid_t dapl_id, int ndims, const hsize_t boundary[], H5D_append_cb_t func, void *user_data);
+ // herr_t H5Pget_append_flush(hid_t dapl_id, int ndims, hsize_t boundary[], H5D_append_cb_t *func, void **user_data)
// Dataset xfer property list (DXPL) routines //
// herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg);
@@ -7128,6 +8108,11 @@ public class H5 implements java.io.Serializable {
// *free_info )
// herr_t H5Pget_type_conv_cb(hid_t plist, H5T_conv_except_func_t *func, void **op_data)
// herr_t H5Pset_type_conv_cb( hid_t plist, H5T_conv_except_func_t func, void *op_data)
+ // #ifdef H5_HAVE_PARALLEL
+ // herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode);
+ // herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode);
+ // herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause);
+ // #endif /* H5_HAVE_PARALLEL */
// Link creation property list (LCPL) routines //
@@ -7145,21 +8130,6 @@ public class H5 implements java.io.Serializable {
// herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, void **op_data);
// herr_t H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data);
-
- // Other/Older property list routines //
- // herr_t H5Pget_fapl_mpio( int fapl_id, MPI_Comm *comm, MPI_Info *info )
- // herr_t H5Pset_fapl_mpio( int fapl_id, MPI_Comm comm, MPI_Info info )
-
- // herr_t H5Pget_fapl_mpiposix( int fapl_id, MPI_Comm *comm, hbool_t *use_gpfs_hints )
- // herr_t H5Pset_fapl_mpiposix( int fapl_id, MPI_Comm comm, hbool_t use_gpfs_hints )
-
- // herr_t H5Pget_dxpl_mpio( hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode )
- // herr_t H5Pset_dxpl_mpio( hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode )
- // herr_t H5Pset_dxpl_mpio_chunk_opt (hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode)
- // herr_t H5Pset_dxpl_mpio_chunk_opt_num (hid_t dxpl_id, unsigned num_chunk_per_proc)
- // herr_t H5Pset_dxpl_mpio_chunk_opt_ratio (hid_t dxpl_id, unsigned percent_proc_per_chunk)
- // herr_t H5Pset_dxpl_mpio_collective_opt (hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mode)
-
// ////////////////////////////////////////////////////////////
// //
// H5PL: HDF5 1.8 Plugin API Functions //
@@ -7289,6 +8259,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 //
// //
// ////////////////////////////////////////////////////////////
@@ -8083,6 +9378,18 @@ public class H5 implements java.io.Serializable {
public synchronized static native boolean H5Sis_regular_hyperslab(long space_id) throws HDF5LibraryException;
// /////// unimplemented ////////
+ // #ifdef NEW_HYPERSLAB_API
+ // hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
+ // const hsize_t start[],
+ // const hsize_t _stride[],
+ // const hsize_t count[],
+ // const hsize_t _block[]);
+ // herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op,
+ // hid_t space2_id);
+ // hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
+ // hid_t space2_id);
+ // #endif /* NEW_HYPERSLAB_API */
+ // herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id);
@@ -9499,6 +10806,26 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Tpack(long type_id) throws HDF5LibraryException;
/**
+ * H5Treclaim reclaims buffer used for VL data.
+ *
+ * @param type_id
+ * Identifier of the datatype.
+ * @param space_id
+ * Identifier of the dataspace.
+ * @param xfer_plist_id
+ * Identifier of a transfer property list for this I/O operation.
+ * @param buf
+ * Buffer with data to be reclaimed.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - buf is null.
+ **/
+ public synchronized static native void H5Treclaim(long type_id, long space_id, long xfer_plist_id, byte[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
+ /**
* H5Tvlen_create creates a new variable-length (VL) dataype.
*
* @param base_id
@@ -9561,6 +10888,28 @@ public class H5 implements java.io.Serializable {
// ////////////////////////////////////////////////////////////
// //
+ // H5VL: VOL Interface Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ /// VOL Connector Functionality
+ public synchronized static native long H5VLregister_connector_by_name(String connector_name, long vipl_id);
+ public synchronized static native long H5VLregister_connector_by_value(int connector_value, long vipl_id);
+ public synchronized static native boolean H5VLis_connector_registered_by_name(String name);
+ public synchronized static native boolean H5VLis_connector_registered_by_value(int connector_value);
+ public synchronized static native long H5VLget_connector_id(long object_id);
+ public synchronized static native long H5VLget_connector_id_by_name(String name);
+ public synchronized static native long H5VLget_connector_id_by_value(int connector_value);
+ public synchronized static native String H5VLget_connector_name(long object_id);
+ public synchronized static native void H5VLclose(long connector_id);
+ public synchronized static native void H5VLunregister_connector(long connector_id);
+
+ // /////// unimplemented ////////
+ // hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id);
+
+
+ // ////////////////////////////////////////////////////////////
+ // //
// H5Z: Filter Interface Functions //
// //
// ////////////////////////////////////////////////////////////
@@ -9571,9 +10920,9 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Zunregister(int filter) throws HDF5LibraryException, NullPointerException;
-}
+ // /////// unimplemented ////////
-// /////// unimplemented ////////
+ // herr_t H5Zregister(const void *cls);
-// herr_t H5Zregister(const void *cls);
+}
diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java
index 8a3d6c8..beba1d1 100644
--- a/java/src/hdf/hdf5lib/HDF5Constants.java
+++ b/java/src/hdf/hdf5lib/HDF5Constants.java
@@ -14,6 +14,8 @@
package hdf.hdf5lib;
+import hdf.hdf5lib.structs.H5O_token_t;
+
/**
* /** This class contains C constants and enumerated types of HDF5 library. The
* values of these constants are obtained from the library by calling J2C(int
@@ -88,6 +90,7 @@ public class HDF5Constants {
public static final int H5D_VDS_ERROR = H5D_VDS_ERROR();
public static final int H5D_VDS_FIRST_MISSING = H5D_VDS_FIRST_MISSING();
public static final int H5D_VDS_LAST_AVAILABLE = H5D_VDS_LAST_AVAILABLE();
+ public static final int H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS = H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS();
public static final int H5E_MAJOR = H5E_MAJOR();
public static final int H5E_MINOR = H5E_MINOR();
@@ -120,6 +123,7 @@ public class HDF5Constants {
public static final long H5E_CANTDEC = H5E_CANTDEC();
public static final long H5E_CANTDECODE = H5E_CANTDECODE();
public static final long H5E_CANTDELETE = H5E_CANTDELETE();
+ public static final long H5E_CANTDELETEFILE = H5E_CANTDELETEFILE();
public static final long H5E_CANTENCODE = H5E_CANTENCODE();
public static final long H5E_CANTFLUSH = H5E_CANTFLUSH();
public static final long H5E_CANTFREE = H5E_CANTFREE();
@@ -189,10 +193,16 @@ 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();
+ private static final int H5ES_STATUS_IN_PROGRESS = H5ES_STATUS_IN_PROGRESS();
+ private static final int H5ES_STATUS_SUCCEED = H5ES_STATUS_SUCCEED();
+ private static final int H5ES_STATUS_FAIL = H5ES_STATUS_FAIL();
+ private static final int H5ES_STATUS_CANCELED = H5ES_STATUS_CANCELED();
+
public static final int H5F_ACC_CREAT = H5F_ACC_CREAT();
public static final int H5F_ACC_EXCL = H5F_ACC_EXCL();
public static final int H5F_ACC_RDONLY = H5F_ACC_RDONLY();
@@ -205,7 +215,13 @@ public class HDF5Constants {
public static final int H5F_CLOSE_SEMI = H5F_CLOSE_SEMI();
public static final int H5F_CLOSE_STRONG = H5F_CLOSE_STRONG();
public static final int H5F_CLOSE_WEAK = H5F_CLOSE_WEAK();
+ public static final int H5F_LIBVER_ERROR = H5F_LIBVER_ERROR();
public static final int H5F_LIBVER_EARLIEST = H5F_LIBVER_EARLIEST();
+ public static final int H5F_LIBVER_V18 = H5F_LIBVER_V18();
+ public static final int H5F_LIBVER_V110 = H5F_LIBVER_V110();
+ public static final int H5F_LIBVER_V112 = H5F_LIBVER_V112();
+ public static final int H5F_LIBVER_V114 = H5F_LIBVER_V114();
+ public static final int H5F_LIBVER_NBOUNDS = H5F_LIBVER_NBOUNDS();
public static final int H5F_LIBVER_LATEST = H5F_LIBVER_LATEST();
public static final int H5F_OBJ_ALL = H5F_OBJ_ALL();
public static final int H5F_OBJ_ATTR = H5F_OBJ_ATTR();
@@ -233,6 +249,8 @@ public class HDF5Constants {
public static final long H5FD_SEC2 = H5FD_SEC2();
public static final long H5FD_STDIO = H5FD_STDIO();
public static final long H5FD_WINDOWS = H5FD_WINDOWS();
+ public static final long H5FD_ROS3 = H5FD_ROS3();
+ public static final long H5FD_HDFS = H5FD_HDFS();
public static final int H5FD_LOG_LOC_READ = H5FD_LOG_LOC_READ();
public static final int H5FD_LOG_LOC_WRITE = H5FD_LOG_LOC_WRITE();
public static final int H5FD_LOG_LOC_SEEK = H5FD_LOG_LOC_SEEK();
@@ -309,9 +327,9 @@ public class HDF5Constants {
public static final int H5I_GROUP = H5I_GROUP();
public static final int H5I_INVALID_HID = H5I_INVALID_HID();
public static final int H5I_NTYPES = H5I_NTYPES();
- 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();
@@ -325,6 +343,13 @@ public class HDF5Constants {
public static final int H5O_COPY_EXPAND_REFERENCE_FLAG = H5O_COPY_EXPAND_REFERENCE_FLAG();
public static final int H5O_COPY_WITHOUT_ATTR_FLAG = H5O_COPY_WITHOUT_ATTR_FLAG();
public static final int H5O_COPY_PRESERVE_NULL_FLAG = H5O_COPY_PRESERVE_NULL_FLAG();
+ public static final int H5O_INFO_BASIC = H5O_INFO_BASIC();
+ public static final int H5O_INFO_TIME = H5O_INFO_TIME();
+ public static final int H5O_INFO_NUM_ATTRS = H5O_INFO_NUM_ATTRS();
+ public static final int H5O_INFO_ALL = H5O_INFO_ALL();
+ public static final int H5O_NATIVE_INFO_HDR = H5O_NATIVE_INFO_HDR();
+ public static final int H5O_NATIVE_INFO_META_SIZE = H5O_NATIVE_INFO_META_SIZE();
+ public static final int H5O_NATIVE_INFO_ALL = H5O_NATIVE_INFO_ALL();
public static final int H5O_SHMESG_NONE_FLAG = H5O_SHMESG_NONE_FLAG();
public static final int H5O_SHMESG_SDSPACE_FLAG = H5O_SHMESG_SDSPACE_FLAG();
public static final int H5O_SHMESG_DTYPE_FLAG = H5O_SHMESG_DTYPE_FLAG();
@@ -337,6 +362,8 @@ public class HDF5Constants {
public static final int H5O_TYPE_DATASET = H5O_TYPE_DATASET();
public static final int H5O_TYPE_NAMED_DATATYPE = H5O_TYPE_NAMED_DATATYPE();
public static final int H5O_TYPE_NTYPES = H5O_TYPE_NTYPES();
+ public static final int H5O_MAX_TOKEN_SIZE = H5O_MAX_TOKEN_SIZE();
+ public static final H5O_token_t H5O_TOKEN_UNDEF = H5O_TOKEN_UNDEF();
public static final long H5P_ROOT = H5P_ROOT();
public static final long H5P_OBJECT_CREATE = H5P_OBJECT_CREATE();
@@ -356,6 +383,7 @@ public class HDF5Constants {
public static final long H5P_OBJECT_COPY = H5P_OBJECT_COPY();
public static final long H5P_LINK_CREATE = H5P_LINK_CREATE();
public static final long H5P_LINK_ACCESS = H5P_LINK_ACCESS();
+ public static final long H5P_VOL_INITIALIZE = H5P_VOL_INITIALIZE();
public static final long H5P_FILE_CREATE_DEFAULT = H5P_FILE_CREATE_DEFAULT();
public static final long H5P_FILE_ACCESS_DEFAULT = H5P_FILE_ACCESS_DEFAULT();
public static final long H5P_DATASET_CREATE_DEFAULT = H5P_DATASET_CREATE_DEFAULT();
@@ -371,20 +399,31 @@ public class HDF5Constants {
public static final long H5P_OBJECT_COPY_DEFAULT = H5P_OBJECT_COPY_DEFAULT();
public static final long H5P_LINK_CREATE_DEFAULT = H5P_LINK_CREATE_DEFAULT();
public static final long H5P_LINK_ACCESS_DEFAULT = H5P_LINK_ACCESS_DEFAULT();
+ public static final long H5P_VOL_INITIALIZE_DEFAULT = H5P_VOL_INITIALIZE_DEFAULT();
public static final int H5P_CRT_ORDER_TRACKED = H5P_CRT_ORDER_TRACKED();
public static final int H5P_CRT_ORDER_INDEXED = H5P_CRT_ORDER_INDEXED();
public static final long H5P_DEFAULT = H5P_DEFAULT();
public static final int H5PL_TYPE_ERROR = H5PL_TYPE_ERROR();
public static final int H5PL_TYPE_FILTER = H5PL_TYPE_FILTER();
+ public static final int H5PL_TYPE_VOL = H5PL_TYPE_VOL();
+ public static final int H5PL_TYPE_NONE = H5PL_TYPE_NONE();
public static final int H5PL_FILTER_PLUGIN = H5PL_FILTER_PLUGIN();
+ 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();
@@ -579,6 +618,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();
@@ -612,6 +652,19 @@ public class HDF5Constants {
public static final long H5T_UNIX_D64LE = H5T_UNIX_D64LE();
public static final long H5T_VARIABLE = H5T_VARIABLE();
public static final int H5T_VLEN = H5T_VLEN();
+ public static final int H5T_VL_T = H5T_VL_T();
+
+ public static final int H5VL_CAP_FLAG_NONE = H5VL_CAP_FLAG_NONE();
+ public static final int H5VL_CAP_FLAG_THREADSAFE = H5VL_CAP_FLAG_THREADSAFE();
+ public static final long H5VL_NATIVE = H5VL_NATIVE();
+ public static final String H5VL_NATIVE_NAME = H5VL_NATIVE_NAME();
+ public static final int H5VL_NATIVE_VALUE = H5VL_NATIVE_VALUE();
+ public static final int H5VL_NATIVE_VERSION = H5VL_NATIVE_VERSION();
+ public static final int H5_VOL_INVALID = H5_VOL_INVALID();
+ public static final int H5_VOL_NATIVE = H5_VOL_NATIVE();
+ public static final int H5_VOL_RESERVED = H5_VOL_RESERVED();
+ public static final int H5_VOL_MAX = H5_VOL_MAX();
+
public static final int H5Z_CB_CONT = H5Z_CB_CONT();
public static final int H5Z_CB_ERROR = H5Z_CB_ERROR();
public static final int H5Z_CB_FAIL = H5Z_CB_FAIL();
@@ -768,6 +821,8 @@ public class HDF5Constants {
private static native final int H5D_VDS_LAST_AVAILABLE();
+ private static native final int H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS();
+
private static native final long H5E_ALIGNMENT();
private static native final long H5E_ALREADYEXISTS();
@@ -825,6 +880,8 @@ public class HDF5Constants {
private static native final long H5E_CANTDELETE();
+ private static native final long H5E_CANTDELETEFILE();
+
private static native final long H5E_CANTENCODE();
private static native final long H5E_CANTFLUSH();
@@ -966,12 +1023,22 @@ 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();
private static native final long H5E_WRITEERROR();
+ private static native final int H5ES_STATUS_IN_PROGRESS();
+
+ private static native final int H5ES_STATUS_SUCCEED();
+
+ private static native final int H5ES_STATUS_FAIL();
+
+ private static native final int H5ES_STATUS_CANCELED();
+
private static native final int H5F_ACC_CREAT();
private static native final int H5F_ACC_EXCL();
@@ -996,8 +1063,20 @@ public class HDF5Constants {
private static native final int H5F_CLOSE_WEAK();
+ private static native final int H5F_LIBVER_ERROR();
+
private static native final int H5F_LIBVER_EARLIEST();
+ private static native final int H5F_LIBVER_V18();
+
+ private static native final int H5F_LIBVER_V110();
+
+ private static native final int H5F_LIBVER_V112();
+
+ private static native final int H5F_LIBVER_V114();
+
+ private static native final int H5F_LIBVER_NBOUNDS();
+
private static native final int H5F_LIBVER_LATEST();
private static native final int H5F_OBJ_ALL();
@@ -1050,6 +1129,10 @@ public class HDF5Constants {
private static native final long H5FD_WINDOWS();
+ private static native final long H5FD_ROS3();
+
+ private static native final long H5FD_HDFS();
+
private static native final int H5FD_LOG_LOC_READ();
private static native final int H5FD_LOG_LOC_WRITE();
@@ -1196,12 +1279,12 @@ public class HDF5Constants {
private static native final int H5I_NTYPES();
- private static native final int H5I_REFERENCE();
-
private static native final int H5I_UNINIT();
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();
@@ -1224,6 +1307,20 @@ public class HDF5Constants {
private static native final int H5O_COPY_PRESERVE_NULL_FLAG();
+ private static native final int H5O_INFO_BASIC();
+
+ private static native final int H5O_INFO_TIME();
+
+ private static native final int H5O_INFO_NUM_ATTRS();
+
+ private static native final int H5O_INFO_ALL();
+
+ private static native final int H5O_NATIVE_INFO_HDR();
+
+ private static native final int H5O_NATIVE_INFO_META_SIZE();
+
+ private static native final int H5O_NATIVE_INFO_ALL();
+
private static native final int H5O_SHMESG_NONE_FLAG();
private static native final int H5O_SHMESG_SDSPACE_FLAG();
@@ -1248,6 +1345,10 @@ public class HDF5Constants {
private static native final int H5O_TYPE_NTYPES();
+ private static native final int H5O_MAX_TOKEN_SIZE();
+
+ private static native final H5O_token_t H5O_TOKEN_UNDEF();
+
private static native final long H5P_ROOT();
private static native final long H5P_OBJECT_CREATE();
@@ -1284,6 +1385,8 @@ public class HDF5Constants {
private static native final long H5P_LINK_ACCESS();
+ private static native final long H5P_VOL_INITIALIZE();
+
private static native final long H5P_FILE_CREATE_DEFAULT();
private static native final long H5P_FILE_ACCESS_DEFAULT();
@@ -1314,6 +1417,8 @@ public class HDF5Constants {
private static native final long H5P_LINK_ACCESS_DEFAULT();
+ private static native final long H5P_VOL_INITIALIZE_DEFAULT();
+
private static native final int H5P_CRT_ORDER_TRACKED();
private static native final int H5P_CRT_ORDER_INDEXED();
@@ -1324,20 +1429,38 @@ public class HDF5Constants {
private static native final int H5PL_TYPE_FILTER();
+ private static native final int H5PL_TYPE_VOL();
+
+ private static native final int H5PL_TYPE_NONE();
+
private static native final int H5PL_FILTER_PLUGIN();
private static native final int H5PL_ALL_PLUGIN();
+ 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();
@@ -1726,6 +1849,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();
@@ -1792,6 +1917,28 @@ public class HDF5Constants {
private static native final int H5T_VLEN();
+ private static native final int H5T_VL_T();
+
+ private static native final int H5VL_CAP_FLAG_NONE();
+
+ private static native final int H5VL_CAP_FLAG_THREADSAFE();
+
+ private static native final long H5VL_NATIVE();
+
+ private static native final String H5VL_NATIVE_NAME();
+
+ private static native final int H5VL_NATIVE_VALUE();
+
+ private static native final int H5VL_NATIVE_VERSION();
+
+ private static native final int H5_VOL_INVALID();
+
+ private static native final int H5_VOL_NATIVE();
+
+ private static native final int H5_VOL_RESERVED();
+
+ private static native final int H5_VOL_MAX();
+
private static native final int H5Z_CB_CONT();
private static native final int H5Z_CB_ERROR();
diff --git a/java/src/hdf/hdf5lib/HDFArray.java b/java/src/hdf/hdf5lib/HDFArray.java
index 529aecb..30f0fc8 100644
--- a/java/src/hdf/hdf5lib/HDFArray.java
+++ b/java/src/hdf/hdf5lib/HDFArray.java
@@ -1025,8 +1025,11 @@ class ArrayDescriptor {
NTsize = 8;
}
else if (css.startsWith("Ljava.lang.String")) {
+ NT = 'L';
+ className = "java.lang.String";
+ NTsize = 1;
throw new HDF5JavaException(new String(
- "ArrayDesciptor: Error: String array not supported yet"));
+ "ArrayDesciptor: Warning: String array not fully supported yet"));
}
else {
/*
diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java
index ec71911..ad9ad8c 100644
--- a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java
+++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java
@@ -13,9 +13,6 @@
package hdf.hdf5lib.callbacks;
-import hdf.hdf5lib.structs.H5L_info_t;
+public interface H5L_iterate_opdata_t {
-//Information class for link callback(for H5Lvisit/H5Lvisit_by_name)
-public interface H5L_iterate_cb extends Callbacks {
- int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data);
}
diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java
index 28ffb8a..f92fbc4 100644
--- a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java
+++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java
@@ -13,8 +13,9 @@
package hdf.hdf5lib.callbacks;
-public interface H5L_iterate_t {
-/** public ArrayList iterdata = new ArrayList();
- * Any derived interfaces must define the single public variable as above.
- */
+import hdf.hdf5lib.structs.H5L_info_t;
+
+// Information class for link callback (for H5Lvisit/H5Lvisit_by_name).
+public interface H5L_iterate_t extends Callbacks {
+ int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data);
}
diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java
index 89cf206..e1c47b5 100644
--- a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java
+++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java
@@ -13,9 +13,6 @@
package hdf.hdf5lib.callbacks;
-import hdf.hdf5lib.structs.H5O_info_t;
+public interface H5O_iterate_opdata_t {
-//Information class for link callback(for H5Ovisit/H5Ovisit_by_name)
-public interface H5O_iterate_cb extends Callbacks {
- int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data);
}
diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java
index 1491b09..9a55106 100644
--- a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java
+++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java
@@ -13,8 +13,9 @@
package hdf.hdf5lib.callbacks;
-public interface H5O_iterate_t {
-/** public ArrayList iterdata = new ArrayList();
- * Any derived interfaces must define the single public variable as above.
- */
+import hdf.hdf5lib.structs.H5O_info_t;
+
+// Information class for link callback(for H5Ovisit/H5Ovisit_by_name)
+public interface H5O_iterate_t extends Callbacks {
+ int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data);
}
diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java b/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java
index 1b55437..1e4b5fd 100644
--- a/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java
+++ b/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java
@@ -30,7 +30,7 @@ package hdf.hdf5lib.exceptions;
* error code returned by the HDF5 library.
*
*/
-public class HDF5Exception extends Exception {
+public class HDF5Exception extends RuntimeException {
protected String detailMessage;
/**
diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
index 5ae977d..54acbdd 100644
--- a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
+++ b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java
@@ -30,6 +30,9 @@ import hdf.hdf5lib.HDF5Constants;
@SuppressWarnings("serial")
public class HDF5LibraryException extends HDF5Exception {
+ private final long majorErrorNumber;
+ private final long minorErrorNumber;
+
/**
* Constructs an <code>HDF5LibraryException</code> with no specified detail
* message.
@@ -44,9 +47,10 @@ public class HDF5LibraryException extends HDF5Exception {
}
catch (Exception e) {
}
- ;
- detailMessage = getMinorError(getMinorErrorNumber());
+ this.majorErrorNumber = _getMajorErrorNumber();
+ this.minorErrorNumber = _getMinorErrorNumber();
+ detailMessage = getMinorError(minorErrorNumber);
}
/**
@@ -65,7 +69,8 @@ public class HDF5LibraryException extends HDF5Exception {
}
catch (Exception e) {
}
- ;
+ this.majorErrorNumber = _getMajorErrorNumber();
+ this.minorErrorNumber = _getMinorErrorNumber();
}
/**
@@ -74,7 +79,11 @@ public class HDF5LibraryException extends HDF5Exception {
*
* @return the major error number
*/
- public native long getMajorErrorNumber();
+ public long getMajorErrorNumber()
+ {
+ return majorErrorNumber;
+ }
+ private native long _getMajorErrorNumber();
/**
* Get the minor error number of the first error on the HDF5 library error
@@ -82,7 +91,11 @@ public class HDF5LibraryException extends HDF5Exception {
*
* @return the minor error number
*/
- public native long getMinorErrorNumber();
+ public long getMinorErrorNumber()
+ {
+ return minorErrorNumber;
+ }
+ private native long _getMinorErrorNumber();
/**
* Return a error message for the minor error number.
@@ -158,6 +171,9 @@ public class HDF5LibraryException extends HDF5Exception {
else if (err_code == HDF5Constants.H5E_MOUNT) {
return "file mount error";
}
+ else if (err_code == HDF5Constants.H5E_CANTDELETEFILE) {
+ return "Unable to delete file";
+ }
else if (err_code == HDF5Constants.H5E_SEEKERROR) {
return "seek failed";
}
@@ -249,7 +265,7 @@ public class HDF5LibraryException extends HDF5Exception {
return "unrecognized message";
}
else if (err_code == HDF5Constants.H5E_CANTDELETE) {
- return " Can't delete message";
+ return "Can't delete message";
}
else if (err_code == HDF5Constants.H5E_CANTOPENOBJ) {
return "Can't open object";
diff --git a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java
new file mode 100644
index 0000000..9fcff2e
--- /dev/null
+++ b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java
@@ -0,0 +1,102 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Read-Only HDFS Virtual File Driver (VFD) *
+ * Copyright (c) 2018, The HDF Group. *
+ * *
+ * All rights reserved. *
+ * *
+ * NOTICE: *
+ * All information contained herein is, and remains, the property of The HDF *
+ * Group. The intellectual and technical concepts contained herein are *
+ * proprietary to The HDF Group. Dissemination of this information or *
+ * reproduction of this material is strictly forbidden unless prior written *
+ * permission is obtained from The HDF Group. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package hdf.hdf5lib.structs;
+
+import java.io.Serializable;
+
+/*
+ * Java representation of the HDFS VFD file access property list (fapl)
+ * structure.
+ *
+ * Used for the access of files hosted on the Hadoop Distributed File System.
+ */
+
+public class H5FD_hdfs_fapl_t implements Serializable {
+ private static final long serialVersionUID = 2072473407027648309L;
+
+ private int version;
+ private String namenode_name;
+ private int namenode_port;
+ private String user_name;
+ private String kerberos_ticket_cache;
+ private int stream_buffer_size;
+
+ /*
+ * Create a fapl_t structure with the specified components.
+ */
+ public H5FD_hdfs_fapl_t(
+ String namenode_name,
+ int namenode_port,
+ String user_name,
+ String kerberos_ticket_cache,
+ int stream_buffer_size)
+ {
+ this.version = 1;
+ this.namenode_name = namenode_name;
+ this.namenode_port = namenode_port;
+ this.user_name = user_name;
+ this.kerberos_ticket_cache = kerberos_ticket_cache;
+ this.stream_buffer_size = stream_buffer_size;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == null)
+ return false;
+ if (!(o instanceof H5FD_hdfs_fapl_t))
+ return false;
+
+ H5FD_hdfs_fapl_t other = (H5FD_hdfs_fapl_t)o;
+ if (this.version != other.version)
+ return false;
+ if (!this.namenode_name.equals(other.namenode_name))
+ return false;
+ if (this.namenode_port != other.namenode_port)
+ return false;
+ if (!this.user_name.equals(other.user_name))
+ return false;
+ if (!this.kerberos_ticket_cache.equals(other.kerberos_ticket_cache))
+ return false;
+ if (this.stream_buffer_size != other.stream_buffer_size)
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ /* this is a _very bad_ hash algorithm for purposes of hashing! */
+ /* implemented to satisfy the "contract" regarding equality */
+ int k = (int)this.version;
+ k += this.namenode_name.length();
+ k += this.user_name.length();
+ k += this.kerberos_ticket_cache.length();
+ k += namenode_port;
+ k += stream_buffer_size;
+ return k;
+ }
+
+ @Override
+ public String toString() {
+ return "H5FD_hdfs_fapl_t (Version: " + this.version + ") {" +
+ "\n namenode_name: '" + this.namenode_name +
+ "'\n namenode_port: " + this.namenode_port +
+ "\n user_name: '" + this.user_name +
+ "'\n kerberos_ticket_cache: '" + this.kerberos_ticket_cache +
+ "'\n stream_buffer_size: " + this.stream_buffer_size +
+ "\n}\n";
+ }
+}
+
+
diff --git a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java
new file mode 100644
index 0000000..a899e10
--- /dev/null
+++ b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java
@@ -0,0 +1,123 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Read-Only S3 Virtual File Driver (VFD) *
+ * Copyright (c) 2017-2018, The HDF Group. *
+ * *
+ * All rights reserved. *
+ * *
+ * NOTICE: *
+ * All information contained herein is, and remains, the property of The HDF *
+ * Group. The intellectual and technical concepts contained herein are *
+ * proprietary to The HDF Group. Dissemination of this information or *
+ * reproduction of this material is strictly forbidden unless prior written *
+ * permission is obtained from The HDF Group. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package hdf.hdf5lib.structs;
+
+import java.io.Serializable;
+
+/*
+ * Java representation of the ROS3 VFD file access property list (fapl)
+ * structure.
+ *
+ * Used for the access of files hosted remotely on S3 by Amazon.
+ *
+ * For simplicity, implemented assuming that all ROS3 fapls have components:
+ * - version
+ * - authenticate
+ * - aws_region
+ * - secret_id
+ * - secret_key
+ *
+ * Future implementations may be created to enable different fapl "shapes"
+ * depending on provided version.
+ *
+ * proposed:
+ *
+ * H5FD_ros3_fapl_t (super class, has only version field)
+ * H5FD_ros3_fapl_v1_t (extends super with Version 1 components)
+ * H5FD_ros3_fapl_v2_t (extends super with Version 2 components)
+ * and so on, for each version
+ *
+ * "super" is passed around, and is version-checked and re-cast as
+ * appropriate
+ */
+
+public class H5FD_ros3_fapl_t implements Serializable {
+ private static final long serialVersionUID = 8985533001471224030L;
+
+ private int version;
+ private boolean authenticate;
+ private String aws_region;
+ private String secret_id;
+ private String secret_key;
+
+ /**
+ * Create a "default" fapl_t structure, for anonymous access.
+ */
+ public H5FD_ros3_fapl_t () {
+ /* H5FD_ros3_fapl_t("", "", ""); */ /* defer */
+ this.version = 1;
+ this.aws_region = "";
+ this.secret_id = "";
+ this.secret_key = "";
+ }
+
+ /**
+ * Create a fapl_t structure with the specified components.
+ * If all are the empty string, is anonymous (non-authenticating).
+ * Region and ID must both be supplied for authentication.
+ *
+ * @param region "aws region" for authenticating request
+ * @param id "secret id" or "access id" for authenticating request
+ * @param key "secret key" or "access key" for authenticating request
+ */
+ public H5FD_ros3_fapl_t (String region, String id, String key) {
+ this.version = 1; /* must equal H5FD_CURR_ROS3_FAPL_T_VERSION */
+ /* as found in H5FDros3.h */
+ this.aws_region = region;
+ this.secret_id = id;
+ this.secret_key = key;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == null)
+ return false;
+ if (!(o instanceof H5FD_ros3_fapl_t))
+ return false;
+
+ H5FD_ros3_fapl_t other = (H5FD_ros3_fapl_t)o;
+ if (this.version != other.version)
+ return false;
+ if (!this.aws_region.equals(other.aws_region))
+ return false;
+ if (!this.secret_key.equals(other.secret_key))
+ return false;
+ if (!this.secret_id.equals(other.secret_id))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ /* this is a _very bad_ hash algorithm for purposes of hashing! */
+ /* implemented to satisfy the "contract" regarding equality */
+ int k = (int)this.version;
+ k += this.aws_region.length();
+ k += this.secret_id.length();
+ k += this.secret_key.length();
+ return k;
+ }
+
+ @Override
+ public String toString() {
+ return "H5FD_ros3_fapl_t (Version:" + this.version + ") {" +
+ "\n aws_region : " + this.aws_region +
+ "\n secret_id : " + this.secret_id +
+ "\n secret_key : " + this.secret_key +
+ "\n}\n";
+ }
+}
+
+
diff --git a/java/src/hdf/hdf5lib/structs/H5L_info_t.java b/java/src/hdf/hdf5lib/structs/H5L_info_t.java
index 3bbb189..377e617 100644
--- a/java/src/hdf/hdf5lib/structs/H5L_info_t.java
+++ b/java/src/hdf/hdf5lib/structs/H5L_info_t.java
@@ -15,22 +15,39 @@ package hdf.hdf5lib.structs;
import java.io.Serializable;
-//Information struct for link (for H5Lget_info/H5Lget_info_by_idx)
-public class H5L_info_t implements Serializable{
+import hdf.hdf5lib.HDF5Constants;
+
+// Information struct for link (for H5Lget_info/H5Lget_info_by_idx)
+public class H5L_info_t implements Serializable {
private static final long serialVersionUID = -4754320605310155033L;
- public int type;
- public boolean corder_valid;
- public long corder;
- public int cset;
- public long address_val_size;
+ public int type;
+ public boolean corder_valid;
+ public long corder;
+ public int cset;
+ public H5O_token_t token;
+ public long val_size;
+
+ // Constructor for using object token portion of C union
+ H5L_info_t (int type, boolean corder_valid, long corder,
+ int cset, H5O_token_t token)
+ {
+ this.type = type;
+ this.corder_valid = corder_valid;
+ this.corder = corder;
+ this.cset = cset;
+ this.token = token;
+ this.val_size = -1;
+ }
+ // Constructor for using val_size portion of C union
H5L_info_t (int type, boolean corder_valid, long corder,
- int cset, long address_val_size)
+ int cset, long val_size)
{
this.type = type;
this.corder_valid = corder_valid;
this.corder = corder;
this.cset = cset;
- this.address_val_size = address_val_size;
+ this.token = HDF5Constants.H5O_TOKEN_UNDEF;
+ this.val_size = val_size;
}
}
diff --git a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java
index a39c1ed..73aaa47 100644
--- a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java
+++ b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java
@@ -16,7 +16,7 @@ package hdf.hdf5lib.structs;
import java.io.Serializable;
// Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx)
-public class H5O_hdr_info_t implements Serializable{
+public class H5O_hdr_info_t implements Serializable {
private static final long serialVersionUID = 7883826382952577189L;
public int version; /* Version number of header format in file */
public int nmesgs; /* Number of object header messages */
@@ -44,4 +44,38 @@ public class H5O_hdr_info_t implements Serializable{
this.mesg_present = mesg_present;
this.mesg_shared = mesg_shared;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (!(o instanceof H5O_hdr_info_t))
+ return false;
+
+ H5O_hdr_info_t info = (H5O_hdr_info_t) o;
+
+ if (this.version != info.version)
+ return false;
+ if (this.nmesgs != info.nmesgs)
+ return false;
+ if (this.nchunks != info.nchunks)
+ return false;
+ if (this.flags != info.flags)
+ return false;
+ if (this.space_total != info.space_total)
+ return false;
+ if (this.space_meta != info.space_meta)
+ return false;
+ if (this.space_mesg != info.space_mesg)
+ return false;
+ if (this.space_free != info.space_free)
+ return false;
+ if (this.mesg_present != info.mesg_present)
+ return false;
+ if (this.mesg_shared != info.mesg_shared)
+ return false;
+
+ return true;
+ }
}
diff --git a/java/src/hdf/hdf5lib/structs/H5O_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_info_t.java
index ac32f6a..6a26a10 100644
--- a/java/src/hdf/hdf5lib/structs/H5O_info_t.java
+++ b/java/src/hdf/hdf5lib/structs/H5O_info_t.java
@@ -15,38 +15,30 @@ package hdf.hdf5lib.structs;
import java.io.Serializable;
-//Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx)
-public class H5O_info_t implements Serializable{
+// Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx)
+public class H5O_info_t implements Serializable {
private static final long serialVersionUID = 4691681163544054518L;
- public long fileno; /* File number that object is located in */
- public long addr; /* Object address in file */
- public int type; /* Basic object type (group, dataset, etc.) */
- public int rc; /* Reference count of object */
- public long atime; /* Access time */
- public long mtime; /* Modification time */
- public long ctime; /* Change time */
- public long btime; /* Birth time */
- public long num_attrs; /* # of attributes attached to object */
- public H5O_hdr_info_t hdr; /* Object header information */
- /* Extra metadata storage for obj & attributes */
- public H5_ih_info_t meta_size_obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
- public H5_ih_info_t meta_size_attr; /* v2 B-tree & heap for attributes */
+ public long fileno; /* File number that object is located in */
+ public H5O_token_t token; /* Object token in file */
+ public int type; /* Basic object type (group, dataset, etc.) */
+ public int rc; /* Reference count of object */
+ public long atime; /* Access time */
+ public long mtime; /* Modification time */
+ public long ctime; /* Change time */
+ public long btime; /* Birth time */
+ public long num_attrs; /* # of attributes attached to object */
- public H5O_info_t (long fileno, long addr, int type,
- int rc, long num_attrs, long atime, long mtime, long ctime, long btime,
- H5O_hdr_info_t hdr, H5_ih_info_t meta_size_obj, H5_ih_info_t meta_size_attr)
+ public H5O_info_t (long fileno, H5O_token_t token, int type,
+ int rc, long atime, long mtime, long ctime, long btime, long num_attrs)
{
this.fileno = fileno;
- this.addr = addr;
+ this.token = token;
this.type = type;
this.rc = rc;
- this.num_attrs = num_attrs;
this.atime = atime;
this.mtime = mtime;
this.ctime = ctime;
this.btime = btime;
- this.hdr = hdr;
- this.meta_size_obj = meta_size_obj;
- this.meta_size_attr = meta_size_attr;
+ this.num_attrs = num_attrs;
}
}
diff --git a/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java
new file mode 100644
index 0000000..f410a7f
--- /dev/null
+++ b/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java
@@ -0,0 +1,52 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package hdf.hdf5lib.structs;
+
+import java.io.Serializable;
+
+// Information struct for native HDF5 object info, such as object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx).
+public class H5O_native_info_t implements Serializable {
+ private static final long serialVersionUID = 7883826382952577189L;
+
+ public H5O_hdr_info_t hdr_info; /* Object header information */
+
+ /* Extra metadata storage for obj & attributes */
+ public H5_ih_info_t obj_info; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
+ public H5_ih_info_t attr_info; /* v2 B-tree & heap for attributes */
+
+ H5O_native_info_t (H5O_hdr_info_t oheader_info, H5_ih_info_t obj_info, H5_ih_info_t attr_info)
+ {
+ this.hdr_info = oheader_info;
+ this.obj_info = obj_info;
+ this.attr_info = attr_info;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (!(o instanceof H5O_native_info_t))
+ return false;
+
+ H5O_native_info_t info = (H5O_native_info_t) o;
+
+ if (!this.hdr_info.equals(info.hdr_info)
+ || !this.obj_info.equals(info.obj_info)
+ || !this.attr_info.equals(info.attr_info))
+ return false;
+
+ return true;
+ }
+}
diff --git a/java/src/hdf/hdf5lib/structs/H5O_token_t.java b/java/src/hdf/hdf5lib/structs/H5O_token_t.java
new file mode 100644
index 0000000..e6d2474
--- /dev/null
+++ b/java/src/hdf/hdf5lib/structs/H5O_token_t.java
@@ -0,0 +1,45 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package hdf.hdf5lib.structs;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+import hdf.hdf5lib.HDF5Constants;
+
+// Object token, which is a unique and permanent identifier, for an HDF5 object within a container.
+public class H5O_token_t implements Serializable {
+ private static final long serialVersionUID = -4754320605310155032L;
+ public byte[] data;
+
+ H5O_token_t (byte[] data) {
+ this.data = data;
+ }
+
+ public boolean isUndefined() {
+ return this.equals(HDF5Constants.H5O_TOKEN_UNDEF);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (!(o instanceof H5O_token_t))
+ return false;
+
+ H5O_token_t token = (H5O_token_t) o;
+
+ return Arrays.equals(this.data, token.data);
+ }
+}
diff --git a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java
index ea36d85..7159f02 100644
--- a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java
+++ b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java
@@ -26,4 +26,22 @@ public class H5_ih_info_t implements Serializable {
this.index_size = index_size;
this.heap_size = heap_size;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (!(o instanceof H5_ih_info_t))
+ return false;
+
+ H5_ih_info_t info = (H5_ih_info_t) o;
+
+ if (this.index_size != info.index_size)
+ return false;
+ if (this.heap_size != info.heap_size)
+ return false;
+
+ return true;
+ }
}
diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html
index 39d75b7..f6a34fc 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
-library (version 1.10). Some of the functions are not supported in JHI5. Most
+<p>There are a large number of functions in the HDF5
+library (version 1.13). 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
@@ -47,20 +48,20 @@ which has a method:
The native method is implemented in C using the
<a href="http://java.sun.com/javase/6/docs/technotes/guides/jni/index.html">Java
Native Method Interface </a>(JNI). This is written something like the following:
-<pre><b>JNIEXPORT jint
+<pre><b>JNIEXPORT jlong
JNICALL Java_hdf_hdf5lib_H5_H5Fopen
(
&nbsp;JNIEnv *env,
&nbsp;jclass class,
&nbsp;jstring hdfFile,
&nbsp;jint flags,
-&nbsp;jint access)
+&nbsp;jlong access)
&nbsp;{
&nbsp;/* ...convert Java String to (char *) */
&nbsp;/* call the HDF library */
-&nbsp;retVal = H5Fopen((char *)file, (unsigned)flags, (hid_t)access );
+&nbsp;retVal = H5Fopen((char *)file, (unsigned)flags, (hid_t)access);
&nbsp;/* ... */
}</b></pre>
@@ -89,8 +90,7 @@ like this:
The <i><b>H5</b> </i>class automatically loads the native method implementations
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.
+<h3>To Obtain</h3>
+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 9e6c099..3f71122 100644
--- a/java/src/jni/CMakeLists.txt
+++ b/java/src/jni/CMakeLists.txt
@@ -1,5 +1,5 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_JAVA_JNI C CXX)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_JAVA_JNI C)
set (HDF5_JAVA_JNI_CSRCS
${HDF5_JAVA_JNI_SOURCE_DIR}/exceptionImp.c
@@ -14,11 +14,25 @@ set (HDF5_JAVA_JNI_CSRCS
${HDF5_JAVA_JNI_SOURCE_DIR}/h5lImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5oImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5pImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pACPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDAPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDCPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDXPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pFAPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pFCPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pGAPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pGCPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pLAPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pLCPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pOCPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pOCpyPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pStrCPLImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5plImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5rImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5vlImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.c
)
@@ -35,40 +49,42 @@ set (HDF5_JAVA_JNI_CHDRS
${HDF5_JAVA_JNI_SOURCE_DIR}/h5lImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5oImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5pImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pACPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDAPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDCPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDXPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pFAPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pFCPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pGAPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pGCPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pLAPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pLCPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pOCPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pOCpyPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pStrCPLImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5plImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5rImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5vlImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.h
)
-INCLUDE_DIRECTORIES( ${HDF5_JAVA_JNI_SOURCE_DIR} )
-
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_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED " " " ")
-target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_LIB_TARGET})
+target_include_directories (${HDF5_JAVA_JNI_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+)
+target_compile_options(${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE "${HDF5_CMAKE_C_FLAGS}")
+TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED)
+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 ${HDF5_JAVA_PACKAGE_SOVERSION})
-if (WIN32)
- get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE)
- if (CMAKE_BUILD_TYPE MATCHES Debug)
- set (HDF5_JAVA_JNI_DLL_NAME "${HDF5_JAVA_JNI_DLL_NAME}_D")
- endif ()
- # 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 ()
+H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED "JAVA")
#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
diff --git a/java/src/jni/Makefile.am b/java/src/jni/Makefile.am
index 6ded371..1ec9b94 100644
--- a/java/src/jni/Makefile.am
+++ b/java/src/jni/Makefile.am
@@ -34,7 +34,10 @@ libhdf5_java_la_LDFLAGS = -avoid-version -shared -export-dynamic -version-info $
# Source files for the library
libhdf5_java_la_SOURCES=exceptionImp.c h5Constants.c nativeData.c h5util.c h5Imp.c \
h5aImp.c h5dImp.c h5eImp.c h5fImp.c h5gImp.c h5iImp.c h5lImp.c h5oImp.c \
- h5pImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c h5zImp.c
+ h5pImp.c h5pACPLImp.c h5pDAPLImp.c h5pDCPLImp.c h5pDXPLImp.c \
+ h5pFAPLImp.c h5pFCPLImp.c h5pGAPLImp.c h5pGCPLImp.c h5pLAPLImp.c h5pLCPLImp.c \
+ h5pOCPLImp.c h5pOCpyPLImp.c h5pStrCPLImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c \
+ h5vlImp.c h5zImp.c
# HDF5 Java (JNI) library depends on HDF5 Library.
libhdf5_java_la_LIBADD=$(LIBHDF5)
diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c
index 05c193f..c08b67b 100644
--- a/java/src/jni/exceptionImp.c
+++ b/java/src/jni/exceptionImp.c
@@ -33,18 +33,14 @@ extern "C" {
#include "h5jni.h"
#include "exceptionImp.h"
+extern H5E_auto2_t efunc;
+extern void *edata;
+
/*******************/
/* Local Variables */
/*******************/
-/* These types are copied from H5Eprivate.h
- * They should be moved to a public include file, and deleted from
- * here.
- */
-
-#define H5E_NSLOTS 32 /*number of slots in an error stack */
-
/*
* The list of error messages in the system is kept as an array of
* error_code/message pairs, one for major error numbers and another for
@@ -70,24 +66,29 @@ typedef struct H5E_num_t {
/* Local Macros */
/********************/
-#define THROWEXCEPTION(className,args) { \
- jclass jc; \
- jmethodID jm; \
- jobject ex; \
- jc = ENVPTR->FindClass(ENVPAR (className)); \
- if (jc == NULL) { \
- return JNI_FALSE; \
- } \
- jm = ENVPTR->GetMethodID(ENVPAR jc, "<init>", "(Ljava/lang/String;)V"); \
- if (jm == NULL) { \
- return JNI_FALSE; \
- } \
- ex = ENVPTR->NewObjectA (ENVPAR jc, jm, (jvalue*)(args)); \
- if (ENVPTR->Throw(ENVPAR (jthrowable)ex) < 0) { \
- printf("FATAL ERROR: %s: Throw failed\n", (className)); \
- return JNI_FALSE; \
- } \
- return JNI_TRUE; \
+#define THROWEXCEPTION(className, args) \
+{ \
+ jmethodID jm; \
+ jclass jc; \
+ jobject ex; \
+ \
+ if (NULL == (jc = ENVPTR->FindClass(ENVONLY, (className)))) \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ \
+ if (NULL == (jm = ENVPTR->GetMethodID(ENVONLY, jc, "<init>", "(Ljava/lang/String;)V"))) { \
+ HDprintf("THROWEXCEPTION FATAL ERROR: GetMethodID failed\n"); \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ } \
+ \
+ if (NULL == (ex = ENVPTR->NewObjectA(ENVONLY, jc, jm, (jvalue *)(args)))) { \
+ HDprintf("THROWEXCEPTION FATAL ERROR: Class %s: Creation failed\n", (className)); \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ } \
+ \
+ if (ENVPTR->Throw(ENVONLY, (jthrowable)ex) < 0) { \
+ HDprintf("THROWEXCEPTION FATAL ERROR: Class %s: Throw failed\n", (className)); \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ } \
}
/********************/
@@ -104,7 +105,9 @@ walk_error_callback
{
H5E_num_t *err_nums = (H5E_num_t *)_err_nums;
- if(err_desc) {
+ UNUSED(n);
+
+ if (err_desc) {
err_nums->maj_num = err_desc->maj_num;
err_nums->min_num = err_desc->min_num;
} /* end if */
@@ -122,10 +125,33 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5error_1off
(JNIEnv *env, jclass clss)
{
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+ UNUSED(env);
+ UNUSED(clss);
+
+ if (H5Eget_auto2(H5E_DEFAULT, &efunc, &edata) < 0)
+ return -1;
+
+ if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
+ return -1;
+
return 0;
} /* end Java_hdf_hdf5lib_H5_H5error_1off() */
+/*
+ * Class: hdf_hdf5lib_exceptions_HDF5Library
+ * Method: H5error_on
+ * Signature: ()V
+ *
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5error_1on
+ (JNIEnv *env, jclass clss)
+{
+ UNUSED(env);
+ UNUSED(clss);
+
+ H5Eset_auto2(H5E_DEFAULT, efunc, edata);
+} /* end Java_hdf_hdf5lib_H5_H5error_1on() */
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
@@ -141,73 +167,100 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0
FILE *stream = NULL;
const char *file = NULL;
- if(file_name == NULL) {
+ UNUSED(obj);
+
+ if (NULL == file_name) {
H5Eprint2(H5E_DEFAULT, stderr);
- } /* end if */
+ }
else {
- file = ENVPTR->GetStringUTFChars(ENVPAR file_name, 0);
- stream = HDfopen(file, "a+");
- if(stream) {
+ PIN_JAVA_STRING(ENVONLY, file_name, file, NULL, "printStackTrace0: file name not pinned");
+
+ if ((stream = HDfopen(file, "a+"))) {
H5Eprint2(H5E_DEFAULT, stream);
HDfclose(stream);
- } /* end if */
- ENVPTR->ReleaseStringUTFChars(ENVPAR file_name, file);
- } /* end else */
+ }
+ }
+
+done:
+ if (file)
+ UNPIN_JAVA_STRING(ENVONLY, file_name, file);
+
+ return;
} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0() */
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
- * Method: getMajorErrorNumber
+ * Method: _getMajorErrorNumber
* Signature: ()J
*
* Extract the HDF-5 major error number from the HDF-5 error stack.
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber
+Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber
(JNIEnv *env, jobject obj)
{
H5E_num_t err_nums;
+
+ UNUSED(env);
+ UNUSED(obj);
+
err_nums.maj_num = 0;
err_nums.min_num = 0;
- H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums);
+ if (H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums) < 0)
+ return -1;
return err_nums.maj_num;
-} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber() */
+} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber() */
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
- * Method: getMinorErrorNumber
+ * Method: _getMinorErrorNumber
* Signature: ()J
*
* Extract the HDF-5 minor error number from the HDF-5 error stack.
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber
+Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber
(JNIEnv *env, jobject obj)
{
H5E_num_t err_nums;
+
+ UNUSED(env);
+ UNUSED(obj);
+
err_nums.maj_num = 0;
err_nums.min_num = 0;
- H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums);
+ if (H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums) < 0)
+ return -1;
return err_nums.min_num;
-} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber() */
+} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber() */
/*
- * Routine to raise particular Java exceptions from C
+ * Routine to raise particular Java exceptions from C.
*/
static jboolean
H5JNIErrorClass
(JNIEnv *env, const char *message, const char *className)
{
- char *args[2];
- jstring str = ENVPTR->NewStringUTF(ENVPAR message);
- args[0] = (char *)str;
+ jstring str;
+ char *args[2];
+ jboolean retVal = JNI_FALSE;
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, message)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ args[0] = (char *) str;
args[1] = 0;
THROWEXCEPTION(className, args);
+
+ retVal = JNI_TRUE;
+
+done:
+ return retVal;
} /* end H5JNIErrorClass() */
/*
@@ -294,7 +347,7 @@ h5unimplemented
*/
jboolean
h5raiseException
- (JNIEnv *env, const char *exception, const char *message)
+ (JNIEnv *env, const char *message, const char *exception)
{
return H5JNIErrorClass(env, message, exception);
} /* end h5raiseException() */
@@ -314,51 +367,76 @@ jboolean
h5libraryError
(JNIEnv *env)
{
- char *args[2];
const char *exception = NULL;
- char *msg_str = NULL;
- int num_errs = 0;
- hid_t min_num;
- hid_t maj_num;
- ssize_t msg_size = 0;
H5E_type_t error_msg_type;
- jstring str = NULL;
- hid_t stk_id = -1;
H5E_num_t exceptionNumbers;
+ jstring str = NULL;
+ ssize_t msg_size = 0;
+ hid_t min_num;
+ hid_t maj_num;
+ hid_t stk_id = H5I_INVALID_HID;
+ char *args[2];
+ char *msg_str = NULL;
+ jboolean retVal = JNI_FALSE;
exceptionNumbers.maj_num = 0;
exceptionNumbers.min_num = 0;
/* Save current stack contents for future use */
- stk_id = H5Eget_current_stack(); /* This will clear current stack */
- if(stk_id >= 0)
- H5Ewalk2(stk_id, H5E_WALK_DOWNWARD, walk_error_callback, &exceptionNumbers);
+ if ((stk_id = H5Eget_current_stack()) >= 0)
+ /* This will clear current stack */
+ if (H5Ewalk2(stk_id, H5E_WALK_DOWNWARD, walk_error_callback, &exceptionNumbers) < 0)
+ goto done;
+
maj_num = exceptionNumbers.maj_num;
min_num = exceptionNumbers.min_num;
+ /*
+ * TODO: handle < 0 case.
+ */
+
+ /*
+ * No error detected in HDF5 error stack.
+ */
+ if (!maj_num && !min_num)
+ goto done;
+
exception = defineHDF5LibraryException(maj_num);
/* get the length of the name */
- msg_size = H5Eget_msg(min_num, NULL, NULL, 0);
- if(msg_size > 0) {
- msg_size++; /* add extra space for the null terminator */
- msg_str = (char*)HDcalloc((size_t)msg_size, sizeof(char));
- if(msg_str) {
- msg_size = H5Eget_msg(min_num, &error_msg_type, (char *)msg_str, (size_t)msg_size);
- str = ENVPTR->NewStringUTF(ENVPAR msg_str);
- HDfree(msg_str);
- } /* end if */
- } /* end if */
+ if ((msg_size = H5Eget_msg(min_num, NULL, NULL, 0)) < 0)
+ goto done;
+
+ if (msg_size > 0) {
+ if (NULL == (msg_str = (char *) HDcalloc((size_t)msg_size + 1, sizeof(char))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5libraryerror: failed to allocate buffer for error message");
+
+ if ((msg_size = H5Eget_msg(min_num, &error_msg_type, msg_str, (size_t)msg_size + 1)) < 0)
+ goto done;
+ msg_str[msg_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, msg_str)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
else
str = NULL;
- if(stk_id >= 0)
+
+ if (stk_id >= 0)
H5Eset_current_stack(stk_id);
- args[0] = (char *)str;
+ args[0] = (char *) str;
args[1] = 0;
+
THROWEXCEPTION(exception, args);
-} /* end h5libraryError() */
+ retVal = JNI_TRUE;
+
+done:
+ if (msg_str)
+ HDfree(msg_str);
+
+ return retVal;
+} /* end h5libraryError() */
/*
* defineHDF5LibraryException() returns the name of the sub-class
diff --git a/java/src/jni/exceptionImp.h b/java/src/jni/exceptionImp.h
index cb74602..5873202 100644
--- a/java/src/jni/exceptionImp.h
+++ b/java/src/jni/exceptionImp.h
@@ -31,6 +31,16 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5error_1off
(JNIEnv *env, jclass clss );
+/*
+ * Class: hdf_hdf5lib_exceptions_HDF5Library
+ * Method: H5error_on
+ * Signature: ()V
+ *
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5error_1on
+ (JNIEnv *env, jclass clss );
+
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
@@ -45,20 +55,20 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
- * Method: getMajorErrorNumber
+ * Method: _getMajorErrorNumber
* Signature: ()J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber
+Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber
(JNIEnv *env, jobject obj);
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
- * Method: getMinorErrorNumber
+ * Method: _getMinorErrorNumber
* Signature: ()J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber
+Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber
(JNIEnv *env, jobject obj);
#ifdef __cplusplus
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c
index f6f8bfa..8fdca35 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -21,12 +21,13 @@
extern "C" {
#endif /* __cplusplus */
-#include <jni.h>
#include "hdf5.h"
+#include <jni.h>
+#include <stdlib.h>
+#include "h5jni.h"
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-#pragma GCC diagnostic ignored "-Wunused-parameter"
+H5_GCC_DIAG_OFF(missing-prototypes)
+H5_GCC_DIAG_OFF(unused-parameter)
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5_1QUARTER_1HADDR_1MAX(JNIEnv *env, jclass cls) { return (hsize_t)HADDR_MAX/4; }
@@ -140,6 +141,8 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1FIRST_1MISSING(JNIEnv *env, jclass cls) { return H5D_VDS_FIRST_MISSING; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1LAST_1AVAILABLE(JNIEnv *env, jclass cls) { return H5D_VDS_LAST_AVAILABLE; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1DONT_1FILTER_1PARTIAL_1CHUNKS(JNIEnv *env, jclass cls) { return H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1ALIGNMENT(JNIEnv *env, jclass cls) { return H5E_ALIGNMENT; }
@@ -200,6 +203,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDECODE(JNIEnv *env, jclass cls) { return
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETE(JNIEnv *env, jclass cls) { return H5E_CANTDELETE; }
JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETEFILE(JNIEnv *env, jclass cls) { return H5E_CANTDELETEFILE; }
+JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTENCODE(JNIEnv *env, jclass cls) { return H5E_CANTENCODE; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFLUSH(JNIEnv *env, jclass cls) { return H5E_CANTFLUSH; }
@@ -342,15 +347,25 @@ 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; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5E_1WRITEERROR(JNIEnv *env, jclass cls) { return H5E_WRITEERROR; }
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1IN_1PROGRESS(JNIEnv *env, jclass cls) { return H5ES_STATUS_IN_PROGRESS; }
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1SUCCEED(JNIEnv *env, jclass cls) { return H5ES_STATUS_SUCCEED; }
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1FAIL(JNIEnv *env, jclass cls) { return H5ES_STATUS_FAIL; }
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5ES_1STATUS_1CANCELED(JNIEnv *env, jclass cls) { return H5ES_STATUS_CANCELED; }
+
/* Java does not have unsigned native types */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-conversion"
+H5_GCC_DIAG_OFF(sign-conversion)
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1CREAT(JNIEnv *env, jclass cls) { return H5F_ACC_CREAT; }
JNIEXPORT jint JNICALL
@@ -367,7 +382,7 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1SWMR_1READ(JNIEnv *env, jclass cls) { return H5F_ACC_SWMR_READ; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1SWMR_1WRITE(JNIEnv *env, jclass cls) { return H5F_ACC_SWMR_WRITE; }
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(sign-conversion)
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_CLOSE_DEFAULT; }
@@ -378,8 +393,20 @@ Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1STRONG(JNIEnv *env, jclass cls) { ret
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1WEAK(JNIEnv *env, jclass cls) { return H5F_CLOSE_WEAK; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1ERROR(JNIEnv *env, jclass cls){return H5F_LIBVER_ERROR;}
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_EARLIEST;}
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V18(JNIEnv *env, jclass cls){return H5F_LIBVER_V18;}
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V110(JNIEnv *env, jclass cls){return H5F_LIBVER_V110;}
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V112(JNIEnv *env, jclass cls){return H5F_LIBVER_V112;}
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V114(JNIEnv *env, jclass cls){return H5F_LIBVER_V114;}
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1NBOUNDS(JNIEnv *env, jclass cls){return H5F_LIBVER_NBOUNDS;}
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;}
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ALL(JNIEnv *env, jclass cls) { return H5F_OBJ_ALL; }
@@ -426,6 +453,14 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) {
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5FD_1FAMILY(JNIEnv *env, jclass cls) { return H5FD_FAMILY; }
JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) {
+#ifdef H5_HAVE_LIBHDFS
+ return H5FD_HDFS;
+#else
+ return -1;
+#endif
+}
+JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG(JNIEnv *env, jclass cls) { return H5FD_LOG; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5FD_1MPIO(JNIEnv *env, jclass cls) { return H5FD_MPIO; }
@@ -434,6 +469,14 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1MULTI(JNIEnv *env, jclass cls) { return H5F
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5FD_1SEC2(JNIEnv *env, jclass cls) { return H5FD_SEC2; }
JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) {
+#ifdef H5_HAVE_ROS3_VFD
+ return H5FD_ROS3;
+#else
+ return -1;
+#endif
+}
+JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5FD_1STDIO(JNIEnv *env, jclass cls) { return H5FD_STDIO; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls) {
@@ -591,10 +634,10 @@ Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASET(JNIEnv *env, jclass cls) { return H5
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5I_1ATTR(JNIEnv *env, jclass cls) { return H5I_ATTR; }
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_HDF5Constants_H5I_1REFERENCE(JNIEnv *env, jclass cls) { return H5I_REFERENCE; }
-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; }
@@ -633,6 +676,20 @@ Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1WITHOUT_1ATTR_1FLAG(JNIEnv *env, jclas
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1PRESERVE_1NULL_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_PRESERVE_NULL_FLAG; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1BASIC(JNIEnv *env, jclass cls) { return H5O_INFO_BASIC; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1TIME(JNIEnv *env, jclass cls) { return H5O_INFO_TIME; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1NUM_1ATTRS(JNIEnv *env, jclass cls) { return H5O_INFO_NUM_ATTRS; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5O_1INFO_1ALL(JNIEnv *env, jclass cls) { return H5O_INFO_ALL; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1HDR(JNIEnv *env, jclass cls) { return H5O_NATIVE_INFO_HDR; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1META_1SIZE(JNIEnv *env, jclass cls) { return H5O_NATIVE_INFO_META_SIZE; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5O_1NATIVE_1INFO_1ALL(JNIEnv *env, jclass cls) { return H5O_NATIVE_INFO_ALL; }
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1NONE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_NONE_FLAG; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1SDSPACE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_SDSPACE_FLAG; }
@@ -656,6 +713,16 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NAMED_1DATATYPE(JNIEnv *env, jclass cls) { return H5O_TYPE_NAMED_DATATYPE; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NTYPES(JNIEnv *env, jclass cls) { return H5O_TYPE_NTYPES; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5O_1MAX_1TOKEN_1SIZE(JNIEnv *env, jclass cls) { return H5O_MAX_TOKEN_SIZE; }
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5O_1TOKEN_1UNDEF(JNIEnv *env, jclass cls)
+{
+ H5O_token_t undef_token = H5O_TOKEN_UNDEF;
+
+ /* TODO: Can be optimized by keeping a global reference to the undefined token class */
+ return create_H5O_token_t(env, &undef_token, FALSE);
+}
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1ROOT(JNIEnv *env, jclass cls){return H5P_ROOT;}
@@ -694,6 +761,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE(JNIEnv *env, jclass cls){return
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS;}
JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5P_1VOL_1INITIALIZE(JNIEnv *env, jclass cls){return H5P_VOL_INITIALIZE;}
+JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_CREATE_DEFAULT;}
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_ACCESS_DEFAULT;}
@@ -723,6 +792,8 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_CREATE_DEFAULT;}
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS_DEFAULT;}
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5P_1VOL_1INITIALIZE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_VOL_INITIALIZE_DEFAULT;}
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1TRACKED(JNIEnv *env, jclass cls){return H5P_CRT_ORDER_TRACKED;}
JNIEXPORT jint JNICALL
@@ -737,8 +808,14 @@ Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1ERROR(JNIEnv *env, jclass cls) { retu
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1FILTER(JNIEnv *env, jclass cls) { return H5PL_TYPE_FILTER; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1VOL(JNIEnv *env, jclass cls) { return H5PL_TYPE_VOL; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1NONE(JNIEnv *env, jclass cls) { return H5PL_TYPE_NONE; }
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5PL_1FILTER_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_FILTER_PLUGIN; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5PL_1VOL_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_VOL_PLUGIN; }
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5PL_1ALL_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_ALL_PLUGIN; }
JNIEXPORT jint JNICALL
@@ -746,13 +823,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; }
@@ -1144,6 +1233,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; }
@@ -1209,6 +1300,30 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5T_1VARIABLE(JNIEnv *env, jclass cls) { return (int)H5T_VARIABLE; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5T_1VLEN(JNIEnv *env, jclass cls) { return H5T_VLEN; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5T_1VL_1T(JNIEnv *env, jclass cls) { return sizeof(hvl_t); }
+
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1NONE(JNIEnv *env, jclass cls) { return H5VL_CAP_FLAG_NONE; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1THREADSAFE(JNIEnv *env, jclass cls) { return H5VL_CAP_FLAG_THREADSAFE; }
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE(JNIEnv *env, jclass cls) { return H5VL_NATIVE; }
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1NAME(JNIEnv *env, jclass cls) { return (jstring)ENVPTR->NewStringUTF(ENVONLY, H5VL_NATIVE_NAME); }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1VALUE(JNIEnv *env, jclass cls) { return H5VL_NATIVE_VALUE; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5VL_1NATIVE_1VERSION(JNIEnv *env, jclass cls) { return H5VL_NATIVE_VERSION; }
+
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1INVALID(JNIEnv *env, jclass cls) { return H5_VOL_INVALID; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1NATIVE(JNIEnv *env, jclass cls) { return H5_VOL_NATIVE; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1RESERVED(JNIEnv *env, jclass cls) { return H5_VOL_RESERVED; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5_1VOL_1MAX(JNIEnv *env, jclass cls) { return H5_VOL_MAX; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1CONT(JNIEnv *env, jclass cls) { return H5Z_CB_CONT; }
@@ -1295,7 +1410,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5Z_1SCALEOFFSET_1USER_1NPARMS(JNIEnv *env, jclas
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ALL(JNIEnv *env, jclass cls) { return H5Z_FILTER_ALL; }
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(missing-prototypes)
+H5_GCC_DIAG_ON(unused-parameter)
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c
index 2eeb075..f0dd691 100644
--- a/java/src/jni/h5Imp.c
+++ b/java/src/jni/h5Imp.c
@@ -35,8 +35,10 @@ extern "C" {
#include "h5jni.h"
#include "h5Imp.h"
-extern JavaVM *jvm;
-extern jobject visit_callback;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -47,10 +49,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5open
(JNIEnv *env, jclass clss)
{
- herr_t retVal = H5open();
- if (retVal < 0)
- h5libraryError(env);
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+ if ((retVal = H5open()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5open */
@@ -63,10 +69,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5close
(JNIEnv *env, jclass clss)
{
- herr_t retVal = H5close();
- if (retVal < 0)
- h5libraryError(env);
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5close()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5close */
@@ -79,10 +89,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5dont_1atexit
(JNIEnv *env, jclass clss)
{
- herr_t retVal = H5dont_atexit();
- if (retVal < 0)
- h5libraryError(env);
+ herr_t retVal = FAIL;
+ UNUSED(clss);
+
+ if ((retVal = H5dont_atexit()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5dont_1atexit */
@@ -95,28 +109,24 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5get_1libversion
(JNIEnv *env, jclass clss, jintArray libversion)
{
- unsigned *theArray = NULL;
- herr_t status = -1;
- jboolean isCopy;
-
- if (libversion == NULL) {
- h5nullArgument(env, "H5get_version: libversion is NULL");
- } /* end if */
- else {
- theArray = (unsigned*)ENVPTR->GetIntArrayElements(ENVPAR libversion, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError( env, "H5get_libversion: input not pinned");
- } /* end if */
- else {
- status = H5get_libversion(&(theArray[0]), &(theArray[1]), &(theArray[2]));
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray,0);
- } /* end else */
- } /* end else */
+ jboolean libversionArrayIsCopy;
+ int *libversionArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (libversion == NULL)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5get_libversion: libversion is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, libversion, libversionArray, &libversionArrayIsCopy, "H5get_libversion: libversion input not pinned");
+
+ if ((status = H5get_libversion((unsigned *) &(libversionArray[0]), (unsigned *) &(libversionArray[1]), (unsigned *) &(libversionArray[2]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (libversionArray)
+ UNPIN_INT_ARRAY(ENVONLY, libversion, libversionArray, (status < 0) ? JNI_ABORT : 0);
+
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5get_1libversion */
@@ -129,6 +139,9 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5check_1version
(JNIEnv *env, jclass clss, jint majnum, jint minnum, jint relnum)
{
+ UNUSED(env);
+ UNUSED(clss);
+
return (jint)H5check_version((unsigned)majnum, (unsigned)minnum, (unsigned)relnum);
} /* end Java_hdf_hdf5lib_H5_H5check_1version */
@@ -142,10 +155,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5garbage_1collect
(JNIEnv *env, jclass clss)
{
- herr_t retVal = H5garbage_collect();
- if (retVal < 0)
- h5libraryError(env);
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5garbage_collect()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5garbage_1collect */
@@ -159,11 +176,15 @@ Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits
(JNIEnv *env, jclass clss, jint reg_global_lim, jint reg_list_lim,
jint arr_global_lim, jint arr_list_lim, jint blk_global_lim, jint blk_list_lim )
{
- herr_t retVal = H5set_free_list_limits((int)reg_global_lim, (int)reg_list_lim,
- (int)arr_global_lim, (int)arr_list_lim, (int)blk_global_lim, (int)blk_list_lim);
- if (retVal < 0)
- h5libraryError(env);
+ herr_t retVal = FAIL;
+ UNUSED(clss);
+
+ if ((retVal = H5set_free_list_limits((int)reg_global_lim, (int)reg_list_lim,
+ (int)arr_global_lim, (int)arr_list_lim, (int)blk_global_lim, (int)blk_list_lim)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits */
@@ -177,7 +198,13 @@ Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe
(JNIEnv *env, jclass clss)
{
hbool_t is_ts = false;
- H5is_library_threadsafe(&is_ts);
+
+ UNUSED(clss);
+
+ if (H5is_library_threadsafe(&is_ts) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jboolean)is_ts;
} /* end Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe */
diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c
index 26ec4fc..8b3f9e5 100644
--- a/java/src/jni/h5aImp.c
+++ b/java/src/jni/h5aImp.c
@@ -21,35 +21,38 @@
extern "C" {
#endif /* __cplusplus */
-#include "hdf5.h"
-#include "h5util.h"
#include <jni.h>
#include <stdlib.h>
#include <string.h>
+#include "hdf5.h"
+#include "h5util.h"
+#include "h5jni.h"
#include "h5aImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
extern JavaVM *jvm;
-extern jobject visit_callback;
-#ifdef __cplusplus
-#define CBENVPTR (cbenv)
-#define CBENVPAR
-#define JVMPTR (jvm)
-#define JVMPAR
-#define JVMPAR2
-#else
-#define CBENVPTR (*cbenv)
-#define CBENVPAR cbenv,
-#define JVMPTR (*jvm)
-#define JVMPAR jvm
-#define JVMPAR2 jvm,
-#endif
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data);
+static herr_t H5AwriteVL_asstr(JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
+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 *cb_data);
+
+/********************/
+/* Local Macros */
+/********************/
/*
@@ -62,18 +65,22 @@ Java_hdf_hdf5lib_H5__1H5Acreate
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
jlong space_id, jlong create_plist)
{
- hid_t attr_id = -1;
- const char *aName;
+ const char *attrName = NULL;
+ hid_t attr_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- attr_id = H5Acreate2((hid_t)loc_id, aName, (hid_t)type_id, (hid_t)space_id, (hid_t)create_plist, (hid_t)H5P_DEFAULT);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, aName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Acreate: attribute name is NULL");
- if (attr_id < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Acreate: attribute name not pinned");
+
+ if ((attr_id = H5Acreate2((hid_t)loc_id, attrName, (hid_t)type_id, (hid_t)space_id, (hid_t)create_plist, (hid_t)H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, name, attrName);
return (jlong)attr_id;
} /* end Java_hdf_hdf5lib_H5__1H5Acreate */
@@ -87,18 +94,32 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aopen_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
- hid_t attr_id = -1;
- const char *aName;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ const char *attrName = NULL;
+#endif
+ hid_t attr_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- attr_id = H5Aopen_name((hid_t)loc_id, aName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name,aName);
+#ifdef H5_NO_DEPRECATED_SYMBOLS
+ UNUSED(loc_id);
+ UNUSED(name);
+ H5_UNIMPLEMENTED(ENVONLY, "H5Aopen_name: not implemented");
+#else
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_name: attribute name is null");
- if (attr_id < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Aopen_name: attribute name not pinned");
+
+ if((attr_id = H5Aopen_name((hid_t)loc_id, attrName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+#endif
+
+done:
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, name, attrName);
+#endif
return (jlong)attr_id;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1name */
@@ -112,85 +133,1312 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aopen_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jint idx)
{
- hid_t attr_id = H5Aopen_idx((hid_t)loc_id, (unsigned int) idx);
+ hid_t attr_id = H5I_INVALID_HID;
+
+ UNUSED(clss);
- if (attr_id < 0)
- h5libraryError(env);
+#ifdef H5_NO_DEPRECATED_SYMBOLS
+ UNUSED(loc_id);
+ UNUSED(idx);
+ H5_UNIMPLEMENTED(ENVONLY, "H5Aopen_idx: not implemented");
+#else
+ if ((attr_id = H5Aopen_idx((hid_t) loc_id, (unsigned int) idx)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+#endif
+done:
return (jlong)attr_id;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1idx */
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Aread
+ * Signature: (JJ[BZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning)
+{
+ jboolean readBufIsCopy;
+ jbyte *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread: read buffer not critically pinned");
+ }
+ else {
+ PIN_BYTE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread */
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Awrite
- * Signature: (JJ[B)I
+ * Signature: (JJ[BZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf)
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jbyte *byteP;
- jboolean isCopy;
+ jboolean writeBufIsCopy;
+ jbyte *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite: variable length type not supported");
- if (buf == NULL) {
- h5nullArgument( env,"H5Awrite: buf is NULL");
- } /* end if */
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite: write buffer not critically pinned");
+ }
else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (byteP == NULL) {
- h5JNIFatalError(env,"H5Awrite: buf is not pinned");
- } /* end if */
- else {
- status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, byteP);
+ PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite: write buffer not pinned");
+ }
- /* free the buffer without copying back */
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT);
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0)
- h5libraryError(env);
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
}
- } /* end else */
+ else {
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Awrite */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Aread
- * Signature: (JJ[B)I
+ * Method: H5Aread_short
+ * Signature: (JJ[SZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf)
+Java_hdf_hdf5lib_H5_H5Aread_1short
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jshortArray buf, jboolean isCriticalPinning)
+{
+ jboolean readBufIsCopy;
+ jshort *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_short: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_short: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_short: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_short: read buffer not critically pinned");
+ }
+ else {
+ PIN_SHORT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_short: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_SHORT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1short */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_short
+ * Signature: (JJ[SZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1short
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jshortArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jbyte *byteP;
- jboolean isCopy;
+ jboolean writeBufIsCopy;
+ jshort *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_short: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_short: variable length type not supported");
- if (buf == NULL) {
- h5nullArgument( env,"H5Aread: buf is NULL");
- } /* end if */
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_short: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_short: write buffer not critically pinned");
+ }
else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (byteP == NULL) {
- h5JNIFatalError( env,"H5Aread: buf is not pinned");
- } /* end if */
+ PIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_short: write buffer not pinned");
+ }
+
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, byteP);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Aread */
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1short */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_int
+ * Signature: (JJ[IZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1int
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jintArray buf, jboolean isCriticalPinning)
+{
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jint *readBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (buf == NULL)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_int: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_int: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_int: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_int: read buffer not critically pinned");
+ }
+ else {
+ PIN_INT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_int: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_INT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1int */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_int
+ * Signature: (JJ[IZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1int
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jintArray buf, jboolean isCriticalPinning)
+{
+ jboolean writeBufIsCopy;
+ jint *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (buf == NULL)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_int: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_int: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_int: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_int: write buffer not critically pinned");
+ }
+ else {
+ PIN_INT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_int: write buffer not pinned");
+ }
+
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_INT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1int */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_long
+ * Signature: (JJ[JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1long
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf, jboolean isCriticalPinning)
+{
+ jboolean readBufIsCopy;
+ jlong *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_long: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_long: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_long: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_long: read buffer not critically pinned");
+ }
+ else {
+ PIN_LONG_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_long: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_LONG_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1long */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_long
+ * Signature: (JJ[JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1long
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf, jboolean isCriticalPinning)
+{
+ jboolean writeBufIsCopy;
+ jlong *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_long: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_long: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_long: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_long: write buffer not critically pinned");
+ }
+ else {
+ PIN_LONG_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_long: write buffer not pinned");
+ }
+
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_LONG_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1long */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_float
+ * Signature: (JJ[FZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1float
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jfloatArray buf, jboolean isCriticalPinning)
+{
+ jboolean readBufIsCopy;
+ jfloat *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_float: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_float: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_float: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_float: read buffer not critically pinned");
+ }
+ else {
+ PIN_FLOAT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_float: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_FLOAT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1float */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_float
+ * Signature: (JJ[FZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1float
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jfloatArray buf, jboolean isCriticalPinning)
+{
+ jboolean writeBufIsCopy;
+ jfloat *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_float: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_float: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_float: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_float: write buffer not critically pinned");
+ }
+ else {
+ PIN_FLOAT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_float: write buffer not pinned");
+ }
+
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_FLOAT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1float */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_double
+ * Signature: (JJ[DZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1double
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jdoubleArray buf, jboolean isCriticalPinning)
+{
+ jboolean readBufIsCopy;
+ jdouble *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_double: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_double: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_double: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_double: read buffer not critically pinned");
+ }
+ else {
+ PIN_DOUBLE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_double: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_DOUBLE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1double */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_double
+ * Signature: (JJ[DZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1double
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jdoubleArray buf, jboolean isCriticalPinning)
+{
+ jboolean writeBufIsCopy;
+ jdouble *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_double: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_double: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_double: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_double: write buffer not critically pinned");
+ }
+ else {
+ PIN_DOUBLE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_double: write buffer not pinned");
+ }
+
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_DOUBLE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1double */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_string
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1string
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray j_buf)
+{
+ jstring jstr;
+ size_t str_len;
+ size_t pos;
+ jsize i, n;
+ char *c_buf = NULL;
+ char *cstr = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == j_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_string: read buffer is NULL");
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, j_buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_string: read buffer length <= 0");
+ }
+
+ if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (cstr = (char *) HDmalloc(str_len + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_string: memory allocation failed");
+
+ if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_string: memory allocation failed");
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, c_buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0, pos = 0; i < n; i++) {
+ HDmemcpy(cstr, c_buf+pos, str_len);
+ cstr[str_len] = '\0';
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, cstr))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_string: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, j_buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ pos += str_len;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (c_buf)
+ HDfree(c_buf);
+ if (cstr)
+ HDfree(cstr);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1string */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_string
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1string
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray j_buf)
+{
+ const char *utf8 = NULL;
+ jstring obj;
+ size_t i, str_len;
+ jsize n;
+ char *c_buf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == j_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_string: write buffer is NULL");
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, j_buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_string: write buffer length <= 0");
+ }
+
+ if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Awrite_string: memory allocation failed");
+
+ for (i = 0; i < (size_t) n; i++) {
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ HDmemset(&c_buf[i * str_len], 0, str_len);
+ continue;
+ }
+
+ /*
+ * length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ */
+
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5Awrite_string: string not pinned");
+
+ HDstrncpy(&c_buf[i * str_len], utf8, str_len);
+
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ } /* end for */
+
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, c_buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (c_buf)
+ HDfree(c_buf);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1string */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5AreadVL
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5AreadVL
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+{
+ H5T_class_t type_class;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
+ htri_t isComplex2 = 0;
+ hid_t nested_tid = H5I_INVALID_HID;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5AreadVL: read buffer is NULL");
+
+ if ((isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (type_class == H5T_COMPOUND) {
+ unsigned i;
+ int num_members;
+
+ if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (unsigned) num_members; i++) {
+ if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ isComplex = isComplex || isComplex2;
+
+ if (H5Tclose(nested_tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nested_tid = H5I_INVALID_HID;
+ }
+ }
+ else if (type_class == H5T_VLEN) {
+ isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
+ }
+
+ if (!isStr || isComplex || isVlenStr) {
+ if ((status = H5AreadVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else if (isStr) {
+ if ((status = H5AreadVL_str(env, (hid_t)attr_id, (hid_t)mem_type_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (nested_tid >= 0)
+ H5Tclose(nested_tid);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1VL */
+
+/*
+ * Helper method to read in a buffer of variable-length strings from an HDF5
+ * attribute. Each C-string is converted to a Java string and set in the output
+ * buffer in turn.
+ */
+static herr_t
+H5AreadVL_str
+ (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+{
+ jstring jstr;
+ jsize i, n;
+ char **strs = NULL;
+ herr_t status = FAIL;
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadVL_str: buf length < 0");
+ }
+
+ if (NULL == (strs = (char **) HDcalloc((size_t)n, sizeof(char *))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadVL_str: failed to allocate variable length string read buffer");
+
+ if ((status = H5Aread(aid, tid, strs)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /*
+ * When repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings),
+ * H5Treclaim() may crash on Windows because the Java GC will not be able to collect
+ * free space in time. Instead, we use "H5free_memory(strs[i])" to free individual strings
+ * once done.
+ */
+ for (i = 0; i < n; i++) {
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, strs[i])))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ H5free_memory(strs[i]);
+ strs[i] = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (strs) {
+ for (i = 0; i < n; i++) {
+ if (strs[i])
+ H5free_memory(strs[i]);
+ }
+
+ HDfree(strs);
+ }
+
+ return status;
+} /* end H5AreadVL_str */
+
+/*
+ * Helper method to read in a buffer of variable-length (hvl_t)
+ * structures from an HDF5 attribute and convert each variable-length
+ * element's buffer into a Java string. Each string is then set
+ * in the output buffer in turn.
+ */
+static herr_t
+H5AreadVL_asstr
+ (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+{
+ hsize_t dims[H5S_MAX_RANK];
+ jstring jstr;
+ h5str_t h5str;
+ size_t typeSize;
+ size_t i;
+ hid_t sid = H5I_INVALID_HID;
+ jsize n;
+ void *readBuf = NULL;
+ herr_t status = FAIL;
+
+ HDmemset(&h5str, 0, sizeof(h5str_t));
+
+ /* Get size of string array */
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadVL_asstr: buf length < 0");
+ }
+
+ dims[0] = (hsize_t)n;
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(typeSize = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (readBuf = HDcalloc((size_t)n, typeSize)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadVL_asstr: failed to allocate read buffer");
+
+ if ((status = H5Aread(aid, tid, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Allocate a decent-sized initial string */
+ h5str_new(&h5str, 4 * typeSize);
+
+ if (!h5str.s)
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadVL_asstr: failed to allocate buffer");
+
+ /* Convert each element to a char string */
+ for (i = 0; i < (size_t) n; i++) {
+ h5str.s[0] = '\0';
+
+ if (!h5str_sprintf(ENVONLY, &h5str, aid, tid, &(((char *) readBuf)[i * typeSize]), typeSize, 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize) i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (h5str.s)
+ h5str_free(&h5str);
+ if (readBuf) {
+ H5Treclaim(tid, sid, H5P_DEFAULT, readBuf);
+ HDfree(readBuf);
+ }
+ if (sid >= 0)
+ H5Sclose(sid);
+
+ return status;
+}
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5AwriteVL
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5AwriteVL
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+{
+ H5T_class_t type_class;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
+ htri_t isComplex2 = 0;
+ hid_t nested_tid = H5I_INVALID_HID;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL: write buffer is NULL");
+
+ if ((isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (type_class == H5T_COMPOUND) {
+ unsigned i;
+ int num_members;
+
+ if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for(i = 0; i < (unsigned) num_members; i++) {
+ if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ isComplex = isComplex || isComplex2;
+
+ if (H5Tclose(nested_tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nested_tid = H5I_INVALID_HID;
+ }
+ }
+ else if (type_class == H5T_VLEN) {
+ isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
+ }
+
+ if (!isStr || isComplex || isVlenStr) {
+ if ((status = H5AwriteVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else if (isStr) {
+ if ((status = H5AwriteVL_str(env, (hid_t)attr_id, (hid_t)mem_type_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (nested_tid >= 0)
+ H5Tclose(nested_tid);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1VL */
+
+/*
+ * Helper method to convert an array of Java strings into a buffer of C-strings.
+ * The buffer of C-strings is then written to the HDF5 attribute specified.
+ */
+static herr_t
+H5AwriteVL_str
+ (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+{
+ const char *utf8 = NULL;
+ jstring obj;
+ jsize size;
+ jint i;
+ char **writeBuf = NULL;
+ herr_t status = FAIL;
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, (jarray) buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL_str: buf length < 0");
+ }
+
+ if (NULL == (writeBuf = (char **) HDcalloc((size_t)size + 1, sizeof(char *))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate variable length string write buffer");
+
+ for (i = 0; i < size; ++i) {
+ jsize length;
+
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray) buf, i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ writeBuf[i] = NULL;
+ continue;
+ }
+
+ length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5AwriteVL_str: string not pinned");
+
+ if (NULL == (writeBuf[i] = (char *) HDmalloc((size_t)length + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate string buffer");
+
+ HDstrncpy(writeBuf[i], utf8, (size_t)length);
+ writeBuf[i][length] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ } /* end for (i = 0; i < size; ++i) */
+
+ if ((status = H5Awrite((hid_t)aid, (hid_t)tid, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (writeBuf) {
+ for (i = 0; i < size; i++) {
+ if (writeBuf[i])
+ HDfree(writeBuf[i]);
+ }
+
+ HDfree(writeBuf);
+ }
+
+ return (jint)status;
+}
+
+/*
+ * Helper method to convert an array of Java strings into a buffer of
+ * variable-length (hvl_t) elements. The buffer of variable-length
+ * elements is then written to the HDF5 attribute.
+ */
+static herr_t
+H5AwriteVL_asstr
+ (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+{
+ const char *utf8 = NULL;
+ hsize_t dims[H5S_MAX_RANK];
+ jstring jstr = NULL;
+ size_t typeSize;
+ size_t i;
+ hid_t sid = H5I_INVALID_HID;
+ jsize n;
+ void *writeBuf = NULL;
+ herr_t status = FAIL;
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL_asstr: buf length < 0");
+ }
+
+ dims[0] = (hsize_t)n;
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(typeSize = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (writeBuf = HDcalloc((size_t)n, typeSize)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer");
+
+ /*
+ * When repeatedly writing a dataset with a large number of strs (e.g., 1,000,000 strings),
+ * H5Treclaim() may crash on Windows because the Java GC will not be able to collect
+ * free space in time. Instead, we use "H5free_memory(strs[i])" to free individual strings
+ * once done.
+ */
+ for (i = 0; i < (size_t) n; i++) {
+ if (NULL == (jstr = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray) buf, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ HDmemset(&(((char *) writeBuf)[i * typeSize]), 0, typeSize);
+ continue;
+ }
+
+ /*
+ * length = ENVPTR->GetStringUTFLength(ENVONLY, jstr);
+ * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ */
+
+ PIN_JAVA_STRING(ENVONLY, jstr, utf8, NULL, "H5AwriteVL_asstr: failed to pin string buffer");
+
+ /*
+ * TODO: If the string isn't a copy, we should probably make
+ * one before destroying it with h5str_convert.
+ */
+
+ if (!h5str_convert(ENVONLY, (char **) &utf8, aid, tid, &(((char *) writeBuf)[i * typeSize]), 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ UNPIN_JAVA_STRING(ENVONLY, jstr, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for (i = 0; i < n; i++) */
+
+ if ((status = H5Awrite(aid, tid, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, jstr, utf8);
+ if (writeBuf) {
+ H5Treclaim(tid, sid, H5P_DEFAULT, writeBuf);
+ HDfree(writeBuf);
+ }
+ if (sid >= 0)
+ H5Sclose(sid);
+
+ return status;
+} /* end H5AwriteVL_str */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_reg_ref
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+{
+ H5R_ref_t *ref_data = NULL;
+ h5str_t h5str;
+ jstring jstr;
+ jsize i, n;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ HDmemset(&h5str, 0, sizeof(h5str_t));
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_reg_ref: buf length < 0");
+ }
+
+ if (NULL == (ref_data = (H5R_ref_t *) HDcalloc(1, (size_t)n * sizeof(H5R_ref_t))))
+ H5_OUT_OF_MEMORY_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)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ h5str_new(&h5str, 1024);
+
+ if (!h5str.s)
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate buffer");
+
+ for (i = 0; i < n; i++) {
+ h5str.s[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)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (h5str.s)
+ h5str_free(&h5str);
+ if (ref_data)
+ HDfree(ref_data);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref */
/*
* Class: hdf_hdf5lib_H5
@@ -201,12 +1449,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aget_1space
(JNIEnv *env, jclass clss, jlong attr_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Aget_space((hid_t)attr_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Aget_space((hid_t)attr_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aget_1space */
@@ -219,12 +1469,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aget_1type
(JNIEnv *env, jclass clss, jlong attr_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
- retVal = H5Aget_type((hid_t)attr_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Aget_type((hid_t)attr_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aget_1type */
@@ -237,34 +1489,29 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1name
(JNIEnv *env, jclass clss, jlong attr_id)
{
- char *aName;
jstring str = NULL;
ssize_t buf_size;
+ char *attrName = NULL;
+
+ UNUSED(clss);
+
+ if ((buf_size = H5Aget_name((hid_t)attr_id, 0, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (attrName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aget_name: failed to allocate attribute name buffer");
+
+ if (H5Aget_name((hid_t)attr_id, (size_t)buf_size + 1, attrName) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ attrName[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, attrName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (attrName)
+ HDfree(attrName);
- /* get the length of the name */
- buf_size = H5Aget_name((hid_t)attr_id, 0, NULL);
- if (buf_size <= 0) {
- h5badArgument(env, "H5Aget_name: buf_size <= 0");
- } /* end if */
- else {
- buf_size++; /* add extra space for the null terminator */
- aName = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (aName == NULL) {
- h5outOfMemory(env, "H5Aget_name: malloc failed");
- } /* end if */
- else {
- buf_size = H5Aget_name((hid_t)attr_id, (size_t)buf_size, aName);
- if (buf_size < 0) {
- HDfree(aName);
- h5libraryError(env);
- } /* end if */
- else {
- /* save the string; */
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- HDfree(aName);
- } /* end else */
- } /* end else */
- } /* end else */
return str;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1name */
@@ -277,12 +1524,19 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs
(JNIEnv *env, jclass clss, jlong loc_id)
{
- int retVal = -1;
+ int retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Aget_num_attrs((hid_t)loc_id);
- if (retVal < 0)
- h5libraryError(env);
+#ifdef H5_NO_DEPRECATED_SYMBOLS
+ UNUSED(loc_id);
+ H5_UNIMPLEMENTED(ENVONLY, "H5Aget_num_attrs: not implemented");
+#else
+ if ((retVal = H5Aget_num_attrs((hid_t)loc_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+#endif
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs */
@@ -295,18 +1549,22 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Adelete
(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
- herr_t status = -1;
- const char *aName;
+ const char *attrName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- status = H5Adelete((hid_t)loc_id, aName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, aName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete: attribute name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Adelete: attribute name not pinned");
+
+ if ((status = H5Adelete((hid_t)loc_id, attrName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, name, attrName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Adelete */
@@ -320,14 +1578,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Aclose
(JNIEnv *env, jclass clss, jlong attr_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- if (attr_id > 0)
- retVal = H5Aclose((hid_t)attr_id);
+ UNUSED(clss);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Aclose((hid_t)attr_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aclose */
@@ -341,24 +1599,27 @@ Java_hdf_hdf5lib_H5__1H5Acreate2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
jlong space_id, jlong create_plist, jlong access_plist)
{
- hid_t status = -1;
- const char *aName;
+ const char *attrName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- status = H5Acreate2((hid_t)loc_id, aName, (hid_t)type_id,
- (hid_t)space_id, (hid_t)create_plist, (hid_t)access_plist );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, aName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Acreate2: attribute name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Acreate2: attribute name not pinned");
+
+ if ((status = H5Acreate2((hid_t)loc_id, attrName, (hid_t)type_id,
+ (hid_t)space_id, (hid_t)create_plist, (hid_t)access_plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, name, attrName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Acreate2 */
-
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Aopen
@@ -369,18 +1630,22 @@ Java_hdf_hdf5lib_H5__1H5Aopen
(JNIEnv *env, jclass clss, jlong obj_id, jstring name, jlong access_plist)
{
- hid_t retVal = -1;
- const char *aName;
+ const char *attrName = NULL;
+ hid_t retVal = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- retVal = H5Aopen((hid_t)obj_id, aName, (hid_t)access_plist);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, aName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen: attribute name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Aopen: attribute name not pinned");
+
+ if ((retVal = H5Aopen((hid_t)obj_id, attrName, (hid_t)access_plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, name, attrName);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen */
@@ -394,19 +1659,23 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint idx_type, jint order, jlong n, jlong aapl_id, jlong lapl_id)
{
- hid_t retVal = -1;
- const char *aName;
+ const char *objName = NULL;
+ hid_t retVal = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- retVal = H5Aopen_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type,
- (H5_iter_order_t)order, (hsize_t)n, (hid_t)aapl_id, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, aName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_by_idx: object name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Aopen_by_idx: object name not pinned");
+
+ if ((retVal = H5Aopen_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
+ (H5_iter_order_t)order, (hsize_t)n, (hid_t)aapl_id, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx */
@@ -420,20 +1689,29 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong type_id, jlong space_id, jlong acpl_id, jlong aapl_id, jlong lapl_id)
{
- hid_t retVal = -1;
- const char *aName;
- const char *attrName;
+ const char *objName = NULL;
+ const char *attrName = NULL;
+ hid_t retVal = H5I_INVALID_HID;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- if (aName != NULL && attrName != NULL) {
- retVal = H5Acreate_by_name((hid_t)loc_id, aName, attrName, (hid_t)type_id,
- (hid_t)space_id, (hid_t)acpl_id, (hid_t)aapl_id, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Acreate_by_name: object name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Acreate_by_name: attribute name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Acreate_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Acreate_by_name: attribute name not pinned");
+
+ if ((retVal = H5Acreate_by_name((hid_t)loc_id, objName, attrName, (hid_t)type_id,
+ (hid_t)space_id, (hid_t)acpl_id, (hid_t)aapl_id, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name */
@@ -447,21 +1725,30 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Aexists_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id)
{
+ const char *objName = NULL;
+ const char *attrName = NULL;
htri_t bval = JNI_FALSE;
- const char *aName;
- const char *attrName;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- if (aName != NULL && attrName != NULL) {
- bval = H5Aexists_by_name((hid_t)loc_id, aName, attrName, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aexists_by_name: object name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aexists_by_name: attribute name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aexists_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aexists_by_name: attribute name not pinned");
+
+ if ((bval = H5Aexists_by_name((hid_t)loc_id, objName, attrName, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Aexists_1by_1name */
@@ -475,24 +1762,32 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Arename
(JNIEnv *env, jclass clss, jlong loc_id, jstring old_attr_name, jstring new_attr_name)
{
- herr_t retVal = -1;
- const char *oName;
- const char *nName;
+ const char *oldAttrName = NULL;
+ const char *newAttrName = NULL;
+ herr_t retVal = FAIL;
- PIN_JAVA_STRING_TWO(old_attr_name, oName, new_attr_name, nName);
- if (oName != NULL && nName != NULL) {
- retVal = H5Arename((hid_t)loc_id, oName, nName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(old_attr_name, oName, new_attr_name, nName);
+ if (NULL == old_attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename: old attribute name is NULL");
+ if (NULL == new_attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename: new attribute name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName, NULL, "H5Arename: old attribute name not pinned");
+ PIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName, NULL, "H5Arename: new attribute name not pinned");
+
+ if ((retVal = H5Arename((hid_t)loc_id, oldAttrName, newAttrName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newAttrName)
+ UNPIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName);
+ if (oldAttrName)
+ UNPIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Arename */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Arename_by_name
@@ -502,20 +1797,34 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Arename_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring old_attr_name, jstring new_attr_name, jlong lapl_id)
{
- herr_t retVal = -1;
- const char *aName;
- const char *oName;
- const char *nName;
-
- PIN_JAVA_STRING_THREE(obj_name, aName, old_attr_name, oName, new_attr_name, nName);
- if (aName != NULL && oName != NULL && nName != NULL) {
- retVal = H5Arename_by_name((hid_t)loc_id, aName, oName, nName, (hid_t)lapl_id);
-
- UNPIN_JAVA_STRING_THREE(obj_name, aName, old_attr_name, oName, new_attr_name, nName);
-
- if (retVal < 0)
- h5libraryError(env);
- }
+ const char *objName = NULL;
+ const char *oldAttrName = NULL;
+ const char *newAttrName = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename_by_name: object name is NULL");
+ if (NULL == old_attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename_by_name: old attribute name is NULL");
+ if (NULL == new_attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename_by_name: new attribute name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Arename_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName, NULL, "H5Arename_by_name: old attribute name not pinned");
+ PIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName, NULL, "H5Arename_by_name: new attribute name not pinned");
+
+ if ((retVal = H5Arename_by_name((hid_t)loc_id, objName, oldAttrName, newAttrName, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newAttrName)
+ UNPIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName);
+ if (oldAttrName)
+ UNPIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Arename_1by_1name */
@@ -529,51 +1838,40 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id)
{
- size_t buf_size;
- char *aValue;
- jlong status_size;
- jstring str = NULL;
- const char *aName;
-
- PIN_JAVA_STRING(obj_name, aName);
- if (aName != NULL) {
- /* get the length of the attribute name */
- status_size = H5Aget_name_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type,
- (H5_iter_order_t) order, (hsize_t) n, (char*)NULL, (size_t)0, (hid_t)lapl_id);
-
- if(status_size < 0) {
- UNPIN_JAVA_STRING(obj_name, aName);
- h5libraryError(env);
- } /* end if */
- else {
- buf_size = (size_t)status_size + 1;/* add extra space for the null terminator */
-
- aValue = (char*)HDmalloc(sizeof(char) * buf_size);
- if (aValue == NULL) {
- UNPIN_JAVA_STRING(obj_name, aName);
- h5outOfMemory(env, "H5Aget_name_by_idx: malloc failed ");
- } /* end if */
- else {
- status_size = H5Aget_name_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type,
- (H5_iter_order_t) order, (hsize_t) n, (char*)aValue, (size_t)buf_size, (hid_t)lapl_id);
-
- UNPIN_JAVA_STRING(obj_name, aName);
-
- if (status_size < 0) {
- HDfree(aValue);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aValue);
- HDfree(aValue);
- if (str == NULL) {
- /* exception -- fatal JNI error */
- h5JNIFatalError(env, "H5Aget_name_by_idx: return string not created");
- } /* end if */
- } /* end else */
- } /* end else */
- } /* end else */
- }
+ const char *objName = NULL;
+ jstring str = NULL;
+ ssize_t status_size = -1;
+ char *attrName = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_name_by_idx: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aget_name_by_idx: object name not pinned");
+
+ /* Get the length of the attribute name */
+ if ((status_size = H5Aget_name_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
+ (H5_iter_order_t) order, (hsize_t) n, (char *)NULL, (size_t)0, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (attrName = (char *) HDmalloc(sizeof(char) * (size_t) status_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Aget_name_by_idx: failed to allocate buffer for attribute name");
+
+ if ((H5Aget_name_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
+ (H5_iter_order_t) order, (hsize_t) n, (char *)attrName, (size_t)status_size + 1, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ attrName[status_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, attrName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (attrName)
+ HDfree(attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
+
return str;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx */
@@ -586,14 +1884,17 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1storage_1size
(JNIEnv *env, jclass clss, jlong attr_id)
{
- hsize_t retVal = (hsize_t)-1;
+ hsize_t retVal = 0;
+
+ UNUSED(clss);
+
+ if (!(retVal = H5Aget_storage_size((hid_t)attr_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Aget_storage_size((hid_t)attr_id);
-/* probably returns '0' if fails--don't do an exception */
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1storage_1size */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_info
@@ -603,23 +1904,23 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1info
(JNIEnv *env, jclass clss, jlong attr_id)
{
- herr_t status = -1;
H5A_info_t ainfo;
- jvalue args[4];
jobject ret_obj = NULL;
+ jvalue args[4];
- status = H5Aget_info((hid_t)attr_id, &ainfo);
+ UNUSED(clss);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].z = ainfo.corder_valid;
- args[1].j = ainfo.corder;
- args[2].i = ainfo.cset;
- args[3].j = (jlong)ainfo.data_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args);
- } /* end else */
+ if (H5Aget_info((hid_t)attr_id, &ainfo) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].z = ainfo.corder_valid;
+ args[1].j = ainfo.corder;
+ args[2].i = ainfo.cset;
+ args[3].j = (jlong)ainfo.data_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args, ret_obj);
+
+done:
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1info */
@@ -632,30 +1933,34 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id)
{
- herr_t status;
+ const char *objName = NULL;
H5A_info_t ainfo;
+ herr_t status;
jvalue args[4];
jobject ret_obj = NULL;
- const char *aName;
- PIN_JAVA_STRING(obj_name, aName);
- if (aName != NULL) {
- status = H5Aget_info_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type,
- (H5_iter_order_t)order, (hsize_t)n, &ainfo, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(obj_name, aName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_info_by_idx: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aget_info_by_idx: object name not pinned");
+
+ if ((status = H5Aget_info_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
+ (H5_iter_order_t)order, (hsize_t)n, &ainfo, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].z = ainfo.corder_valid;
+ args[1].j = ainfo.corder;
+ args[2].i = ainfo.cset;
+ args[3].j = (jlong)ainfo.data_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args, ret_obj);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].z = ainfo.corder_valid;
- args[1].j = ainfo.corder;
- args[2].i = ainfo.cset;
- args[3].j = (jlong)ainfo.data_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args);
- } /* end else */
- }
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx */
@@ -668,30 +1973,39 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id)
{
- const char *aName;
- const char *attrName;
- herr_t status;
+ const char *objName = NULL;
+ const char *attrName = NULL;
H5A_info_t ainfo;
+ herr_t status;
jvalue args[4];
jobject ret_obj = NULL;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- if (aName != NULL && attrName != NULL) {
- status = H5Aget_info_by_name((hid_t)loc_id, aName, attrName, &ainfo, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_info_by_name: object name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_info_by_name: attribute name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aget_info_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aget_info_by_name: attribute name not pinned");
+
+ if ((status = H5Aget_info_by_name((hid_t)loc_id, objName, attrName, &ainfo, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].z = ainfo.corder_valid;
+ args[1].j = ainfo.corder;
+ args[2].i = ainfo.cset;
+ args[3].j = (jlong)ainfo.data_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args, ret_obj);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].z = ainfo.corder_valid;
- args[1].j = ainfo.corder;
- args[2].i = ainfo.cset;
- args[3].j = (jlong)ainfo.data_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args);
- } /* end else */
- }
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name */
@@ -704,19 +2018,28 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Adelete_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id)
{
- herr_t retVal = -1;
- const char *aName;
- const char *attrName;
+ const char *objName = NULL;
+ const char *attrName = NULL;
+ herr_t retVal = FAIL;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- if (aName != NULL && attrName != NULL) {
- retVal = H5Adelete_by_name((hid_t)loc_id, aName, attrName, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete_by_name: object name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete_by_name: attribute name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Adelete_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Adelete_by_name: attribute name not pinned");
+
+ if ((retVal = H5Adelete_by_name((hid_t)loc_id, objName, attrName, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Adelete_1by_1name */
@@ -730,20 +2053,24 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Aexists
(JNIEnv *env, jclass clss, jlong obj_id, jstring attr_name)
{
+ const char *attrName = NULL;
htri_t bval = JNI_FALSE;
- const char *aName;
- PIN_JAVA_STRING(attr_name, aName);
- if (aName != NULL) {
- bval = H5Aexists((hid_t)obj_id, aName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(attr_name, aName);
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aexists: attribute name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aexists: attribute name not pinned");
+
+ if ((bval = H5Aexists((hid_t)obj_id, attrName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Aexists */
@@ -757,18 +2084,22 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id)
{
- herr_t status = -1;
- const char *aName;
+ const char *objName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(obj_name, aName);
- if (aName != NULL) {
- status = H5Adelete_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t)n, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(obj_name, aName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete_by_idx: object name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Adelete_by_idx: object name not pinned");
+
+ if ((status = H5Adelete_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t)n, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
} /* end Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx */
/*
@@ -781,19 +2112,28 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong aapl_id, jlong lapl_id)
{
- hid_t status = -1;
- const char *aName;
- const char *oName;
+ const char *attrName = NULL;
+ const char *objName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING_TWO(obj_name, oName, attr_name, aName);
- if (oName != NULL && aName != NULL) {
- status = H5Aopen_by_name((hid_t)loc_id, oName, aName, (hid_t)aapl_id, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(obj_name, oName, attr_name, aName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_by_name: object name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_by_name: attribute name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aopen_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aopen_by_name: attribute name not pinned");
+
+ if ((status = H5Aopen_by_name((hid_t)loc_id, objName, attrName, (hid_t)aapl_id, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name */
@@ -807,53 +2147,58 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist
(JNIEnv *env, jclass clss, jlong attr_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
- retVal = H5Aget_create_plist((hid_t)attr_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Aget_create_plist((hid_t)attr_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end 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) {
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
- jmethodID constructor;
- jvalue args[4];
- jobject cb_info_t = NULL;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
-
- args[0].z = info->corder_valid;
- args[1].j = info->corder;
- args[2].i = info->cset;
- args[3].j = (jlong)info->data_size;
- /* get a reference to your class if you don't have it already */
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5A_info_t");
- if (cls != 0) {
- /* get a reference to the constructor; the name is <init> */
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(ZJIJ)V");
- if (constructor != 0) {
- cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
-
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data);
- } /* end if (constructor != 0) */
- } /* end if (cls != 0) */
- } /* end if (mid != 0) */
- } /* end if (cls != 0) */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
+ (hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data) {
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ jmethodID mid;
+ jobject cb_info_t = NULL;
+ jobject visit_callback = wrapper->visit_callback;
+ jstring str;
+ JNIEnv *cbenv = NULL;
+ jclass cbcls;
+ jvalue args[4];
+ void *op_data = (void *)wrapper->op_data;
+ jint status = -1;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5A_iterate_cb: failed to attach current thread to JVM");
+ }
+
+ if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[0].z = info->corder_valid;
+ args[1].j = info->corder;
+ args[2].i = info->cset;
+ args[3].j = (jlong)info->data_size;
+
+ CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args, cb_info_t);
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, g_id, str, cb_info_t, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
} /* end H5A_iterate_cb */
@@ -868,22 +2213,24 @@ Java_hdf_hdf5lib_H5_H5Aiterate
(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
jlong idx, jobject callback_op, jobject op_data)
{
- hsize_t start_idx = (hsize_t)idx;
- herr_t status = -1;
+ cb_wrapper wrapper = { callback_op, op_data };
+ hsize_t start_idx = (hsize_t)idx;
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
+ UNUSED(clss);
- 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);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate: callback_op is NULL");
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ if ((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)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Aiterate */
@@ -897,27 +2244,31 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name
(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
jlong idx, jobject callback_op, jobject op_data, jlong access_id)
{
- const char *lName;
- hsize_t start_idx = (hsize_t)idx;
- herr_t status = -1;
+ const char *objName = NULL;
+ cb_wrapper wrapper = { callback_op, op_data };
+ hsize_t start_idx = (hsize_t)idx;
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
+ UNUSED(clss);
- if ((op_data == NULL) || (callback_op == NULL)) {
- h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
- } /* end if */
- 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);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate_by_name: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate_by_name: callback_op is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate_by_name: object name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
- } /* end else */
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Aiterate_by_name: object name not pinned");
+
+ if ((status = H5Aiterate_by_name((hid_t)grp_id, objName, (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)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name */
diff --git a/java/src/jni/h5aImp.h b/java/src/jni/h5aImp.h
index 62769fd..15cc83e 100644
--- a/java/src/jni/h5aImp.h
+++ b/java/src/jni/h5aImp.h
@@ -51,21 +51,174 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1idx
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Aread
+ * Signature: (JJ[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread
+ (JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Awrite
* Signature: (JJ[B)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite
- (JNIEnv *, jclass, jlong, jlong, jbyteArray);
+ (JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Aread
+ * Method: H5Aread_short
+ * Signature: (JJ[SZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1short
+ (JNIEnv*, jclass, jlong, jlong, jshortArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_short
+ * Signature: (JJ[SZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1short
+ (JNIEnv*, jclass, jlong, jlong, jshortArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_int
+ * Signature: (JJ[IZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1int
+ (JNIEnv*, jclass, jlong, jlong, jintArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_int
+ * Signature: (JJ[IZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1int
+ (JNIEnv*, jclass, jlong, jlong, jintArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_long
+ * Signature: (JJ[JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1long
+ (JNIEnv*, jclass, jlong, jlong, jlongArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_long
+ * Signature: (JJ[JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1long
+ (JNIEnv*, jclass, jlong, jlong, jlongArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_float
+ * Signature: (JJ[FZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1float
+ (JNIEnv*, jclass, jlong, jlong, jfloatArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_float
+ * Signature: (JJ[FZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1float
+ (JNIEnv*, jclass, jlong, jlong, jfloatArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_double
+ * Signature: (JJ[DZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1double
+ (JNIEnv*, jclass, jlong, jlong, jdoubleArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_double
+ * Signature: (JJ[DZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1double
+ (JNIEnv*, jclass, jlong, jlong, jdoubleArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5AreadVL
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5AreadVL
+ (JNIEnv *, jclass, jlong, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5AwriteVL
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5AwriteVL
+ (JNIEnv *, jclass, jlong, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_string
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1string
+ (JNIEnv*, jclass, jlong, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_string
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1string
+(JNIEnv*, jclass, jlong, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_VLStrings
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1VLStrings
+(JNIEnv*, jclass, jlong, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_VLStrings
* Signature: (JJ[B)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread
- (JNIEnv *, jclass, jlong, jlong, jbyteArray);
+Java_hdf_hdf5lib_H5_H5Awrite_1VLStrings
+ (JNIEnv*, jclass, jlong, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_reg_ref
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
+(JNIEnv*, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c
index 66efed0..bcefe12 100644
--- a/java/src/jni/h5dImp.c
+++ b/java/src/jni/h5dImp.c
@@ -27,125 +27,32 @@ extern "C" {
#include <string.h>
#include "hdf5.h"
#include "h5util.h"
+#include "h5jni.h"
#include "h5dImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
extern JavaVM *jvm;
-extern jobject visit_callback;
-#ifdef __cplusplus
- #ifdef _WINDOWS
- #include <direct.h>
- #endif
- #define CBENVPTR (cbenv)
- #define CBENVPAR
- #define JVMPTR (jvm)
- #define JVMPAR
- #define JVMPAR2
-#else
- #define CBENVPTR (*cbenv)
- #define CBENVPAR cbenv,
- #define JVMPTR (*jvm)
- #define JVMPAR jvm
- #define JVMPAR2 jvm,
-#endif
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5DreadVL_asstr (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DreadVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DreadVL_array (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DwriteVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DwriteVL_array (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
+static herr_t H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
+static herr_t H5DreadVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
+static herr_t 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);
+static herr_t H5DwriteVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
/********************/
/* Local Macros */
/********************/
-#define PIN_BYTE_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jbyte*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); \
-}
-
-#define UNPIN_BYTE_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, mode); \
-}
-
-#define PIN_SHORT_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jshort*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetShortArrayElements(ENVPAR buf, &isCopy); \
-}
-
-#define UNPIN_SHORT_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseShortArrayElements(ENVPAR buf, buffP, mode); \
-}
-
-#define PIN_INT_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jint*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetIntArrayElements(ENVPAR buf, &isCopy); \
-}
-
-#define UNPIN_INT_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseIntArrayElements(ENVPAR buf, buffP, mode); \
-}
-
-#define PIN_LONG_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jlong*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetLongArrayElements(ENVPAR buf,&isCopy); \
-}
-
-#define UNPIN_LONG_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, buffP, mode); \
-}
-
-#define PIN_FLOAT_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jfloat*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetFloatArrayElements(ENVPAR buf, &isCopy); \
-}
-
-#define UNPIN_FLOAT_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseFloatArrayElements(ENVPAR buf, buffP, mode); \
-}
-
-#define PIN_DOUBLE_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jdouble*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetDoubleArrayElements(ENVPAR buf, &isCopy); \
-}
-
-#define UNPIN_DOUBLE_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR buf, buffP, mode); \
-}
/*
* Class: hdf_hdf5lib_H5
@@ -157,18 +64,22 @@ Java_hdf_hdf5lib_H5__1H5Dcreate
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
jlong space_id, jlong create_plist_id)
{
- hid_t dset_id = -1;
- const char *fileName;
+ const char *dsetName = NULL;
+ hid_t dset_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- dset_id = H5Dcreate2((hid_t)loc_id, fileName, (hid_t)type_id, (hid_t)space_id, H5P_DEFAULT, (hid_t)create_plist_id, H5P_DEFAULT);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dcreate: dataset name is NULL");
- if (dset_id < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dcreate: dataset name not pinned");
+
+ if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, H5P_DEFAULT, (hid_t)create_plist_id, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dsetName)
+ UNPIN_JAVA_STRING(ENVONLY, name, dsetName);
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dcreate */
@@ -182,17 +93,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dopen
(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
- hid_t dset_id = -1;
- const char *fileName;
+ const char *dsetName = NULL;
+ hid_t dset_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- dset_id = H5Dopen2((hid_t)loc_id, fileName, H5P_DEFAULT);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
- if (dset_id < 0)
- h5libraryError(env);
- }
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dopen: dataset name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dopen: dataset name not pinned");
+
+ if ((dset_id = H5Dopen2((hid_t)loc_id, dsetName, H5P_DEFAULT)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dsetName)
+ UNPIN_JAVA_STRING(ENVONLY, name, dsetName);
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dopen */
@@ -206,12 +122,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dget_1space
(JNIEnv *env, jclass clss, jlong dataset_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Dget_space((hid_t)dataset_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Dget_space((hid_t)dataset_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Dget_1space */
@@ -224,12 +142,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dget_1type
(JNIEnv *env, jclass clss, jlong dataset_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
- retVal = H5Dget_type((hid_t)dataset_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Dget_type((hid_t)dataset_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Dget_1type */
@@ -242,40 +162,17 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist
(JNIEnv *env, jclass clss, jlong dataset_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Dget_create_plist((hid_t)dataset_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Dget_create_plist((hid_t)dataset_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist */
-static htri_t
-H5Tdetect_variable_str
- (hid_t tid) {
- htri_t ret_val = 0;
-
- if (H5Tget_class(tid) == H5T_COMPOUND) {
- unsigned i;
- unsigned nm = (unsigned)H5Tget_nmembers(tid);
- for(i = 0; i < nm; i++) {
- htri_t status = 0;
- hid_t mtid = 0;
- if((mtid = H5Tget_member_type(tid, i)) < 0)
- return -1; /* exit immediately on error */
- if((status = H5Tdetect_variable_str(mtid)) < 0)
- return status; /* exit immediately on error */
- ret_val |= status;
- H5Tclose (mtid);
- } /* end for */
- } /* end if */
- else
- ret_val = H5Tis_variable_str(tid);
-
- return ret_val;
-} /* end H5Tdetect_variable_str */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread
@@ -286,48 +183,49 @@ Java_hdf_hdf5lib_H5_H5Dread
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jbyte *readBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread: buf does not support variable length type");
- } /* end else if */
+ PIN_BYTE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_BYTE_ARRAY();
-
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_BYTE_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_BYTE_ARRAY(0); /* update java buffer for return */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread */
@@ -342,44 +240,49 @@ Java_hdf_hdf5lib_H5_H5Dwrite
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jbyte *writeBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite: write buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite: buf does not support variable length type");
- } /* end else if */
+ PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite: write buffer not pinned");
+ }
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_BYTE_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_BYTE_ARRAY(JNI_ABORT); /* no need to update buffer */
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite */
@@ -393,13 +296,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Dclose
(JNIEnv *env, jclass clss, jlong dataset_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Dclose((hid_t)dataset_id);
+ UNUSED(clss);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Dclose((hid_t)dataset_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Dclose */
@@ -412,15 +316,17 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Dget_1storage_1size
(JNIEnv *env, jclass clss, jlong dataset_id)
{
- hsize_t retVal = (hsize_t)-1;
+ hsize_t retVal = 0;
- if (dataset_id < 0) {
- h5badArgument(env, "H5Dget_storage_size: not a dataset");
- } /* end if */
- else {
- retVal = H5Dget_storage_size((hid_t)dataset_id);
- } /* end else */
+ UNUSED(clss);
+
+ if (dataset_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dget_storage_size: not a dataset");
+ if (!(retVal = H5Dget_storage_size((hid_t)dataset_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Dget_1storage_1size */
@@ -434,27 +340,35 @@ Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim
(JNIEnv *env, jclass clss, jlong type_id, jlong space_id,
jlong xfer_plist_id, jbyteArray buf)
{
- herr_t status = -1;
- jbyte *byteP;
- jboolean isCopy;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ jboolean vlenBufIsCopy;
+ jbyte *vlenBuf = NULL;
+#endif
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dvlen_reclaim: buf is NULL");
- } /* end if */
- else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Dvlen_reclaim: buf not pinned");
- } /* end if */
- else {
- status = H5Dvlen_reclaim((hid_t)type_id, (hid_t)space_id, (hid_t)xfer_plist_id, byteP);
+ UNUSED(clss);
+
+#ifdef H5_NO_DEPRECATED_SYMBOLS
+ UNUSED(type_id);
+ UNUSED(space_id);
+ UNUSED(xfer_plist_id);
+ UNUSED(buf);
+ H5_UNIMPLEMENTED(ENVONLY, "H5Dvlen_reclaim: not implemented");
+#else
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dvlen_reclaim: buffer is NULL");
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT);
+ PIN_BYTE_ARRAY(ENVONLY, buf, vlenBuf, &vlenBufIsCopy, "H5Dvlen_reclaim: buffer not pinned");
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ if ((status = H5Dvlen_reclaim((hid_t)type_id, (hid_t)space_id, (hid_t)xfer_plist_id, vlenBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+#endif
+
+done:
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ if (vlenBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, vlenBuf, (status < 0) ? JNI_ABORT : 0);
+#endif
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim */
@@ -469,47 +383,49 @@ Java_hdf_hdf5lib_H5_H5Dread_1short
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jshort *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ jshort *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_short: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_short: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_short: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_short: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_short: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_short: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread_short: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_short: buf does not support variable length type");
- } /* end else if */
+ PIN_SHORT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_short: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_SHORT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread_short: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_SHORT_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_SHORT_ARRAY(0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_SHORT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1short */
@@ -524,44 +440,49 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1short
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jshort *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ jshort *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
- if (buf == NULL ) {
- h5nullArgument(env, "H5Dwrite_short: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_short: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_short: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_short: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_short: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_short: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_short: write buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_short: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_short: buf does not support variable length type");
- } /* end else if */
+ PIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_short: write buffer not pinned");
+ }
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_SHORT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite_short: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_SHORT_ARRAY(JNI_ABORT);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1short */
@@ -576,47 +497,49 @@ Java_hdf_hdf5lib_H5_H5Dread_1int
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jint *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jint *readBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_int: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread_int: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_int: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_int: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_int: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_int: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_int: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread_int: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_int: buf does not support variable length type");
- } /* end else if */
+ PIN_INT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_int: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_INT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread_int: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_INT_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_INT_ARRAY(0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_INT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1int */
@@ -631,44 +554,49 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1int
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jint *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jint *writeBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite_int: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_int: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_int: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_int: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_int: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_int: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_int: write buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_int: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_int: buf does not support variable length type");
- } /* end else if */
+ PIN_INT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_int: write buffer not pinned");
+ }
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_INT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite_int: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_INT_ARRAY(JNI_ABORT);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_INT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1int */
@@ -683,47 +611,49 @@ Java_hdf_hdf5lib_H5_H5Dread_1long
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jlong *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jlong *readBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_long: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread_long: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_long: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_long: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_long: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_long: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_long: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread_long: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_long: buf does not support variable length type");
- } /* end else if */
+ PIN_LONG_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_long: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_LONG_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread_long: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_LONG_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_LONG_ARRAY(0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_LONG_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1long */
@@ -738,43 +668,49 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1long
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jlong *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jlong *writeBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite_long: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_long: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_long: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_long: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_long: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_long: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_long: write buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_long: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_long: buf does not support variable length type");
- } /* end else if */
+ PIN_LONG_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_long: write buffer not pinned");
+ }
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_LONG_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite_long: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_LONG_ARRAY(JNI_ABORT);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_LONG_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1long */
@@ -789,47 +725,49 @@ Java_hdf_hdf5lib_H5_H5Dread_1float
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jfloat *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jfloat *readBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_float: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread_float: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_float: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_float: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_float: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_float: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_float: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread_float: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_float: buf does not support variable length type");
- } /* end else if */
+ PIN_FLOAT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_float: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_FLOAT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread_float: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_FLOAT_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_FLOAT_ARRAY(0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_FLOAT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1float */
@@ -844,43 +782,49 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1float
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jfloat *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jfloat *writeBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite_float: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_float: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_float: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_float: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_float: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_float: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_float: write buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_float: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_float: buf does not support variable length type");
- } /* end else if */
+ PIN_FLOAT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_float: write buffer not pinned");
+ }
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_FLOAT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite_float: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_FLOAT_ARRAY(JNI_ABORT);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_FLOAT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1float */
@@ -895,47 +839,49 @@ Java_hdf_hdf5lib_H5_H5Dread_1double
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jdouble *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ jdouble *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_double: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread_double: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_double: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_double: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_double: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_double: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_double: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread_double: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_double: buf does not support variable length type");
- } /* end else if */
+ PIN_DOUBLE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_double: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_DOUBLE_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread_double: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_DOUBLE_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_DOUBLE_ARRAY(0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_DOUBLE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1double */
@@ -950,136 +896,52 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1double
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jdouble *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ jdouble *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite_double: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_double: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_double: buf does not support variable length type");
- } /* end else if */
- else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_double: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_double: buf does not support variable length type");
- } /* end else if */
- else {
- PIN_DOUBLE_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite_double: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_DOUBLE_ARRAY(JNI_ABORT);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNUSED(clss);
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1double */
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_double: write buffer is NULL");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5DreadVL
- * Signature: (JJJJJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5DreadVL
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
-{
- herr_t status = -1;
- htri_t isVlenStr=0;
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (buf == NULL) {
- h5nullArgument(env, "H5DreadVL: buf is NULL");
- } /* end if */
- else {
- isVlenStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING);
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_double: variable length type not supported");
- if (isVlenStr)
- h5badArgument(env, "H5DreadVL: type is not variable length non-string");
- else
- status = H5DreadVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id,
- (hid_t)xfer_plist_id, buf);
- } /* end else */
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dread_1VLStrings */
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_double: variable length type not supported");
-herr_t
-H5DreadVL_asstr
- (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
-{
- jint i;
- jint n;
- jstring jstr;
- h5str_t h5str;
- hvl_t *rdata;
- size_t size;
- size_t max_len = 0;
- herr_t status = -1;
-
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- rdata = (hvl_t*)HDcalloc((size_t)n, sizeof(hvl_t));
- if (rdata == NULL) {
- h5JNIFatalError(env, "H5DreadVL_notstr: failed to allocate buff for read");
- } /* end if */
+ if (isCriticalPinning) {
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_double: write buffer not critically pinned");
+ }
else {
- status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, rdata);
+ PIN_DOUBLE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_double: write buffer not pinned");
+ }
- if (status < 0) {
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, rdata);
- HDfree(rdata);
- h5JNIFatalError(env, "H5DreadVL_notstr: failed to read data");
- } /* end if */
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- max_len = 1;
- for (i=0; i < n; i++) {
- if ((rdata + i)->len > max_len)
- max_len = (rdata + i)->len;
- }
-
- size = H5Tget_size(tid) * max_len;
- HDmemset(&h5str, 0, sizeof(h5str_t));
- h5str_new(&h5str, 4 * size);
-
- if (h5str.s == NULL) {
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, rdata);
- HDfree(rdata);
- h5JNIFatalError(env, "H5DreadVL_notstr: failed to allocate buf");
- } /* end if */
- else {
- for (i=0; i < n; i++) {
- h5str.s[0] = '\0';
- h5str_sprintf(&h5str, did, tid, rdata+i, 0);
- jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s);
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- } /* end for */
- h5str_free(&h5str);
-
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, rdata);
- HDfree(rdata);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_DOUBLE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
- return status;
-}
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1double */
/*
* Class: hdf_hdf5lib_H5
@@ -1091,68 +953,59 @@ Java_hdf_hdf5lib_H5_H5Dread_1string
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf)
{
- herr_t status = -1;
- char *c_buf;
- char *cstr;
- size_t str_len;
- jsize i;
- jsize n;
- size_t pos;
- jstring jstr;
-
- c_buf = cstr = NULL;
- if (j_buf == NULL) {
- h5nullArgument(env, "H5Dread_string: buf is NULL");
- } /* end if */
- else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) {
- h5nullArgument(env, "H5Dread_string: buf length <= 0");
- } /* end else if */
- else if ((str_len = H5Tget_size((hid_t)mem_type_id)) <=0) {
- h5libraryError(env);
- } /* end else if */
- else {
- if ((cstr = (char*)HDmalloc(str_len + 1)) == NULL) {
- h5JNIFatalError(env, "H5Dread_string: memory allocation failed.");
- } /* end if */
- else {
- if ((c_buf = (char*)HDmalloc((size_t)n * str_len)) == NULL) {
- if (cstr)
- HDfree(cstr);
- cstr = NULL;
- h5JNIFatalError(env, "H5Dread_string: memory allocation failed.");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf);
-
- if (status < 0) {
- if (cstr)
- HDfree(cstr);
- cstr = NULL;
- if (c_buf)
- HDfree(c_buf);
- c_buf = NULL;
- h5libraryError(env);
- } /* end if */
- else {
- pos = 0;
- for (i = 0; i < n; i++) {
- HDmemcpy(cstr, c_buf+pos, str_len);
- cstr[str_len] = '\0';
- jstr = ENVPTR->NewStringUTF(ENVPAR cstr);
- ENVPTR->SetObjectArrayElement(ENVPAR j_buf, i, jstr);
- pos += str_len;
- } /* end for */
- } /* end else */
-
- if (c_buf)
- HDfree(c_buf);
- } /* end else cbuf allocation*/
-
- if (cstr)
- HDfree(cstr);
- } /* end else cstr allocation*/
- } /* end else */
+ jstring jstr;
+ size_t str_len;
+ size_t pos;
+ jsize i, n;
+ char *c_buf = NULL;
+ char *cstr = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == j_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_string: read buffer is NULL");
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, j_buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_string: read buffer length <= 0");
+ }
+
+ if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (cstr = (char *) HDmalloc(str_len + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: memory allocation failed");
+
+ if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: memory allocation failed");
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0, pos = 0; i < n; i++) {
+ HDmemcpy(cstr, c_buf+pos, str_len);
+ cstr[str_len] = '\0';
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, cstr))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, j_buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ pos += str_len;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (c_buf)
+ HDfree(c_buf);
+ if (cstr)
+ HDfree(cstr);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1string */
@@ -1167,361 +1020,665 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf)
{
- herr_t status = -1;
- char *c_buf;
- jsize str_len;
- jsize i;
- jsize n;
-
- if (j_buf == NULL) {
- h5nullArgument(env, "H5Dwrite_string: buf is NULL");
- } /* end if */
- else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) {
- h5nullArgument(env, "H5Dwrite_string: buf length <= 0");
- } /* end else if */
- else if ((str_len = (jsize)H5Tget_size((hid_t)mem_type_id)) <=0) {
- h5libraryError(env);
- } /* end else if */
- else {
- if ((c_buf = (char*)HDmalloc((size_t)n * (size_t)str_len)) == NULL) {
- h5JNIFatalError(env, "H5Dwrite_string: memory allocation failed.");
- } /* end if */
- else {
- for (i = 0; i < n; i++) {
- jstring obj = (jstring)ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray)j_buf, i);
- if (obj != 0) {
- jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj);
- const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
-
- if (utf8) {
- strncpy(&c_buf[i * str_len], utf8, str_len);
- } /* end if */
-
- ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
- ENVPTR->DeleteLocalRef(ENVPAR obj);
- } /* end if */
- } /* end for */
-
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf);
-
- if (c_buf)
- HDfree(c_buf);
- c_buf = NULL;
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- } /* end else */
- } /* end else */
+ const char *utf8 = NULL;
+ jstring obj;
+ size_t i, str_len;
+ jsize n;
+ char *c_buf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == j_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_string: write buffer is NULL");
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, j_buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_string: write buffer length <= 0");
+ }
+
+ if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dwrite_string: memory allocation failed");
+
+ for (i = 0; i < (size_t) n; i++) {
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ HDmemset(&c_buf[i * str_len], 0, str_len);
+ continue;
+ }
+
+ /*
+ * length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ */
+
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5Dwrite_string: string not pinned");
+
+ HDstrncpy(&c_buf[i * str_len], utf8, str_len);
+
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ } /* end for */
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (c_buf)
+ HDfree(c_buf);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1string */
-/**
- * Read VLEN data into array of arrays.
- * Object[] buf contains VL arrays of data points
- * Currently only deal with variable length of atomic data types
- */
-/* old version */
-
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Dread_VLStrings
+ * Method: H5DreadVL
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1VLStrings
+Java_hdf_hdf5lib_H5_H5DreadVL
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
- herr_t status = -1;
- htri_t isVlenStr=0;
+ H5T_class_t type_class;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
+ htri_t isComplex2 = 0;
+ hid_t nested_tid = H5I_INVALID_HID;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_VLStrings: buf is NULL");
- } /* end if */
- else {
- isVlenStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING);
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5DreadVL: read buffer is NULL");
+
+ if ((isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (type_class == H5T_COMPOUND) {
+ unsigned i;
+ int num_members;
+
+ if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (unsigned) num_members; i++) {
+ if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ isComplex = isComplex || isComplex2;
- if (isVlenStr) {
- status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id,
- (hid_t)xfer_plist_id, buf);
- } /* end if */
- else
- h5badArgument(env, "H5Dread_VLStrings: type is not variable length String");
- } /* end else */
+ if (H5Tclose(nested_tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nested_tid = H5I_INVALID_HID;
+ }
+ }
+ else if (type_class == H5T_VLEN) {
+ isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
+ }
+
+ if (!isStr || isComplex || isVlenStr) {
+ if ((status = H5DreadVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else if (isStr) {
+ if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (nested_tid >= 0)
+ H5Tclose(nested_tid);
return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dread_1VLStrings */
+} /* end Java_hdf_hdf5lib_H5_H5Dread_1VL */
-herr_t
+/*
+ * Helper method to read in a buffer of variable-length strings from an HDF5
+ * dataset. Each C-string is converted to a Java string and set in the output
+ * buffer in turn.
+ */
+static herr_t
H5DreadVL_str
(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
{
- char **strs;
- jstring jstr;
- jint i;
- jint n;
- herr_t status = -1;
+ jstring jstr;
+ jsize i, n;
+ char **strs = NULL;
+ herr_t status = FAIL;
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- strs =(char**)HDcalloc((size_t)n, sizeof(char*));
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DreadVL_str: buf length < 0");
+ }
- if (strs == NULL) {
- h5JNIFatalError(env, "H5DreadVL_str: failed to allocate buff for read variable length strings");
- } /* end if */
- else {
- status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, strs);
+ if (NULL == (strs = (char **) HDcalloc((size_t)n, sizeof(char *))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL_str: failed to allocate variable length string read buffer");
- if (status < 0) {
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs);
- HDfree(strs);
- h5JNIFatalError(env, "H5DreadVL_str: failed to read variable length strings");
- } /* end if */
- else {
- for (i=0; i < n; i++) {
- jstr = ENVPTR->NewStringUTF(ENVPAR strs[i]);
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- H5free_memory (strs[i]);
- } /* end for */
+ if ((status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, strs)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- /*
- for repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings,
- H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect
- free space in time. Instead, use "H5free_memory(strs[i])" above to free individual strings
- after it is done.
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs);
- */
+ /*
+ * When repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings),
+ * H5Treclaim() may crash on Windows because the Java GC will not be able to collect
+ * free space in time. Instead, we use "H5free_memory(strs[i])" to free individual strings
+ * once done.
+ */
+ for (i = 0; i < n; i++) {
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, strs[i])))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- HDfree(strs);
- } /* end else */
- } /* end else */
+ H5free_memory(strs[i]);
+ strs[i] = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (strs) {
+ for (i = 0; i < n; i++) {
+ if (strs[i])
+ H5free_memory(strs[i]);
+ }
+
+ HDfree(strs);
+ }
return status;
} /* end H5DreadVL_str */
+/*
+ * Helper method to read in a buffer of variable-length (hvl_t)
+ * structures from an HDF5 dataset and convert each variable-length
+ * element's buffer into a Java string. Each string is then set
+ * in the output buffer in turn.
+ */
+static herr_t
+H5DreadVL_asstr
+ (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
+{
+ H5T_class_t tclass;
+ jstring jstr;
+ h5str_t h5str;
+ hbool_t close_mem_space = FALSE;
+ size_t typeSize;
+ size_t i;
+ hid_t mem_space = mem_sid;
+ jsize n;
+ void *readBuf = NULL;
+ herr_t status = FAIL;
+
+ HDmemset(&h5str, 0, sizeof(h5str_t));
+
+ if (mem_space == H5S_ALL) {
+ mem_space = file_sid;
+
+ if (mem_space == H5S_ALL) {
+ /*
+ * Retrieve a valid dataspace for H5Treclaim().
+ */
+ if ((mem_space = H5Dget_space(did)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ close_mem_space = TRUE;
+
+ if (H5Sselect_all(mem_space) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ }
+
+ /* Get size of string array */
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DreadVL_asstr: buf length < 0");
+ }
+
+ if (!(typeSize = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (readBuf = HDcalloc((size_t)n, typeSize)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL_asstr: failed to allocate read buffer");
+
+ if ((status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Allocate a decent-sized initial string */
+ h5str_new(&h5str, 4 * typeSize);
+
+ if (!h5str.s)
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL_asstr: failed to allocate buffer");
+
+ if ((tclass = H5Tget_class(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Convert each element to a char string */
+ for (i = 0; i < (size_t) n; i++) {
+ h5str.s[0] = '\0';
+
+ if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *) readBuf)[i * typeSize]), typeSize, 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize) i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (h5str.s)
+ h5str_free(&h5str);
+ if (readBuf) {
+ H5Treclaim(tid, mem_space, xfer_plist_id, readBuf);
+ HDfree(readBuf);
+ }
+ if (close_mem_space)
+ H5Sclose(mem_space);
+
+ return status;
+}
+
+/**
+ * Read VLEN data into array of arrays.
+ * Object[] buf contains VL arrays of data points
+ * Currently only deal with variable length of atomic data types
+ */
+/* old version */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Dwrite_VLStrings
+ * Method: H5Dread_VLStrings
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings
+Java_hdf_hdf5lib_H5_H5Dread_1VLStrings
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
- herr_t status = -1;
- htri_t isVlenStr=0;
+ htri_t isVlenStr = 0;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite_VLStrings: buf is NULL");
- } /* end if */
- else {
- isVlenStr = H5Tis_variable_str((hid_t)mem_type_id);
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_VLStrings: read buffer is NULL");
+
+ if ((isVlenStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (isVlenStr) {
- status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id,
- (hid_t)xfer_plist_id, buf);
- } /* end if */
- else
- h5badArgument(env, "H5Dwrite_VLStrings: type is not variable length String");
- } /* end else */
+ if (isVlenStr) {
+ if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ else
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_VLStrings: datatype is not variable length String");
+done:
return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings */
+} /* end Java_hdf_hdf5lib_H5_H5Dread_1VLStrings */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5DwriteVL
+ * Signature: (JJJJJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5DwriteVL
+ (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
+ jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
+{
+ H5T_class_t type_class;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
+ htri_t isComplex2 = 0;
+ hid_t nested_tid = H5I_INVALID_HID;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
-herr_t
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL: write buffer is NULL");
+
+ if ((isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (type_class == H5T_COMPOUND) {
+ unsigned i;
+ int num_members;
+
+ if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (unsigned) num_members; i++) {
+ if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ isComplex = isComplex || isComplex2;
+
+ if (H5Tclose(nested_tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nested_tid = H5I_INVALID_HID;
+ }
+ }
+ else if (type_class == H5T_VLEN) {
+ isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
+ }
+
+ if (!isStr || isComplex || isVlenStr) {
+ if ((status = H5DwriteVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else if (isStr) {
+ if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (nested_tid >= 0)
+ H5Tclose(nested_tid);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VL */
+
+/*
+ * Helper method to convert an array of Java strings into a buffer of C-strings.
+ * The buffer of C-strings is then written to the HDF5 dataset specified.
+ */
+static herr_t
H5DwriteVL_str
(JNIEnv *env, hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, jobjectArray buf)
{
- herr_t status = -1;
- char **wdata;
- jsize size;
- jsize i;
+ const char *utf8 = NULL;
+ jstring obj;
+ jsize size;
+ jsize i;
+ char **writeBuf = NULL;
+ herr_t status = FAIL;
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, (jarray) buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL_str: buf length < 0");
+ }
- size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf);
- wdata = (char**)HDmalloc((size_t)size * sizeof (char*));
+ if (NULL == (writeBuf = (char **) HDcalloc((size_t)size + 1, sizeof(char *))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate variable length string write buffer");
- if (!wdata) {
- h5JNIFatalError(env, "H5DwriteVL_string: cannot allocate buffer");
- } /* end if */
- else {
- HDmemset(wdata, 0, (size_t)size * sizeof(char*));
- for (i = 0; i < size; ++i) {
- jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray)buf, i);
- if (obj != 0) {
- jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj);
- const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
-
- if (utf8) {
- wdata[i] = (char*)HDmalloc((size_t)length + 1);
- if (wdata[i]) {
- HDmemset(wdata[i], 0, (size_t)length + 1);
- HDstrncpy(wdata[i], utf8, (size_t)length + 1);
- } /* end if */
- } /* end if */
-
- ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
- ENVPTR->DeleteLocalRef(ENVPAR obj);
- } /* end if */
- } /* end for (i = 0; i < size; ++i) */
-
- status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, wdata);
-
- /* now free memory*/
+ for (i = 0; i < size; ++i) {
+ jsize length;
+
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ writeBuf[i] = NULL;
+ continue;
+ }
+
+ length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5DwriteVL_str: string not pinned");
+
+ if (NULL == (writeBuf[i] = (char *) HDmalloc((size_t)length + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate string buffer");
+
+ HDstrncpy(writeBuf[i], utf8, (size_t)length + 1);
+ writeBuf[i][length] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ } /* end for (i = 0; i < size; ++i) */
+
+ if ((status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (writeBuf) {
for (i = 0; i < size; i++) {
- if(wdata[i]) {
- HDfree(wdata[i]);
- } /* end if */
- } /* end for */
- HDfree(wdata);
+ if (writeBuf[i])
+ HDfree(writeBuf[i]);
+ }
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ HDfree(writeBuf);
+ }
return status;
} /* end H5DwriteVL_str */
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Dread_reg_ref
- * Signature: (JJJJJ[Ljava/lang/String;)I
+ * Helper method to convert an array of Java strings into a buffer of
+ * variable-length (hvl_t) elements. The buffer of variable-length
+ * elements is then written to the HDF5 dataset.
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
- (JNIEnv *env, jclass clss,
- jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
+static herr_t
+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)
{
- herr_t status = -1;
- h5str_t h5str;
- size_t size;
- hdset_reg_ref_t *ref_data;
- jint i;
- jint n;
- jstring jstr;
+ const char *utf8 = NULL;
+ jstring obj = NULL;
+ hbool_t close_mem_space = FALSE;
+ size_t typeSize;
+ size_t i;
+ hid_t mem_space = mem_sid;
+ jsize n;
+ void *writeBuf = NULL;
+ herr_t status = FAIL;
+
+ if (mem_space == H5S_ALL) {
+ mem_space = file_sid;
+
+ if (mem_space == H5S_ALL) {
+ /*
+ * Retrieve a valid dataspace for H5Treclaim().
+ */
+ if ((mem_space = H5Dget_space(did)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ close_mem_space = TRUE;
+
+ if (H5Sselect_all(mem_space) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ }
- hid_t region = -1;
- hid_t did = (hid_t) dataset_id;
- hid_t tid = (hid_t) mem_type_id;
- hid_t mem_sid = (hid_t) mem_space_id;
- hid_t file_sid = (hid_t) file_space_id;
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL_asstr: buf length < 0");
+ }
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/
- ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n);
+ if (!(typeSize = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
- if (ref_data == NULL) {
- h5JNIFatalError(env, "H5Dread_reg_ref: failed to allocate buff for read");
- return -1;
- } /* end if */
+ if (NULL == (writeBuf = HDcalloc((size_t)n, typeSize)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer");
- status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, ref_data);
+ for (i = 0; i < (size_t) n; ++i) {
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (status < 0) {
- HDfree(ref_data);
- h5JNIFatalError(env, "H5Dread_reg_ref: failed to read data");
- return -1;
- } /* end if */
+ /*
+ * If the string object was NULL, skip it.
+ */
+ HDmemset(&(((char *) writeBuf)[i * typeSize]), 0, typeSize);
+ continue;
+ }
- HDmemset(&h5str, 0, sizeof(h5str_t));
- h5str_new(&h5str, 1024);
- for (i=0; i<n; i++) {
- h5str.s[0] = '\0';
- h5str_sprintf(&h5str, did, tid, ref_data[i], 0);
- jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s);
+ /*
+ * length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ */
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- } /* end for */
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5DwriteVL_asstr: failed to pin string buffer");
+
+ /*
+ * TODO: If the string isn't a copy, we should probably make
+ * one before destroying it with h5str_convert.
+ */
+
+ if (!h5str_convert(ENVONLY, (char **) &utf8, did, tid, &(((char *) writeBuf)[i * typeSize]), 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- h5str_free(&h5str);
- HDfree(ref_data);
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ } /* end for (i = 0; i < size; ++i) */
+
+ if ((status = H5Dwrite(did, tid, mem_sid, file_sid, xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (writeBuf) {
+ H5Treclaim(tid, mem_space, xfer_plist_id, writeBuf);
+ HDfree(writeBuf);
+ }
+ if (close_mem_space)
+ H5Sclose(mem_space);
+
+ return status;
+} /* end H5DwriteVL_asstr */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Dwrite_VLStrings
+ * Signature: (JJJJJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings
+ (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
+ jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
+{
+ htri_t isVlenStr = 0;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_VLStrings: write buffer is NULL");
+
+ if ((isVlenStr = H5Tis_variable_str((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (isVlenStr) {
+ if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ } /* end if */
+ else
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_VLStrings: datatype is not variable length String");
+
+done:
return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref */
+} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Dread_reg_ref_data
+ * Method: H5Dread_reg_ref
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data
+Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
(JNIEnv *env, jclass clss,
jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
- herr_t status = -1;
- h5str_t h5str;
- size_t size;
- hdset_reg_ref_t *ref_data;
- jint i;
- jint n;
- jstring jstr;
+ H5R_ref_t *ref_data = NULL;
+ h5str_t h5str;
+ jstring jstr;
+ jsize i, n;
+ herr_t status = FAIL;
- hid_t region_obj;
- H5S_sel_type region_type;
+ UNUSED(clss);
- hid_t region = -1;
- hid_t did = (hid_t) dataset_id;
- hid_t tid = (hid_t) mem_type_id;
- hid_t mem_sid = (hid_t) mem_space_id;
- hid_t file_sid = (hid_t) file_space_id;
+ HDmemset(&h5str, 0, sizeof(h5str_t));
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/
- ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n);
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_reg_ref: buf length < 0");
+ }
- if (ref_data == NULL) {
- h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to allocate buff for read");
- return -1;
- } /* end if */
+ if (NULL == (ref_data = (H5R_ref_t *) HDcalloc(1, (size_t)n * sizeof(H5R_ref_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate read buffer");
- status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, ref_data);
+ 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)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0) {
- HDfree(ref_data);
- h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to read data");
- return -1;
- } /* end if */
-
- HDmemset(&h5str, 0, sizeof(h5str_t));
h5str_new(&h5str, 1024);
- for (i=0; i<n; i++) {
+
+ if (!h5str.s)
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate buffer");
+
+ for (i = 0; i < n; i++) {
h5str.s[0] = '\0';
- /* get name of the dataset the region reference points to using H5Rget_name */
- region_obj = H5Rdereference2(did, H5P_DEFAULT, H5R_DATASET_REGION, ref_data[i]);
- if (region_obj >= 0) {
- region = H5Rget_region(did, H5R_DATASET_REGION, ref_data[i]);
- if (region >= 0) {
- region_type = H5Sget_select_type(region);
- if(region_type==H5S_SEL_POINTS) {
- h5str_dump_region_points_data(&h5str, region, region_obj);
- } /* end if */
- else {
- h5str_dump_region_blocks_data(&h5str, region, region_obj);
- } /* end else */
-
- H5Sclose(region);
- } /* end if */
- H5Dclose(region_obj);
- } /* end if */
- jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s);
-
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
+ 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)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
} /* end for */
- h5str_free(&h5str);
- HDfree(ref_data);
+done:
+ if (h5str.s)
+ h5str_free(&h5str);
+ if (ref_data)
+ HDfree(ref_data);
return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data */
+} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref */
/*
* Class: hdf_hdf5lib_H5
@@ -1533,17 +1690,22 @@ Java_hdf_hdf5lib_H5__1H5Dcreate2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
jlong space_id, jlong link_plist_id, jlong create_plist_id, jlong access_plist_id)
{
- hid_t dset_id = -1;
- const char *fileName;
+ const char *dsetName = NULL;
+ hid_t dset_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- dset_id = H5Dcreate2((hid_t)loc_id, fileName, (hid_t)type_id, (hid_t)space_id, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
- if (dset_id < 0)
- h5libraryError(env);
- }
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dcreate2: dataset name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dcreate2: dataset name not pinned");
+
+ if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dsetName)
+ UNPIN_JAVA_STRING(ENVONLY, name, dsetName);
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dcreate2 */
@@ -1557,17 +1719,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dopen2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist)
{
- hid_t dset_id = -1;
- const char *fileName;
+ const char *dsetName = NULL;
+ hid_t dset_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- dset_id = H5Dopen2((hid_t)loc_id, fileName, (hid_t)access_plist);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
- if (dset_id < 0)
- h5libraryError(env);
- }
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dopen2: dataset name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dopen2: dataset name not pinned");
+
+ if ((dset_id = H5Dopen2((hid_t)loc_id, dsetName, (hid_t)access_plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dsetName)
+ UNPIN_JAVA_STRING(ENVONLY, name, dsetName);
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dopen2 */
@@ -1581,12 +1748,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dcreate_1anon
(JNIEnv *env, jclass clss, jlong loc_id, jlong type_id, jlong space_id, jlong dcpl_id, jlong dapl_id)
{
- hid_t dset_id = -1;
+ hid_t dset_id = H5I_INVALID_HID;
+
+ UNUSED(clss);
- dset_id = H5Dcreate_anon((hid_t)loc_id, (hid_t)type_id, (hid_t)space_id, (hid_t)dcpl_id, (hid_t)dapl_id);
- if (dset_id < 0)
- h5libraryError(env);
+ if ((dset_id = H5Dcreate_anon((hid_t)loc_id, (hid_t)type_id, (hid_t)space_id, (hid_t)dcpl_id, (hid_t)dapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dcreate_1anon */
@@ -1601,9 +1770,12 @@ Java_hdf_hdf5lib_H5_H5Dget_1space_1status
{
H5D_space_status_t space_status = H5D_SPACE_STATUS_ERROR;
+ UNUSED(clss);
+
if (H5Dget_space_status((hid_t)loc_id, &space_status) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)space_status;
} /* end Java_hdf_hdf5lib_H5_H5Dget_1space_1status */
@@ -1616,12 +1788,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Dget_1access_1plist
(JNIEnv *env, jclass clss, jlong loc_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Dget_access_plist((hid_t)loc_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Dget_access_plist((hid_t)loc_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Dget_1access_1plist */
@@ -1636,10 +1810,12 @@ Java_hdf_hdf5lib_H5_H5Dget_1offset
{
haddr_t offset = HADDR_UNDEF;
- offset = H5Dget_offset((hid_t)loc_id);
- if (offset == HADDR_UNDEF)
- h5libraryError(env);
+ UNUSED(clss);
+ if (HADDR_UNDEF == (offset = H5Dget_offset((hid_t)loc_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)offset;
} /* end Java_hdf_hdf5lib_H5_H5Dget_1offset */
@@ -1652,12 +1828,15 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size
(JNIEnv *env, jclass clss, jlong dataset_id, jlong type_id, jlong space_id)
{
- hsize_t sz = 0;
+ hsize_t sz = 0;
+
+ UNUSED(clss);
- if (H5Dvlen_get_buf_size((hid_t)dataset_id, (hid_t)type_id, (hid_t)space_id, &sz) < 0)
- h5libraryError(env);
+ if (H5Dvlen_get_buf_size((hid_t)dataset_id, (hid_t)type_id, (hid_t)space_id, &sz) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jlong)sz;
+done:
+ return (jlong)sz;
} /* end Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size_1long */
/*
@@ -1669,49 +1848,36 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Dfill
(JNIEnv *env, jclass clss, jbyteArray fill, jlong fill_type_id, jbyteArray buf, jlong buf_type_id, jlong space_id)
{
- herr_t status;
- jbyte *fillP;
- jbyte *buffP;
jboolean isCopy1;
jboolean isCopy2;
+ herr_t status = FAIL;
+ jbyte *fillP = NULL;
+ jbyte *buffP = NULL;
+ UNUSED(clss);
- if (buf == NULL) {
- h5nullArgument(env, "H5Dfill: buf is NULL");
- } /* end if */
- else {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy2);
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dfill: buf not pinned");
- } /* end if */
- else {
- if(fill) {
- fillP = ENVPTR->GetByteArrayElements(ENVPAR fill, &isCopy1);
- if (fillP == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT);
- h5JNIFatalError( env, "H5Dfill: fill not pinned");
- return;
- } /* end if */
- } /* end if */
- else
- fillP = NULL;
-
- status = H5Dfill((const void*)fillP, (hid_t)fill_type_id, (void*)buffP, (hid_t)buf_type_id, (hid_t)space_id);
- if(fillP) {
- /* free the buffer without copying back */
- ENVPTR->ReleaseByteArrayElements(ENVPAR fill, fillP, JNI_ABORT);
- } /* end if */
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- if (isCopy2 == JNI_TRUE) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, 0);
- } /* end if */
- } /* end else */
- }
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dfill: buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, buf, buffP, &isCopy2, "H5Dfill: buffer not pinned");
+
+ if (fill) {
+ PIN_BYTE_ARRAY(ENVONLY, fill, fillP, &isCopy1, "H5Dfill: fill buffer not pinned");
}
+
+ if ((status = H5Dfill((const void *)fillP, (hid_t)fill_type_id, (void *)buffP, (hid_t)buf_type_id, (hid_t)space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (fillP) {
+ UNPIN_BYTE_ARRAY(ENVONLY, fill, fillP, JNI_ABORT);
+ fillP = NULL;
+ }
+
+done:
+ if (fillP)
+ UNPIN_BYTE_ARRAY(ENVONLY, fill, fillP, JNI_ABORT);
+ if (buffP)
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, buffP, (status < 0) ? JNI_ABORT : 0);
} /* end Java_hdf_hdf5lib_H5_H5Dfill */
/*
@@ -1723,103 +1889,97 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Dset_1extent
(JNIEnv *env, jclass clss, jlong loc_id, jlongArray buf)
{
+ jboolean isCopy;
+ hsize_t *dims = NULL;
herr_t status;
- hsize_t *dims;
- jlong *buffP;
jsize rank;
- jboolean isCopy;
+ jlong *dimsBuf = NULL;
int i = 0;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dset_extent: buf is NULL");
- } /* end if */
- else {
- rank = ENVPTR->GetArrayLength(ENVPAR buf);
- if (rank <= 0) {
- h5JNIFatalError(env, "H5Dset_extent: rank <=0");
- } /* end if */
- else {
- buffP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy);
- if (buffP == NULL) {
- h5JNIFatalError( env, "H5Dset_extent: buf not pinned");
- } /* end if */
- else {
- dims = (hsize_t*)HDmalloc((size_t)rank * sizeof(hsize_t));
- for (i = 0; i< rank; i++)
- dims[i] = (hsize_t)buffP[i];
-
- status = H5Dset_extent((hid_t)loc_id, (hsize_t*)dims);
-
- HDfree (dims);
-
- /* free the buffer without copying back */
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, buffP, JNI_ABORT);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- } /* end else */
- } /* end else */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dset_extent: buffer is NULL");
+
+ if ((rank = ENVPTR->GetArrayLength(ENVONLY, buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dset_extent: buf length <= 0");
}
+
+ PIN_LONG_ARRAY(ENVONLY, buf, dimsBuf, &isCopy, "H5Dset_extent: buffer not pinned");
+
+ if (NULL == (dims = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dset_extent: failed to allocate dataset dimension buffer");
+
+ for (i = 0; i < rank; i++)
+ dims[i] = (hsize_t)dimsBuf[i];
+
+ if ((status = H5Dset_extent((hid_t)loc_id, (hsize_t *)dims)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dims)
+ HDfree(dims);
+ if (dimsBuf)
+ UNPIN_LONG_ARRAY(ENVONLY, buf, dimsBuf, JNI_ABORT);
} /* end 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) {
- JNIEnv *cbenv;
- jint status;
- jclass cls;
- jmethodID mid;
- jbyteArray elemArray;
- jlongArray pointArray;
- jsize size;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls == 0) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "([BJI[JLhdf/hdf5lib/callbacks/H5D_iterate_t;)I");
- if (mid == 0) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
+ (void *elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data) {
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ jbyteArray elemArray;
+ jlongArray pointArray;
+ jmethodID mid;
+ jobject visit_callback = wrapper->visit_callback;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = FAIL;
+ jsize size;
+ void *op_data = (void *)wrapper->op_data;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5D_iterate_cb: failed to attach current thread to JVM");
+ }
- if (elem == NULL) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- if (point == NULL) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- size = (jsize)H5Tget_size(elem_id);
- elemArray = CBENVPTR->NewByteArray(CBENVPAR size);
- if (elemArray == NULL) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- CBENVPTR->SetByteArrayRegion(CBENVPAR elemArray, 0, size, (jbyte *)elem);
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "([BJI[JLhdf/hdf5lib/callbacks/H5D_iterate_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- pointArray = CBENVPTR->NewLongArray(CBENVPAR 2);
- if (pointArray == NULL) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- CBENVPTR->SetLongArrayRegion(CBENVPAR pointArray, 0, 2, (const jlong *)point);
+ if (NULL == elem)
+ H5_NULL_ARGUMENT_ERROR(CBENVONLY, "H5D_iterate_cb: element buffer is NULL");
+ if (NULL == point)
+ H5_NULL_ARGUMENT_ERROR(CBENVONLY, "H5D_iterate_cb: point is NULL");
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, (void*)elemArray, elem_id, ndim, pointArray, op_data);
+ if (!(size = (jsize)H5Tget_size(elem_id)))
+ H5_LIBRARY_ERROR(CBENVONLY);
- CBENVPTR->GetByteArrayRegion(CBENVPAR elemArray, 0, size, (jbyte *)elem);
+ if (NULL == (elemArray = CBENVPTR->NewByteArray(CBENVONLY, size)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- JVMPTR->DetachCurrentThread(JVMPAR);
+ CBENVPTR->SetByteArrayRegion(CBENVONLY, elemArray, 0, size, (jbyte *)elem);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return status;
+ if (NULL == (pointArray = CBENVPTR->NewLongArray(CBENVONLY, 2)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ CBENVPTR->SetLongArrayRegion(CBENVONLY, pointArray, 0, 2, (const jlong *)point);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, (void *)elemArray, elem_id, ndim, pointArray, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ CBENVPTR->GetByteArrayRegion(CBENVONLY, elemArray, 0, size, (jbyte *)elem);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
+
+ return (herr_t)status;
} /* end H5D_iterate_cb */
/*
@@ -1832,41 +1992,31 @@ Java_hdf_hdf5lib_H5_H5Diterate
(JNIEnv *env, jclass clss, jbyteArray buf, jlong buf_type, jlong space,
jobject callback_op, jobject op_data)
{
- herr_t status = -1;
- jboolean isCopy;
- jbyte *buffP;
+ cb_wrapper wrapper = { callback_op, op_data };
+ jboolean isCopy;
+ jbyte *iterBuf = NULL;
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
+ UNUSED(clss);
- if (op_data == NULL) {
- h5nullArgument(env, "H5Diterate: op_data is NULL");
- } /* end if */
- else if (callback_op == NULL) {
- h5nullArgument(env, "H5Diterate: callback_op is NULL");
- } /* end if */
- else if (buf == NULL) {
- h5nullArgument(env, "H5Diterate: buf is NULL");
- } /* end if */
- else {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (buffP == NULL) {
- 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);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- if (isCopy == JNI_TRUE) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, 0);
- } /* end if */
- } /* end else */
- } /* end else */
- }
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Diterate: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Diterate: callback_op is NULL");
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Diterate: buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, buf, iterBuf, &isCopy, "H5Diterate: buffer not pinned");
+
+ if ((status = H5Diterate((void *)iterBuf, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (iterBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, iterBuf, (status < 0) ? (JNI_ABORT) : ((isCopy == JNI_TRUE) ? 0 : JNI_ABORT));
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Diterate */
@@ -1880,8 +2030,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Dflush
(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Dflush((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
}
/*
@@ -1893,11 +2048,14 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Drefresh
(JNIEnv *env, jclass clss, jlong loc_id)
{
- if (H5Drefresh((hid_t)loc_id) < 0)
- h5libraryError(env);
-}
+ UNUSED(clss);
+ if (H5Drefresh((hid_t)loc_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
+ return;
+}
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5dImp.h b/java/src/jni/h5dImp.h
index 3cf24fe..f824452 100644
--- a/java/src/jni/h5dImp.h
+++ b/java/src/jni/h5dImp.h
@@ -213,6 +213,15 @@ Java_hdf_hdf5lib_H5_H5DreadVL
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5DwriteVL
+ * Signature: (JJJJJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5DwriteVL
+(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Dread_string
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
@@ -241,7 +250,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1VLStrings
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dwrite_VLStrings
- * Signature: (JJJJJ[BZ)I
+ * Signature: (JJJJJ[B)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings
@@ -258,15 +267,6 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Dread_reg_ref_data
- * Signature: (JJJJJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
-
-/*
- * Class: hdf_hdf5lib_H5
* Method: _H5Dcreate2
* Signature: (JLjava/lang/String;JJJJJ)J
*/
diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c
index 24ddcbc..80e23a1 100644
--- a/java/src/jni/h5eImp.c
+++ b/java/src/jni/h5eImp.c
@@ -39,28 +39,21 @@ extern "C" {
#include "h5jni.h"
#include "h5eImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
extern JavaVM *jvm;
-extern jobject visit_callback;
-#ifdef __cplusplus
- #define CBENVPTR (cbenv)
- #define CBENVPAR
- #define JVMPTR (jvm)
- #define JVMPAR
- #define JVMPAR2
-#else /* __cplusplus */
- #define CBENVPTR (*cbenv)
- #define CBENVPAR cbenv,
- #define JVMPTR (*jvm)
- #define JVMPAR jvm
- #define JVMPAR2 jvm,
-#endif /* __cplusplus */
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
/********************/
/* 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
@@ -69,16 +62,19 @@ static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *op_data);
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2
- (JNIEnv *env, jclass cls, jlong stk_id)
+ (JNIEnv *env, jclass clss, jlong stk_id)
{
unsigned int is_stack = 0;
- if (stk_id < 0) {
- h5badArgument(env, "H5Eauto_is_v2: invalid argument");
- } /* end if */
- else if (H5Eauto_is_v2((hid_t)stk_id, &is_stack) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eauto_is_v2: invalid stack ID");
+
+ if (H5Eauto_is_v2((hid_t)stk_id, &is_stack) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jboolean)is_stack;
} /* end Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2 */
@@ -89,22 +85,36 @@ Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Eregister_1class
- (JNIEnv *env, jclass cls, jstring cls_name, jstring lib_name, jstring version)
+ (JNIEnv *env, jclass clss, jstring cls_name, jstring lib_name, jstring version)
{
- hid_t ret_val = -1;
- const char* the_cls_name;
- const char* the_lib_name;
- const char* the_version;
-
- PIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version);
- if (the_cls_name != NULL && the_lib_name != NULL && the_version != NULL) {
- ret_val = H5Eregister_class(the_cls_name, the_lib_name, the_version);
-
- UNPIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version);
-
- if (ret_val < 0)
- h5libraryError(env);
- }
+ const char* the_cls_name = NULL;
+ const char* the_lib_name = NULL;
+ const char* the_version = NULL;
+ hid_t ret_val = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == cls_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eregister_class: class name is NULL");
+ if (NULL == lib_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eregister_class: lib name is NULL");
+ if (NULL == version)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eregister_class: version string is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, cls_name, the_cls_name, NULL, "H5Eregister_class: class name not pinned");
+ PIN_JAVA_STRING(ENVONLY, lib_name, the_lib_name, NULL, "H5Eregister_class: lib name not pinned");
+ PIN_JAVA_STRING(ENVONLY, version, the_version, NULL, "H5Eregister_class: version string not pinned");
+
+ if ((ret_val = H5Eregister_class(the_cls_name, the_lib_name, the_version)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (the_version)
+ UNPIN_JAVA_STRING(ENVONLY, version, the_version);
+ if (the_lib_name)
+ UNPIN_JAVA_STRING(ENVONLY, lib_name, the_lib_name);
+ if (the_cls_name)
+ UNPIN_JAVA_STRING(ENVONLY, cls_name, the_cls_name);
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Eregister_1class */
@@ -116,13 +126,18 @@ Java_hdf_hdf5lib_H5_H5Eregister_1class
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eunregister_1class
- (JNIEnv *env, jclass cls, jlong cls_id)
+ (JNIEnv *env, jclass clss, jlong cls_id)
{
- if (cls_id < 0) {
- h5badArgument(env, "H5Eunregister_class: invalid argument");
- } /* end if */
- else if (H5Eunregister_class((hid_t)cls_id) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (cls_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eunregister_class: invalid error class ID");
+
+ if (H5Eunregister_class((hid_t)cls_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eunregister_1class */
/*
@@ -132,13 +147,18 @@ Java_hdf_hdf5lib_H5_H5Eunregister_1class
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclose_1msg
- (JNIEnv *env, jclass cls, jlong err_id)
+ (JNIEnv *env, jclass clss, jlong err_id)
{
- if (err_id < 0) {
- h5badArgument(env, "H5Eclose_msg: invalid argument");
- } /* end if */
- else if (H5Eclose_msg((hid_t)err_id) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (err_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclose_msg: invalid error message ID");
+
+ if (H5Eclose_msg((hid_t)err_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eclose_1msg */
/*
@@ -148,26 +168,27 @@ Java_hdf_hdf5lib_H5_H5Eclose_1msg
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Ecreate_1msg
- (JNIEnv *env, jclass cls, jlong err_id, jint msg_type, jstring err_msg)
+ (JNIEnv *env, jclass clss, jlong err_id, jint msg_type, jstring err_msg)
{
- hid_t ret_val = -1;
- const char *the_err_msg;
H5E_type_t error_msg_type = (H5E_type_t)msg_type;
+ const char *the_err_msg = NULL;
+ hid_t ret_val = H5I_INVALID_HID;
- if (err_id < 0) {
- h5badArgument(env, "H5Ecreate_msg: invalid argument");
- } /* end if */
- else {
- PIN_JAVA_STRING(err_msg, the_err_msg);
- if (the_err_msg != NULL) {
- ret_val = H5Ecreate_msg((hid_t)err_id, error_msg_type, the_err_msg);
+ UNUSED(clss);
+
+ if (err_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ecreate_msg: invalid error class ID");
+ if (NULL == err_msg)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ecreate_msg: error message string is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, err_msg, the_err_msg, NULL, "H5Ecreate_msg: error message string not pinned");
- UNPIN_JAVA_STRING(err_msg, the_err_msg);
+ if ((ret_val = H5Ecreate_msg((hid_t)err_id, error_msg_type, the_err_msg)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (ret_val < 0)
- h5libraryError(env);
- }
- } /* end else */
+done:
+ if (the_err_msg)
+ UNPIN_JAVA_STRING(ENVONLY, err_msg, the_err_msg);
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Ecreate_1msg */
@@ -179,14 +200,16 @@ Java_hdf_hdf5lib_H5_H5Ecreate_1msg
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Ecreate_1stack
- (JNIEnv *env, jclass cls)
+ (JNIEnv *env, jclass clss)
{
- hid_t ret_val = -1;
+ hid_t ret_val = H5I_INVALID_HID;
- ret_val = H5Ecreate_stack();
- if (ret_val < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((ret_val = H5Ecreate_stack()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Ecreate_1stack */
@@ -197,14 +220,16 @@ Java_hdf_hdf5lib_H5_H5Ecreate_1stack
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1current_1stack
- (JNIEnv *env, jclass cls)
+ (JNIEnv *env, jclass clss)
{
- hid_t ret_val = -1;
+ hid_t ret_val = H5I_INVALID_HID;
+
+ UNUSED(clss);
- ret_val = H5Eget_current_stack();
- if (ret_val < 0)
- h5libraryError(env);
+ if ((ret_val = H5Eget_current_stack()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Eget_1current_1stack */
@@ -215,13 +240,18 @@ Java_hdf_hdf5lib_H5_H5Eget_1current_1stack
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclose_1stack
- (JNIEnv *env, jclass cls, jlong stk_id)
+ (JNIEnv *env, jclass clss, jlong stk_id)
{
- if (stk_id < 0) {
- h5badArgument(env, "H5Eclose_stack: invalid argument");
- } /* end if */
- else if (H5Eclose_stack((hid_t)stk_id) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclose_stack: invalid error stack ID");
+
+ if (H5Eclose_stack((hid_t)stk_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eclose_1stack */
/*
@@ -231,22 +261,26 @@ Java_hdf_hdf5lib_H5_H5Eclose_1stack
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eprint2
- (JNIEnv *env, jclass cls, jlong stk_id, jobject stream_obj)
+ (JNIEnv *env, jclass clss, jlong stk_id, jobject stream_obj)
{
- herr_t ret_val = -1;
+ herr_t ret_val = FAIL;
- if (stk_id < 0) {
- h5badArgument(env, "H5Eprint2: invalid argument");
- } /* end if */
+ UNUSED(clss);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eprint2: invalid error stack ID");
+
+ if (!stream_obj) {
+ if ((ret_val = H5Eprint2((hid_t)stk_id, stdout)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
else {
- if(!stream_obj)
- ret_val = H5Eprint2((hid_t)stk_id, stdout);
- else
- ret_val = H5Eprint2((hid_t)stk_id, (FILE*)stream_obj);
-
- if (ret_val < 0)
- h5libraryError(env);
- } /* end else */
+ if ((ret_val = H5Eprint2((hid_t)stk_id, (FILE *)stream_obj)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eprint2 */
/*
@@ -256,45 +290,38 @@ Java_hdf_hdf5lib_H5_H5Eprint2
*/
JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1class_1name
- (JNIEnv *env, jclass cls, jlong cls_id)
+ (JNIEnv *env, jclass clss, jlong cls_id)
{
- char *namePtr;
- jstring str = NULL;
- ssize_t buf_size;
+ jstring str = NULL;
+ ssize_t buf_size;
+ char *namePtr = NULL;
+
+ UNUSED(clss);
+
+ if (cls_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_class_name: invalid error class ID");
+
+ /* Get the length of the name */
+ if ((buf_size = H5Eget_class_name((hid_t)cls_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!buf_size)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_class_name: no class name");
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Eget_class_name: malloc failed");
+
+ if ((H5Eget_class_name((hid_t)cls_id, (char *)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 (cls_id < 0) {
- h5badArgument(env, "H5Eget_class_name: invalid argument");
- } /* end if */
- else {
- /* get the length of the name */
- buf_size = H5Eget_class_name((hid_t)cls_id, NULL, 0);
-
- if (buf_size < 0) {
- h5badArgument( env, "H5Eget_class_name: buf_size < 0");
- } /* end if */
- else if (buf_size == 0) {
- h5badArgument( env, "H5Eget_class_name: No class name");
- } /* end else if */
- else {
- buf_size++; /* add extra space for the null terminator */
- namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (namePtr == NULL) {
- h5outOfMemory( env, "H5Eget_class_name: malloc failed");
- } /* end if */
- else {
- buf_size = H5Eget_class_name((hid_t)cls_id, (char *)namePtr, (size_t)buf_size);
-
- if (buf_size < 0) {
- HDfree(namePtr);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR namePtr);
- HDfree(namePtr);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
return str;
} /* end Java_hdf_hdf5lib_H5_H5Eget_1class_1name */
@@ -305,13 +332,18 @@ Java_hdf_hdf5lib_H5_H5Eget_1class_1name
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eset_1current_1stack
- (JNIEnv *env, jclass cls, jlong stk_id)
+ (JNIEnv *env, jclass clss, jlong stk_id)
{
- if (stk_id < 0) {
- h5badArgument(env, "H5Eset_current_stack: invalid argument");
- } /* end if */
- else if (H5Eset_current_stack((hid_t)stk_id) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eset_current_stack: invalid error stack ID");
+
+ if (H5Eset_current_stack((hid_t)stk_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eset_1current_1stack */
/*
@@ -321,13 +353,18 @@ Java_hdf_hdf5lib_H5_H5Eset_1current_1stack
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Epop
- (JNIEnv *env, jclass cls, jlong stk_id, jlong count)
+ (JNIEnv *env, jclass clss, jlong stk_id, jlong count)
{
- if (stk_id < 0) {
- h5badArgument(env, "H5Epop: invalid argument");
- } /* end if */
- else if (H5Epop((hid_t)stk_id, (size_t)count) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epop: invalid error stack ID");
+
+ if (H5Epop((hid_t)stk_id, (size_t)count) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Epop */
/*
@@ -337,38 +374,46 @@ Java_hdf_hdf5lib_H5_H5Epop
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Epush2
- (JNIEnv *env, jclass cls, jlong stk_id, jstring filename, jstring funcname,
+ (JNIEnv *env, jclass clss, jlong stk_id, jstring filename, jstring funcname,
jint linenumber, jlong class_id, jlong major_id, jlong minor_id, jstring err_desc)
{
- herr_t ret_val = -1;
- const char* fName;
- const char* fncName;
- const char* errMsg;
-
- if (stk_id < 0) {
- h5badArgument(env, "H5Epush: invalid argument");
- } /* end if */
- else if (class_id < 0) {
- h5badArgument(env, "H5Epush: invalid class_id argument");
- } /* end else if */
- else if (major_id < 0) {
- h5badArgument(env, "H5Epush: invalid major_id argument");
- } /* end else if */
- else if (minor_id < 0) {
- h5badArgument(env, "H5Epush: invalid minor_id argument");
- } /* end else if */
- else {
- PIN_JAVA_STRING_THREE(filename, fName, funcname, fncName, err_desc, errMsg);
- if (fName != NULL && fncName != NULL && errMsg != NULL) {
- ret_val = H5Epush2((hid_t)stk_id, fName, fncName, (unsigned)linenumber, (hid_t)class_id,
- (hid_t)major_id, (hid_t)minor_id, errMsg);
-
- UNPIN_JAVA_STRING_THREE(filename, fName, funcname, fncName, err_desc, errMsg);
-
- if (ret_val < 0)
- h5libraryError(env);
- }
- } /* end else */
+ const char *fName = NULL;
+ const char *fncName = NULL;
+ const char *errMsg = NULL;
+ herr_t ret_val = FAIL;
+
+ UNUSED(clss);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid error stack ID");
+ if (class_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid error class ID");
+ if (major_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid major error class ID");
+ if (minor_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid minor error class ID");
+ if (NULL == filename)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Epush2: filename is NULL");
+ if (NULL == funcname)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Epush2: function name is NULL");
+ if (NULL == err_desc)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Epush2: error message is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, filename, fName, NULL, "H5Epush2: filename not pinned");
+ PIN_JAVA_STRING(ENVONLY, funcname, fncName, NULL, "H5Epush2: function name not pinned");
+ PIN_JAVA_STRING(ENVONLY, err_desc, errMsg, NULL, "H5Epush2: error message not pinned");
+
+ if ((ret_val = H5Epush2((hid_t)stk_id, fName, fncName, (unsigned)linenumber, (hid_t)class_id,
+ (hid_t)major_id, (hid_t)minor_id, errMsg)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (errMsg)
+ UNPIN_JAVA_STRING(ENVONLY, err_desc, errMsg);
+ if (fncName)
+ UNPIN_JAVA_STRING(ENVONLY, funcname, fncName);
+ if (fName)
+ UNPIN_JAVA_STRING(ENVONLY, filename, fName);
} /* end Java_hdf_hdf5lib_H5_H5Epush2 */
/*
@@ -378,13 +423,18 @@ Java_hdf_hdf5lib_H5_H5Epush2
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclear2
- (JNIEnv *env, jclass cls, jlong stk_id)
+ (JNIEnv *env, jclass clss, jlong stk_id)
{
- if (stk_id < 0) {
- h5badArgument(env, "H5Eclear2: invalid argument");
- } /* end if */
- else if (H5Eclear2((hid_t)stk_id) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclear2: invalid error stack ID");
+
+ if (H5Eclear2((hid_t)stk_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eclear2 */
/*
@@ -394,59 +444,47 @@ Java_hdf_hdf5lib_H5_H5Eclear2
*/
JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1msg
- (JNIEnv *env, jclass cls, jlong msg_id, jintArray error_msg_type_list)
+ (JNIEnv *env, jclass clss, jlong msg_id, jintArray error_msg_type_list)
{
- char *namePtr;
- jstring str = NULL;
- jboolean isCopy;
- ssize_t buf_size;
- jint *theArray;
- H5E_type_t error_msg_type;
-
- if (msg_id < 0) {
- h5badArgument(env, "H5Eget_msg: invalid argument");
- } /* end if */
- else if (error_msg_type_list == NULL) {
- h5nullArgument(env, "H5Eget_msg: error_msg_type_list is NULL");
- } /* end if */
- else {
- /* get the length of the name */
- buf_size = H5Eget_msg((hid_t)msg_id, NULL, NULL, 0);
-
- if ((buf_size < 0) || (buf_size == 0)) {
- h5JNIFatalError(env, "H5Eget_msg: Invalid message");
- } /* end if */
- else {
- buf_size++; /* add extra space for the null terminator */
- namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (namePtr == NULL) {
- h5outOfMemory(env, "H5Eget_msg: malloc failed");
- } /* end if */
- else {
- theArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR error_msg_type_list, &isCopy);
- if (theArray == NULL) {
- HDfree(namePtr);
- h5JNIFatalError(env, "H5Eget_msg: error_msg_type_list not pinned");
- } /* end if */
- else {
- buf_size = H5Eget_msg((hid_t)msg_id, &error_msg_type, (char *)namePtr, (size_t)buf_size);
-
- if (buf_size < 0) {
- HDfree(namePtr);
- ENVPTR->ReleaseIntArrayElements(ENVPAR error_msg_type_list, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = error_msg_type;
- ENVPTR->ReleaseIntArrayElements(ENVPAR error_msg_type_list, theArray, 0);
-
- str = ENVPTR->NewStringUTF(ENVPAR namePtr);
- HDfree(namePtr);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ H5E_type_t error_msg_type;
+ jstring str = NULL;
+ ssize_t buf_size;
+ jint *theArray = NULL;
+ char *namePtr = NULL;
+
+ UNUSED(clss);
+
+ if (msg_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_msg: invalid error message ID");
+ if (NULL == error_msg_type_list)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eget_msg: error_msg_type_list is NULL");
+
+ /* Get the length of the name */
+ if ((buf_size = H5Eget_msg((hid_t)msg_id, NULL, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!buf_size)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_msg: invalid message");
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Eget_msg: malloc failed");
+
+ PIN_INT_ARRAY(ENVONLY, error_msg_type_list, theArray, NULL, "H5Eget_msg: error_msg_type_list not pinned");
+
+ if ((H5Eget_msg((hid_t)msg_id, &error_msg_type, (char *)namePtr, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ namePtr[buf_size] = '\0';
+
+ theArray[0] = error_msg_type;
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, error_msg_type_list, theArray, 0);
+ if (namePtr)
+ HDfree(namePtr);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Eget_1msg */
@@ -458,64 +496,77 @@ Java_hdf_hdf5lib_H5_H5Eget_1msg
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1num
- (JNIEnv *env, jclass cls, jlong stk_id)
+ (JNIEnv *env, jclass clss, jlong stk_id)
{
ssize_t ret_val = -1;
- if (stk_id < 0) {
- h5badArgument(env, "H5Eget_num: invalid argument");
- } /* end if */
- else {
- ret_val = H5Eget_num((hid_t)stk_id);
- if (ret_val < 0)
- h5libraryError(env);
- } /* end else */
+ UNUSED(clss);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_num: invalid error stack ID");
+
+ if ((ret_val = H5Eget_num((hid_t)stk_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)ret_val;
} /* end 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;
- jclass cls;
- jmethodID mid;
- jstring str1, str2, str3;
- jmethodID constructor;
- jvalue args[7];
- jobject cb_info_t = NULL;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I");
- if (mid != 0) {
- args[0].j = info->cls_id;
- args[1].j = info->maj_num;
- args[2].j = info->min_num;
- args[3].i = (jint)info->line;
- str1 = CBENVPTR->NewStringUTF(CBENVPAR info->func_name);
- args[4].l = str1;
- str2 = CBENVPTR->NewStringUTF(CBENVPAR info->file_name);
- args[5].l = str2;
- str3 = CBENVPTR->NewStringUTF(CBENVPAR info->desc);
- args[6].l = str3;
- // get a reference to your class if you don't have it already
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5E_error2_t");
- if (cls != 0) {
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(JJJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
- if (constructor != 0) {
- cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
-
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, nindx, cb_info_t, op_data);
- } /* end if (constructor != 0) */
- } /* end if(cls != 0) */
- } /* end if (mid != 0) */
- } /* end if (cls != 0) */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ jmethodID mid;
+ jobject visit_callback = wrapper->visit_callback;
+ jstring str1, str2, str3;
+ jobject cb_info_t = NULL;
+ jvalue args[7];
+ JNIEnv *cbenv = NULL;
+ jclass cbcls;
+ void *op_data = (void *)wrapper->op_data;
+ jint status = FAIL;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5E_walk_cb: failed to attach current thread to JVM");
+ }
+
+ if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[0].j = info->cls_id;
+ args[1].j = info->maj_num;
+ args[2].j = info->min_num;
+ args[3].i = (jint)info->line;
+
+ if (NULL == (str1 = CBENVPTR->NewStringUTF(CBENVONLY, info->func_name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[4].l = str1;
+
+ if (NULL == (str2 = CBENVPTR->NewStringUTF(CBENVONLY, info->file_name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[5].l = str2;
+
+ if (NULL == (str3 = CBENVPTR->NewStringUTF(CBENVONLY, info->desc)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[6].l = str3;
+
+ CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5E_error2_t", "(JJJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, cb_info_t);
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, nindx, cb_info_t, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (CBENVONLY)
+ JVMPTR->DetachCurrentThread(JVMPAR);
+
return (herr_t)status;
} /* end H5E_walk_cb */
@@ -526,16 +577,25 @@ H5E_walk_cb
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Ewalk2
- (JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data)
+ (JNIEnv *env, jclass clss, jlong stk_id, jlong direction, jobject callback_op, jobject 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)
- h5libraryError(env);
+ cb_wrapper wrapper = { callback_op, op_data };
+
+ UNUSED(clss);
+
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ewalk2: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ewalk2: callback_op is NULL");
+
+ if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void *)&wrapper) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end iJava_hdf_hdf5lib_H5_H5Ewalk2f */
#ifdef __cplusplus
diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c
index 8cf5252..3b7b96c 100644
--- a/java/src/jni/h5fImp.c
+++ b/java/src/jni/h5fImp.c
@@ -28,8 +28,10 @@ extern "C" {
#include "h5fImp.h"
#include "h5util.h"
-extern JavaVM *jvm;
-extern jobject visit_callback;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -40,18 +42,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Fopen
(JNIEnv *env, jclass clss, jstring name, jint flags, jlong access_id)
{
- hid_t status = -1;
- const char *fileName;
+ const char *fileName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- status = H5Fopen(fileName, (unsigned)flags, (hid_t)access_id );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fopen: file name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fopen: file name not pinned");
+
+ if ((status = H5Fopen(fileName, (unsigned)flags, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Fopen */
@@ -65,18 +71,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Fcreate
(JNIEnv *env, jclass clss, jstring name, jint flags, jlong create_id, jlong access_id)
{
- hid_t status = -1;
- const char *fileName;
+ const char *fileName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- status = H5Fcreate(fileName, (unsigned)flags, create_id, access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fcreate: file name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fcreate: file name not pinned");
+
+ if ((status = H5Fcreate(fileName, (unsigned)flags, create_id, access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Fcreate */
@@ -90,12 +100,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Fflush
(JNIEnv *env, jclass clss, jlong object_id, jint scope)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Fflush((hid_t)object_id, (H5F_scope_t)scope );
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Fflush((hid_t)object_id, (H5F_scope_t)scope)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Fflush */
@@ -106,36 +118,31 @@ Java_hdf_hdf5lib_H5_H5Fflush
*/
JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1name
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
- char *namePtr;
- jstring str = NULL;
- ssize_t buf_size;
-
- /* get the length of the name */
- buf_size = H5Fget_name((hid_t)file_id, NULL, 0);
-
- if (buf_size <= 0) {
- h5badArgument(env, "H5Fget_name: buf_size <= 0");
- } /* end if */
- else {
- buf_size++; /* add extra space for the null terminator */
- namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (namePtr == NULL) {
- h5outOfMemory(env, "H5Fget_name: malloc failed");
- } /* end if */
- else {
- buf_size = H5Fget_name((hid_t)file_id, namePtr, (size_t)buf_size);
- if (buf_size < 0) {
- HDfree(namePtr);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR namePtr);
- HDfree(namePtr);
- }/* end else */
- }/* end else */
- }/* end else */
+ jstring str = NULL;
+ ssize_t buf_size;
+ char *namePtr = NULL;
+
+ UNUSED(clss);
+
+ /* Get the length of the name */
+ if ((buf_size = H5Fget_name((hid_t)file_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Fget_name: malloc failed");
+
+ if ((H5Fget_name((hid_t)file_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);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1name */
@@ -149,26 +156,70 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fis_1hdf5
(JNIEnv *env, jclass clss, jstring name)
{
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ const char *fileName = NULL;
+#endif
htri_t bval = JNI_FALSE;
- const char *fileName;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- bval = H5Fis_hdf5(fileName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+#ifdef H5_NO_DEPRECATED_SYMBOLS
+ UNUSED(name);
+ H5_UNIMPLEMENTED(ENVONLY, "H5Fis_hdf5: not implemented");
+#else
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fis_hdf5: file name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fis_hdf5: file name not pinned");
+
+ if ((bval = H5Fis_hdf5(fileName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+#endif
+
+done:
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
+#endif
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Fis_accessible
+ * Signature: (Ljava/lang/String;J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Fis_1accessible
+ (JNIEnv *env, jclass clss, jstring name, jlong file_id)
+{
+ const char *fileName = NULL;
+ htri_t bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fis_accessible: file name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fis_accessible: file name not pinned");
+
+ if ((bval = H5Fis_accessible(fileName, (hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
+
+ return (jboolean)bval;
+} /* end Java_hdf_hdf5lib_H5_H5Fis_1accessible */
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Fget_create_plist
* Signature: (J)J
*/
@@ -176,12 +227,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist
(JNIEnv *env, jclass clss, jlong file_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Fget_create_plist((hid_t)file_id );
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Fget_create_plist((hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist */
@@ -194,12 +247,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist
(JNIEnv *env, jclass clss, jlong file_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
- retVal = H5Fget_access_plist((hid_t)file_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Fget_access_plist((hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist */
@@ -210,18 +265,41 @@ Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1intent
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
unsigned intent = 0;
+ UNUSED(clss);
+
if (H5Fget_intent((hid_t)file_id, &intent) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)intent;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1intent */
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Fget_fileno
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1fileno
+ (JNIEnv *env, jclass clss, jlong file_id)
+{
+ unsigned long fileno = 0;
+
+ UNUSED(clss);
+
+ if (H5Fget_fileno((hid_t)file_id, &fileno) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)fileno;
+} /* end Java_hdf_hdf5lib_H5_H5Fget_1fileno */
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Fclose
* Signature: (J)I
*/
@@ -229,14 +307,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Fclose
(JNIEnv *env, jclass clss, jlong file_id)
{
- herr_t status = -1;
+ herr_t status = FAIL;
- if (file_id > 0)
- status = H5Fclose((hid_t)file_id );
+ UNUSED(clss);
- if (status < 0)
- h5libraryError(env);
+ if ((status = H5Fclose((hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)status;
} /* end Java_hdf_hdf5lib_H5__1H5Fclose */
@@ -249,18 +327,22 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Fmount
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong child_id, jlong plist_id)
{
- herr_t status = -1;
- const char *fileName;
+ const char *fileName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- status = H5Fmount((hid_t)loc_id, fileName, (hid_t)child_id, (hid_t)plist_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fmount: file name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fmount: file name not pinned");
+
+ if ((status = H5Fmount((hid_t)loc_id, fileName, (hid_t)child_id, (hid_t)plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Fmount */
@@ -274,18 +356,22 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Funmount
(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
- herr_t status = -1;
- const char *fileName;
+ const char *fileName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- status = H5Funmount((hid_t)loc_id, fileName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Funmount: file name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Funmount: file name not pinned");
+
+ if ((status = H5Funmount((hid_t)loc_id, fileName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Funmount */
@@ -297,13 +383,16 @@ Java_hdf_hdf5lib_H5_H5Funmount
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1freespace
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
- hssize_t ret_val = H5Fget_freespace((hid_t)file_id);
+ hssize_t ret_val = -1;
- if (ret_val < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((ret_val = H5Fget_freespace((hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1freespace */
@@ -316,12 +405,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Freopen
(JNIEnv *env, jclass clss, jlong file_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Freopen((hid_t)file_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Freopen((hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Freopen */
@@ -332,50 +423,43 @@ Java_hdf_hdf5lib_H5__1H5Freopen
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids
- (JNIEnv *env, jclass cls, jlong file_id, jint types, jlong maxObjs,
+ (JNIEnv *env, jclass clss, jlong file_id, jint types, jlong maxObjs,
jlongArray obj_id_list)
{
- ssize_t ret_val = -1;
- jlong *obj_id_listP;
- jboolean isCopy;
- hid_t *id_list;
- size_t rank;
- size_t i;
-
- if (obj_id_list == NULL) {
- h5nullArgument(env, "H5Fget_obj_ids: obj_id_list is NULL");
- } /* end if */
- else {
- obj_id_listP = ENVPTR->GetLongArrayElements(ENVPAR obj_id_list, &isCopy);
- if (obj_id_listP == NULL) {
- h5JNIFatalError(env, "H5Fget_obj_ids: obj_id_list not pinned");
- } /* end if */
- else {
- rank = (size_t)ENVPTR->GetArrayLength(ENVPAR obj_id_list);
-
- id_list = (hid_t *)HDmalloc(rank * sizeof(hid_t));
- if (id_list == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, JNI_ABORT);
- h5JNIFatalError(env, "H5Fget_obj_ids: obj_id_list not converted to hid_t");
- } /* end if */
- else {
- ret_val = H5Fget_obj_ids((hid_t)file_id, (unsigned int)types, (size_t)maxObjs, id_list);
-
- if (ret_val < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, JNI_ABORT);
- HDfree(id_list);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < rank; i++) {
- obj_id_listP[i] = (jlong)id_list[i];
- } /* end for */
- HDfree(id_list);
- ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ ssize_t ret_val = -1;
+ size_t i;
+ jsize rank;
+ jlong *obj_id_listP = NULL;
+ hid_t *id_list = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == obj_id_list)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_obj_ids: obj_id_list is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, obj_id_list, obj_id_listP, &isCopy, "H5Fget_obj_ids: obj_id_list not pinned");
+
+ if ((rank = ENVPTR->GetArrayLength(ENVONLY, obj_id_list)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_obj_ids: obj_id_list length < 0");
+ }
+
+ if (NULL == (id_list = (hid_t *) HDmalloc((size_t)rank * sizeof(hid_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Fget_obj_ids: malloc failed");
+
+ if ((ret_val = H5Fget_obj_ids((hid_t)file_id, (unsigned int)types, (size_t)maxObjs, id_list)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (size_t)rank; i++) {
+ obj_id_listP[i] = (jlong)id_list[i];
+ } /* end for */
+
+done:
+ if (id_list)
+ HDfree(id_list);
+ if (obj_id_listP)
+ UNPIN_LONG_ARRAY(ENVONLY, obj_id_list, obj_id_listP, (ret_val < 0) ? JNI_ABORT : 0);
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids */
@@ -387,13 +471,16 @@ Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1obj_1count
- (JNIEnv *env, jclass cls, jlong file_id, jint types)
+ (JNIEnv *env, jclass clss, jlong file_id, jint types)
{
- ssize_t ret_val = H5Fget_obj_count((hid_t)file_id, (unsigned int)types);
+ ssize_t ret_val = -1;
- if (ret_val < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((ret_val = H5Fget_obj_count((hid_t)file_id, (unsigned int)types)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1obj_1count_1long */
@@ -408,9 +495,12 @@ Java_hdf_hdf5lib_H5_H5Fget_1filesize
{
hsize_t size = 0;
- if (H5Fget_filesize ((hid_t)file_id, &size) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5Fget_filesize((hid_t)file_id, &size) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong) size;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1filesize */
@@ -421,13 +511,16 @@ Java_hdf_hdf5lib_H5_H5Fget_1filesize
*/
JNIEXPORT jdouble JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
double rate = 0.0;
+ UNUSED(clss);
+
if (H5Fget_mdc_hit_rate((hid_t)file_id, &rate) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jdouble)rate;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate */
@@ -438,35 +531,39 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size
- (JNIEnv *env, jclass cls, jlong file_id, jlongArray metadata_cache)
+ (JNIEnv *env, jclass clss, jlong file_id, jlongArray metadata_cache)
{
- jint size = 0;
- jlong *metadata_cache_ptr;
- size_t max_size = 0, min_clean_size = 0, cur_size = 0;
- int cur_num_entries = -1;
- jboolean isCopy;
-
- if (metadata_cache == NULL) {
- h5nullArgument(env, "H5Fget_mdc_size: metadata_cache is NULL");
- } /* end if */
- else {
- size = (int)ENVPTR->GetArrayLength(ENVPAR metadata_cache);
- if (size < 3) {
- h5badArgument(env, "H5Fget_mdc_size: length of metadata_cache < 3.");
- } /* end if */
- else {
- if (H5Fget_mdc_size((hid_t)file_id, &max_size, &min_clean_size, &cur_size, &cur_num_entries) < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- metadata_cache_ptr = ENVPTR->GetLongArrayElements(ENVPAR metadata_cache, &isCopy);
- metadata_cache_ptr[0] = (jlong)max_size;
- metadata_cache_ptr[1] = (jlong)min_clean_size;
- metadata_cache_ptr[2] = (jlong)cur_size;
- ENVPTR->ReleaseLongArrayElements(ENVPAR metadata_cache, metadata_cache_ptr, 0);
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ size_t max_size = 0, min_clean_size = 0, cur_size = 0;
+ jlong *metadata_cache_ptr = NULL;
+ jsize size = 0;
+ int cur_num_entries = -1;
+
+ UNUSED(clss);
+
+ if (NULL == metadata_cache)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_size: metadata cache array is NULL");
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, metadata_cache)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_size: metadata_cache length < 0");
+ }
+
+ if (size < 3)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_size: length of metadata_cache array < 3");
+
+ if (H5Fget_mdc_size((hid_t)file_id, &max_size, &min_clean_size, &cur_size, &cur_num_entries) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ PIN_LONG_ARRAY(ENVONLY, metadata_cache, metadata_cache_ptr, &isCopy, "H5Fget_mdc_size: metadata_cache array not pinned");
+
+ metadata_cache_ptr[0] = (jlong)max_size;
+ metadata_cache_ptr[1] = (jlong)min_clean_size;
+ metadata_cache_ptr[2] = (jlong)cur_size;
+
+done:
+ if (metadata_cache_ptr)
+ UNPIN_LONG_ARRAY(ENVONLY, metadata_cache, metadata_cache_ptr, 0);
return (jint)cur_num_entries;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size */
@@ -480,31 +577,36 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1info
(JNIEnv *env, jclass clss, jlong obj_id)
{
- H5F_info2_t finfo;
- jvalue args[9];
+ H5F_info2_t finfo;
jobject ihinfobuf;
+ jvalue args[9];
jobject ret_obj = NULL;
- if (H5Fget_info2((hid_t)obj_id, &finfo) < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].j = (jlong)finfo.sohm.msgs_info.index_size;
- args[1].j = (jlong)finfo.sohm.msgs_info.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf = ret_obj;
-
- args[0].i = (jint)finfo.super.version;
- args[1].j = (jlong)finfo.super.super_size;
- args[2].j = (jlong)finfo.super.super_ext_size;
- args[3].i = (jint)finfo.free.version;
- args[4].j = (jlong)finfo.free.meta_size;
- args[5].j = (jlong)finfo.free.tot_space;
- args[6].j = (jint)finfo.sohm.version;
- args[7].j = (jlong)finfo.sohm.hdr_size;
- args[8].l = ihinfobuf;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5F_info2_t", "(IJJIJJIJLhdf/hdf5lib/structs/H5_ih_info_t;)V", args);
- } /* end else */
+ UNUSED(clss);
+
+ if (H5Fget_info2((hid_t)obj_id, &finfo) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].j = (jlong)finfo.sohm.msgs_info.index_size;
+ args[1].j = (jlong)finfo.sohm.msgs_info.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+
+ ihinfobuf = ret_obj;
+
+ args[0].i = (jint)finfo.super.version;
+ args[1].j = (jlong)finfo.super.super_size;
+ args[2].j = (jlong)finfo.super.super_ext_size;
+ args[3].i = (jint)finfo.free.version;
+ args[4].j = (jlong)finfo.free.meta_size;
+ args[5].j = (jlong)finfo.free.tot_space;
+ args[6].j = (jint)finfo.sohm.version;
+ args[7].j = (jlong)finfo.sohm.hdr_size;
+ args[8].l = ihinfobuf;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5F_info2_t", "(IJJIJJIJLhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+
+done:
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1info */
@@ -515,10 +617,15 @@ Java_hdf_hdf5lib_H5_H5Fget_1info
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
+ UNUSED(clss);
+
if (H5Freset_mdc_hit_rate_stats((hid_t)file_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats */
/*
@@ -528,10 +635,15 @@ Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
+ UNUSED(clss);
+
if (H5Fclear_elink_file_cache((hid_t)file_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache */
/*
@@ -541,10 +653,15 @@ 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 clss, jlong file_id)
{
+ UNUSED(clss);
+
if (H5Fstart_swmr_write((hid_t)file_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write */
/*
@@ -554,10 +671,15 @@ 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 clss, jlong file_id)
{
+ UNUSED(clss);
+
if (H5Fstart_mdc_logging((hid_t)file_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging */
/*
@@ -567,10 +689,15 @@ Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging
- (JNIEnv *env, jclass cls, jlong file_id)
+ (JNIEnv *env, jclass clss, jlong file_id)
{
+ UNUSED(clss);
+
if (H5Fstop_mdc_logging((hid_t)file_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging */
/*
@@ -580,36 +707,108 @@ 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 clss, jlong file_id, jbooleanArray mdc_logging_status)
{
+ jboolean *mdc_logging_status_ptr = NULL;
+ jboolean isCopy;
hbool_t is_enabled;
hbool_t is_currently_logging;
- jboolean *mdc_logging_status_ptr;
- jint size;
- jboolean isCopy;
+ jsize size;
+
+ UNUSED(clss);
- if (mdc_logging_status == NULL) {
- h5nullArgument(env, "H5Fget_mdc_logging_status: mdc_logging_status is NULL");
- } /* end if */
- else {
- size = (int)ENVPTR->GetArrayLength(ENVPAR mdc_logging_status);
- if (size < 2) {
- h5badArgument(env, "H5Fget_mdc_logging_status: length of mdc_logging_status < 2.");
- } /* end if */
- else {
- if (H5Fget_mdc_logging_status((hid_t)file_id, &is_enabled, &is_currently_logging) < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- mdc_logging_status_ptr = ENVPTR->GetBooleanArrayElements(ENVPAR mdc_logging_status, &isCopy);
- mdc_logging_status_ptr[0] = (jboolean)is_enabled;
- mdc_logging_status_ptr[1] = (jboolean)is_currently_logging;
- ENVPTR->ReleaseBooleanArrayElements(ENVPAR mdc_logging_status, mdc_logging_status_ptr, 0);
- } /* end else */
- } /* end else */
- } /* end else */
+ if (NULL == mdc_logging_status)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_logging_status: mdc_logging_status is NULL");
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, mdc_logging_status)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_logging_status: mdc_logging_status length < 0");
+ }
+
+ if (size < 2)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_logging_status: length of mdc_logging_status < 2");
+
+ if (H5Fget_mdc_logging_status((hid_t)file_id, &is_enabled, &is_currently_logging) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ PIN_BOOL_ARRAY(ENVONLY, mdc_logging_status, mdc_logging_status_ptr, &isCopy, "H5Fget_mdc_logging_status: mdc_logging_status array not pinned");
+
+ mdc_logging_status_ptr[0] = (jboolean)is_enabled;
+ mdc_logging_status_ptr[1] = (jboolean)is_currently_logging;
+
+done:
+ if (mdc_logging_status_ptr)
+ UNPIN_BOOL_ARRAY(ENVONLY, mdc_logging_status, mdc_logging_status_ptr, 0);
+
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status */
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fset_dset_no_attrs_hint
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint
+(JNIEnv *env, jclass clss, jlong file_id, jboolean minimize)
+{
+ hbool_t minimize_val;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ minimize_val = (minimize == JNI_TRUE) ? TRUE : FALSE;
+
+ if ((retVal = H5Fset_dset_no_attrs_hint((hid_t)file_id, (hbool_t)minimize_val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+}
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fget_dset_no_attrs_hint
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
+(JNIEnv *env, jclass clss, jlong file_id)
+{
+ jboolean bval = JNI_FALSE;
+ hbool_t minimize = FALSE;
+
+ UNUSED(clss);
+
+ if (H5Fget_dset_no_attrs_hint((hid_t)file_id, (hbool_t *)&minimize) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (minimize == TRUE)
+ bval = JNI_TRUE;
+
+done:
+ return bval;
+}
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fset_libver_bounds
+ * Signature: (JII)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
+ (JNIEnv *env, jclass clss, jlong file_id, jint low, jint high)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Fset_libver_bounds((hid_t)file_id, (H5F_libver_t)low, (H5F_libver_t)high)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds */
#ifdef __cplusplus
diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h
index fcfdedf..fc02c76 100644
--- a/java/src/jni/h5fImp.h
+++ b/java/src/jni/h5fImp.h
@@ -68,6 +68,15 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Fis_accessible
+ * Signature: (Ljava/lang/String;J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Fis_1accessible
+ (JNIEnv*, jclass, jstring, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Fget_create_plist
* Signature: (J)J
*/
@@ -95,6 +104,15 @@ Java_hdf_hdf5lib_H5_H5Fget_1intent
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Fget_fileno
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1fileno
+ (JNIEnv*, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Fclose
* Signature: (J)I
*/
@@ -246,6 +264,33 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
(JNIEnv *, jclass, jlong, jbooleanArray);
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fset_dset_no_attrs_hint
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint
+ (JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fget_dset_no_attrs_hint
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fset_libver_bounds
+ * Signature: (JII)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
+(JNIEnv *, jclass, jlong, jint, jint);
+
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c
index 41ec382..79b1b65 100644
--- a/java/src/jni/h5gImp.c
+++ b/java/src/jni/h5gImp.c
@@ -29,8 +29,10 @@ extern "C" {
#include "h5util.h"
#include "h5gImp.h"
-extern JavaVM *jvm;
-extern jobject visit_callback;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -41,12 +43,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Gclose
(JNIEnv *env, jclass clss, jlong group_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Gclose((hid_t)group_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Gclose((hid_t)group_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Gclose */
@@ -64,33 +68,46 @@ jobject
create_H5G_info_t
(JNIEnv *env, H5G_info_t group_info)
{
- jclass cls;
+ jfieldID fid_storage_type, fid_nlinks, fid_max_corder, fid_mounted;
jboolean jmounted;
+ jclass cls;
jint storage_type;
jobject obj = NULL;
- jfieldID fid_storage_type, fid_nlinks, fid_max_corder, fid_mounted;
- cls = ENVPTR->FindClass(ENVPAR "hdf/hdf5lib/structs/H5G_info_t");
- if (cls != NULL) {
- obj = ENVPTR->AllocObject(ENVPAR cls);
- if (obj != NULL) {
- if ((fid_storage_type = ENVPTR->GetFieldID(ENVPAR cls, "storage_type", "I")) != NULL) {
- if ((fid_nlinks = ENVPTR->GetFieldID(ENVPAR cls, "nlinks", "J")) != NULL) {
- if ((fid_max_corder = ENVPTR->GetFieldID(ENVPAR cls, "max_corder", "J")) != NULL) {
- if ((fid_mounted = ENVPTR->GetFieldID(ENVPAR cls, "mounted", "Z")) != NULL) {
- jmounted = (group_info.mounted==0) ? JNI_FALSE : JNI_TRUE;
- storage_type = (jint)group_info.storage_type;
-
- ENVPTR->SetIntField(ENVPAR obj, fid_storage_type, (jint)storage_type);
- ENVPTR->SetLongField(ENVPAR obj, fid_nlinks, (jlong)group_info.nlinks);
- ENVPTR->SetLongField(ENVPAR obj, fid_max_corder, (jlong)group_info.max_corder);
- ENVPTR->SetBooleanField(ENVPAR obj, fid_mounted, jmounted);
- }
- }
- }
- }
- }
- }
+ if (NULL == (cls = ENVPTR->FindClass(ENVONLY, "hdf/hdf5lib/structs/H5G_info_t")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (obj = ENVPTR->AllocObject(ENVONLY, cls)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid_storage_type = ENVPTR->GetFieldID(ENVONLY, cls, "storage_type", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid_nlinks = ENVPTR->GetFieldID(ENVONLY, cls, "nlinks", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid_max_corder = ENVPTR->GetFieldID(ENVONLY, cls, "max_corder", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid_mounted = ENVPTR->GetFieldID(ENVONLY, cls, "mounted", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ jmounted = (group_info.mounted == 0) ? JNI_FALSE : JNI_TRUE;
+ storage_type = (jint)group_info.storage_type;
+
+ ENVPTR->SetIntField(ENVONLY, obj, fid_storage_type, (jint)storage_type);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetLongField(ENVONLY, obj, fid_nlinks, (jlong)group_info.nlinks);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetLongField(ENVONLY, obj, fid_max_corder, (jlong)group_info.max_corder);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetBooleanField(ENVONLY, obj, fid_mounted, jmounted);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
return obj;
} /* end create_H5G_info_t */
@@ -104,17 +121,22 @@ Java_hdf_hdf5lib_H5__1H5Gcreate2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jlong link_plist_id, jlong create_plist_id, jlong access_plist_id)
{
- hid_t group_id = -1;
- const char *gName;
+ const char *grpName = NULL;
+ hid_t group_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, gName);
- if (gName != NULL) {
- group_id = H5Gcreate2((hid_t)loc_id, gName, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, gName);
- if (group_id < 0)
- h5libraryError(env);
- }
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gcreate2: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gcreate2: group name not pinned");
+
+ if ((group_id = H5Gcreate2((hid_t)loc_id, grpName, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
return (jlong)group_id;
} /* end Java_hdf_hdf5lib_H5__1H5Gcreate2 */
@@ -126,14 +148,16 @@ Java_hdf_hdf5lib_H5__1H5Gcreate2
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Gcreate_1anon
- (JNIEnv *env, jclass cls, jlong loc_id, jlong gcpl_id, jlong gapl_id)
+ (JNIEnv *env, jclass clss, jlong loc_id, jlong gcpl_id, jlong gapl_id)
{
- hid_t group_id = -1;
+ hid_t group_id = H5I_INVALID_HID;
+
+ UNUSED(clss);
- group_id = H5Gcreate_anon((hid_t)loc_id, (hid_t)gcpl_id, (hid_t)gapl_id);
- if (group_id < 0)
- h5libraryError(env);
+ if ((group_id = H5Gcreate_anon((hid_t)loc_id, (hid_t)gcpl_id, (hid_t)gapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)group_id;
} /* end Java_hdf_hdf5lib_H5__1H5Gcreate_1anon */
@@ -146,18 +170,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Gopen2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id)
{
- hid_t group_id = -1;
- const char *gName;
+ const char *grpName = NULL;
+ hid_t group_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, gName);
- if (gName != NULL) {
- group_id = H5Gopen2((hid_t)loc_id, gName, (hid_t)access_plist_id );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, gName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gopen2: group name is NULL");
- if (group_id < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gopen2: group name not pinned");
+
+ if ((group_id = H5Gopen2((hid_t)loc_id, grpName, (hid_t)access_plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
return (jlong)group_id;
} /* end Java_hdf_hdf5lib_H5__1H5Gopen2 */
@@ -170,13 +198,16 @@ Java_hdf_hdf5lib_H5__1H5Gopen2
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1create_1plist
- (JNIEnv *env, jclass cls, jlong loc_id)
+ (JNIEnv *env, jclass clss, jlong loc_id)
{
- hid_t plist_id = H5Gget_create_plist((hid_t)loc_id);
+ hid_t plist_id = H5I_INVALID_HID;
- if (plist_id < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((plist_id = H5Gget_create_plist((hid_t)loc_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)plist_id;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1create_1plist */
@@ -187,16 +218,20 @@ Java_hdf_hdf5lib_H5_H5Gget_1create_1plist
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info
- (JNIEnv *env, jclass cls, jlong loc_id)
+ (JNIEnv *env, jclass clss, jlong loc_id)
{
- jobject obj = NULL;
H5G_info_t group_info;
+ jobject obj = NULL;
+
+ UNUSED(clss);
if (H5Gget_info((hid_t)loc_id, &group_info) < 0)
- h5libraryError(env);
- else
- obj = create_H5G_info_t(env, group_info);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (obj = create_H5G_info_t(env, group_info)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_info: unable to create H5G_info_t object");
+done:
return obj;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1info */
@@ -207,25 +242,32 @@ Java_hdf_hdf5lib_H5_H5Gget_1info
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name
- (JNIEnv *env, jclass cls, jlong loc_id, jstring name, jlong lapl_id)
+ (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong lapl_id)
{
- jobject obj = NULL;
- herr_t ret_val = -1;
- const char *gName;
H5G_info_t group_info;
+ const char *grpName = NULL;
+ jobject obj = NULL;
+ herr_t ret_val = FAIL;
+
+ UNUSED(clss);
- PIN_JAVA_STRING(name, gName);
- if (gName != NULL) {
- ret_val = H5Gget_info_by_name((hid_t)loc_id, gName, &group_info, (hid_t)lapl_id);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_info_by_name: group name is NULL");
- UNPIN_JAVA_STRING(name, gName);
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gget_info_by_name: group name not pinned");
- if (ret_val < 0)
- h5libraryError(env);
- else
- obj = create_H5G_info_t(env, group_info);
+ if ((ret_val = H5Gget_info_by_name((hid_t)loc_id, grpName, &group_info, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (obj = create_H5G_info_t(env, group_info))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_info_by_name: unable to create H5G_info_t object");
}
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
+
return obj;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name */
@@ -236,29 +278,36 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx
- (JNIEnv *env, jclass cls, jlong loc_id, jstring name, jint index_type,
+ (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_type,
jint order, jlong n, jlong lapl_id)
{
- jobject obj = NULL;
- herr_t ret_val = -1;
- const char *gName;
- H5G_info_t group_info;
- H5_index_t cindex_type = (H5_index_t)index_type;
- H5_iter_order_t corder = (H5_iter_order_t)order;
-
- PIN_JAVA_STRING(name, gName);
- if (gName != NULL) {
- ret_val = H5Gget_info_by_idx((hid_t)loc_id, gName, cindex_type,
- corder, (hsize_t)n, &group_info, (hid_t)lapl_id);
-
- UNPIN_JAVA_STRING(name, gName);
-
- if (ret_val < 0)
- h5libraryError(env);
- else
- obj = create_H5G_info_t(env, group_info);
+ H5_iter_order_t corder = (H5_iter_order_t)order;
+ H5_index_t cindex_type = (H5_index_t)index_type;
+ H5G_info_t group_info;
+ const char *grpName = NULL;
+ jobject obj = NULL;
+ herr_t ret_val = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_info_by_idx: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gget_info_by_idx: group name not pinned");
+
+ if ((ret_val = H5Gget_info_by_idx((hid_t)loc_id, grpName, cindex_type,
+ corder, (hsize_t)n, &group_info, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (obj = create_H5G_info_t(env, group_info))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_info_by_idx: unable to create H5G_info_t object");
}
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
+
return obj;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx */
@@ -271,8 +320,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Gflush
(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Gflush((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Gflush */
/*
@@ -284,8 +338,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Grefresh
(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Grefresh((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Grefresh */
diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c
index 47574ca..e8030aee 100644
--- a/java/src/jni/h5iImp.c
+++ b/java/src/jni/h5iImp.c
@@ -27,8 +27,10 @@ extern "C" {
#include "h5jni.h"
#include "h5iImp.h"
-extern JavaVM *jvm;
-extern jobject visit_callback;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -41,10 +43,12 @@ Java_hdf_hdf5lib_H5_H5Iget_1type
{
H5I_type_t retVal = H5I_BADID;
- retVal = H5Iget_type((hid_t)obj_id);
- if (retVal == H5I_BADID)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5I_BADID == (retVal = H5Iget_type((hid_t)obj_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1type */
@@ -57,32 +61,32 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Iget_1name_1long
(JNIEnv *env, jclass clss, jlong obj_id, jobjectArray name, jlong buf_size)
{
- char *aName;
- jstring str;
- hssize_t size = -1;
- long bs;
-
- bs = (long)buf_size;
- if (bs <= 0) {
- h5badArgument(env, "H5Iget_name: buf_size <= 0");
- } /* end if */
- else {
- aName = (char*)HDmalloc(sizeof(char) * (size_t)bs);
- if (aName == NULL) {
- h5outOfMemory(env, "H5Iget_name: malloc failed");
- } /* end if */
- else {
- size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size);
- if (size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, str);
- }
- HDfree(aName);
- }
- }
+ ssize_t size = -1;
+ jstring str;
+ char *aName = NULL;
+
+ UNUSED(clss);
+
+ if (buf_size < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Iget_name_long: buf_size < 0");
+
+ if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Iget_name_long: malloc failed");
+
+ if ((size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ aName[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (aName)
+ HDfree(aName);
+
return (jlong)size;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1name */
@@ -96,33 +100,30 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Iget_1name
(JNIEnv *env, jclass clss, jlong obj_id)
{
- char *aName;
jstring str = NULL;
- ssize_t buf_size;
-
- /* get the length of the name */
- buf_size = H5Iget_name((hid_t)obj_id, NULL, 0);
-
- if (buf_size <= 0) {
- h5badArgument(env, "H5Iget_name: buf_size <= 0");
- } /* end if */
- else {
- buf_size++; /* add extra space for the null terminator */
- aName = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (aName == NULL) {
- h5outOfMemory(env, "H5Iget_name: malloc failed");
- } /* end if */
- else {
- buf_size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size);
- if (buf_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- }
- HDfree(aName);
- }
- }
+ ssize_t buf_size = -1;
+ char *aName = NULL;
+
+ UNUSED(clss);
+
+ /* Get the length of the name */
+ if ((buf_size = H5Iget_name((hid_t)obj_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Iget_name: malloc failed");
+
+ if (H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ aName[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (aName)
+ HDfree(aName);
+
return str;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1name */
@@ -135,12 +136,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Iget_1ref
(JNIEnv *env, jclass clss, jlong obj_id)
{
- int retVal = -1;
+ int retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Iget_ref((hid_t)obj_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Iget_ref((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1ref */
@@ -153,12 +156,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Iinc_1ref
(JNIEnv *env, jclass clss, jlong obj_id)
{
- int retVal = -1;
+ int retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Iinc_ref((hid_t)obj_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Iinc_ref((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iinc_1ref */
@@ -171,12 +176,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Idec_1ref
(JNIEnv *env, jclass clss, jlong obj_id)
{
- int retVal = -1;
+ int retVal = FAIL;
- retVal = H5Idec_ref((hid_t)obj_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Idec_ref((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Idec_1ref */
@@ -190,12 +197,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Iget_1file_1id
(JNIEnv *env, jclass clss, jlong obj_id)
{
- hid_t file_id = -1;
+ hid_t file_id = H5I_INVALID_HID;
+
+ UNUSED(clss);
- file_id = H5Iget_file_id((hid_t)obj_id);
- if (file_id < 0)
- h5libraryError(env);
+ if ((file_id = H5Iget_file_id((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong) file_id;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1file_1id */
@@ -208,12 +217,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Iget_1type_1ref
(JNIEnv *env, jclass clss, jint type)
{
- int retVal = -1;
+ int retVal = FAIL;
- retVal = H5Iget_type_ref((H5I_type_t)type);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Iget_type_ref((H5I_type_t)type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1type_1ref */
@@ -226,12 +237,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Idec_1type_1ref
(JNIEnv *env, jclass clss, jint type)
{
- int retVal = -1;
+ int retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Idec_type_ref((H5I_type_t)type);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Idec_type_ref((H5I_type_t)type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Idec_1type_1ref */
@@ -244,12 +257,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref
(JNIEnv *env, jclass clss, jint type)
{
- int retVal = -1;
+ int retVal = FAIL;
- retVal = H5Iinc_type_ref((H5I_type_t)type);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Iinc_type_ref((H5I_type_t)type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref */
@@ -262,11 +277,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Inmembers
(JNIEnv *env, jclass clss, jint type)
{
- hsize_t num_members;
+ hsize_t num_members = 0;
+
+ UNUSED(clss);
if (H5Inmembers((H5I_type_t)type, &num_members) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)num_members;
} /* end Java_hdf_hdf5lib_H5_H5Inmembers */
@@ -281,12 +299,14 @@ Java_hdf_hdf5lib_H5_H5Iis_1valid
{
htri_t bval = JNI_FALSE;
- bval = H5Iis_valid((hid_t)obj_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((bval = H5Iis_valid((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Iis_1valid */
/*
@@ -300,12 +320,14 @@ Java_hdf_hdf5lib_H5_H5Itype_1exists
{
htri_t bval = JNI_FALSE;
- bval = H5Itype_exists((H5I_type_t)type);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Itype_exists((H5I_type_t)type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+done:
return (jboolean)bval;
} /* end else Java_hdf_hdf5lib_H5_H5Itype_1exists */
@@ -318,8 +340,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Iclear_1type
(JNIEnv *env, jclass clss, jint type, jboolean force)
{
- if (H5Iclear_type((H5I_type_t)type, (hbool_t)force) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5Iclear_type((H5I_type_t)type, (hbool_t)force) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Iclear_1type */
/*
@@ -331,8 +358,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Idestroy_1type
(JNIEnv *env, jclass clss, jint type)
{
- if (H5Idestroy_type((H5I_type_t)type) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5Idestroy_type((H5I_type_t)type) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Idestroy_1type */
#ifdef __cplusplus
diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h
index 2970e14..f583630 100644
--- a/java/src/jni/h5jni.h
+++ b/java/src/jni/h5jni.h
@@ -27,147 +27,300 @@
#ifdef __cplusplus
#define ENVPTR (env)
- #define ENVPAR
#define ENVONLY
#define CBENVPTR (cbenv)
- #define CBENVPAR
+ #define CBENVONLY
#define JVMPTR (jvm)
#define JVMPAR
- #define JVMPAR2
#else /* __cplusplus */
#define ENVPTR (*env)
- #define ENVPAR env,
#define ENVONLY env
#define CBENVPTR (*cbenv)
- #define CBENVPAR cbenv,
+ #define CBENVONLY cbenv
#define JVMPTR (*jvm)
#define JVMPAR jvm
- #define JVMPAR2 jvm,
#endif /* __cplusplus */
+/*
+ * Used to silence compiler when a particular
+ * function parameter is not used.
+ */
+#define UNUSED(o) (void) o
+
+/*
+ * Macro to check for a JNI exception after a JNI method is called.
+ * If an exception occurred, the value of 'clearException' will determine
+ * whether or not the exception will be cleared in order for the native
+ * method to do its own error handling.
+ *
+ * If the exception does not get cleared, this macro will skip to the
+ * cleanup+return section of the native method, since at that point
+ * cleaning up and returning is the only safe thing that can be done.
+ */
+#define CHECK_JNI_EXCEPTION(envptr, clearException) \
+do { \
+ if (JNI_TRUE == (*envptr)->ExceptionCheck(envptr)) { \
+ if (JNI_TRUE == clearException) \
+ (*envptr)->ExceptionClear(envptr); \
+ else \
+ goto done; \
+ } \
+} while(0)
+
/* Macros for class access */
/* Calling code must define ret_obj as jobject */
-#define CALL_CONSTRUCTOR(classname,classsig,args) { \
- jclass cls; \
- jmethodID constructor; \
- cls = ENVPTR->FindClass(ENVPAR (classname)); \
- if (cls == 0) { \
- h5JNIFatalError(env, "JNI error: GetObjectClass\n"); \
- ret_obj = NULL; \
- } \
- constructor = ENVPTR->GetMethodID(ENVPAR cls, "<init>", (classsig)); \
- if (constructor == 0) { \
- h5JNIFatalError(env, "JNI error: GetMethodID failed\n"); \
- ret_obj = NULL; \
- } \
- ret_obj = ENVPTR->NewObjectA(ENVPAR cls, constructor, (args)); \
-}
+#define CALL_CONSTRUCTOR(envptr, classname, classsig, args, ret_obj) \
+do { \
+ jmethodID constructor; \
+ jclass cls; \
+ \
+ if (NULL == (cls = (*envptr)->FindClass(envptr, (classname)))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, "JNI error: GetObjectClass"); \
+ } \
+ if (NULL == (constructor = (*envptr)->GetMethodID(envptr, cls, "<init>", (classsig)))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, "JNI error: GetMethodID failed"); \
+ } \
+ if (NULL == (ret_obj = (*envptr)->NewObjectA(envptr, cls, constructor, (args)))) { \
+ HDprintf("FATAL ERROR: %s: Creation failed\n", classname); \
+ CHECK_JNI_EXCEPTION(envptr, JNI_FALSE); \
+ } \
+} while(0)
+
+/*
+ * Macros for pinning/unpinning objects.
+ */
+#define PIN_BYTE_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (*envptr)->GetByteArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define PIN_BYTE_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (jbyte *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define UNPIN_BYTE_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+do { \
+ (*envptr)->ReleaseByteArrayElements(envptr, pinnedArray, (jbyte *) bufToRelease, freeMode); \
+} while(0)
+
+#define PIN_SHORT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (*envptr)->GetShortArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define PIN_SHORT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (jshort *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define UNPIN_SHORT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+do { \
+ (*envptr)->ReleaseShortArrayElements(envptr, pinnedArray, (jshort *) bufToRelease, freeMode); \
+} while(0)
+
+#define PIN_INT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (*envptr)->GetIntArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define PIN_INT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (jint *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define UNPIN_INT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+do { \
+ (*envptr)->ReleaseIntArrayElements(envptr, pinnedArray, (jint *) bufToRelease, freeMode); \
+} while(0)
+
+#define PIN_LONG_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (*envptr)->GetLongArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define PIN_LONG_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (jlong *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define UNPIN_LONG_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+do { \
+ (*envptr)->ReleaseLongArrayElements(envptr, pinnedArray, (jlong *) bufToRelease, freeMode); \
+} while(0)
+#define PIN_FLOAT_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (*envptr)->GetFloatArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define PIN_FLOAT_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (jfloat *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define UNPIN_FLOAT_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+do { \
+ (*envptr)->ReleaseFloatArrayElements(envptr, pinnedArray, (jfloat *) bufToRelease, freeMode); \
+} while(0)
+
+#define PIN_DOUBLE_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (*envptr)->GetDoubleArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define PIN_DOUBLE_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (jdouble *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define UNPIN_DOUBLE_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+do { \
+ (*envptr)->ReleaseDoubleArrayElements(envptr, pinnedArray, (jdouble *) bufToRelease, freeMode); \
+} while(0)
+
+#define PIN_BOOL_ARRAY(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (*envptr)->GetBooleanArrayElements(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define PIN_BOOL_ARRAY_CRITICAL(envptr, arrayToPin, outBuf, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outBuf = (jboolean *) (*envptr)->GetPrimitiveArrayCritical(envptr, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define UNPIN_BOOL_ARRAY(envptr, pinnedArray, bufToRelease, freeMode) \
+do { \
+ (*envptr)->ReleaseBooleanArrayElements(envptr, pinnedArray, (jboolean *) bufToRelease, freeMode); \
+} while(0)
+
+#define UNPIN_ARRAY_CRITICAL(envptr, pinnedArray, bufToRelease, freeMode) \
+do { \
+ (*envptr)->ReleasePrimitiveArrayCritical(envptr, pinnedArray, bufToRelease, freeMode); \
+} while(0)
/* Macros for string access */
-#define PIN_JAVA_STRING(javastr,localstr) { \
- jboolean isCopy; \
- (localstr) = NULL; \
- if ((javastr) == NULL) { \
- h5nullArgument(env, "java string is NULL"); \
- } \
- else { \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- } \
- } \
-}
-
-#define UNPIN_JAVA_STRING(javastr,localstr) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
-}
-
-#define PIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str) { \
- jboolean isCopy; \
- (localstr) = NULL; \
- (local2str) = NULL; \
- if ((javastr) == NULL) { \
- h5nullArgument(env, "java string is NULL"); \
- } \
- else if ((java2str) == NULL) { \
- h5nullArgument(env, "second java string is NULL"); \
- } \
- else { \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- } \
- else { \
- (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \
- if ((local2str) == NULL) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- h5JNIFatalError(env, "second local c string is not pinned"); \
- } \
- } \
- } \
-}
-
-#define UNPIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \
-}
-
-#define PIN_JAVA_STRING_THREE(javastr,localstr,java2str,local2str,java3str,local3str) { \
- jboolean isCopy; \
- (localstr) = NULL; \
- (local2str) = NULL; \
- (local3str) = NULL; \
- if ((javastr) == NULL) { \
- h5nullArgument(env, "java string is NULL"); \
- } \
- else if ((java2str) == NULL) { \
- h5nullArgument(env, "second java string is NULL"); \
- } \
- else if ((java3str) == NULL) { \
- h5nullArgument(env, "third java string is NULL"); \
- } \
- else { \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- } \
- else { \
- (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \
- if ((local2str) == NULL) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- h5JNIFatalError(env, "second local c string is not pinned"); \
- } \
- else { \
- (local3str) = ENVPTR->GetStringUTFChars(ENVPAR (java3str), &isCopy); \
- if ((local3str) == NULL) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \
- h5JNIFatalError(env, "third local c string is not pinned"); \
- } \
- } \
- } \
- } \
-}
-
-#define UNPIN_JAVA_STRING_THREE(javastr,localstr,java2str,local2str,java3str,local3str) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (java3str), (local3str)); \
-}
+#define PIN_JAVA_STRING(envptr, stringToPin, outString, isCopy, failErrMsg) \
+do { \
+ if (NULL == (outString = (*envptr)->GetStringUTFChars(envptr, stringToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(envptr, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(envptr, failErrMsg); \
+ } \
+} while(0)
+
+#define UNPIN_JAVA_STRING(envptr, pinnedString, stringToRelease) \
+do { \
+ (*envptr)->ReleaseStringUTFChars(envptr, pinnedString, stringToRelease); \
+} while(0)
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-extern jboolean h5JNIFatalError(JNIEnv *, const char *);
-extern jboolean h5nullArgument(JNIEnv *, const char *);
-extern jboolean h5badArgument (JNIEnv *, const char *);
-extern jboolean h5outOfMemory (JNIEnv *, const char *);
-extern jboolean h5libraryError(JNIEnv *env );
-extern jboolean h5raiseException(JNIEnv *, const char *, const char *);
+extern jboolean h5JNIFatalError(JNIEnv *env, const char *);
+extern jboolean h5nullArgument(JNIEnv *env, const char *);
+extern jboolean h5badArgument(JNIEnv *env, const char *);
+extern jboolean h5outOfMemory(JNIEnv *env, const char *);
+extern jboolean h5libraryError(JNIEnv *env);
+extern jboolean h5raiseException(JNIEnv *env, const char *, const char *);
extern jboolean h5unimplemented( JNIEnv *env, const char *functName);
+/*
+ * The following macros are to facilitate immediate cleanup+return
+ * from a native JNI method when an exception is to be thrown.
+ * Since, in general, the "cleanup" methods are the only safe JNI
+ * methods to call once an exception has occurred, we want to immediately
+ * cleanup and return instead of letting the native method continue.
+ *
+ * Note that a native method can clear the exception when one occurs and
+ * then do its own error handling, but we instead opt to immediately return.
+ */
+#define H5_JNI_FATAL_ERROR(env, message) \
+do { \
+ h5JNIFatalError(env, message); \
+ goto done; \
+} while(0)
+
+#define H5_NULL_ARGUMENT_ERROR(env, message) \
+do { \
+ h5nullArgument(env, message); \
+ goto done; \
+} while(0)
+
+#define H5_BAD_ARGUMENT_ERROR(env, message) \
+do { \
+ h5badArgument(env, message); \
+ goto done; \
+} while(0)
+
+#define H5_OUT_OF_MEMORY_ERROR(env, message) \
+do { \
+ h5outOfMemory(env, message); \
+ goto done; \
+} while(0)
+
+#define H5_LIBRARY_ERROR(env) \
+do { \
+ h5libraryError(env); \
+ goto done; \
+} while(0)
+
+#define H5_RAISE_EXCEPTION(env, message, exception) \
+do { \
+ h5raiseException(env, message, exception); \
+ goto done; \
+} while(0)
+
+#define H5_UNIMPLEMENTED(env, message) \
+do { \
+ h5unimplemented(env, message); \
+ goto done; \
+} while(0)
+
/* implemented at H5.c */
extern jint get_enum_value(JNIEnv *env, jobject enum_obj);
extern jobject get_enum_object(JNIEnv *env, const char* enum_class_name,
@@ -176,6 +329,9 @@ extern jobject get_enum_object(JNIEnv *env, const char* enum_class_name,
/* implemented at H5G.c */
extern jobject create_H5G_info_t(JNIEnv *env, H5G_info_t group_info);
+/* implemented at h5oimp.c */
+extern jobject create_H5O_token_t(JNIEnv *env, const H5O_token_t *token, hbool_t is_critical_pinning);
+
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c
index ac71845..b5312bd 100644
--- a/java/src/jni/h5lImp.c
+++ b/java/src/jni/h5lImp.c
@@ -27,14 +27,21 @@ extern "C" {
#include "h5jni.h"
#include "h5lImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
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_info2_t *info, void *cb_data);
/*
* Class: hdf_hdf5lib_H5
@@ -46,19 +53,28 @@ Java_hdf_hdf5lib_H5_H5Lcopy
(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, jlong dst_loc_id,
jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lCurName;
- const char *lDstName;
+ const char *lCurName = NULL;
+ const char *lDstName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- if (lCurName != NULL && lDstName != NULL) {
- status = H5Lcopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcopy: src name is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcopy: dest name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcopy: src name not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcopy: dest name not pinned");
+
+ if ((status = H5Lcopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (lDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, lDstName);
+ if (lCurName)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, lCurName);
} /* end Java_hdf_hdf5lib_H5_H5Lcopy */
/*
@@ -71,20 +87,34 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1external
(JNIEnv *env, jclass clss, jstring file_name, jstring cur_name,
jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lFileName;
- const char *lCurName;
- const char *lDstName;
-
- PIN_JAVA_STRING_THREE(file_name, lFileName, cur_name, lCurName, dst_name, lDstName);
- if (lFileName != NULL && lCurName != NULL && lDstName != NULL) {
- status = H5Lcreate_external(lFileName, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
-
- UNPIN_JAVA_STRING_THREE(file_name, lFileName, cur_name, lCurName, dst_name, lDstName);
-
- if (status < 0)
- h5libraryError(env);
- }
+ const char *lFileName = NULL;
+ const char *lCurName = NULL;
+ const char *lDstName = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == file_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_external: file name is NULL");
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_external: object name is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_external: link name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, file_name, lFileName, NULL, "H5Lcreate_external: file name not pinned");
+ PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcreate_external: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcreate_external: link name not pinned");
+
+ if ((status = H5Lcreate_external(lFileName, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (lDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, lDstName);
+ if (lCurName)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, lCurName);
+ if (lFileName)
+ UNPIN_JAVA_STRING(ENVONLY, file_name, lFileName);
} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1external */
/*
@@ -97,19 +127,28 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1hard
(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name,
jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lCurName;
- const char *lDstName;
+ const char *lCurName = NULL;
+ const char *lDstName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- if (lCurName != NULL && lDstName != NULL) {
- status = H5Lcreate_hard((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_hard: object name is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_hard: link name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcreate_hard: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcreate_hard: link name not pinned");
+
+ if ((status = H5Lcreate_hard((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (lDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, lDstName);
+ if (lCurName)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, lCurName);
} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1hard */
/*
@@ -122,19 +161,28 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1soft
(JNIEnv *env, jclass clss, jstring cur_name, jlong dst_loc_id,
jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lCurName;
- const char *lDstName;
+ const char *linkTarget = NULL;
+ const char *linkName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- if (lCurName != NULL && lDstName != NULL) {
- status = H5Lcreate_soft(lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_soft: link target is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_soft: link name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, cur_name, linkTarget, NULL, "H5Lcreate_soft: link target not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, linkName, NULL, "H5Lcreate_soft: link name not pinned");
+
+ if ((status = H5Lcreate_soft(linkTarget, (hid_t)dst_loc_id, linkName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (linkName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, linkName);
+ if (linkTarget)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, linkTarget);
} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1soft */
/*
@@ -146,18 +194,22 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Ldelete
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
- herr_t status = -1;
- const char *lName;
+ const char *linkName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Ldelete((hid_t)loc_id, lName, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ldelete: link name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Ldelete: link name not pinned");
+
+ if ((status = H5Ldelete((hid_t)loc_id, linkName, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (linkName)
+ UNPIN_JAVA_STRING(ENVONLY, name, linkName);
} /* end Java_hdf_hdf5lib_H5_H5Ldelete */
/*
@@ -170,19 +222,23 @@ Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jint index_field, jint order, jlong link_n, jlong access_id)
{
+ const char *groupName = NULL;
hsize_t n = (hsize_t)link_n;
- herr_t status;
- const char *lName;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Ldelete_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, n, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ldelete_by_idx: group name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Ldelete_by_idx: group name not pinned");
+
+ if ((status = H5Ldelete_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, n, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (groupName)
+ UNPIN_JAVA_STRING(ENVONLY, name, groupName);
} /* end Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx */
/*
@@ -194,20 +250,24 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Lexists
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
- htri_t bval = JNI_FALSE;
- const char *lName;
+ const char *linkName = NULL;
+ htri_t bval = JNI_FALSE;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- bval = H5Lexists((hid_t)loc_id, lName, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lexists: link name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Lexists: link name not pinned");
+
+ if ((bval = H5Lexists((hid_t)loc_id, linkName, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (linkName)
+ UNPIN_JAVA_STRING(ENVONLY, name, linkName);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Lexists */
@@ -221,33 +281,56 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Lget_1info
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
- jobject ret_obj = NULL;
- jvalue args[5];
- herr_t status;
- H5L_info_t infobuf;
- const char *lName;
-
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Lget_info((hid_t)loc_id, lName, &infobuf, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = infobuf.type;
- args[1].z = infobuf.corder_valid;
- args[2].j = infobuf.corder;
- args[3].i = infobuf.cset;
- if(infobuf.type==0)
- args[4].j = (jlong)infobuf.u.address;
- else
- args[4].j = (jlong)infobuf.u.val_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args);
- } /* end else */
- } /* end if */
+ H5L_info2_t infobuf;
+ const char *linkName = NULL;
+ jvalue args[5];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_info: link name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Lget_info: link name not pinned");
+
+ if ((status = H5Lget_info2((hid_t)loc_id, linkName, &infobuf, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /*
+ * Set the last argument based upon whether this is a hard link (which returns object tokens)
+ * or a soft/user-defined link (which returns the link's value size). Then, call the appropriate
+ * constructor to instantiate an H5L_info_t object.
+ */
+ if (infobuf.type == H5L_TYPE_HARD) {
+ jobject token;
+
+ /* Create an H5O_token_t object */
+ if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.u.token, FALSE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ args[0].i = infobuf.type;
+ args[1].z = infobuf.corder_valid;
+ args[2].j = infobuf.corder;
+ args[3].i = infobuf.cset;
+ args[4].l = token;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, ret_obj);
+ }
+ else {
+ args[0].i = infobuf.type;
+ args[1].z = infobuf.corder_valid;
+ args[2].j = infobuf.corder;
+ args[3].i = infobuf.cset;
+ args[4].j = (jlong)infobuf.u.val_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args, ret_obj);
+ }
+
+done:
+ if (linkName)
+ UNPIN_JAVA_STRING(ENVONLY, name, linkName);
+
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1info */
@@ -261,33 +344,56 @@ Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jint index_field, jint order, jlong link_n, jlong access_id)
{
- jobject ret_obj = NULL;
- jvalue args[5];
- herr_t status;
- H5L_info_t infobuf;
- const char *lName;
-
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Lget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = infobuf.type;
- args[1].z = infobuf.corder_valid;
- args[2].j = infobuf.corder;
- args[3].i = infobuf.cset;
- if(infobuf.type==0)
- args[4].j = (jlong)infobuf.u.address;
- else
- args[4].j = (jlong)infobuf.u.val_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args);
- } /* end els */
+ H5L_info2_t infobuf;
+ const char *groupName = NULL;
+ jvalue args[5];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_info_by_idx: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Lget_info_by_idx: group name not pinned");
+
+ if ((status = H5Lget_info_by_idx2((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /*
+ * Set the last argument based upon whether this is a hard link (which returns object tokens)
+ * or a soft/user-defined link (which returns the link's value size). Then, call the appropriate
+ * constructor to instantiate an H5L_info_t object.
+ */
+ if (infobuf.type == H5L_TYPE_HARD) {
+ jobject token;
+
+ /* Create an H5O_token_t object */
+ if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.u.token, FALSE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ args[0].i = infobuf.type;
+ args[1].z = infobuf.corder_valid;
+ args[2].j = infobuf.corder;
+ args[3].i = infobuf.cset;
+ args[4].l = token;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, ret_obj);
}
+ else {
+ args[0].i = infobuf.type;
+ args[1].z = infobuf.corder_valid;
+ args[2].j = infobuf.corder;
+ args[3].i = infobuf.cset;
+ args[4].j = (jlong)infobuf.u.val_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args, ret_obj);
+ }
+
+done:
+ if (groupName)
+ UNPIN_JAVA_STRING(ENVONLY, name, groupName);
+
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx */
@@ -301,43 +407,38 @@ Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jint index_field, jint order, jlong link_n, jlong access_id)
{
- jlong status_size;
+ const char *groupName = NULL;
jstring str = NULL;
- size_t buf_size;
- const char *lName;
- char *lValue;
-
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- /* get the length of the link name */
- status_size = H5Lget_name_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char*)NULL, (size_t)0, H5P_DEFAULT);
- if(status_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- buf_size = (size_t)status_size + 1;/* add extra space for the null terminator */
-
- lValue = (char*)HDmalloc(sizeof(char) * buf_size);
- if (lValue == NULL) {
- h5outOfMemory(env, "H5Lget_name_by_idx: malloc failed ");
- } /* end if */
- else {
- status_size = H5Lget_name_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char*)lValue, (size_t)buf_size, (hid_t)access_id);
-
- if (status_size < 0) {
- HDfree(lValue);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR lValue);
- HDfree(lValue);
- if (str == NULL)
- h5JNIFatalError(env, "H5Lget_name_by_idx: return string not created");
- } /* end else */
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, lName);
- }
+ ssize_t status_size = -1;
+ char *linkName = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_name_by_idx: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Lget_name_by_idx: group name not pinned");
+
+ /* Get the length of the link name */
+ if ((status_size = H5Lget_name_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char *)NULL, (size_t)0, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* add extra space for the null terminator */
+ if (NULL == (linkName = (char *) HDmalloc(sizeof(char) * (size_t)status_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_name_by_idx: failed to allocate buffer for link name");
+
+ if ((H5Lget_name_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char *)linkName, (size_t)status_size + 1, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ linkName[status_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, linkName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (linkName)
+ HDfree(linkName);
+ if (groupName)
+ UNPIN_JAVA_STRING(ENVONLY, name, groupName);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx */
@@ -351,80 +452,83 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Lget_1value
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jobjectArray link_value, jlong access_id)
{
- size_t buf_size;
- herr_t status;
- H5L_info_t infobuf;
- const char *lName;
- char *lValue;
- const char *file_name;
- const char *obj_name;
- jstring str;
+ H5L_info2_t infobuf;
+ const char *file_name = NULL;
+ const char *obj_name = NULL;
+ const char *linkName = NULL;
+ jstring str;
+ herr_t status;
+ char *linkValue = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_value: link name is NULL");
+
+ infobuf.type = H5L_TYPE_ERROR;
+
+ PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Lget_value: link name not pinned");
+
+ /* Get the length of the link value */
+ if ((status = H5Lget_info2((hid_t)loc_id, linkName, &infobuf, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5L_TYPE_HARD == infobuf.type)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Lget_val: hard links are unsupported");
+
+ if (NULL == (linkValue = (char *) HDmalloc(sizeof(char) * infobuf.u.val_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_val: failed to allocate buffer for link value");
+
+ if ((status = H5Lget_val((hid_t)loc_id, linkName, (void *)linkValue, infobuf.u.val_size + 1, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ linkValue[infobuf.u.val_size] = '\0';
- infobuf.type = -1;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- /* get the length of the link val */
- status = H5Lget_info((hid_t)loc_id, lName, &infobuf, H5P_DEFAULT);
- if(status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- buf_size = infobuf.u.val_size + 1;/* add extra space for the null terminator */
-
- if(infobuf.type == H5L_TYPE_HARD) {
- h5JNIFatalError(env, "H5Lget_val: link is hard type");
- } /* end if */
- else {
- lValue = (char*)HDmalloc(sizeof(char) * buf_size);
- if (lValue == NULL) {
- h5outOfMemory(env, "H5Lget_val: malloc failed");
- } /* end if */
- else {
- status = H5Lget_val((hid_t)loc_id, lName, (void*)lValue, buf_size, (hid_t)access_id);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else if(infobuf.type == H5L_TYPE_EXTERNAL) {
- status = H5Lunpack_elink_val(lValue, (size_t)infobuf.u.val_size, (unsigned*)NULL, &file_name, &obj_name);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR obj_name);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Lget_val: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
-
- str = ENVPTR->NewStringUTF(ENVPAR file_name);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Lget_val: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 1, str);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR lValue);
- if (str == NULL) {
- /* exception -- fatal JNI error */
- h5JNIFatalError(env, "H5Lget_val: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
- } /* end else */
- } /* end else */
- HDfree(lValue);
- } /* end else */
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, lName);
+ switch (infobuf.type) {
+ case H5L_TYPE_SOFT:
+ {
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, linkValue)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ case H5L_TYPE_EXTERNAL:
+ {
+ if ((status = H5Lunpack_elink_val(linkValue, (size_t)infobuf.u.val_size, (unsigned *)NULL, &file_name, &obj_name)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, obj_name)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, file_name)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 1, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default:
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Lget_val: invalid link type");
+ break;
}
+done:
+ if (linkValue)
+ HDfree(linkValue);
+ if (linkName)
+ UNPIN_JAVA_STRING(ENVONLY, name, linkName);
+
return infobuf.type;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1val */
@@ -438,78 +542,86 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_field, jint order,
jlong link_n, jobjectArray link_value, jlong access_id)
{
- herr_t status;
- size_t buf_size;
- H5L_info_t infobuf;
- const char *lName;
- void *lValue;
- const char *file_name;
- const char *obj_name;
- jstring str;
+ H5L_info2_t infobuf;
+ const char *file_name = NULL;
+ const char *obj_name = NULL;
+ const char *grpName = NULL;
+ jstring str;
+ herr_t status;
+ void *linkValue = NULL;
+
+ UNUSED(clss);
+
+ infobuf.type = H5L_TYPE_ERROR;
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_val_by_idx: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lget_val_by_idx: group name not pinned");
+
+ /* Get the length of the link value */
+ if ((status = H5Lget_info_by_idx2((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5L_TYPE_HARD == infobuf.type)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Lget_val_by_idx: hard links are unsupported");
- infobuf.type = -1;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- /* get the length of the link valuee */
- status = H5Lget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id);
- if(status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- buf_size = infobuf.u.val_size;
- if(buf_size == 0) {
- h5libraryError(env);
- } /* end if */
- else {
- lValue = (void*)HDmalloc(buf_size);
- if (lValue == NULL) {
- h5outOfMemory(env, "H5Lget_val_by_idx: malloc failed ");
- } /* end if */
- else {
- status = H5Lget_val_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (void*)lValue, (size_t)buf_size, (hid_t)access_id);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else if(infobuf.type == H5L_TYPE_EXTERNAL) {
- status = H5Lunpack_elink_val((char*)lValue, (size_t)infobuf.u.val_size, (unsigned*)NULL, (const char**)&file_name, (const char**)&obj_name);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR obj_name);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
-
- str = ENVPTR->NewStringUTF(ENVPAR file_name);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 1, str);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR (char *)lValue);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
- } /* end else */
- } /* end else */
- HDfree(lValue);
- } /* end else */
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, lName);
+ if (!infobuf.u.val_size)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (linkValue = (void *) HDmalloc(infobuf.u.val_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Lget_val_by_idx: failed to allocate buffer for link value");
+
+ if ((status = H5Lget_val_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (void *)linkValue, infobuf.u.val_size + 1, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ ((char *) linkValue)[infobuf.u.val_size] = '\0';
+
+ switch (infobuf.type) {
+ case H5L_TYPE_SOFT:
+ {
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, (char *)linkValue)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ case H5L_TYPE_EXTERNAL:
+ {
+ if ((status = H5Lunpack_elink_val((char *)linkValue, (size_t)infobuf.u.val_size, (unsigned *)NULL, (const char **)&file_name, (const char**)&obj_name)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, obj_name)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, file_name)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 1, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default:
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Lget_val_by_idx: invalid link type");
+ break;
}
+done:
+ if (linkValue)
+ HDfree(linkValue);
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
+
return infobuf.type;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1val_1by_1idx */
@@ -523,66 +635,101 @@ Java_hdf_hdf5lib_H5_H5Lmove
(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name,
jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lCurName;
- const char *lDstName;
+ const char *lCurName = NULL;
+ const char *lDstName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- if (lCurName != NULL && lDstName != NULL) {
- status = H5Lmove((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lmove: src name is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lmove: dest name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lmove: src name not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lmove: dest name not pinned");
+ if ((status = H5Lmove((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (lDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, lDstName);
+ if (lCurName)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, lCurName);
} /* end Java_hdf_hdf5lib_H5_H5Lmove */
+/*
+ * Shim function for link iteration and link visiting which
+ */
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_info2_t *info, void *cb_data)
{
- JNIEnv *cbenv;
- jint status;
- jclass cls;
- jmethodID mid;
- jstring str;
- jmethodID constructor;
- jvalue args[5];
- jobject cb_info_t = NULL;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_t;)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
-
- args[0].i = info->type;
- args[1].z = info->corder_valid;
- args[2].j = info->corder;
- args[3].i = info->cset;
- if(info->type==0)
- args[4].j = (jlong)info->u.address;
- else
- args[4].j = (jlong)info->u.val_size;
- // get a reference to your class if you don't have it already
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5L_info_t");
- if (cls != 0) {
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(IZJIJ)V");
- if (constructor != 0) {
- cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
-
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data);
- } /* end if */
- } /* end if */
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ jmethodID mid;
+ jobject cb_info_t = NULL;
+ jobject visit_callback = wrapper->visit_callback;
+ jstring str;
+ JNIEnv *cbenv = NULL;
+ jclass cbcls;
+ jvalue args[5];
+ void *op_data = (void *)wrapper->op_data;
+ jint status = -1;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5L_iterate_cb: failed to attach current thread to JVM");
+ }
+
+ /* Get the Method ID for the "callback" function of the H5L_iterate_t class */
+ if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_opdata_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ /*
+ * Set the last argument based upon whether this is a hard link (which returns object tokens)
+ * or a soft/user-defined link (which returns the link's value size). Then, call the appropriate
+ * constructor to instantiate an H5L_info_t object.
+ */
+ if (info->type == H5L_TYPE_HARD) {
+ jobject token;
+
+ /* Create an H5O_token_t object */
+ if (NULL == (token = create_H5O_token_t(CBENVONLY, &info->u.token, FALSE)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[0].i = info->type;
+ args[1].z = info->corder_valid;
+ args[2].j = info->corder;
+ args[3].i = info->cset;
+ args[4].l = token;
+
+ CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJILhdf/hdf5lib/structs/H5O_token_t;)V", args, cb_info_t);
+ }
+ else {
+ args[0].i = info->type;
+ args[1].z = info->corder_valid;
+ args[2].j = info->corder;
+ args[3].i = info->cset;
+ args[4].j = (jlong)info->u.val_size;
+
+ CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args, cb_info_t);
+ }
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, g_id, str, cb_info_t, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
+
+ return (herr_t)status;
} /* end H5L_iterate_cb */
/*
@@ -595,20 +742,24 @@ Java_hdf_hdf5lib_H5_H5Lvisit
(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
jobject callback_op, jobject op_data)
{
- herr_t status = -1;
+ cb_wrapper wrapper = { callback_op, op_data };
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
+ UNUSED(clss);
- 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);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit: callback_op is NULL");
+
+ if ((status = H5Lvisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ H5L_iterate_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return status;
} /* end Java_hdf_hdf5lib_H5_H5Lvisit */
@@ -622,26 +773,31 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name
(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
jobject callback_op, jobject op_data, jlong access_id)
{
- herr_t status = -1;
- const char *lName;
+ cb_wrapper wrapper = { callback_op, op_data };
+ const char *grpName = NULL;
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
+ UNUSED(clss);
- if ((op_data == NULL) || (callback_op == NULL)) {
- h5nullArgument(env, "H5Lvisit_by_name: op_data or callback_op is NULL");
- } /* end if */
- 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);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit_by_name: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit_by_name: callback_op is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit_by_name: group name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
- } /* end else */
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lvisit_by_name: group name not pinned");
+
+ if ((status = H5Lvisit_by_name2((hid_t)grp_id, grpName, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ H5L_iterate_cb, (void *)&wrapper, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
return status;
} /* end Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name */
@@ -656,22 +812,25 @@ Java_hdf_hdf5lib_H5_H5Literate
(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
jlong idx, jobject callback_op, jobject op_data)
{
- hsize_t start_idx = (hsize_t)idx;
- herr_t status = -1;
+ cb_wrapper wrapper = { callback_op, op_data };
+ hsize_t start_idx = (hsize_t)idx;
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
+ UNUSED(clss);
- 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);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate: callback_op is NULL");
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ if ((status = H5Literate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ &start_idx, H5L_iterate_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return status;
} /* end Java_hdf_hdf5lib_H5_H5Literate */
@@ -685,27 +844,32 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name
(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
jlong idx, jobject callback_op, jobject op_data, jlong access_id)
{
- hsize_t start_idx = (hsize_t)idx;
- herr_t status = -1;
- const char *lName;
+ cb_wrapper wrapper = { callback_op, op_data };
+ const char *groupName = NULL;
+ hsize_t start_idx = (hsize_t)idx;
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
+ UNUSED(clss);
- if ((op_data == NULL) || (callback_op == NULL)) {
- h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
- } /* end if */
- 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);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate_by_name: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate_by_name: callback_op is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate_by_name: group name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
- } /* end else */
+ PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Literate_by_name: group name not pinned");
+
+ if ((status = H5Literate_by_name2((hid_t)grp_id, groupName, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ &start_idx, H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (groupName)
+ UNPIN_JAVA_STRING(ENVONLY, name, groupName);
return status;
} /* end Java_hdf_hdf5lib_H5_H5Literate_1by_1name */
@@ -719,11 +883,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Lis_1registered
(JNIEnv *env, jclass clss, jint link_cls_id)
{
- htri_t ret_val = H5Lis_registered((H5L_type_t)link_cls_id);
+ htri_t ret_val = FAIL;
+
+ UNUSED(clss);
- if (ret_val < 0)
- h5libraryError(env);
+ if ((ret_val = H5Lis_registered((H5L_type_t)link_cls_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (int)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Lis_1registered */
@@ -736,8 +903,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Lunregister
(JNIEnv *env, jclass clss, jint link_cls_id)
{
+ UNUSED(clss);
+
if (H5Lunregister((H5L_type_t)link_cls_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Lunregister */
diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c
index e8abead..33bec85 100644
--- a/java/src/jni/h5oImp.c
+++ b/java/src/jni/h5oImp.c
@@ -26,14 +26,72 @@ extern "C" {
#include "h5jni.h"
#include "h5oImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
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_info2_t *info, void *cb_data);
+
+/*
+ * Create a java object of hdf.hdf5lib.structs.H5O_token_t.
+ */
+jobject
+create_H5O_token_t
+ (JNIEnv *envptr, const H5O_token_t *token, hbool_t is_critical_pinning)
+{
+ jbyteArray tokenByteBuf;
+ jboolean token_buf_is_copy;
+ jvalue constructor_args[1];
+ jbyte *token_buf = NULL;
+ jobject ret_token_obj = NULL;
+
+ if (NULL == (tokenByteBuf = (*envptr)->NewByteArray(envptr, H5O_MAX_TOKEN_SIZE)))
+ CHECK_JNI_EXCEPTION(envptr, JNI_FALSE);
+
+ if (is_critical_pinning)
+ PIN_BYTE_ARRAY_CRITICAL(envptr, tokenByteBuf, token_buf, &token_buf_is_copy, "create_H5O_token_t: object token buffer not pinned");
+ else
+ PIN_BYTE_ARRAY(envptr, tokenByteBuf, token_buf, &token_buf_is_copy, "create_H5O_token_t: object token buffer not pinned");
+
+ HDmemcpy(token_buf, token, sizeof(H5O_token_t));
+
+ if (is_critical_pinning)
+ UNPIN_ARRAY_CRITICAL(envptr, tokenByteBuf, token_buf, 0);
+ else
+ UNPIN_BYTE_ARRAY(envptr, tokenByteBuf, token_buf, 0);
+
+ token_buf = NULL;
+
+ constructor_args[0].l = tokenByteBuf;
+ CALL_CONSTRUCTOR(envptr, "hdf/hdf5lib/structs/H5O_token_t", "([B)V", constructor_args, ret_token_obj);
+
+ /*
+ * If critical pinning is being used, this routine is probably being
+ * called within a loop, so we'll clean up local references.
+ */
+ if (is_critical_pinning)
+ (*envptr)->DeleteLocalRef(envptr, tokenByteBuf);
+
+done:
+ if (token_buf) {
+ if (is_critical_pinning)
+ UNPIN_ARRAY_CRITICAL(envptr, tokenByteBuf, token_buf, JNI_ABORT);
+ else
+ UNPIN_BYTE_ARRAY(envptr, tokenByteBuf, token_buf, JNI_ABORT);
+ } /* end if */
+
+ return ret_token_obj;
+} /* end create_H5O_token_t */
/*
* Class: hdf_hdf5lib_H5
@@ -44,18 +102,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Oopen
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id)
{
- hid_t status = -1;
- const char *oName;
+ const char *objName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, oName);
- if (oName != NULL) {
- status = H5Oopen((hid_t)loc_id, oName, (hid_t)access_plist_id );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, oName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oopen: object name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oopen: object name not pinned");
+
+ if ((status = H5Oopen((hid_t)loc_id, objName, (hid_t)access_plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Oopen */
@@ -69,11 +131,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Oclose
(JNIEnv *env, jclass clss, jlong object_id)
{
- herr_t retVal = H5Oclose((hid_t)object_id);
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Oclose((hid_t)object_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Oclose */
@@ -87,149 +152,114 @@ Java_hdf_hdf5lib_H5_H5Ocopy
(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name,
jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lCurName;
- const char *lDstName;
+ const char *lCurName = NULL;
+ const char *lDstName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- if (lCurName != NULL && lDstName != NULL) {
- status = H5Ocopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ocopy: src name is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ocopy: dst name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Ocopy: src name not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Ocopy: dest name not pinned");
+
+ if ((status = H5Ocopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (lDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, lDstName);
+ if (lCurName)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, lCurName);
} /* end Java_hdf_hdf5lib_H5_H5Ocopy */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_info
- * Signature: (J)Lhdf/hdf5lib/structs/H5O_info_t;
+ * Signature: (JI)Lhdf/hdf5lib/structs/H5O_info_t;
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1info
- (JNIEnv *env, jclass clss, jlong loc_id)
+ (JNIEnv *env, jclass clss, jlong loc_id, jint fields)
{
- herr_t status = -1;
- H5O_info_t infobuf;
- jvalue args[12];
- jobject hdrinfobuf;
- jobject ihinfobuf1;
- jobject ihinfobuf2;
+ H5O_info2_t infobuf;
+ jobject token;
+ jvalue args[9];
+ herr_t status = FAIL;
jobject ret_obj = NULL;
- status = H5Oget_info((hid_t)loc_id, &infobuf);
+ UNUSED(clss);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = (jint)infobuf.hdr.version;
- args[1].i = (jint)infobuf.hdr.nmesgs;
- args[2].i = (jint)infobuf.hdr.nchunks;
- args[3].i = (jint)infobuf.hdr.flags;
- args[4].j = (jlong)infobuf.hdr.space.total;
- args[5].j = (jlong)infobuf.hdr.space.meta;
- args[6].j = (jlong)infobuf.hdr.space.mesg;
- args[7].j = (jlong)infobuf.hdr.space.free;
- args[8].j = (jlong)infobuf.hdr.mesg.present;
- args[9].j = (jlong)infobuf.hdr.mesg.shared;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args);
- hdrinfobuf = ret_obj;
-
- args[0].j = (jlong)infobuf.meta_size.obj.index_size;
- args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf1 = ret_obj;
- args[0].j = (jlong)infobuf.meta_size.attr.index_size;
- args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf2 = ret_obj;
-
- args[0].j = (jlong)infobuf.fileno;
- args[1].j = (jlong)infobuf.addr;
- args[2].i = infobuf.type;
- args[3].i = (jint)infobuf.rc;
- args[4].j = (jlong)infobuf.num_attrs;
- args[5].j = infobuf.atime;
- args[6].j = infobuf.mtime;
- args[7].j = infobuf.ctime;
- args[8].j = infobuf.btime;
- args[9].l = hdrinfobuf;
- args[10].l = ihinfobuf1;
- args[11].l = ihinfobuf2;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args);
- }
+ if ((status = H5Oget_info3((hid_t)loc_id, &infobuf, (unsigned)fields)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, FALSE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ args[0].j = (jlong)infobuf.fileno;
+ args[1].l = token;
+ args[2].i = infobuf.type;
+ args[3].i = (jint)infobuf.rc;
+ args[4].j = infobuf.atime;
+ args[5].j = infobuf.mtime;
+ args[6].j = infobuf.ctime;
+ args[7].j = infobuf.btime;
+ args[8].j = (jlong)infobuf.num_attrs;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj);
+
+done:
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1info */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_info_by_name
- * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5O_info_t;
+ * Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_info_t;
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name
- (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
+ (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint fields, jlong access_id)
{
- const char *lName;
- herr_t status = -1;
- H5O_info_t infobuf;
- jvalue args[12];
- jobject hdrinfobuf;
- jobject ihinfobuf1;
- jobject ihinfobuf2;
- jobject ret_obj = NULL;
+ H5O_info2_t infobuf;
+ const char *objName = NULL;
+ jobject token;
+ jvalue args[9];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Oget_info_by_name((hid_t)loc_id, lName, &infobuf, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = (jint)infobuf.hdr.version;
- args[1].i = (jint)infobuf.hdr.nmesgs;
- args[2].i = (jint)infobuf.hdr.nchunks;
- args[3].i = (jint)infobuf.hdr.flags;
- args[4].j = (jlong)infobuf.hdr.space.total;
- args[5].j = (jlong)infobuf.hdr.space.meta;
- args[6].j = (jlong)infobuf.hdr.space.mesg;
- args[7].j = (jlong)infobuf.hdr.space.free;
- args[8].j = (jlong)infobuf.hdr.mesg.present;
- args[9].j = (jlong)infobuf.hdr.mesg.shared;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args);
- hdrinfobuf = ret_obj;
-
- args[0].j = (jlong)infobuf.meta_size.obj.index_size;
- args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf1 = ret_obj;
- args[0].j = (jlong)infobuf.meta_size.attr.index_size;
- args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf2 = ret_obj;
-
- args[0].j = (jlong)infobuf.fileno;
- args[1].j = (jlong)infobuf.addr;
- args[2].i = infobuf.type;
- args[3].i = (jint)infobuf.rc;
- args[4].j = (jlong)infobuf.num_attrs;
- args[5].j = infobuf.atime;
- args[6].j = infobuf.mtime;
- args[7].j = infobuf.ctime;
- args[8].j = infobuf.btime;
- args[9].l = hdrinfobuf;
- args[10].l = ihinfobuf1;
- args[11].l = ihinfobuf2;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args);
- }
- }
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_info_by_name: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_info_by_name: object name not pinned");
+
+ if ((status = H5Oget_info_by_name3((hid_t)loc_id, objName, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Create an H5O_token_t object */
+ if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, FALSE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ args[0].j = (jlong)infobuf.fileno;
+ args[1].l = token;
+ args[2].i = infobuf.type;
+ args[3].i = (jint)infobuf.rc;
+ args[4].j = infobuf.atime;
+ args[5].j = infobuf.mtime;
+ args[6].j = infobuf.ctime;
+ args[7].j = infobuf.btime;
+ args[8].j = (jlong)infobuf.num_attrs;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name */
@@ -237,75 +267,250 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_info_by_idx
- * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5O_info_t;
+ * Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_info_t;
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id,
- jstring name, jint index_field, jint order, jlong link_n, jlong access_id)
+ jstring name, jint index_field, jint order, jlong link_n, jint fields, jlong access_id)
{
- const char *lName;
- herr_t status;
- H5O_info_t infobuf;
- jvalue args[12];
- jobject hdrinfobuf;
- jobject ihinfobuf1;
- jobject ihinfobuf2;
- jobject ret_obj = NULL;
+ H5O_info2_t infobuf;
+ const char *grpName = NULL;
+ jobject token;
+ jvalue args[9];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Oget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = (jint)infobuf.hdr.version;
- args[1].i = (jint)infobuf.hdr.nmesgs;
- args[2].i = (jint)infobuf.hdr.nchunks;
- args[3].i = (jint)infobuf.hdr.flags;
- args[4].j = (jlong)infobuf.hdr.space.total;
- args[5].j = (jlong)infobuf.hdr.space.meta;
- args[6].j = (jlong)infobuf.hdr.space.mesg;
- args[7].j = (jlong)infobuf.hdr.space.free;
- args[8].j = (jlong)infobuf.hdr.mesg.present;
- args[9].j = (jlong)infobuf.hdr.mesg.shared;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args);
- hdrinfobuf = ret_obj;
-
- args[0].j = (jlong)infobuf.meta_size.obj.index_size;
- args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf1 = ret_obj;
- args[0].j = (jlong)infobuf.meta_size.attr.index_size;
- args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf2 = ret_obj;
-
- args[0].j = (jlong)infobuf.fileno;
- args[1].j = (jlong)infobuf.addr;
- args[2].i = infobuf.type;
- args[3].i = (jint)infobuf.rc;
- args[4].j = (jlong)infobuf.num_attrs;
- args[5].j = infobuf.atime;
- args[6].j = infobuf.mtime;
- args[7].j = infobuf.ctime;
- args[8].j = infobuf.btime;
- args[9].l = hdrinfobuf;
- args[10].l = ihinfobuf1;
- args[11].l = ihinfobuf2;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args);
- }
- }
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_info_by_idx: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oget_info_by_idx: group name not pinned");
+
+ if ((status = H5Oget_info_by_idx3((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n,
+ &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Create an H5O_token_t object */
+ if (NULL == (token = create_H5O_token_t(ENVONLY, &infobuf.token, FALSE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ args[0].j = (jlong)infobuf.fileno;
+ args[1].l = token;
+ args[2].i = infobuf.type;
+ args[3].i = (jint)infobuf.rc;
+ args[4].j = infobuf.atime;
+ args[5].j = infobuf.mtime;
+ args[6].j = infobuf.ctime;
+ args[7].j = infobuf.btime;
+ args[8].j = (jlong)infobuf.num_attrs;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, ret_obj);
+
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx */
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Oget_native_info
+ * Signature: (JI)Lhdf/hdf5lib/structs/H5O_native_info_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Oget_1native_1info
+ (JNIEnv *env, jclass clss, jlong loc_id, jint fields)
+{
+ H5O_native_info_t infobuf;
+ jobject hdrinfobuf;
+ jobject obj_ihinfobuf;
+ jobject attr_ihinfobuf;
+ jvalue args[10];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+ if ((status = H5Oget_native_info((hid_t)loc_id, &infobuf, (unsigned)fields)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].i = (jint)infobuf.hdr.version;
+ args[1].i = (jint)infobuf.hdr.nmesgs;
+ args[2].i = (jint)infobuf.hdr.nchunks;
+ args[3].i = (jint)infobuf.hdr.flags;
+ args[4].j = (jlong)infobuf.hdr.space.total;
+ args[5].j = (jlong)infobuf.hdr.space.meta;
+ args[6].j = (jlong)infobuf.hdr.space.mesg;
+ args[7].j = (jlong)infobuf.hdr.space.free;
+ args[8].j = (jlong)infobuf.hdr.mesg.present;
+ args[9].j = (jlong)infobuf.hdr.mesg.shared;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args, ret_obj);
+ hdrinfobuf = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.obj.index_size;
+ args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ obj_ihinfobuf = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.attr.index_size;
+ args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ attr_ihinfobuf = ret_obj;
+
+ args[0].l = hdrinfobuf;
+ args[1].l = obj_ihinfobuf;
+ args[2].l = attr_ihinfobuf;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t", "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+
+done:
+ return ret_obj;
+} /* end Java_hdf_hdf5lib_H5_H5Oget_1native_1info */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Oget_native_info_by_name
+ * Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_native_info_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name
+ (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint fields, jlong access_id)
+{
+ H5O_native_info_t infobuf;
+ const char *objName = NULL;
+ jobject hdrinfobuf;
+ jobject obj_ihinfobuf;
+ jobject attr_ihinfobuf;
+ jvalue args[10];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_native_info_by_name: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_native_info_by_name: object name not pinned");
+
+ if ((status = H5Oget_native_info_by_name((hid_t)loc_id, objName, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].i = (jint)infobuf.hdr.version;
+ args[1].i = (jint)infobuf.hdr.nmesgs;
+ args[2].i = (jint)infobuf.hdr.nchunks;
+ args[3].i = (jint)infobuf.hdr.flags;
+ args[4].j = (jlong)infobuf.hdr.space.total;
+ args[5].j = (jlong)infobuf.hdr.space.meta;
+ args[6].j = (jlong)infobuf.hdr.space.mesg;
+ args[7].j = (jlong)infobuf.hdr.space.free;
+ args[8].j = (jlong)infobuf.hdr.mesg.present;
+ args[9].j = (jlong)infobuf.hdr.mesg.shared;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args, ret_obj);
+ hdrinfobuf = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.obj.index_size;
+ args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ obj_ihinfobuf = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.attr.index_size;
+ args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ attr_ihinfobuf = ret_obj;
+
+ args[0].l = hdrinfobuf;
+ args[1].l = obj_ihinfobuf;
+ args[2].l = attr_ihinfobuf;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t", "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
+
+ return ret_obj;
+} /* end Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Oget_native_info_by_idx
+ * Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_native_info_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx
+ (JNIEnv *env, jclass clss, jlong loc_id,
+ jstring name, jint index_field, jint order, jlong link_n, jint fields, jlong access_id)
+{
+ H5O_native_info_t infobuf;
+ const char *grpName = NULL;
+ jobject hdrinfobuf;
+ jobject obj_ihinfobuf;
+ jobject attr_ihinfobuf;
+ jvalue args[10];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_native_info_by_idx: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oget_native_info_by_idx: group name not pinned");
+
+ if ((status = H5Oget_native_info_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n,
+ &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].i = (jint)infobuf.hdr.version;
+ args[1].i = (jint)infobuf.hdr.nmesgs;
+ args[2].i = (jint)infobuf.hdr.nchunks;
+ args[3].i = (jint)infobuf.hdr.flags;
+ args[4].j = (jlong)infobuf.hdr.space.total;
+ args[5].j = (jlong)infobuf.hdr.space.meta;
+ args[6].j = (jlong)infobuf.hdr.space.mesg;
+ args[7].j = (jlong)infobuf.hdr.space.free;
+ args[8].j = (jlong)infobuf.hdr.mesg.present;
+ args[9].j = (jlong)infobuf.hdr.mesg.shared;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args, ret_obj);
+ hdrinfobuf = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.obj.index_size;
+ args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ obj_ihinfobuf = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.attr.index_size;
+ args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ attr_ihinfobuf = ret_obj;
+
+ args[0].l = hdrinfobuf;
+ args[1].l = obj_ihinfobuf;
+ args[2].l = attr_ihinfobuf;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_native_info_t", "(Lhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
+
+ return ret_obj;
+} /* end Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx */
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Olink
* Signature: (JJLjava/lang/String;JJ)V
*/
@@ -314,178 +519,147 @@ Java_hdf_hdf5lib_H5_H5Olink
(JNIEnv *env, jclass clss, jlong cur_loc_id, jlong dst_loc_id,
jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lDstName;
+ const char *linkDstName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(dst_name, lDstName);
- if (lDstName != NULL) {
- status = H5Olink((hid_t)cur_loc_id, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(dst_name, lDstName);
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Olink: link destination name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, dst_name, linkDstName, NULL, "H5Olink: link destination name not pinned");
+
+ if ((status = H5Olink((hid_t)cur_loc_id, (hid_t)dst_loc_id, linkDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (linkDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, linkDstName);
} /* end 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_info2_t *info, void *cb_data)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
- jmethodID constructor;
- jvalue args[12];
- jobject hdrinfobuf;
- jobject ihinfobuf1;
- jobject ihinfobuf2;
- jobject cb_info_t = NULL;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
- /* printf("JNI H5O_iterate_cb error: AttachCurrentThread failed\n"); */
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ jmethodID mid;
+ jobject cb_info_t = NULL;
+ jobject visit_callback = wrapper->visit_callback;
+ jobject token;
+ jstring str;
+ JNIEnv *cbenv = NULL;
+ jclass cbcls;
+ jvalue args[12];
+ void *op_data = (void *)wrapper->op_data;
+ jint status = FAIL;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5O_iterate_cb: failed to attach current thread to JVM");
+ }
+
+ if (NULL == (cbcls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cbcls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_opdata_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ /* Create an H5O_token_t object */
+ if (NULL == (token = create_H5O_token_t(CBENVONLY, &info->token, FALSE)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[0].j = (jlong)info->fileno;
+ args[1].l = token;
+ args[2].i = info->type;
+ args[3].i = (jint)info->rc;
+ args[4].j = info->atime;
+ args[5].j = info->mtime;
+ args[6].j = info->ctime;
+ args[7].j = info->btime;
+ args[8].j = (jlong)info->num_attrs;
+
+ /* Get a reference to the H5O_info_t class */
+ CALL_CONSTRUCTOR(CBENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JLhdf/hdf5lib/structs/H5O_token_t;IIJJJJJ)V", args, cb_info_t);
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, g_id, str, cb_info_t, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_t;)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
-
- args[0].i = (jint)info->hdr.version;
- args[1].i = (jint)info->hdr.nmesgs;
- args[2].i = (jint)info->hdr.nchunks;
- args[3].i = (jint)info->hdr.flags;
- args[4].j = (jlong)info->hdr.space.total;
- args[5].j = (jlong)info->hdr.space.meta;
- args[6].j = (jlong)info->hdr.space.mesg;
- args[7].j = (jlong)info->hdr.space.free;
- args[8].j = (jlong)info->hdr.mesg.present;
- args[9].j = (jlong)info->hdr.mesg.shared;
- // get a reference to the H5_hdr_info_t class
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5O_hdr_info_t");
- if (cls != 0) {
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(IIIIJJJJJJ)V");
- if (constructor != 0) {
- hdrinfobuf = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
-
- args[0].j = (jlong)info->meta_size.obj.index_size;
- args[1].j = (jlong)info->meta_size.obj.heap_size;
- // get a reference to the H5_ih_info_t class
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5_ih_info_t");
- if (cls != 0) {
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(JJ)V");
- if (constructor != 0) {
- ihinfobuf1 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
- args[0].j = (jlong)info->meta_size.attr.index_size;
- args[1].j = (jlong)info->meta_size.attr.heap_size;
- ihinfobuf2 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
-
- args[0].j = (jlong)info->fileno;
- args[1].j = (jlong)info->addr;
- args[2].i = info->type;
- args[3].i = (jint)info->rc;
- args[4].j = (jlong)info->num_attrs;
- args[5].j = info->atime;
- args[6].j = info->mtime;
- args[7].j = info->ctime;
- args[8].j = info->btime;
- args[9].l = hdrinfobuf;
- args[10].l = ihinfobuf1;
- args[11].l = ihinfobuf2;
- // get a reference to the H5O_info_t class
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5O_info_t");
- if (cls != 0) {
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V");
- if (constructor != 0) {
- cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
-
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data);
- }
- }
- }
- }
- }
- }
- }
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5O_iterate_cb */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ovisit
- * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I
+ * Signature: (JIILjava/lang/Object;Ljava/lang/Object;I)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Ovisit
(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
- jobject callback_op, jobject op_data)
+ jobject callback_op, jobject op_data, jint fields)
{
- herr_t status = -1;
+ cb_wrapper wrapper = { callback_op, op_data };
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
+ UNUSED(clss);
- if (op_data == NULL) {
- h5nullArgument(env, "H5Ovisit: op_data is NULL");
- } /* end if */
- else if (callback_op == NULL) {
- h5nullArgument(env, "H5Ovisit: callback_op is NULL");
- } /* end if */
- else {
- status = H5Ovisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (status < 0)
- h5libraryError(env);
- }
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit: callback_op is NULL");
+
+ if ((status = H5Ovisit3((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ H5O_iterate_cb, (void *)&wrapper, (unsigned)fields)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return status;
} /* end Java_hdf_hdf5lib_H5_H5Ovisit */
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ovisit_by_name
- * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I
+ * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;IJ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name
(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
- jobject callback_op, jobject op_data, jlong access_id)
+ jobject callback_op, jobject op_data, jint fields, jlong access_id)
{
- herr_t status = -1;
- const char *lName;
+ cb_wrapper wrapper = { callback_op, op_data };
+ const char *objName = NULL;
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
+ UNUSED(clss);
- if (op_data == NULL) {
- h5nullArgument(env, "H5Ovisit_by_name: op_data is NULL");
- return -1;
- } /* end if */
- else if (callback_op == NULL) {
- h5nullArgument(env, "H5Ovisit_by_name: callback_op is NULL");
- return -1;
- } /* end if */
- else {
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Ovisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (hid_t)access_id);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit_by_name: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit_by_name: callback_op is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit_by_name: object name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
- }
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Ovisit_by_name: object name not pinned");
+
+ if ((status = H5Ovisit_by_name3((hid_t)grp_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order,
+ H5O_iterate_cb, (void *)&wrapper, (unsigned)fields, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return status;
} /* end Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name */
@@ -499,24 +673,20 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Oset_1comment
(JNIEnv *env, jclass clss, jlong loc_id, jstring comment)
{
- herr_t status = -1;
const char *oComment = NULL;
- jboolean isCopy;
+ herr_t status = FAIL;
- if (comment == NULL) {
- status = H5Oset_comment((hid_t)loc_id, oComment);
- } /* end if */
- else {
- oComment = ENVPTR->GetStringUTFChars(ENVPAR comment, &isCopy);
- if (oComment != NULL) {
- status = H5Oset_comment((hid_t)loc_id, oComment);
+ UNUSED(clss);
- ENVPTR->ReleaseStringUTFChars(ENVPAR comment, oComment);
- }
- } /* end else */
+ if (NULL != comment)
+ PIN_JAVA_STRING(ENVONLY, comment, oComment, NULL, "H5Oset_comment: object comment not pinned");
- if (status < 0)
- h5libraryError(env);
+ if ((status = H5Oset_comment((hid_t)loc_id, oComment)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (oComment)
+ UNPIN_JAVA_STRING(ENVONLY, comment, oComment);
} /* end Java_hdf_hdf5lib_H5_H5Oset_1comment */
/*
@@ -529,29 +699,29 @@ Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id,
jstring name, jstring comment, jlong access_id)
{
- herr_t status = -1;
- const char *oName;
- const char *oComment;
-
- PIN_JAVA_STRING(name, oName);
- if (oName != NULL) {
- if (comment == NULL) {
- status = H5Oset_comment_by_name((hid_t)loc_id, oName, NULL, (hid_t)access_id);
- } /* end if */
- else {
- jboolean isCopy;
- oComment = ENVPTR->GetStringUTFChars(ENVPAR comment, &isCopy);
- if (oComment != NULL) {
- status = H5Oset_comment_by_name((hid_t)loc_id, oName, oComment, (hid_t)access_id);
- ENVPTR->ReleaseStringUTFChars(ENVPAR comment, oComment);
- } /* end if */
- } /* end else */
-
- UNPIN_JAVA_STRING(name, oName);
-
- if (status < 0)
- h5libraryError(env);
- }
+ const char *objName = NULL;
+ const char *objComment = NULL;
+ jboolean isCopy;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oset_comment_by_name: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oset_comment_by_name: object name not pinned");
+
+ if (NULL != comment)
+ PIN_JAVA_STRING(ENVONLY, comment, objComment, &isCopy, "H5Oset_comment_by_name: object comment not pinned");
+
+ if ((status = H5Oset_comment_by_name((hid_t)loc_id, objName, objComment, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objComment)
+ UNPIN_JAVA_STRING(ENVONLY, comment, objComment);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
} /* end Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name */
/*
@@ -563,39 +733,32 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1comment
(JNIEnv *env, jclass clss, jlong loc_id)
{
- char *oComment;
- ssize_t buf_size;
- ssize_t status;
jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t status = -1;
+ char *oComment = NULL;
- /* get the length of the comment */
- buf_size = H5Oget_comment((hid_t)loc_id, NULL, 0);
- if (buf_size < 0) {
- h5badArgument( env, "H5Oget_comment: buf_size < 0");
- } /* end if */
- else if (buf_size > 0) {
- buf_size++; /* add extra space for the null terminator */
- oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (oComment == NULL) {
- /* exception -- out of memory */
- h5outOfMemory( env, "H5Oget_comment: malloc failed");
- } /* end if */
- else {
- status = H5Oget_comment((hid_t)loc_id, oComment, (size_t)buf_size);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- /* may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR oComment);
- if (str == NULL) {
- h5JNIFatalError( env, "H5Oget_comment: return string not allocated");
- } /* end if */
- } /* end else */
- HDfree(oComment);
- }
- } /* end else if */
+ UNUSED(clss);
+
+ /* Get the length of the comment */
+ if ((buf_size = H5Oget_comment((hid_t)loc_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (buf_size) {
+ if (NULL == (oComment = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Oget_comment: failed to allocate object comment buffer");
+
+ if ((status = H5Oget_comment((hid_t)loc_id, oComment, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ oComment[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, oComment)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (oComment)
+ HDfree(oComment);
return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment */
@@ -609,44 +772,41 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
- char *oComment;
- const char *oName;
+ const char *objName = NULL;
+ jstring str = NULL;
ssize_t buf_size;
ssize_t status;
- jstring str = NULL;
+ char *objComment = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_comment_by_name: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_comment_by_name: object name not pinned");
+
+ /* Get the length of the comment */
+ if ((buf_size = H5Oget_comment_by_name((hid_t)loc_id, objName, NULL, 0, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (buf_size) {
+ if (NULL == (objComment = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Oget_comment_by_name: failed to allocate buffer for object comment");
+
+ if ((status = H5Oget_comment_by_name((hid_t)loc_id, objName, objComment, (size_t)buf_size + 1, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ objComment[buf_size] = '\0';
- PIN_JAVA_STRING(name, oName);
- if (oName != NULL) {
- /* get the length of the comment */
- buf_size = H5Oget_comment_by_name((hid_t)loc_id, oName, NULL, 0, (hid_t)access_id);
- if (buf_size < 0) {
- h5badArgument( env, "H5Oget_comment_by_name: buf_size < 0");
- } /* end if */
- else if (buf_size > 0) {
- buf_size++; /* add extra space for the null terminator */
- oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (oComment == NULL) {
- h5outOfMemory( env, "H5Oget_comment_by_name: malloc failed");
- } /* end if */
- else {
- status = H5Oget_comment_by_name((hid_t)loc_id, oName, oComment, (size_t)buf_size, (hid_t)access_id);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- /* may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR oComment);
- if (str == NULL) {
- h5JNIFatalError( env, "H5Oget_comment_by_name: return string not allocated");
- } /* end if */
- } /* end else */
- HDfree(oComment);
- }
- } /* end if */
- UNPIN_JAVA_STRING(name, oName);
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, objComment)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
+done:
+ if (objComment)
+ HDfree(objComment);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
+
return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name */
@@ -659,20 +819,24 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Oexists_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
+ const char *objName = NULL;
htri_t bval = JNI_FALSE;
- const char *oName;
- PIN_JAVA_STRING(name, oName);
- if (oName != NULL) {
- bval = H5Oexists_by_name((hid_t)loc_id, oName, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, oName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oexists_by_name: object name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oexists_by_name: object name not pinned");
+
+ if ((bval = H5Oexists_by_name((hid_t)loc_id, objName, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Oexists_1by_1name */
@@ -686,8 +850,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Odecr_1refcount
(JNIEnv *env, jclass clss, jlong object_id)
{
+ UNUSED(clss);
+
if (H5Odecr_refcount((hid_t)object_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
}
/* end Java_hdf_hdf5lib_H5_H5Odecr_1refcount */
/*
@@ -699,27 +868,57 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Oincr_1refcount
(JNIEnv *env, jclass clss, jlong object_id)
{
+ UNUSED(clss);
+
if (H5Oincr_refcount((hid_t)object_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Oincr_1refcount */
/*
* Class: hdf_hdf5lib_H5
- * Method: _H5Oopen_by_addr
- * Signature: (JJ)J;
+ * Method: _H5Oopen_by_token
+ * Signature: (JLhdf/hdf5lib/structs/H5O_token_t;)J;
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr
- (JNIEnv *env, jclass clss, jlong loc_id, jlong addr)
+Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token
+ (JNIEnv *env, jclass clss, jlong loc_id, jobject token)
{
- hid_t retVal = -1;
+ H5O_token_t obj_token;
+ jboolean token_buf_is_copy;
+ jfieldID token_data_field_id;
+ jclass token_cls;
+ jbyte *token_buf = NULL;
+ jobject token_data;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ token_cls = ENVPTR->GetObjectClass(ENVONLY, token);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (token_data_field_id = ENVPTR->GetFieldID(ENVONLY, token_cls, "data", "[B")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ token_data = ENVPTR->GetObjectField(ENVONLY, token, token_data_field_id);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, (jbyteArray)token_data, token_buf, &token_buf_is_copy, "H5Oopen_by_token: token buffer not pinned");
+ HDmemcpy(&obj_token, token_buf, sizeof(H5O_token_t));
+ UNPIN_BYTE_ARRAY(ENVONLY, (jbyteArray)token_data, token_buf, JNI_ABORT);
+ token_buf = NULL;
- retVal = H5Oopen_by_addr((hid_t)loc_id, (haddr_t)addr );
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Oopen_by_token((hid_t)loc_id, obj_token)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (token_buf)
+ UNPIN_BYTE_ARRAY(ENVONLY, (jbyteArray)token_data, token_buf, (retVal < 0) ? JNI_ABORT : 0);
return (jlong)retVal;
-} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr */
+} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token */
/*
* Class: hdf_hdf5lib_H5
@@ -731,18 +930,22 @@ Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jint index_field, jint order, jlong link_n, jlong lapl_id)
{
- hid_t retVal = -1;
- const char *oName;
+ const char *grpName = NULL;
+ hid_t retVal = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, oName);
- if (oName != NULL) {
- retVal = H5Oopen_by_idx((hid_t)loc_id, oName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (hid_t)lapl_id );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, oName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oopen_by_idx: object name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oopen_by_idx: object name not pinned");
+
+ if ((retVal = H5Oopen_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx */
@@ -756,8 +959,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Oflush
(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Oflush((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Oflush */
/*
@@ -769,10 +977,75 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Orefresh
(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Orefresh((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Orefresh */
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Odisable_mdc_flushes
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes
+ (JNIEnv *env, jclass clss, jlong loc_id)
+{
+ UNUSED(clss);
+
+ if (H5Odisable_mdc_flushes((hid_t)loc_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Oenable_mdc_flushes
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes
+ (JNIEnv *env, jclass clss, jlong loc_id)
+{
+ UNUSED(clss);
+
+ if (H5Oenable_mdc_flushes((hid_t)loc_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Oare_mdc_flushes_disabled
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled
+ (JNIEnv *env, jclass clss, jlong loc_id)
+{
+ jboolean bval = JNI_FALSE;
+ hbool_t is_disabled = FALSE;
+
+ UNUSED(clss);
+
+ if (H5Oare_mdc_flushes_disabled((hid_t)loc_id, &is_disabled) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (is_disabled == TRUE)
+ bval = JNI_TRUE;
+
+done:
+ return bval;
+} /* end Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled */
+
#ifdef __cplusplus
diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h
index 224f298..2b53fd3 100644
--- a/java/src/jni/h5oImp.h
+++ b/java/src/jni/h5oImp.h
@@ -52,29 +52,56 @@ Java_hdf_hdf5lib_H5_H5Ocopy
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_info
- * Signature: (J)Lhdf/hdf5lib/structs/H5O_info_t;
+ * Signature: (JI)Lhdf/hdf5lib/structs/H5O_info_t;
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1info
-(JNIEnv*, jclass, jlong);
+(JNIEnv*, jclass, jlong, jint fields);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_info_by_name
- * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5O_info_t;
+ * Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_info_t;
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name
-(JNIEnv*, jclass, jlong, jstring, jlong);
+(JNIEnv*, jclass, jlong, jstring, jint fields, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Oget_info_by_idx
- * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5O_info_t;
+ * Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_info_t;
*/
JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx
-(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong);
+(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jint fields, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Oget_native_info
+ * Signature: (JI)Lhdf/hdf5lib/structs/H5O_native_info_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Oget_1native_1info
+(JNIEnv*, jclass, jlong, jint fields);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Oget_native_info_by_name
+ * Signature: (JLjava/lang/String;IJ)Lhdf/hdf5lib/structs/H5O_native_info_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1name
+(JNIEnv*, jclass, jlong, jstring, jint fields, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Oget_native_info_by_idx
+ * Signature: (JLjava/lang/String;IIJIJ)Lhdf/hdf5lib/structs/H5O_native_info_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Oget_1native_1info_1by_1idx
+(JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jint fields, jlong);
/*
* Class: hdf_hdf5lib_H5
@@ -88,20 +115,20 @@ Java_hdf_hdf5lib_H5_H5Olink
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ovisit
- * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I
+ * Signature: (JIILjava/lang/Object;Ljava/lang/Object;I)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Ovisit
- (JNIEnv*, jclass, jlong, jint, jint, jobject, jobject);
+ (JNIEnv*, jclass, jlong, jint, jint, jobject, jobject, jint);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Ovisit_by_name
- * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I
+ * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;IJ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name
- (JNIEnv*, jclass, jlong, jstring, jint, jint, jobject, jobject, jlong);
+ (JNIEnv*, jclass, jlong, jstring, jint, jint, jobject, jobject, jint, jlong);
/*
* Class: hdf_hdf5lib_H5
@@ -168,12 +195,12 @@ Java_hdf_hdf5lib_H5_H5Oincr_1refcount
/*
* Class: hdf_hdf5lib_H5
- * Method: _H5Oopen_by_addr
- * Signature: (JJ)J;
+ * Method: _H5Oopen_by_token
+ * Signature: (JLhdf/hdf5lib/structs/H5O_token_t;)J;
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr
- (JNIEnv*, jclass, jlong, jlong);
+Java_hdf_hdf5lib_H5__1H5Oopen_1by_1token
+ (JNIEnv*, jclass, jlong, jobject);
/*
* Class: hdf_hdf5lib_H5
@@ -202,6 +229,33 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Orefresh
(JNIEnv*, jclass, jlong);
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Odisable_mdc_flushes
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes
+ (JNIEnv*, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Oenable_mdc_flushes
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes
+ (JNIEnv*, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Oare_mdc_flushes_disabled
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled
+ (JNIEnv*, jclass, jlong);
+
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5pACPLImp.c b/java/src/jni/h5pACPLImp.c
new file mode 100644
index 0000000..f6c14e1
--- /dev/null
+++ b/java/src/jni/h5pACPLImp.c
@@ -0,0 +1,36 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pACPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pACPLImp.h b/java/src/jni/h5pACPLImp.h
new file mode 100644
index 0000000..194afc0
--- /dev/null
+++ b/java/src/jni/h5pACPLImp.h
@@ -0,0 +1,27 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PACPL
+#define _Included_hdf_hdf5lib_H5_H5PACPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PACPL */
diff --git a/java/src/jni/h5pDAPLImp.c b/java/src/jni/h5pDAPLImp.c
new file mode 100644
index 0000000..2386df1
--- /dev/null
+++ b/java/src/jni/h5pDAPLImp.c
@@ -0,0 +1,325 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pDAPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+extern JavaVM *jvm;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
+
+static herr_t H5D_append_cb(hid_t dataset_id, hsize_t *cur_dims, void *cb_data);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk_cache
+ * Signature: (JJJD)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache
+ (JNIEnv *env, jclass clss, jlong dapl, jlong rdcc_nslots,
+ jlong rdcc_nbytes, jdouble rdcc_w0)
+{
+ UNUSED(clss);
+
+ if (H5Pset_chunk_cache((hid_t)dapl, (size_t)rdcc_nslots, (size_t)rdcc_nbytes, (double) rdcc_w0) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk_cache
+ * Signature: (J[J[J[D)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
+ (JNIEnv *env, jclass clss, jlong dapl, jlongArray rdcc_nslots,
+ jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
+{
+ jboolean isCopy;
+ jdouble *w0Array = NULL;
+ jlong *rdcc_nslotsArray = NULL;
+ jlong *nbytesArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL != rdcc_w0)
+ PIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, &isCopy, "H5Pget_chunk_cache: rdcc_w0 array not pinned");
+ if (NULL != rdcc_nslots)
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nslots, rdcc_nslotsArray, &isCopy, "H5Pget_chunk_cache: rdcc_nslots array not pinned");
+ if (NULL != rdcc_nbytes)
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, &isCopy, "H5Pget_chunk_cache: nbytesArray array not pinned");
+
+ {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ long long rdcc_nslots_temp = *rdcc_nslotsArray;
+ long long nbytes_temp = *nbytesArray;
+ size_t rdcc_nslots_t = (size_t) rdcc_nslots_temp;
+ size_t nbytes_t = (size_t) nbytes_temp;
+
+ if ((status = H5Pget_chunk_cache((hid_t)dapl, &rdcc_nslots_t, &nbytes_t, (double *)w0Array)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ *rdcc_nslotsArray = (jlong)rdcc_nslots_t;
+ *nbytesArray = (jlong)nbytes_t;
+ } /* end direct cast special handling */
+
+done:
+ if (nbytesArray)
+ UNPIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, (status < 0) ? JNI_ABORT : 0);
+ if (rdcc_nslotsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, rdcc_nslots, rdcc_nslotsArray, (status < 0) ? JNI_ABORT : 0);
+ if (w0Array)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, (status < 0) ? JNI_ABORT : 0);
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_efile_prefix
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix
+ (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
+{
+ const char *extFilePrefix = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == prefix)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_efile_prefix: external file prefix is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, prefix, extFilePrefix, NULL, "H5Pset_efile_prefix: external file prefix not pinned");
+
+ if ((retVal = H5Pset_efile_prefix((hid_t)dapl_id, extFilePrefix)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (extFilePrefix)
+ UNPIN_JAVA_STRING(ENVONLY, prefix, extFilePrefix);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_efile_prefix
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix
+ (JNIEnv *env, jclass clss, jlong dapl_id)
+{
+ ssize_t prefix_size = -1;
+ char *pre = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ if ((prefix_size = H5Pget_efile_prefix((hid_t)dapl_id, (char *)NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t)prefix_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_efile_prefix: memory allocation failed");
+
+ if (H5Pget_efile_prefix((hid_t)dapl_id, (char *)pre, (size_t)prefix_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ pre[(size_t)prefix_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_efile_prefix: out of memory - unable to construct string from UTF characters");
+ }
+
+done:
+ if (pre)
+ HDfree(pre);
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_append_flush
+ * Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
+ (JNIEnv *env, jclass clss, jlong plist_id, jint ndims, jlongArray boundary, jobject callback_op, jobject op_data)
+{
+ cb_wrapper wrapper = { callback_op, op_data };
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_append_flush: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_append_flush: callback_op is NULL");
+
+ if ((status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t *)boundary, (H5D_append_cb_t)H5D_append_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1append_1flush */
+
+/*
+ * TODO: H5Pget_append_flush
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_view
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view
+ (JNIEnv *env, jclass clss, jlong dapl_id, jint view)
+{
+ UNUSED(clss);
+
+ if (H5Pset_virtual_view((hid_t)dapl_id, (H5D_vds_view_t)view) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_view
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view
+ (JNIEnv *env, jclass clss, jlong dapl_id)
+{
+ H5D_vds_view_t virtual_view = H5D_VDS_ERROR;
+
+ UNUSED(clss);
+
+ if (H5Pget_virtual_view((hid_t)dapl_id, &virtual_view) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)virtual_view;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_printf_gap
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
+ (JNIEnv *env, jclass clss, jlong dapl_id, jlong gap_size)
+{
+ UNUSED(clss);
+
+ if (H5Pset_virtual_printf_gap((hid_t)dapl_id, (hsize_t)gap_size) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_printf_gap
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap
+ (JNIEnv *env, jclass clss, jlong dapl_id)
+{
+ hsize_t gap_size = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_virtual_printf_gap((hid_t)dapl_id, &gap_size) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)gap_size;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap */
+
+static herr_t
+H5D_append_cb
+ (hid_t dataset_id, hsize_t *cur_dims, void *cb_data)
+{
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ jlongArray cur_dimsArray;
+ jmethodID mid;
+ jobject visit_callback = wrapper->visit_callback;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ void *op_data = (void *)wrapper->op_data;
+ jint status = -1;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5D_append_cb: failed to attach current thread to JVM");
+ }
+
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(J[JLhdf/hdf5lib/callbacks/H5D_append_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL != cur_dims) {
+ if (NULL == (cur_dimsArray = CBENVPTR->NewLongArray(CBENVONLY, 2)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ CBENVPTR->SetLongArrayRegion(CBENVONLY, cur_dimsArray, 0, 2, (const jlong *)cur_dims);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, dataset_id, cur_dims, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (CBENVONLY)
+ JVMPTR->DetachCurrentThread(JVMPAR);
+
+ return (herr_t)status;
+} /* end H5D_append_cb */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pDAPLImp.h b/java/src/jni/h5pDAPLImp.h
new file mode 100644
index 0000000..a9fbadd
--- /dev/null
+++ b/java/src/jni/h5pDAPLImp.h
@@ -0,0 +1,112 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PDAPL
+#define _Included_hdf_hdf5lib_H5_H5PDAPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk_cache
+ * Signature: (JJJD)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache
+(JNIEnv *, jclass, jlong, jlong, jlong, jdouble);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk_cache
+ * Signature: (J[J[J[D)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
+(JNIEnv *, jclass, jlong, jlongArray, jlongArray, jdoubleArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_efile_prefix
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix
+(JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_efile_prefix
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_append_flush
+ * Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
+ (JNIEnv*, jclass, jlong, jint, jlongArray, jobject, jobject);
+
+/*
+ * TODO: H5Pget_append_flush
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_view
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_view
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_printf_gap
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_printf_gap
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap
+(JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PDAPL */
diff --git a/java/src/jni/h5pDCPLImp.c b/java/src/jni/h5pDCPLImp.c
new file mode 100644
index 0000000..f5bbcb1
--- /dev/null
+++ b/java/src/jni/h5pDCPLImp.c
@@ -0,0 +1,1415 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pDCPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_layout
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1layout
+ (JNIEnv *env, jclass clss, jlong plist, jint layout)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_layout((hid_t)plist, (H5D_layout_t)layout)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1layout */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_layout
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1layout
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ H5D_layout_t retVal = H5D_LAYOUT_ERROR;
+
+ UNUSED(clss);
+
+ if (H5D_LAYOUT_ERROR == (retVal = H5Pget_layout((hid_t)plist)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1layout */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk
+ * Signature: (JI[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk
+ (JNIEnv *env, jclass clss, jlong plist, jint ndims, jbyteArray dim)
+{
+ jboolean isCopy;
+ hsize_t *da = NULL;
+ hsize_t *lp = NULL;
+ size_t i;
+ size_t rank;
+ jsize arrLen;
+ jbyte *theArray = NULL;
+ jlong *jlp = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (ndims < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_chunk: ndims < 0");
+ if (NULL == dim)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_chunk: dim array is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, dim)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_chunk: dim array length < 0");
+ }
+
+ rank = (size_t) arrLen / sizeof(jlong);
+ if (rank < (size_t) ndims)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_chunk: dims array rank < ndims");
+
+ PIN_BYTE_ARRAY(ENVONLY, dim, theArray, &isCopy, "H5Pset_chunk: dim array not pinned");
+
+ if (NULL == (da = lp = (hsize_t *) HDmalloc(rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_chunk: memory allocation failed");
+
+ jlp = (jlong *)theArray;
+ for (i = 0; i < rank; i++) {
+ *lp = (hsize_t)*jlp;
+ lp++;
+ jlp++;
+ } /* end if */
+
+ if ((status = H5Pset_chunk((hid_t)plist, (int)ndims, da)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (da)
+ HDfree(da);
+ if (theArray)
+ UNPIN_BYTE_ARRAY(ENVONLY, dim, theArray, JNI_ABORT);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk
+ * Signature: (JI[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk
+ (JNIEnv *env, jclass clss, jlong plist, jint max_ndims, jlongArray dims)
+{
+ jboolean isCopy;
+ hsize_t *da = NULL;
+ jlong *theArray = NULL;
+ jsize arrLen;
+ int i;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_chunk: dims is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_chunk: dims array length < 0");
+ }
+ if (arrLen < max_ndims)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_chunk: dims array < max_ndims");
+
+ PIN_LONG_ARRAY(ENVONLY, dims, theArray, &isCopy, "H5Pget_chunk: input dims not pinned");
+
+ if (NULL == (da = (hsize_t *) HDmalloc((size_t)max_ndims * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_chunk: memory allocation failed");
+
+ if ((status = H5Pget_chunk((hid_t)plist, (int)max_ndims, da)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < max_ndims; i++)
+ theArray[i] = (jlong)da[i];
+
+done:
+ if (da)
+ HDfree(da);
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk_opts
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jint opts)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_chunk_opts((hid_t)dcpl_id, (unsigned)opts)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk_opts
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts
+ (JNIEnv *env, jclass clss, jlong dcpl_id)
+{
+ unsigned opts = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_chunk_opts((hid_t)dcpl_id, &opts) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)opts;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_dset_no_attrs_hint
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint
+(JNIEnv *env, jclass clss, jlong dcpl_id, jboolean minimize)
+{
+ hbool_t minimize_val;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ minimize_val = (JNI_TRUE == minimize) ? TRUE : FALSE;
+
+ if ((retVal = H5Pset_dset_no_attrs_hint((hid_t)dcpl_id, (hbool_t)minimize_val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_dset_no_attrs_hint
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint
+(JNIEnv *env, jclass clss, jlong dcpl_id)
+{
+ hbool_t minimize = FALSE;
+ jboolean bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (H5Pget_dset_no_attrs_hint((hid_t)dcpl_id, (hbool_t *)&minimize) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (minimize == TRUE)
+ bval = JNI_TRUE;
+
+done:
+ return bval;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_deflate
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1deflate
+ (JNIEnv *env, jclass clss, jlong plist, jint level)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_deflate((hid_t)plist, (unsigned)level)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1deflate */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fill_value
+ * Signature: (JJ[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fill_1value
+ (JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value)
+{
+ jboolean isCopy;
+ jbyte *byteP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value) {
+ if ((status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ else {
+ PIN_BYTE_ARRAY(ENVONLY, value, byteP, &isCopy, "H5Pget_fill_value: value array not pinned");
+
+ if ((status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+
+done:
+ if (byteP)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, byteP, JNI_ABORT);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1value */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fill_value
+ * Signature: (JJ[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fill_1value
+ (JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value)
+{
+ jboolean isCopy;
+ herr_t status = FAIL;
+ jbyte *byteP = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_fill_value: value is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, value, byteP, &isCopy, "H5Pget_fill_value: value array not pinned");
+
+ if ((status = H5Pget_fill_value((hid_t)plist_id, (hid_t)type_id, byteP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (byteP)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, byteP, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1value */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pfill_value_defined
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined
+ (JNIEnv *env, jclass clss, jlong plist, jintArray status)
+{
+ H5D_fill_value_t value = H5D_FILL_VALUE_ERROR;
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == status)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pfill_value_defined: status is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, status, theArray, &isCopy, "H5Pfill_value_defined: status not pinned");
+
+ if ((retVal = H5Pfill_value_defined((hid_t)plist, &value)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jint)value;
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, status, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fill_time
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fill_1time
+ (JNIEnv *env, jclass clss, jlong plist, jint fill_time)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fill_time((hid_t)plist, (H5D_fill_time_t)fill_time)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1time */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fill_time
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fill_1time
+ (JNIEnv *env, jclass clss, jlong plist, jintArray fill_time)
+{
+ H5D_fill_time_t time = H5D_FILL_TIME_ERROR;
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == fill_time)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_fill_time: fill_time is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, fill_time, theArray, &isCopy, "H5Pget_fill_time: fill_time not pinned");
+
+ if ((retVal = H5Pget_fill_time((hid_t)plist, &time)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jint)time;
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, fill_time, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1time */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_alloc_time
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time
+ (JNIEnv *env, jclass clss, jlong plist, jint alloc_time)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_alloc_time((hid_t)plist, (H5D_alloc_time_t)alloc_time)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_alloc_time
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time
+ (JNIEnv *env, jclass clss, jlong plist, jintArray alloc_time)
+{
+ H5D_alloc_time_t time = H5D_ALLOC_TIME_ERROR;
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == alloc_time)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_alloc_time: alloc_time is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, alloc_time, theArray, &isCopy, "H5Pget_alloc_time: alloc_time not pinned");
+
+ if ((retVal = H5Pget_alloc_time((hid_t)plist, &time)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = time;
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, alloc_time, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_filter
+ * Signature: (JIIJ[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1filter
+ (JNIEnv *env, jclass clss, jlong plist, jint filter, jint flags,
+ jlong cd_nelmts, jintArray cd_values)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == cd_values) {
+ if ((status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter,
+ (unsigned int)flags, (size_t)cd_nelmts, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ else {
+ PIN_INT_ARRAY(ENVONLY, cd_values, theArray, &isCopy, "H5Pset_filter: input array not pinned");
+
+ if ((status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter,
+ (unsigned int)flags, (size_t)cd_nelmts, (const unsigned int *)theArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, theArray, JNI_ABORT);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1filter */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pall_filters_avail
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail
+ (JNIEnv *env, jclass clss, jlong dcpl_id)
+{
+ htri_t bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if ((bval = H5Pall_filters_avail((hid_t)dcpl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return (jboolean)bval;
+} /* end Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_nfilters
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1nfilters
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ int retVal = -1;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_nfilters((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1nfilters */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter
+ (JNIEnv *env, jclass clss, jlong plist, jint filter_number, jintArray flags,
+ jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name)
+{
+ jboolean isCopy;
+ jstring str;
+ jint *flagsArray = NULL;
+ jlong *cd_nelmtsArray = NULL;
+ jint *cd_valuesArray = NULL;
+ char *filter = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (namelen <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter: namelen <= 0");
+ if (NULL == flags)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter: flags is NULL");
+ if (NULL == cd_nelmts)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter: cd_nelmts is NULL");
+ if (NULL == cd_values)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter: cd_values is NULL");
+
+ if (NULL == (filter = (char *) HDmalloc(sizeof(char) * (size_t)namelen)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter: memory allocation failed");
+
+ PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter: flags array not pinned");
+ PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter: nelmts array not pinned");
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy, "H5Pget_filter: elmts array not pinned");
+
+
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ {
+ unsigned int filter_config;
+ long long cd_nelmts_temp = *cd_nelmtsArray;
+ size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+
+ if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
+ (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
+ (size_t)namelen, filter, &filter_config)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ filter[namelen - 1] = '\0';
+
+ *cd_nelmtsArray = (jlong)cd_nelmts_t;
+ }
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, filter))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (cd_valuesArray)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, (status < 0) ? JNI_ABORT : 0);
+ if (cd_nelmtsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, (status < 0) ? JNI_ABORT : 0);
+ if (flagsArray)
+ UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0);
+ if (filter)
+ HDfree(filter);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter2
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter2
+ (JNIEnv *env, jclass clss, jlong plist, jint filter_number,
+ jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen,
+ jobjectArray name, jintArray filter_config)
+{
+ jboolean isCopy;
+ jstring str;
+ jint *flagsArray = NULL;
+ jlong *cd_nelmtsArray = NULL;
+ jint *cd_valuesArray = NULL;
+ jint *filter_configArray = NULL;
+ char *filter = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (namelen <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: namelen <= 0");
+ if (NULL == flags)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: flags is NULL");
+ if (NULL == cd_nelmts)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: cd_nelmts is NULL");
+ if (NULL == filter_config)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: filter_config is NULL");
+
+ if (NULL == (filter = (char *) HDmalloc(sizeof(char) * (size_t)namelen)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter2: memory allocation failed");
+
+ PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter2: flags array not pinned");
+ PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter2: nelmts array not pinned");
+ PIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, &isCopy, "H5Pget_filter2: filter_config array not pinned");
+
+ if (NULL == cd_values && *cd_nelmtsArray == 0) {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ long long cd_nelmts_temp = 0;
+ size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+
+ if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
+ (unsigned int *)flagsArray, &cd_nelmts_t, NULL,
+ (size_t)namelen, filter, (unsigned int *)filter_configArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ filter[namelen - 1] = '\0';
+
+ *cd_nelmtsArray = (jlong)cd_nelmts_t;
+ }
+ else {
+ if (NULL == cd_values)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: cd_values is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy, "H5Pget_filter2: elmts array not pinned");
+
+ {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ long long cd_nelmts_temp = *cd_nelmtsArray;
+ size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+
+ if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
+ (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
+ (size_t)namelen, filter, (unsigned int *)filter_configArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ filter[namelen - 1] = '\0';
+
+ *cd_nelmtsArray = (jlong)cd_nelmts_t;
+ } /* end direct cast special */
+ }
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, filter))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter2: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (cd_valuesArray)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, (status < 0) ? JNI_ABORT : 0);
+ if (filter_configArray)
+ UNPIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, (status < 0) ? JNI_ABORT : 0);
+ if (cd_nelmtsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, (status < 0) ? JNI_ABORT : 0);
+ if (flagsArray)
+ UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0);
+ if (filter)
+ HDfree(filter);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter2 */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter_by_id
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
+ (JNIEnv *env, jclass clss, jlong plist, jint filter,
+ jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name)
+{
+ jboolean isCopy;
+ jstring str;
+ jlong *cd_nelmtsArray = NULL;
+ jint *cd_valuesArray = NULL;
+ jint *flagsArray = NULL;
+ char *aName = NULL;
+ long bs;
+ int rank;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ bs = (long)namelen;
+
+ if (bs <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: namelen <= 0");
+ if (NULL == flags)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: flags is NULL");
+ if (NULL == cd_nelmts)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: cd_nelmts is NULL");
+ if (NULL == cd_values)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: cd_values is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: name is NULL");
+
+ if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)bs)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id: memory allocation failed");
+
+ PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter_by_id: flags not pinned");
+ PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter_by_id: cd_nelms not pinned");
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy, "H5Pget_filter_by_id: cd_values array not pinned");
+
+ if ((rank = ENVPTR->GetArrayLength(ENVONLY, cd_values)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: cd_values array length < 0");
+ }
+
+ {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ unsigned int filter_config;
+ long long cd_nelmts_temp = *cd_nelmtsArray;
+ size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+
+ if ((status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter,
+ (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
+ (size_t)namelen, (char *)aName, &filter_config)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ aName[bs - 1] = '\0';
+
+ *cd_nelmtsArray = (jlong)cd_nelmts_t;
+ } /* end direct cast special */
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (cd_valuesArray)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, (status < 0) ? JNI_ABORT : 0);
+ if (cd_nelmtsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, (status < 0) ? JNI_ABORT : 0);
+ if (flagsArray)
+ UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0);
+ if (aName)
+ HDfree(aName);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter_by_id2
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
+ (JNIEnv *env, jclass clss, jlong plist, jint filter,
+ jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name, jintArray filter_config)
+{
+ jboolean isCopy;
+ jstring str;
+ jlong *cd_nelmtsArray = NULL;
+ jint *cd_valuesArray = NULL;
+ jint *flagsArray = NULL;
+ jint *filter_configArray = NULL;
+ long bs;
+ char *aName = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ bs = (long)namelen;
+
+ if (bs <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: namelen <= 0");
+ if (NULL == flags)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: flags is NULL");
+ if (NULL == cd_nelmts)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: cd_nelmts is NULL");
+ if (NULL == cd_values)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: cd_values is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: name is NULL");
+ if (NULL == filter_config)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: filter_config is NULL");
+
+ if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)bs)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id2: memory allocation failed");
+
+ PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter_by_id2: flags not pinned");
+ PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter_by_id2: cd_nelms not pinned");
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy, "H5Pget_filter_by_id2: cd_values array not pinned");
+ PIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, &isCopy, "H5Pget_filter_by_id2: filter_config not pinned");
+
+ {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ long long cd_nelmts_temp = *cd_nelmtsArray;
+ size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+
+ if ((status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter,
+ (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
+ (size_t)namelen, (char *)aName, (unsigned int *)filter_configArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ aName[bs - 1] = '\0';
+
+ *cd_nelmtsArray = (jlong)cd_nelmts_t;
+ } /* end direct cast special handling */
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_filter_by_id2: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (filter_configArray)
+ UNPIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, (status < 0) ? JNI_ABORT : 0);
+ if (cd_valuesArray)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, (status < 0) ? JNI_ABORT : 0);
+ if (cd_nelmtsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, (status < 0) ? JNI_ABORT : 0);
+ if (flagsArray)
+ UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0);
+ if (aName)
+ HDfree(aName);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2 */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pmodify_filter
+ * Signature: (JIIJ[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pmodify_1filter
+ (JNIEnv *env, jclass clss, jlong plist, jint filter,
+ jint flags, jlong cd_nelmts, jintArray cd_values)
+{
+ jboolean isCopy;
+ jint *cd_valuesP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == cd_values)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pmodify_filter: cd_values is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesP, &isCopy, "H5Pmodify_filter: cd_values not pinned");
+
+ if ((status = H5Pmodify_filter((hid_t)plist, (H5Z_filter_t)filter, (const unsigned int)flags,
+ (size_t)cd_nelmts, (unsigned int *)cd_valuesP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (cd_valuesP)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesP, JNI_ABORT);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pmodify_1filter */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Premove_filter
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5P1remove_1filter
+ (JNIEnv *env, jclass clss, jlong obj_id, jint filter)
+{
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if ((status = H5Premove_filter((hid_t)obj_id, (H5Z_filter_t)filter)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5P1remove_1filter */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fletcher32
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fletcher32
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fletcher32((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fletcher32 */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_nbit
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1nbit
+ (JNIEnv *env, jclass clss, jlong plist_id)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_nbit((hid_t)plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1nbit */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_scaleoffset
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset
+ (JNIEnv *env, jclass clss, jlong plist_id, jint scale_type, jint scale_factor)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (scale_factor < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_scaleoffset: scale factor must be >= 0");
+ if (scale_type != H5Z_SO_FLOAT_DSCALE && scale_type != H5Z_SO_FLOAT_ESCALE && scale_type != H5Z_SO_INT)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_scaleoffset: invalid scale type");
+
+ if ((retVal = H5Pset_scaleoffset((hid_t)plist_id, (H5Z_SO_scale_type_t)scale_type, scale_factor)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shuffle
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shuffle
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_shuffle((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1shuffle */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_szip
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1szip
+ (JNIEnv *env, jclass clss, jlong plist, jint options_mask, jint pixels_per_block)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_szip((hid_t)plist, (unsigned int)options_mask, (unsigned int)pixels_per_block)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1szip */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_external
+ * Signature: (JLjava/lang/String;JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1external
+ (JNIEnv *env, jclass clss, jlong plist, jstring name, jlong offset, jlong size)
+{
+ const char *fileName = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_external: file name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Pset_external: file name not pinned");
+
+ if ((status = H5Pset_external((hid_t)plist, fileName, (off_t)offset, (hsize_t)size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1external */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_external
+ * Signature: (JIJ[Ljava/lang/String;[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1external
+ (JNIEnv *env, jclass clss, jlong plist, jint idx, jlong name_size,
+ jobjectArray name, jlongArray size)
+{
+ jboolean isCopy;
+ jstring str;
+ hsize_t s;
+ off_t o;
+ jsize arrLen;
+ jlong *theArray = NULL;
+ char *file = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (name_size < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_external: name_size < 0");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, size)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_external: size array length < 0");
+ }
+ if ((size != NULL) && (arrLen < 2))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_external: size input array < 2");
+
+ if (name_size > 0)
+ if (NULL == (file = (char *) HDmalloc(sizeof(char) * (size_t)name_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_external: memory allocation failed");
+
+ if ((status = H5Pget_external((hid_t) plist, (unsigned)idx, (size_t)name_size,
+ file, (off_t *)&o, (hsize_t *)&s)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL != size) {
+ PIN_LONG_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_external: size array not pinned");
+
+ theArray[0] = o;
+ theArray[1] = (jlong)s;
+ }
+
+ if (NULL != file) {
+ file[name_size - 1] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, file))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_external: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0);
+ if (file)
+ HDfree(file);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1external */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_external_count
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1external_1count
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ int retVal = -1;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_external_count((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1external_1count */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual
+ * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jlong vspace_id,
+ jstring src_file_name, jstring src_dset_name, jlong src_space_id)
+{
+ const char *fstr = NULL;
+ const char *dstr = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == src_file_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_virtual: src_file_name is NULL");
+ if (NULL == src_dset_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_virtual: src_dset_name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, src_file_name, fstr, NULL, "H5Pset_virtual: src_file_name not pinned");
+ PIN_JAVA_STRING(ENVONLY, src_dset_name, dstr, NULL, "H5Pset_virtual: src_dset_name not pinned");
+
+ if ((retVal = H5Pset_virtual((hid_t)dcpl_id, (hid_t)vspace_id, fstr, dstr, (hid_t)src_space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dstr)
+ UNPIN_JAVA_STRING(ENVONLY, src_dset_name, dstr);
+ if (fstr)
+ UNPIN_JAVA_STRING(ENVONLY, src_file_name, fstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_count
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count
+ (JNIEnv *env, jclass clss, jlong dcpl_id)
+{
+ size_t s = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_virtual_count((hid_t)dcpl_id, &s) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)s;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_dsetname
+ * Signature: (JJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
+{
+ ssize_t buf_size;
+ char *dname = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ /* get the length of the filename */
+ if ((buf_size = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t) idx, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (dname = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_dsetname: memory allocation failed");
+
+ if (H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t) idx, dname, (size_t)buf_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ dname[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, dname))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_dsetname: out of memory - unable to construct string from UTF characters");
+ }
+
+done:
+ if (dname)
+ HDfree(dname);
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_filename
+ * Signature: (JJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
+{
+ ssize_t buf_size;
+ char *fname = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ /* get the length of the filename */
+ if ((buf_size = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t) idx, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (fname = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_filename: memory allocation failed");
+
+ if (H5Pget_virtual_filename((hid_t)dcpl_id, (size_t) idx, fname, (size_t)buf_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ fname[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, fname))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_filename: out of memory - unable to construct string from UTF characters");
+ }
+
+done:
+ if (fname)
+ HDfree(fname);
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_srcspace
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
+{
+ hid_t space_id = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((space_id = H5Pget_virtual_srcspace((hid_t)dcpl_id, (size_t) idx)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)space_id;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_vspace
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jlong idx)
+{
+ hid_t space_id = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((space_id = H5Pget_virtual_vspace((hid_t)dcpl_id, (size_t) idx)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)space_id;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_prefix
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
+ (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
+{
+ const char *virtPrefix = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == prefix)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_virtual_prefix: virtual prefix is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, prefix, virtPrefix, NULL, "H5Pset_virtual_prefix: virtual prefix not pinned");
+
+ if ((retVal = H5Pset_virtual_prefix((hid_t)dapl_id, virtPrefix)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (virtPrefix)
+ UNPIN_JAVA_STRING(ENVONLY, prefix, virtPrefix);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_prefix
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
+ (JNIEnv *env, jclass clss, jlong dapl_id)
+{
+ ssize_t prefix_size = -1;
+ char *pre = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ if ((prefix_size = H5Pget_virtual_prefix((hid_t)dapl_id, (char *)NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t) prefix_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_prefix: memory allocation failed");
+
+ if (H5Pget_virtual_prefix((hid_t)dapl_id, (char *)pre, (size_t) prefix_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ pre[prefix_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_virtual_prefix: out of memory - unable to construct string from UTF characters");
+ }
+
+done:
+ if (pre)
+ HDfree(pre);
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pDCPLImp.h b/java/src/jni/h5pDCPLImp.h
new file mode 100644
index 0000000..6e5c225
--- /dev/null
+++ b/java/src/jni/h5pDCPLImp.h
@@ -0,0 +1,396 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PDCPL
+#define _Included_hdf_hdf5lib_H5_H5PDCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_layout
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1layout
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_layout
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1layout
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk
+ * Signature: (JI[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk
+(JNIEnv *, jclass, jlong, jint, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk
+ * Signature: (JI[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk
+(JNIEnv *, jclass, jlong, jint, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk_opts
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk_opts
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_dset_no_attrs_hint
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint
+ (JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_dset_no_attrs_hint
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_deflate
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1deflate
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fill_value
+ * Signature: (JJ[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fill_1value
+(JNIEnv *, jclass, jlong, jlong, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fill_value
+ * Signature: (JJ[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fill_1value
+(JNIEnv *, jclass, jlong, jlong, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pfill_value_defined
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fill_time
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fill_1time
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fill_time
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fill_1time
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_alloc_time
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_alloc_time
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_filter
+ * Signature: (JIIJ[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1filter
+(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pall_filters_avail
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_nfilters
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1nfilters
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter
+(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter2
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter2
+(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter_by_id
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
+(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter_by_id2
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
+(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pmodify_filter
+ * Signature: (JIIJ[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pmodify_1filter
+(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Premove_filter
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5P1remove_1filter
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fletcher32
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fletcher32
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_nbit
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1nbit
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_scaleoffset
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shuffle
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shuffle
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_szip
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1szip
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_external
+ * Signature: (JLjava/lang/String;JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1external
+(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_external
+ * Signature: (JIJ[Ljava/lang/String;[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1external
+(JNIEnv *, jclass, jlong, jint, jlong, jobjectArray, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_external_count
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1external_1count
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual
+ * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual
+(JNIEnv *, jclass, jlong, jlong, jstring, jstring, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_count
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_dsetname
+ * Signature: (JJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_filename
+ * Signature: (JJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_srcspace
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_vspace
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_prefix
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
+(JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_prefix
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
+(JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PDCPL */
diff --git a/java/src/jni/h5pDXPLImp.c b/java/src/jni/h5pDXPLImp.c
new file mode 100644
index 0000000..12e3367
--- /dev/null
+++ b/java/src/jni/h5pDXPLImp.c
@@ -0,0 +1,505 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pDXPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_buffer
+ * Signature: (JJ[B[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1buffer
+ (JNIEnv *env, jclass clss, jlong plist, jlong size, jbyteArray tconv, jbyteArray bkg)
+{
+#ifdef notdef
+ jboolean isCopy;
+ jbyte *tconvP = NULL;
+ jbyte *bkgP = NULL;
+#endif
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+#ifndef notdef
+ UNUSED(plist);
+ UNUSED(size);
+ UNUSED(tconv);
+ UNUSED(bkg);
+#endif
+
+ H5_UNIMPLEMENTED(ENVONLY, "H5Pset_buffer: not implemented");
+
+ /* NOTE: DON'T IMPLEMENT THIS!!! */
+#ifdef notdef
+ if (NULL != tconv)
+ PIN_BYTE_ARRAY(ENVONLY, tconv, tconvP, &isCopy, "H5Pset_buffer: tconv not pinned");
+ if (NULL != bkg)
+ PIN_BYTE_ARRAY(ENVONLY, bkg, bkgP, &isCopy, "H5Pset_buffer: bkg not pinned");
+
+ if ((status = H5Pset_buffer((hid_t)plist, (size_t)size, tconvP, bkgP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+#endif
+
+done:
+#ifdef notdef
+ if (bkgP)
+ UNPIN_BYTE_ARRAY(ENVONLY, bkg, bkgP, (status < 0) ? JNI_ABORT : 0);
+ if (tconvP)
+ UNPIN_BYTE_ARRAY(ENVONLY, tconv, tconvP, (status < 0) ? JNI_ABORT : 0);
+#endif
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_buffer
+ * Signature: (J[B[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1buffer
+ (JNIEnv *env, jclass clss, jlong plist, jbyteArray tconv, jbyteArray bkg)
+{
+#ifdef notdef
+ jboolean isCopy;
+ jbyte *tconvP = NULL;
+ jbyte *bkgP = NULL;
+#endif
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+#ifndef notdef
+ UNUSED(plist);
+ UNUSED(tconv);
+ UNUSED(bkg);
+#endif
+
+ H5_UNIMPLEMENTED(ENVONLY, "H5Pget_buffer: not implemented");
+
+ /* NOTE: DON'T IMPLEMENT THIS!!! */
+#ifdef notdef
+ if (NULL == tconv)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_buffer: tconv input array is NULL");
+ if (NULL == bkg)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_buffer: bkg array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, tconv, tconvP, &isCopy, "H5Pget_buffer: tconv not pinned");
+ PIN_BYTE_ARRAY(ENVONLY, bkg, bkgP, &isCopy, "H5Pget_buffer: bkg not pinned");
+
+ if ((status = H5Pget_buffer((hid_t)plist, tconvP, bkgP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+#endif
+
+done:
+#ifdef notdef
+ if (bkgP)
+ UNPIN_BYTE_ARRAY(ENVONLY, bkg, bkgP, (status < 0) ? JNI_ABORT : 0);
+ if (tconvP)
+ UNPIN_BYTE_ARRAY(ENVONLY, tconv, tconvP, (status < 0) ? JNI_ABORT : 0);
+#endif
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_buffer_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlong size)
+{
+ UNUSED(clss);
+
+ if (H5Pset_buffer((hid_t)plist, (size_t)size, NULL, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_buffer_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ size_t size = 0;
+
+ UNUSED(clss);
+
+ if (!(size = H5Pget_buffer((hid_t)plist, NULL, NULL)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)size;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_preserve
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1preserve
+ (JNIEnv *env, jclass clss, jlong plist, jboolean status)
+{
+ hbool_t st = JNI_FALSE;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (JNI_TRUE == status)
+ st = TRUE;
+ else if (JNI_FALSE == status)
+ st = false;
+ else
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_preserve: status not TRUE or FALSE");
+
+ if ((retVal = H5Pset_preserve((hid_t)plist, st)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1preserve */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_preserve
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1preserve
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_preserve((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1preserve */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_edc_check
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1edc_1check
+ (JNIEnv *env, jclass clss, jlong plist, jint check)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_edc_check((hid_t)plist, (H5Z_EDC_t)check)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1edc_1check */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_edc_check
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1edc_1check
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ H5Z_EDC_t retVal = -1;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_edc_check((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1edc_1check */
+
+/*
+ * TODO: H5Pset_filter_callback
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_data_transform
+ * Signature: (JLjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1data_1transform
+ (JNIEnv *env, jclass clss, jlong plist_id, jstring expression)
+{
+ const char *express = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == expression)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_data_transform: data transform expression is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, expression, express, NULL, "H5Pset_data_transform: data transform expression not pinned");
+
+ if ((retVal = H5Pset_data_transform((hid_t)plist_id, express)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (express)
+ UNPIN_JAVA_STRING(ENVONLY, expression, express);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1data_1transform */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_data_transform
+ * Signature: (J[Ljava/lang/String;J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
+ (JNIEnv *env, jclass clss, jlong plist_id, jobjectArray expression, jlong size)
+{
+ jstring str = NULL;
+ char *express = NULL;
+ ssize_t express_size = -1;
+
+ UNUSED(clss);
+
+ if (size <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_data_transform: size <= 0");
+
+ if ((express_size = H5Pget_data_transform((hid_t)plist_id, (char *)NULL, (size_t)size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (express = (char *) HDmalloc(sizeof(char) * (size_t)express_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_data_transform: memory allocation failed");
+
+ if (H5Pget_data_transform((hid_t)plist_id, express, (size_t)express_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ express[express_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, express))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_data_transform: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, expression, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (express)
+ HDfree(express);
+
+ return (jlong)express_size;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1data_1transform */
+
+/*
+ * TODO: H5Pset_type_conv_cb
+ */
+
+/*
+ * TODO: H5Pget_type_conv_cb
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_hyper_vector_size
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlong vector_size)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_hyper_vector_size((hid_t)plist, (size_t)vector_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_hyper_vector_size
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlongArray vector_size)
+{
+ jboolean isCopy;
+ size_t size;
+ jlong *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == vector_size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_hyper_vector_size: vector_size is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, vector_size, theArray, &isCopy, "H5Pget_hyper_vector_size: vector_size not pinned");
+
+ if ((retVal = H5Pget_hyper_vector_size((hid_t)plist, &size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jlong)size;
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, vector_size, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_btree_ratios
+ * Signature: (JDDD)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios
+ (JNIEnv *env, jclass clss, jlong plist_id, jdouble left, jdouble middle, jdouble right)
+{
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if ((status = H5Pset_btree_ratios((hid_t)plist_id, (double)left,(double)middle, (double)right)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_btree_ratios
+ * Signature: (J[D[D[D)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios
+ (JNIEnv *env, jclass clss, jlong plist_id, jdoubleArray left,
+ jdoubleArray middle, jdoubleArray right)
+{
+ jboolean isCopy;
+ jdouble *leftP = NULL;
+ jdouble *middleP = NULL;
+ jdouble *rightP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == left)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_btree_ratios: left input array is NULL");
+ if (NULL == middle)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_btree_ratios: middle input array is NULL");
+ if (NULL == right)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_btree_ratios: right input array is NULL");
+
+ PIN_DOUBLE_ARRAY(ENVONLY, left, leftP, &isCopy, "H5Pget_btree_ratios: left array not pinned");
+ PIN_DOUBLE_ARRAY(ENVONLY, middle, middleP, &isCopy, "H5Pget_btree_ratios: middle array not pinned");
+ PIN_DOUBLE_ARRAY(ENVONLY, right, rightP, &isCopy, "H5Pget_btree_ratios: right array not pinned");
+
+ if ((status = H5Pget_btree_ratios((hid_t)plist_id, (double *)leftP,
+ (double *)middleP, (double *)rightP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (rightP)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, right, rightP, (status < 0) ? JNI_ABORT : 0);
+ if (middleP)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, middle, middleP, (status < 0) ? JNI_ABORT : 0);
+ if (leftP)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, left, leftP, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios */
+
+/*
+ * TODO: H5Pset_vlen_mem_manager
+ */
+
+/*
+ * TODO: H5Pget_vlen_mem_manager
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio
+ */
+
+/*
+ * TODO: H5Pget_dxpl_mpio
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt_num
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt_ratio
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_collective_opt
+ */
+
+/*
+ * TODO: H5Pget_mpio_actual_chunk_opt_mode
+ */
+
+/*
+ * TODO: H5Pget_mpio_actual_io_mode
+ */
+
+/*
+ * TODO: H5Pget_mpio_no_collective_cause
+ */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pDXPLImp.h b/java/src/jni/h5pDXPLImp.h
new file mode 100644
index 0000000..d62f9c5
--- /dev/null
+++ b/java/src/jni/h5pDXPLImp.h
@@ -0,0 +1,209 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PDXPL
+#define _Included_hdf_hdf5lib_H5_H5PDXPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_buffer
+ * Signature: (JJ[B[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1buffer
+(JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_buffer
+ * Signature: (J[B[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1buffer
+(JNIEnv *, jclass, jlong, jbyteArray, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_buffer_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_buffer_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_preserve
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1preserve
+(JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_preserve
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1preserve
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_edc_check
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1edc_1check
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_edc_check
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1edc_1check
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pset_filter_callback
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_data_transform
+ * Signature: (JLjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1data_1transform
+(JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_data_transform
+ * Signature: (J[Ljava/lang/String;J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
+(JNIEnv *, jclass, jlong, jobjectArray, jlong);
+
+/*
+ * TODO: H5Pset_type_conv_cb
+ */
+
+/*
+ * TODO: H5Pget_type_conv_cb
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_hyper_vector_size
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_hyper_vector_size
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size
+(JNIEnv *, jclass, jlong, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_btree_ratios
+ * Signature: (JDDD)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios
+(JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_btree_ratios
+ * Signature: (J[D[D[D)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios
+(JNIEnv *, jclass, jlong, jdoubleArray, jdoubleArray, jdoubleArray);
+
+/*
+ * TODO: H5Pset_vlen_mem_manager
+ */
+
+/*
+ * TODO: H5Pget_vlen_mem_manager
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio
+ */
+
+/*
+ * TODO: H5Pget_dxpl_mpio
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt_num
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt_ratio
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_collective_opt
+ */
+
+/*
+ * TODO: H5Pget_mpio_actual_chunk_opt_mode
+ */
+
+/*
+ * TODO: H5Pget_mpio_actual_io_mode
+ */
+
+/*
+ * TODO: H5Pget_mpio_no_collective_cause
+ */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PDXPL */
diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c
new file mode 100644
index 0000000..9ae8775
--- /dev/null
+++ b/java/src/jni/h5pFAPLImp.c
@@ -0,0 +1,1977 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5util.h"
+#include "h5pFAPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * TODO: H5Pset_driver
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_driver
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1driver
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_driver((hid_t) plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1driver */
+
+/*
+ * TODO: H5Pget_driver_info
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fclose_degree
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree
+ (JNIEnv *env, jclass clss, jlong plist, jint fc_degree)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fclose_degree((hid_t)plist, (H5F_close_degree_t)fc_degree)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fclose_degree
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ H5F_close_degree_t degree = H5F_CLOSE_DEFAULT;
+
+ UNUSED(clss);
+
+ if (H5Pget_fclose_degree((hid_t)plist, &degree) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)degree;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_core
+ * Signature: (JJZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core
+ (JNIEnv *env, jclass clss, jlong fapl_id, jlong increment, jboolean backing_store)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fapl_core((hid_t)fapl_id, (size_t)increment, (hbool_t)backing_store)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_core
+ * Signature: (J[J[Z)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
+ (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray increment, jbooleanArray backing_store)
+{
+ jboolean isCopy;
+ jboolean *backArray = NULL;
+ jlong *incArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == increment)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_core: increment is NULL");
+ if (NULL == backing_store)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_core: backing_store is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, increment, incArray, &isCopy, "H5Pget_fapl_core: incArray not pinned");
+ PIN_BOOL_ARRAY(ENVONLY, backing_store, backArray, &isCopy, "H5Pget_fapl_core: backArray not pinned");
+
+ {
+ /* Direct cast (size_t *)variable fails on 32-bit environment */
+ long long inc_temp = *incArray;
+ size_t inc_t = (size_t) inc_temp;
+
+ if ((status = H5Pget_fapl_core((hid_t)fapl_id, &inc_t, (hbool_t *)backArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ *incArray = (jlong)inc_t;
+ }
+
+done:
+ if (backArray)
+ UNPIN_BOOL_ARRAY(ENVONLY, backing_store, backArray, (status < 0) ? JNI_ABORT : 0);
+ if (incArray)
+ UNPIN_LONG_ARRAY(ENVONLY, increment, incArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core */
+
+/*
+ * TODO: H5Pset_core_write_tracking
+ */
+
+/*
+ * TODO: H5Pget_core_write_tracking
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_direct
+ * Signature: (JJJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct
+ (JNIEnv *env, jclass clss, jlong fapl_id, jlong alignment,
+ jlong block_size, jlong cbuf_size)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+#ifdef H5_HAVE_DIRECT
+ if ((retVal = H5Pset_fapl_direct((hid_t)fapl_id, (size_t)alignment, (size_t)block_size, (size_t)cbuf_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+#else
+ UNUSED(env);
+ UNUSED(fapl_id);
+ UNUSED(alignment);
+ UNUSED(block_size);
+ UNUSED(cbuf_size);
+#endif
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_direct
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct
+ (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray info)
+{
+#ifdef H5_HAVE_DIRECT
+ jboolean isCopy;
+ jlong *theArray = NULL;
+ size_t alignment = 0;
+ size_t block_size = 0;
+ size_t cbuf_size = 0;
+ jsize arrLen;
+#endif
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+#ifdef H5_HAVE_DIRECT
+ if (NULL == info)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_direct: info input array is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, info)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_direct: info array length < 0");
+ }
+ if (arrLen < 3)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_direct: info input array < 3");
+
+ PIN_LONG_ARRAY(ENVONLY, info, theArray, &isCopy, "H5Pget_fapl_direct: info not pinned");
+
+ if ((retVal = H5Pget_fapl_direct((hid_t)fapl_id, &alignment, &block_size, &cbuf_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jlong)alignment;
+ theArray[1] = (jlong)block_size;
+ theArray[2] = (jlong)cbuf_size;
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, info, theArray, (retVal < 0) ? JNI_ABORT : 0);
+#else
+ UNUSED(env);
+ UNUSED(fapl_id);
+ UNUSED(info);
+#endif
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_family
+ * Signature: (JJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family
+ (JNIEnv *env, jclass clss, jlong plist, jlong memb_size, jlong memb_plist)
+{
+ long ms = (long)memb_size;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fapl_family((hid_t)plist, (hsize_t)ms, (hid_t)memb_plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_family
+ * Signature: (J[J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
+ (JNIEnv *env, jclass clss, jlong tid, jlongArray memb_size, jlongArray memb_plist)
+{
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ size_t i;
+ jlong *sizeArray = NULL;
+ jlong *plistArray = NULL;
+ jsize rank;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == memb_size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_family: memb_size is NULL");
+ if (NULL == memb_plist)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_family: memb_plist is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, memb_size, sizeArray, &isCopy, "H5Pget_family: sizeArray not pinned");
+
+ if ((rank = ENVPTR->GetArrayLength(ENVONLY, memb_size)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_family: memb_size array length < 0");
+ }
+
+ if (NULL == (sa = (hsize_t *) HDmalloc((size_t) rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_family: memory allocation failed");
+
+ PIN_LONG_ARRAY(ENVONLY, memb_plist, plistArray, &isCopy, "H5Pget_family: plistArray not pinned");
+
+ if ((status = H5Pget_fapl_family((hid_t)tid, sa, (hid_t *)plistArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (size_t) rank; i++)
+ sizeArray[i] = (jlong)sa[i];
+
+done:
+ if (plistArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_plist, plistArray, (status < 0) ? JNI_ABORT : 0);
+ if (sa)
+ HDfree(sa);
+ if (sizeArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_size, sizeArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_family_offset
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1family_1offset
+ (JNIEnv *env, jclass clss, jlong fapl_id, jlong offset)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_family_offset((hid_t)fapl_id, (hsize_t)offset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1family_1offset */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_family_offset
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1family_1offset
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ hsize_t offset = 0;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_family_offset((hid_t)fapl_id, &offset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)offset;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1family_1offset */
+
+/* Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_hdfs
+ * Signature: (J)Lhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+#ifdef H5_HAVE_LIBHDFS
+ H5FD_hdfs_fapl_t fa;
+ jvalue args[5];
+ jint j_namenode_port = 0;
+ jstring j_namenode_name = NULL;
+ jstring j_user_name = NULL;
+ jstring j_kerb_cache_path = NULL;
+ jint j_stream_buffer_size = 0;
+#endif /* H5_HAVE_LIBHDFS */
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+#ifdef H5_HAVE_LIBHDFS
+ if (H5Pget_fapl_hdfs((hid_t)fapl_id, &fa) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (j_namenode_name = ENVPTR->NewStringUTF(ENVONLY, fa.namenode_name))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create namenode_name string");
+ }
+ args[0].l = j_namenode_name;
+
+ args[1].i = (jint)fa.namenode_port;
+
+ if (NULL == (j_user_name = ENVPTR->NewStringUTF(ENVONLY, fa.user_name))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create user_name string");
+ }
+ args[2].l = j_user_name;
+
+ if (NULL == (j_kerb_cache_path = ENVPTR->NewStringUTF(ENVONLY, fa.kerberos_ticket_cache))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create kerberos_ticket_cache string");
+ }
+ args[3].l = j_kerb_cache_path;
+
+ args[4].i = (jint)fa.stream_buffer_size;
+
+ 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 */
+
+done:
+ return ret_obj;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_hdfs
+ * Signature: (JLhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs
+ (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config)
+{
+#ifdef H5_HAVE_LIBHDFS
+ H5FD_hdfs_fapl_t instance;
+ const char *str = NULL;
+ jfieldID fid;
+ jstring j_str;
+ jclass cls;
+#endif /* H5_HAVE_LIBHDFS */
+
+ UNUSED(clss);
+
+#ifdef H5_HAVE_LIBHDFS
+ HDmemset(&instance, 0, sizeof(H5FD_hdfs_fapl_t));
+
+ if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, fapl_config)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "version", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ instance.version = ENVPTR->GetIntField(ENVONLY, fapl_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "namenode_name", "Ljava/lang/String;")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (j_str) {
+ PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config namenode_name not pinned");
+
+ HDstrncpy(instance.namenode_name, str, H5FD__HDFS_NODE_NAME_SPACE + 1);
+ instance.namenode_name[H5FD__HDFS_NODE_NAME_SPACE] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+ str = NULL;
+ }
+ else
+ HDmemset(instance.namenode_name, 0, H5FD__HDFS_NODE_NAME_SPACE + 1);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "namenode_port", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ instance.namenode_port = ENVPTR->GetIntField(ENVONLY, fapl_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "user_name", "Ljava/lang/String;")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (j_str) {
+ PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config user_name not pinned");
+
+ HDstrncpy(instance.user_name, str, H5FD__HDFS_USER_NAME_SPACE + 1);
+ instance.user_name[H5FD__HDFS_USER_NAME_SPACE] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+ str = NULL;
+ }
+ else
+ HDmemset(instance.user_name, 0, H5FD__HDFS_USER_NAME_SPACE + 1);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "kerberos_ticket_cache", "Ljava/lang/String;")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (j_str) {
+ PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config kerberos_ticket_cache not pinned");
+
+ HDstrncpy(instance.kerberos_ticket_cache, str, H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1);
+ instance.kerberos_ticket_cache[H5FD__HDFS_KERB_CACHE_PATH_SPACE] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+ str = NULL;
+ }
+ else
+ HDmemset(instance.kerberos_ticket_cache, 0, H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "stream_buffer_size", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ instance.stream_buffer_size = ENVPTR->GetIntField(ENVONLY, fapl_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ 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 */
+
+done:
+ /* NOP */;
+#ifdef H5_HAVE_LIBHDFS
+ if (str)
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+#endif /* H5_HAVE_LIBHDFS */
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_log
+ * Signature: (JLjava/lang/String;JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
+ (JNIEnv *env, jclass clss, jlong fapl_id, jstring logfile, jlong flags, jlong buf_size)
+{
+ const char *pLogfile = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == logfile)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_fapl_log: log file name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, logfile, pLogfile, NULL, "H5Pset_fapl_log: log file name not pinned");
+
+ if ((retVal = H5Pset_fapl_log((hid_t)fapl_id, pLogfile, (unsigned long long)flags, (size_t)buf_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (pLogfile)
+ UNPIN_JAVA_STRING(ENVONLY, logfile, pLogfile);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log */
+
+/*
+ * TODO: H5Pset_fapl_mpio
+ */
+
+/*
+ * TODO: H5Pget_fapl_mpio
+ */
+
+/*
+ * TODO: H5Pset_fapl_mpiposix
+ */
+
+/*
+ * TODO: H5Pget_fapl_mpiposix
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_multi
+ * Signature: (J[I[J[Ljava/lang/String;[JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
+ (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
+ jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr, jboolean relax)
+{
+ const char * const *mName = NULL;
+ const char *utf8 = NULL;
+ jboolean isCopy;
+ jboolean bb;
+ jobject o;
+ jstring rstring;
+ jstring obj;
+ jclass Sjc;
+ size_t i;
+ jlong *thefaplArray = NULL;
+ jlong *theaddrArray = NULL;
+ jint *themapArray = NULL;
+ char *member_name[H5FD_MEM_NTYPES];
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ HDmemset(member_name, 0, H5FD_MEM_NTYPES * sizeof(char *));
+
+ if (memb_map)
+ PIN_INT_ARRAY(ENVONLY, memb_map, themapArray, &isCopy, "H5Pset_fapl_multi: memb_map not pinned");
+ if (memb_fapl)
+ PIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, &isCopy, "H5Pset_fapl_multi: memb_fapl not pinned");
+ if (memb_addr)
+ PIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, &isCopy, "H5Pset_fapl_multi: memb_addr not pinned");
+
+ if (memb_name) {
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ size_t str_len;
+
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray) memb_name, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ member_name[i] = NULL;
+ continue;
+ }
+
+ /*
+ * length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ */
+
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5Pset_fapl_multi: string not pinned");
+
+ str_len = HDstrlen(utf8);
+
+ if (NULL == (member_name[i] = (char *) HDmalloc(str_len + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_fapl_multi: memory allocation failed");
+
+ HDstrncpy(member_name[i], utf8, str_len + 1);
+ (member_name[i])[str_len] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ }
+
+ mName = (const char * const *)member_name;
+ }
+
+ if ((status = H5Pset_fapl_multi((hid_t)tid, (const H5FD_mem_t *)themapArray, (const hid_t *)thefaplArray,
+ mName, (const haddr_t *)theaddrArray, (hbool_t)relax)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (memb_name && mName) {
+ if (NULL == (Sjc = ENVPTR->FindClass(ENVONLY, "java/lang/String")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ if (!member_name[i]) continue;
+
+ if (NULL == (rstring = ENVPTR->NewStringUTF(ENVONLY, member_name[i]))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pset_fapl_multi: out of memory - unable to construct string from UTF characters");
+ }
+
+ if (NULL == (o = ENVPTR->GetObjectArrayElement(ENVONLY, memb_name, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ ENVPTR->DeleteLocalRef(ENVONLY, rstring);
+ continue;
+ }
+
+ if (JNI_TRUE == (bb = ENVPTR->IsInstanceOf(ENVONLY, o, Sjc))) {
+ ENVPTR->SetObjectArrayElement(ENVONLY, memb_name, (jsize) i, (jobject)rstring);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+ ENVPTR->DeleteLocalRef(ENVONLY, o);
+ ENVPTR->DeleteLocalRef(ENVONLY, rstring);
+
+ HDfree(member_name[i]);
+ member_name[i] = NULL;
+ }
+ }
+
+done:
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ if (member_name[i])
+ HDfree(member_name[i]);
+ }
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (theaddrArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, (status < 0) ? JNI_ABORT : 0);
+ if (thefaplArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, (status < 0) ? JNI_ABORT : 0);
+ if (themapArray)
+ UNPIN_INT_ARRAY(ENVONLY, memb_map, themapArray, (status < 0) ? JNI_ABORT : 0);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_multi
+ * Signature: (J[I[J[Ljava/lang/String;[J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
+ (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
+ jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr)
+{
+ jboolean isCopy;
+ jstring str;
+ herr_t status = FAIL;
+ size_t i;
+ jlong *thefaplArray = NULL;
+ jlong *theaddrArray = NULL;
+ jint *themapArray = NULL;
+ char **mName = NULL;
+ int relax = 0;
+ int retVal = 0;
+
+ UNUSED(clss);
+
+ if (memb_map)
+ PIN_INT_ARRAY(ENVONLY, memb_map, themapArray, &isCopy, "H5Pget_fapl_multi: memb_map not pinned");
+ if (memb_fapl)
+ PIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, &isCopy, "H5Pget_fapl_multi: memb_fapl not pinned");
+ if (memb_addr)
+ PIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, &isCopy, "H5Pget_fapl_multi: memb_addr not pinned");
+ if (memb_name)
+ if (NULL == (mName = (char **) HDcalloc(H5FD_MEM_NTYPES, sizeof(*mName))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_multi: memory allocation failed");
+
+ if ((status = H5Pget_fapl_multi((hid_t)tid, (H5FD_mem_t *)themapArray, (hid_t *)thefaplArray,
+ mName, (haddr_t *)theaddrArray, (hbool_t *)&relax)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (memb_name && mName) {
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ if (mName[i]) {
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, mName[i]))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_multi: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, memb_name, (jsize) i, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, str);
+ }
+ }
+ }
+
+ retVal = (relax != 0);
+
+done:
+ h5str_array_free(mName, H5FD_MEM_NTYPES);
+ if (theaddrArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, (status < 0) ? JNI_ABORT : 0);
+ if (thefaplArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, (status < 0) ? JNI_ABORT : 0);
+ if (themapArray)
+ UNPIN_INT_ARRAY(ENVONLY, memb_map, themapArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jboolean)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi */
+
+/*
+ * TODO: H5Pset_multi_type
+ */
+
+/*
+ * TODO: H5Pget_multi_type
+ */
+
+/*
+ * Class: hdf5_hdf5lib_H5
+ * Method: H5Pget_fapl_ros3
+ * Signature: (J)Lhdf/hdf5lib/structs/H5FD_ros3_fapl_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+#ifdef H5_HAVE_ROS3_VFD
+ H5FD_ros3_fapl_t fa;
+ jvalue args[3];
+ jstring j_aws = NULL;
+ jstring j_id = NULL;
+ jstring j_key = NULL;
+#endif /* H5_HAVE_ROS3_VFD */
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+#ifdef H5_HAVE_ROS3_VFD
+ /* pass fapl and fapl_t instance into library get_fapl */
+ /* store fapl details in ros3_fapl_t instance `fa` */
+ if (H5Pget_fapl_ros3((hid_t)fapl_id, &fa) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (j_aws = ENVPTR->NewStringUTF(ENVONLY, fa.aws_region))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create aws_region string");
+ }
+ args[0].l = j_aws;
+
+ if (NULL == (j_id = ENVPTR->NewStringUTF(ENVONLY, fa.secret_id))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create secret_id string");
+ }
+ args[1].l = j_id;
+
+ if (NULL == (j_key = ENVPTR->NewStringUTF(ENVONLY, fa.secret_key))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create secret_key string");
+ }
+ args[2].l = j_key;
+
+ 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 */
+
+done:
+ return ret_obj;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_ros3
+ * Signature: (JLhdf/hdf5lib/structs/H5FD_ros3_fapl_t;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3
+ (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config)
+{
+#ifdef H5_HAVE_ROS3_VFD
+ H5FD_ros3_fapl_t instance;
+ const char *str = NULL;
+ jfieldID fid;
+ jstring j_str;
+ jclass cls;
+#endif /* H5_HAVE_ROS3_VFD */
+
+ UNUSED(clss);
+
+#ifdef H5_HAVE_ROS3_VFD
+ HDmemset(&instance, 0, sizeof(H5FD_ros3_fapl_t));
+
+ if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, fapl_config)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "version", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ instance.version = ENVPTR->GetIntField(ENVONLY, fapl_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "aws_region", "Ljava/lang/String;")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (j_str) {
+ PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config aws_region not pinned");
+
+ HDstrncpy(instance.aws_region, str, H5FD_ROS3_MAX_REGION_LEN + 1);
+ instance.aws_region[H5FD_ROS3_MAX_REGION_LEN] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+ str = NULL;
+ }
+ else
+ HDmemset(instance.aws_region, 0, H5FD_ROS3_MAX_REGION_LEN + 1);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "secret_id", "Ljava/lang/String;")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (j_str) {
+ PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_id not pinned");
+
+ HDstrncpy(instance.secret_id, str, H5FD_ROS3_MAX_SECRET_ID_LEN + 1);
+ instance.secret_id[H5FD_ROS3_MAX_SECRET_ID_LEN] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+ str = NULL;
+ }
+ else
+ HDmemset(instance.secret_id, 0, H5FD_ROS3_MAX_SECRET_ID_LEN + 1);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "secret_key", "Ljava/lang/String;")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (j_str) {
+ PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_key not pinned");
+
+ HDstrncpy(instance.secret_key, str, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1);
+ instance.secret_key[H5FD_ROS3_MAX_SECRET_KEY_LEN] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+ str = NULL;
+ }
+ else
+ HDmemset(instance.secret_key, 0, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1);
+
+ if (instance.aws_region[0] != '\0' && instance.secret_id[0] !='\0' && instance.secret_key[0] !='\0')
+ instance.authenticate = TRUE;
+
+ 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 */
+
+done:
+ /* NOP */;
+#ifdef H5_HAVE_ROS3_VFD
+ if (str)
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+#endif /* H5_HAVE_LIBHDFS */
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_split
+ * Signature: (JLjava/lang/String;JLjava/lang/String;J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
+ (JNIEnv *env, jclass clss, jlong fapl_id, jstring metaext, jlong meta_pl_id, jstring rawext, jlong raw_pl_id)
+{
+ const char *mstr = NULL;
+ const char *rstr = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == metaext)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_fapl_split: metaext is NULL");
+ if (NULL == rawext)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_fapl_split: rawext is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, metaext, mstr, NULL, "H5Pset_fapl_split: metaext not pinned");
+ PIN_JAVA_STRING(ENVONLY, rawext, rstr, NULL, "H5Pset_fapl_split: rawext not pinned");
+
+ if ((retVal = H5Pset_fapl_split((hid_t)fapl_id, mstr, (hid_t)meta_pl_id, rstr, (hid_t)raw_pl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (rstr)
+ UNPIN_JAVA_STRING(ENVONLY, rawext, rstr);
+ if (mstr)
+ UNPIN_JAVA_STRING(ENVONLY, metaext, mstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_sec2
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fapl_sec2((hid_t) fapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2 */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_stdio
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fapl_stdio((hid_t) fapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_windows
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+#ifdef H5_HAVE_WINDOWS
+ if ((retVal = H5Pset_fapl_windows((hid_t) fapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+#else
+ UNUSED(env);
+ UNUSED(fapl_id);
+#endif
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows */
+
+/*
+ * TODO: H5Pset_file_image
+ */
+
+/*
+ * TODO: H5Pget_file_image
+ */
+
+/*
+ * TODO: H5Pset_file_image_callbacks
+ */
+
+/*
+ * TODO: H5Pget_file_image_callbacks
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_meta_block_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlong size)
+{
+ long sz = (long)size;
+
+ UNUSED(clss);
+
+ if (H5Pset_meta_block_size((hid_t)plist, (hsize_t)sz) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_meta_block_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ hsize_t s = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_meta_block_size((hid_t)plist, &s) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)s;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size */
+
+/*
+ * TODO: H5Pset_page_buffer_size
+ */
+
+/*
+ * TODO: H5Pget_page_buffer_size
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sieve_buf_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlong size)
+{
+ size_t sz = (size_t)size;
+
+ UNUSED(clss);
+
+ if (H5Pset_sieve_buf_size((hid_t)plist, (size_t)sz) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sieve_buf_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ size_t s = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_sieve_buf_size((hid_t)plist, &s) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)s;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_alignment
+ * Signature: (JJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1alignment
+ (JNIEnv *env, jclass clss, jlong plist, jlong threshold, jlong alignment)
+{
+ long thr = (long)threshold;
+ long align = (long)alignment;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_alignment((hid_t)plist, (hsize_t)thr, (hsize_t)align)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1alignment */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_alignment
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1alignment
+ (JNIEnv *env, jclass clss, jlong plist, jlongArray alignment)
+{
+ jboolean isCopy;
+ hsize_t t = 0;
+ hsize_t a = 0;
+ jsize arrLen;
+ jlong *theArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == alignment)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_alignment: input alignment is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, alignment)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_alignment: alignment array length < 0");
+ }
+ if (arrLen < 2)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_alignment: alignment input array < 2");
+
+ PIN_LONG_ARRAY(ENVONLY, alignment, theArray, &isCopy, "H5Pget_alignment: input array not pinned");
+
+ if ((status = H5Pget_alignment((hid_t)plist, &t, &a)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jlong)t;
+ theArray[1] = (jlong)a;
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, alignment, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1alignment */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_cache
+ * Signature: (JIJJD)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1cache
+ (JNIEnv *env, jclass clss, jlong plist, jint mdc_nelmts, jlong rdcc_nelmts,
+ jlong rdcc_nbytes, jdouble rdcc_w0)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_cache((hid_t)plist, (int)mdc_nelmts, (size_t)rdcc_nelmts,
+ (size_t)rdcc_nbytes, (double) rdcc_w0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1cache */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_cache
+ * Signature: (J[I[J[J[D)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1cache
+ (JNIEnv *env, jclass clss, jlong plist, jintArray mdc_nelmts,
+ jlongArray rdcc_nelmts, jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
+{
+ jboolean isCopy;
+ jdouble *w0Array = NULL;
+ jlong *rdcc_nelmtsArray = NULL;
+ jlong *nbytesArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+ UNUSED(mdc_nelmts);
+
+ if (NULL != rdcc_w0)
+ PIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, &isCopy, "H5Pget_cache: rdcc_w0 array not pinned");
+ if (NULL != rdcc_nelmts)
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nelmts, rdcc_nelmtsArray, &isCopy, "H5Pget_cache: rdcc_nelmts array not pinned");
+ if (NULL != rdcc_nbytes)
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, &isCopy, "H5Pget_cache: nbytesArray array not pinned");
+
+ {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ long long rdcc_nelmts_temp = *rdcc_nelmtsArray;
+ long long nbytes_temp = *nbytesArray;
+ size_t rdcc_nelmts_t = (size_t) rdcc_nelmts_temp;
+ size_t nbytes_t = (size_t) nbytes_temp;
+
+ if ((status = H5Pget_cache((hid_t)plist, (int *)NULL, &rdcc_nelmts_t,
+ &nbytes_t, (double *)w0Array)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ *rdcc_nelmtsArray = (jlong)rdcc_nelmts_t;
+ *nbytesArray = (jlong)nbytes_t;
+ } /* end direct cast special */
+
+done:
+ if (nbytesArray)
+ UNPIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, (status < 0) ? JNI_ABORT : 0);
+ if (rdcc_nelmtsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, rdcc_nelmts, rdcc_nelmtsArray, (status < 0) ? JNI_ABORT : 0);
+ if (w0Array)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1cache */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_file_cache_size
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size
+ (JNIEnv *env, jclass clss, jlong plist, jint size)
+{
+ unsigned sz = (unsigned)size;
+
+ UNUSED(clss);
+
+ if (H5Pset_elink_file_cache_size((hid_t)plist, (unsigned)sz) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_file_cache_size
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ unsigned s = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_elink_file_cache_size((hid_t)plist, &s) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)s;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_evict_on_close
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close
+ (JNIEnv *env, jclass clss, jlong fapl_id, jboolean evict_on_close)
+{
+ hbool_t evict_on_close_val = FALSE;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ evict_on_close_val = (evict_on_close == JNI_TRUE) ? TRUE : FALSE;
+
+ if ((retVal = H5Pset_evict_on_close((hid_t)fapl_id, (hbool_t)evict_on_close_val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_evict_on_close
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ hbool_t evict_on_close_val = FALSE;
+ jboolean bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (H5Pget_evict_on_close((hid_t)fapl_id, (hbool_t *)&evict_on_close_val) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (evict_on_close_val == TRUE) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return bval;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_metadata_read_attempts
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
+ (JNIEnv *env, jclass clss, jlong plist_id, jlong attempts)
+{
+ UNUSED(clss);
+
+ if (attempts <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_metadata_read_attempts: attempts <= 0");
+
+ if (H5Pset_metadata_read_attempts((hid_t)plist_id, (unsigned)attempts) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_metadata_read_attempts
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
+ (JNIEnv *env, jclass clss, jlong plist_id)
+{
+ unsigned attempts = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_metadata_read_attempts((hid_t)plist_id, &attempts) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong) attempts;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_mdc_config
+ * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
+ (JNIEnv *env, jclass clss, jlong plist, jobject cache_config)
+{
+ H5AC_cache_config_t cacheinfo;
+ const char *str = NULL;
+ jfieldID fid;
+ jstring j_str;
+ jclass cls;
+ jint flash_incr_mode;
+ jint incr_mode;
+ jint decr_mode;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t));
+
+ if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, cache_config)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "version", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.version = ENVPTR->GetIntField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "rpt_fcn_enabled", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.rpt_fcn_enabled = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "open_trace_file", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.open_trace_file = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "close_trace_file", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.close_trace_file = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "trace_file_name", "Ljava/lang/String;")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, cache_config, fid)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (j_str) {
+ PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_mdc_config: cache_config not pinned");
+
+ HDstrncpy(cacheinfo.trace_file_name, str, H5AC__MAX_TRACE_FILE_NAME_LEN + 1);
+ cacheinfo.trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+ str = NULL;
+ }
+ else
+ HDmemset(cacheinfo.trace_file_name, 0, H5AC__MAX_TRACE_FILE_NAME_LEN + 1);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "evictions_enabled", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.evictions_enabled = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "set_initial_size", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.set_initial_size = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "initial_size", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.initial_size = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "min_clean_fraction", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.min_clean_fraction = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "max_size", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.max_size = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "min_size", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.min_size = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "epoch_length", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.epoch_length = (long int)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "incr_mode", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ incr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_incr_mode) */
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ cacheinfo.incr_mode = (enum H5C_cache_incr_mode) incr_mode;
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "lower_hr_threshold", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.lower_hr_threshold = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "increment", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.increment = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "apply_max_increment", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.apply_max_increment = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "max_increment", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.max_increment = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "flash_incr_mode", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ flash_incr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_flash_incr_mode) */
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ cacheinfo.flash_incr_mode = (enum H5C_cache_flash_incr_mode) flash_incr_mode;
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "flash_multiple", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.flash_multiple = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "flash_threshold", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.flash_threshold = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "decr_mode", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ decr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_decr_mode) */
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ cacheinfo.decr_mode = (enum H5C_cache_decr_mode) decr_mode;
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "upper_hr_threshold", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.upper_hr_threshold = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "decrement", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.decrement = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "apply_max_decrement", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.apply_max_decrement = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "max_decrement", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.max_decrement = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "epochs_before_eviction", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.epochs_before_eviction = ENVPTR->GetIntField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "apply_empty_reserve", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.apply_empty_reserve = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "empty_reserve", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.empty_reserve = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "dirty_bytes_threshold", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.dirty_bytes_threshold = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "metadata_write_strategy", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.metadata_write_strategy = ENVPTR->GetIntField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if ((status = H5Pset_mdc_config((hid_t)plist, &cacheinfo)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (str)
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_mdc_config
+ * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ H5AC_cache_config_t cacheinfo;
+ jstring j_str = NULL;
+ jvalue args[30];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+ HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t));
+ cacheinfo.version = H5AC__CURR_CACHE_CONFIG_VERSION;
+
+ if ((status = H5Pget_mdc_config((hid_t)plist, &cacheinfo)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].i = cacheinfo.version;
+ args[1].z = cacheinfo.rpt_fcn_enabled;
+ args[2].z = cacheinfo.open_trace_file;
+ args[3].z = cacheinfo.close_trace_file;
+
+ if (NULL == (j_str = ENVPTR->NewStringUTF(ENVONLY, cacheinfo.trace_file_name))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_mdc_config: out of memory - unable to construct string from UTF characters");
+ }
+
+ args[4].l = j_str;
+ args[5].z = cacheinfo.evictions_enabled;
+ args[6].z = cacheinfo.set_initial_size;
+ args[7].j = (jlong)cacheinfo.initial_size;
+ args[8].d = cacheinfo.min_clean_fraction;
+ args[9].j = (jlong)cacheinfo.max_size;
+ args[10].j = (jlong)cacheinfo.min_size;
+ args[11].j = cacheinfo.epoch_length;
+ args[12].i = cacheinfo.incr_mode;
+ args[13].d = cacheinfo.lower_hr_threshold;
+ args[14].d = cacheinfo.increment;
+ args[15].z = cacheinfo.apply_max_increment;
+ args[16].j = (jlong)cacheinfo.max_increment;
+ args[17].i = cacheinfo.flash_incr_mode;
+ args[18].d = cacheinfo.flash_multiple;
+ args[19].d = cacheinfo.flash_threshold;
+ args[20].i = cacheinfo.decr_mode;
+ args[21].d = cacheinfo.upper_hr_threshold;
+ args[22].d = cacheinfo.decrement;
+ args[23].z = cacheinfo.apply_max_decrement;
+ args[24].j = (jlong)cacheinfo.max_decrement;
+ args[25].i = cacheinfo.epochs_before_eviction;
+ args[26].z = cacheinfo.apply_empty_reserve;
+ args[27].d = cacheinfo.empty_reserve;
+ args[28].j = (jlong)cacheinfo.dirty_bytes_threshold;
+ args[29].i = cacheinfo.metadata_write_strategy;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5AC_cache_config_t", "(IZZZLjava/lang/String;ZZJDJJJIDDZJIDDIDDZJIZDJI)V", args, ret_obj);
+
+done:
+ return ret_obj;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config */
+
+/*
+ * TODO: H5Pset_mdc_image_config
+ */
+
+/*
+ * TODO: H5Pget_mdc_image_config
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_mdc_log_options
+ * Signature: (JZLjava/lang/String;Z)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
+ (JNIEnv *env, jclass clss, jlong fapl_id, jboolean is_enabled, jstring location, jboolean start_on_access)
+{
+ const char *locStr = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == location)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_mdc_log_options: location string is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, location, locStr, NULL, "H5Pset_mdc_log_options: location string not pinned");
+
+ if ((retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (hbool_t)is_enabled, locStr, (hbool_t)start_on_access)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (locStr)
+ UNPIN_JAVA_STRING(ENVONLY, location, locStr);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_mdc_log_options
+ * Signature: (J[Z)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
+ (JNIEnv *env, jclass clss, jlong fapl_id, jbooleanArray mdc_log_options)
+{
+ jboolean isCopy;
+ jboolean *mdc_log_options_ptr = NULL;
+ hbool_t is_enabled;
+ hbool_t start_on_access;
+ ssize_t status = -1;
+ size_t location_size;
+ jsize arrLen;
+ char *lname = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == mdc_log_options)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: mdc_log_options is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, mdc_log_options)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: mdc_log_options array length < 0");
+ }
+ if (arrLen < 2)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: length of mdc_log_options < 2");
+
+ PIN_BOOL_ARRAY(ENVONLY, mdc_log_options, mdc_log_options_ptr, &isCopy, "H5Pget_mdc_log_options: mdc_log_options array not pinned");
+
+ /* get the length of the filename */
+ if (H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, NULL, &location_size, &start_on_access) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!location_size)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: location_size is 0");
+
+ location_size++; /* add extra space for the null terminator */
+ if (NULL == (lname = (char *) HDmalloc(sizeof(char) * location_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_mdc_log_options: memory allocation failed");
+
+ if ((status = H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, lname, &location_size, &start_on_access)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ lname[location_size - 1] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, lname))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_mdc_log_options: out of memory - unable to construct string from UTF characters");
+ }
+
+ mdc_log_options_ptr[0] = (jboolean)is_enabled;
+ mdc_log_options_ptr[1] = (jboolean)start_on_access;
+
+done:
+ if (lname)
+ HDfree(lname);
+ if (mdc_log_options_ptr)
+ UNPIN_BOOL_ARRAY(ENVONLY, mdc_log_options, mdc_log_options_ptr, (status < 0) ? JNI_ABORT : 0);
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options */
+
+/*
+ * TODO: H5Pset_all_coll_metadata_ops
+ */
+
+/*
+ * TODO: H5Pget_all_coll_metadata_ops
+ */
+
+/*
+ * TODO: H5Pset_coll_metadata_write
+ */
+
+/*
+ * TODO: H5Pget_coll_metadata_write
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_gc_references
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1gc_1references
+ (JNIEnv *env, jclass clss, jlong fapl_id, jboolean gc_ref)
+{
+ unsigned gc_ref_val = 0;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ gc_ref_val = (gc_ref == JNI_TRUE) ? 1 : 0;
+
+ if ((retVal = H5Pset_gc_references((hid_t)fapl_id, gc_ref_val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1gc_1references */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_gc_references
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1gc_1references
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ unsigned gc_ref_val = 0;
+ jboolean bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (H5Pget_gc_references((hid_t)fapl_id, (unsigned *)&gc_ref_val) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (gc_ref_val == 1) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return bval;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1gc_1references */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_small_data_block_size
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlong size)
+{
+ long sz = (long)size;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_small_data_block_size((hid_t)plist, (hsize_t)sz)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_small_data_block_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ hsize_t s = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_small_data_block_size((hid_t)plist, &s) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)s;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_libver_bounds
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds
+ (JNIEnv *env, jclass clss, jlong fapl_id, jint low, jint high)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_libver_bounds((hid_t)fapl_id, (H5F_libver_t)low, (H5F_libver_t)high)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_libver_bounds
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
+ (JNIEnv *env, jclass clss, jlong fapl_id, jintArray libver)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == libver)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_libver_bounds: libversion bounds is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, libver, theArray, &isCopy, "H5Pget_libver_bounds: input not pinned");
+
+ if ((retVal = H5Pget_libver_bounds((hid_t)fapl_id, (H5F_libver_t *)&(theArray[0]), (H5F_libver_t *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, libver, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds */
+
+/*
+ * TODO: H5Pset_object_flush_cb
+ */
+
+/*
+ * TODO: H5Pget_object_flush_cb
+ */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pFAPLImp.h b/java/src/jni/h5pFAPLImp.h
new file mode 100644
index 0000000..9b353e6
--- /dev/null
+++ b/java/src/jni/h5pFAPLImp.h
@@ -0,0 +1,537 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PFAPL
+#define _Included_hdf_hdf5lib_H5_H5PFAPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * TODO: H5Pset_driver
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_driver
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1driver
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pget_driver_info
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fclose_degree
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fclose_degree
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_core
+ * Signature: (JJZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core
+(JNIEnv *, jclass, jlong, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_core
+ * Signature: (J[J[Z)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
+(JNIEnv *, jclass, jlong, jlongArray, jbooleanArray);
+
+/*
+ * TODO: H5Pset_core_write_tracking
+ */
+
+/*
+ * TODO: H5Pget_core_write_tracking
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_direct
+ * Signature: (JJJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct
+(JNIEnv *, jclass, jlong, jlong, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_direct
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct
+(JNIEnv *, jclass, jlong, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_family
+ * Signature: (JJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family
+(JNIEnv *, jclass, jlong, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_family
+ * Signature: (J[J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
+(JNIEnv *, jclass, jlong, jlongArray, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_family_offset
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1family_1offset
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_family_offset
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1family_1offset
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_hdfs
+ * Signature: (J)Lhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_hdfs
+ * Signature: (JLhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs
+(JNIEnv *, jclass, jlong, jobject);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_log
+ * Signature: (JLjava/lang/String;JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
+(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
+
+/*
+ * TODO: H5Pset_fapl_mpio
+ */
+
+/*
+ * TODO: H5Pget_fapl_mpio
+ */
+
+/*
+ * TODO: H5Pset_fapl_mpiposix
+ */
+
+/*
+ * TODO: H5Pget_fapl_mpiposix
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_multi
+ * Signature: (J[I[J[Ljava/lang/String;[JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
+(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_multi
+ * Signature: (J[I[J[Ljava/lang/String;[J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
+(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray);
+
+/*
+ * TODO: H5Pset_multi_type
+ */
+
+/*
+ * TODO: H5Pget_multi_type
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_ros3
+ * Signature: (J)Lhdf/hdf5lib/structs/H5FD_ros3_fapl_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_ros3
+ * Signature: (JLhdf/hdf5lib/structs/H5FD_ros3_fapl_t;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3
+(JNIEnv *, jclass, jlong, jobject);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_split
+ * Signature: (JLjava/lang/String;JLjava/lang/String;J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
+(JNIEnv *, jclass, jlong, jstring, jlong, jstring, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_sec2
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_stdio
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_windows
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pset_file_image
+ */
+
+/*
+ * TODO: H5Pget_file_image
+ */
+
+/*
+ * TODO: H5Pset_file_image_callbacks
+ */
+
+/*
+ * TODO: H5Pget_file_image_callbacks
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_meta_block_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_meta_block_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pset_page_buffer_size
+ */
+
+/*
+ * TODO: H5Pget_page_buffer_size
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sieve_buf_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sieve_buf_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_alignment
+ * Signature: (JJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1alignment
+(JNIEnv *, jclass, jlong, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_alignment
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1alignment
+(JNIEnv *, jclass, jlong, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_cache
+ * Signature: (JIJJD)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1cache
+(JNIEnv *, jclass, jlong, jint, jlong, jlong, jdouble);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_cache
+ * Signature: (J[I[J[J[D)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1cache
+(JNIEnv *, jclass, jlong, jintArray, jlongArray, jlongArray, jdoubleArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_file_cache_size
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_file_cache_size
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_evict_on_close
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close
+(JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_evict_on_close
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_metadata_read_attempts
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_metadata_read_attempts
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_mdc_config
+ * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
+(JNIEnv *, jclass, jlong, jobject);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_mdc_config
+ * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pset_mdc_image_config
+ */
+
+/*
+ * TODO: H5Pget_mdc_image_config
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_mdc_log_options
+ * Signature: (JZLjava/lang/String;Z)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
+(JNIEnv *, jclass, jlong, jboolean, jstring, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_mdc_log_options
+ * Signature: (J[Z)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
+(JNIEnv *, jclass, jlong, jbooleanArray);
+
+/*
+ * TODO: H5Pset_all_coll_metadata_ops
+ */
+
+/*
+ * TODO: H5Pget_all_coll_metadata_ops
+ */
+
+/*
+ * TODO: H5Pset_coll_metadata_write
+ */
+
+/*
+ * TODO: H5Pget_coll_metadata_write
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_gc_references
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1gc_1references
+(JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_gc_references
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1gc_1references
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_small_data_block_size
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_small_data_block_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_libver_bounds
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_libver_bounds
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * TODO: H5Pset_object_flush_cb
+ */
+
+/*
+ * TODO: H5Pget_object_flush_cb
+ */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PFAPL */
diff --git a/java/src/jni/h5pFCPLImp.c b/java/src/jni/h5pFCPLImp.c
new file mode 100644
index 0000000..2160496
--- /dev/null
+++ b/java/src/jni/h5pFCPLImp.c
@@ -0,0 +1,572 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pFCPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_userblock
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1userblock
+ (JNIEnv *env, jclass clss, jlong plist, jlong size)
+{
+ long sz = (long) size;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_userblock((hid_t)plist, (hsize_t)sz)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1userblock */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_userblock
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1userblock
+ (JNIEnv *env, jclass clss, jlong plist, jlongArray size)
+{
+ jboolean isCopy;
+ hsize_t s;
+ jlong *theArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_userblock: size is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_userblock: size not pinned");
+
+ if ((status = H5Pget_userblock((hid_t)plist, &s)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jlong)s;
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1userblock */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sizes
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sizes
+ (JNIEnv *env, jclass clss, jlong plist, jint sizeof_addr, jint sizeof_size)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_sizes((hid_t)plist, (size_t)sizeof_addr, (size_t)sizeof_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1sizes */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sizes
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sizes
+ (JNIEnv *env, jclass clss, jlong plist, jlongArray size)
+{
+ jboolean isCopy;
+ jlong *theArray = NULL;
+ jsize arrLen;
+ size_t ss;
+ size_t sa;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_sizes: size is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, size)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_sizes: size array length < 0");
+ }
+ if (arrLen < 2)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_sizes: size input array < 2 elements");
+
+ PIN_LONG_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_sizes: size not pinned");
+
+ if ((status = H5Pget_sizes((hid_t)plist, &sa, &ss)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jlong)sa;
+ theArray[1] = (jlong)ss;
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1sizes */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sym_k
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sym_1k
+ (JNIEnv *env, jclass clss, jlong plist, jint ik, jint lk)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_sym_k((hid_t)plist, (unsigned)ik, (unsigned)lk)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1sym_1k */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sym_k
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sym_1k
+ (JNIEnv *env, jclass clss, jlong plist, jintArray size)
+{
+ jboolean isCopy;
+ jsize arrLen;
+ jint *theArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_sym_k: size is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, size)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_sym_k: size array length < 0");
+ }
+ if (arrLen < 2)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_sym_k: size < 2 elements");
+
+ PIN_INT_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_sym_k: size not pinned");
+
+ if ((status = H5Pget_sym_k((hid_t)plist, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1sym_1k */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_istore_k
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1istore_1k
+ (JNIEnv *env, jclass clss, jlong plist, jint ik)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_istore_k((hid_t)plist, (unsigned)ik)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1istore_1k */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_istore_k
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1istore_1k
+ (JNIEnv *env, jclass clss, jlong plist, jintArray ik)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == ik)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_store_k: ik is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, ik, theArray, &isCopy, "H5Pget_store_k: size not pinned");
+
+ if ((status = H5Pget_istore_k((hid_t)plist, (unsigned *)&(theArray[0]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, ik, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1istore_1k */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_file_space_page_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jlong fsp_size)
+{
+ UNUSED(clss);
+
+ if (H5Pset_file_space_page_size((hid_t)fcpl_id, (hsize_t)fsp_size) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_page_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
+ (JNIEnv *env, jclass clss, jlong fcpl_id)
+{
+ hsize_t fsp_size = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_file_space_page_size((hid_t)fcpl_id, &fsp_size) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)fsp_size;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_file_space_strategy
+ * Signature: (JIZJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jint strategy, jboolean persist, jlong threshold)
+{
+ UNUSED(clss);
+
+ if (H5Pset_file_space_strategy((hid_t)fcpl_id, (H5F_fspace_strategy_t)strategy, (hbool_t)persist, (hsize_t)threshold) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_file_space_strategy */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy
+ * Signature: (J[Z[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jbooleanArray persist, jlongArray threshold)
+{
+ H5F_fspace_strategy_t thestrategy = H5F_FSPACE_STRATEGY_FSM_AGGR; /* Library default */
+ jboolean isCopy;
+ jboolean *persistArray = NULL;
+ jlong *thresholdArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (persist)
+ PIN_BOOL_ARRAY(ENVONLY, persist, persistArray, &isCopy, "H5Pget_file_space: persist not pinned");
+ if (threshold)
+ PIN_LONG_ARRAY(ENVONLY, threshold, thresholdArray, &isCopy, "H5Pget_file_space: threshold not pinned");
+
+ if ((status = H5Pget_file_space_strategy((hid_t)fcpl_id, &thestrategy, (hbool_t *)persistArray, (hsize_t *)thresholdArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (thresholdArray)
+ UNPIN_LONG_ARRAY(ENVONLY, threshold, thresholdArray, (status < 0) ? JNI_ABORT : 0);
+ if (persistArray)
+ UNPIN_BOOL_ARRAY(ENVONLY, persist, persistArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)thestrategy;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy_persist
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
+ (JNIEnv *env, jclass clss, jlong fcpl_id)
+{
+ hbool_t persist = FALSE;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if ((status = H5Pget_file_space_strategy((hid_t)fcpl_id, NULL, &persist, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jboolean)persist;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy_threshold
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
+ (JNIEnv *env, jclass clss, jlong fcpl_id)
+{
+ hsize_t threshold = 0;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if ((status = H5Pget_file_space_strategy((hid_t)fcpl_id, NULL, NULL, &threshold)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)threshold;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1threshold */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_nindexes
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes
+ (JNIEnv *env, jclass clss, jlong plist_id, jint nindexes)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (nindexes > H5O_SHMESG_MAX_NINDEXES)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_nindexes: number of indexes is greater than H5O_SHMESG_MAX_NINDEXES");
+
+ if ((retVal = H5Pset_shared_mesg_nindexes((hid_t)plist_id, (unsigned)nindexes)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_nindexes
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes
+ (JNIEnv *env, jclass clss, jlong fcpl_id)
+{
+ unsigned nindexes;
+
+ UNUSED(clss);
+
+ if (H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)nindexes;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_index
+ * Signature: (JIII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num,
+ jint mesg_type_flags, jint min_mesg_size)
+{
+ unsigned nindexes; /* Number of SOHM indexes */
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ /* Check arguments */
+ if ((unsigned) mesg_type_flags > H5O_SHMESG_ALL_FLAG)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_index: unrecognized flags in mesg_type_flags");
+
+ /* Read the current number of indexes */
+ if (H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Range check */
+ if ((unsigned) index_num >= nindexes)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_index: index_num is too large; no such index");
+
+ if ((retVal = H5Pset_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned) mesg_type_flags, (unsigned) min_mesg_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_index
+ * Signature: (JI[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num, jintArray mesg_info)
+{
+ jboolean isCopy;
+ unsigned nindexes; /* Number of SOHM indexes */
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == mesg_info)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_shared_mesg_index: mesg_info is NULL");
+
+ /* Read the current number of indexes */
+ if (H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Range check */
+ if ((unsigned) index_num >= nindexes)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_shared_mesg_index: index_num is too large; no such index");
+
+ PIN_INT_ARRAY(ENVONLY, mesg_info, theArray, &isCopy, "H5Pget_shared_mesg_index: input not pinned");
+
+ if ((retVal = H5Pget_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, mesg_info, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_phase_change
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jint max_list, jint min_btree)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ /* Check that values are sensible. The min_btree value must be no greater
+ * than the max list plus one.
+ *
+ * Range check to make certain they will fit into encoded form.
+ */
+
+ if (max_list + 1 < min_btree)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_phase_change: minimum B-tree value is greater than maximum list value");
+ if (max_list > H5O_SHMESG_MAX_LIST_SIZE)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_phase_change: max list value is larger than H5O_SHMESG_MAX_LIST_SIZE");
+ if (min_btree > H5O_SHMESG_MAX_LIST_SIZE)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_phase_change: min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE");
+
+ if ((retVal = H5Pset_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned)max_list, (unsigned)min_btree)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jintArray size)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_shared_mesg_phase_change: size is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_shared_mesg_phase_change: input not pinned");
+
+ if ((retVal = H5Pget_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, size, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pFCPLImp.h b/java/src/jni/h5pFCPLImp.h
new file mode 100644
index 0000000..57fcae8
--- /dev/null
+++ b/java/src/jni/h5pFCPLImp.h
@@ -0,0 +1,207 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PFCPL
+#define _Included_hdf_hdf5lib_H5_H5PFCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_userblock
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1userblock
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_userblock
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1userblock
+(JNIEnv *, jclass, jlong, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sizes
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sizes
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sizes
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sizes
+(JNIEnv *, jclass, jlong, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sym_k
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sym_1k
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sym_k
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sym_1k
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_istore_k
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1istore_1k
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_istore_k
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1istore_1k
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_file_space_page_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_page_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_file_space_strategy
+ * Signature: (JIZJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
+(JNIEnv *, jclass, jlong, jint, jboolean, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy
+ * Signature: (J[Z[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
+(JNIEnv *, jclass, jlong, jbooleanArray, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy_persist
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy_threshold
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_nindexes
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_nindexes
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_index
+ * Signature: (JIII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
+(JNIEnv *, jclass, jlong, jint, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_index
+ * Signature: (JI[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index
+(JNIEnv *, jclass, jlong, jint, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_phase_change
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change
+(JNIEnv *, jclass, jlong, jintArray);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PFCPL */
diff --git a/java/src/jni/h5pGAPLImp.c b/java/src/jni/h5pGAPLImp.c
new file mode 100644
index 0000000..9540387
--- /dev/null
+++ b/java/src/jni/h5pGAPLImp.c
@@ -0,0 +1,36 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pGAPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pGAPLImp.h b/java/src/jni/h5pGAPLImp.h
new file mode 100644
index 0000000..73ad4a8
--- /dev/null
+++ b/java/src/jni/h5pGAPLImp.h
@@ -0,0 +1,27 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PGAPL
+#define _Included_hdf_hdf5lib_H5_H5PGAPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PGAPL */
diff --git a/java/src/jni/h5pGCPLImp.c b/java/src/jni/h5pGCPLImp.c
new file mode 100644
index 0000000..2ba1c7d
--- /dev/null
+++ b/java/src/jni/h5pGCPLImp.c
@@ -0,0 +1,227 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pGCPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_local_heap_size_hint
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jlong size_hint)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_local_heap_size_hint((hid_t)gcpl_id, (size_t)size_hint)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_local_heap_size_hint
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint
+ (JNIEnv *env, jclass clss, jlong gcpl_id)
+{
+ size_t size_hint = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_local_heap_size_hint((hid_t)gcpl_id, &size_hint) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)size_hint;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_link_creation_order
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jint crt_order_flags)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_link_creation_order((hid_t)gcpl_id, (unsigned)crt_order_flags)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_link_creation_order
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order
+ (JNIEnv *env, jclass clss, jlong gcpl_id)
+{
+ unsigned crt_order_flags;
+
+ UNUSED(clss);
+
+ if (H5Pget_link_creation_order((hid_t)gcpl_id, &crt_order_flags) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)crt_order_flags;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_est_link_info
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jint est_num_entries, jint est_name_len)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ /* Range check values */
+ if ((est_num_entries > 65535) || (est_name_len > 65535))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_est_link_info: est. name length or number of entries must be < 65536");
+
+ if ((retVal = H5Pset_est_link_info((hid_t)gcpl_id, (unsigned)est_num_entries, (unsigned)est_name_len)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_est_link_info
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray link_info)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == link_info)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_est_link_info: link_info is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, link_info, theArray, &isCopy, "H5Pget_est_link_info: input not pinned");
+
+ if ((retVal = H5Pget_est_link_info((hid_t)gcpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, link_info, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_link_phase_change
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jint max_compact, jint min_dense)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (max_compact < min_dense)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_link_phase_change: max compact value must be >= min dense value");
+ if (max_compact > 65535)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_link_phase_change: max compact value must be < 65536");
+ if (min_dense > 65535)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_link_phase_change: min dense value must be < 65536");
+
+ if ((retVal = H5Pset_link_phase_change((hid_t)gcpl_id, (unsigned)max_compact, (unsigned)min_dense)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_link_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray links)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == links)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_link_phase_change: links is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, links, theArray, &isCopy, "H5Pget_link_phase_change: input not pinned");
+
+ if ((retVal = H5Pget_link_phase_change((hid_t)gcpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, links, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pGCPLImp.h b/java/src/jni/h5pGCPLImp.h
new file mode 100644
index 0000000..9c32063
--- /dev/null
+++ b/java/src/jni/h5pGCPLImp.h
@@ -0,0 +1,99 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PGCPL
+#define _Included_hdf_hdf5lib_H5_H5PGCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_local_heap_size_hint
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_local_heap_size_hint
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_link_creation_order
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_link_creation_order
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_est_link_info
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_est_link_info
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_link_phase_change
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_link_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
+(JNIEnv *, jclass, jlong, jintArray);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PGCPL */
diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c
index dcfcd82..9e5b004 100644
--- a/java/src/jni/h5pImp.c
+++ b/java/src/jni/h5pImp.c
@@ -26,8 +26,11 @@ extern "C" {
#include "h5util.h"
#include "h5pImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
extern JavaVM *jvm;
-extern jobject visit_callback;
+
extern jobject copy_callback;
extern jobject close_callback;
extern jobject create_callback;
@@ -36,23 +39,27 @@ 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 */
/********************/
-static herr_t H5P_cls_create_func_cb(hid_t prop_id, void *create_data);
-static herr_t H5P_cls_copy_func_cb(hid_t new_prop_id, hid_t old_prop_id, void *copy_data);
-static herr_t H5P_cls_close_func_cb(hid_t prop_id, void *close_data);
+static herr_t H5P_cls_create_cb(hid_t prop_id, void *create_data);
+static herr_t H5P_cls_copy_cb(hid_t new_prop_id, hid_t old_prop_id, void *copy_data);
+static herr_t H5P_cls_close_cb(hid_t prop_id, void *close_data);
+static herr_t H5P_prp_create_cb(const char *name, size_t size, void *value);
+static herr_t H5P_prp_copy_cb(const char *name, size_t size, void *value);
+static herr_t H5P_prp_close_cb(const char *name, size_t size, void *value);
+static int H5P_prp_compare_cb(void *value1, void *value2, size_t size);
+static herr_t H5P_prp_get_cb(hid_t prop_id, const char *name, size_t size, void *value);
+static herr_t H5P_prp_set_cb(hid_t prop_id, const char *name, size_t size, void *value);
+static herr_t H5P_prp_delete_cb(hid_t prop_id, const char *name, size_t size, void *value);
-static herr_t H5P_prp_create_func_cb(const char *name, size_t size, void *value);
-static herr_t H5P_prp_copy_func_cb(const char *name, size_t size, void *value);
-static herr_t H5P_prp_close_func_cb(const char *name, size_t size, void *value);
-static int H5P_prp_compare_func_cb(void *value1, void *value2, size_t size);
-static herr_t H5P_prp_get_func_cb(hid_t prop_id, const char *name, size_t size, void *value);
-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
@@ -63,37 +70,19 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Pcreate
(JNIEnv *env, jclass clss, jlong type)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Pcreate((hid_t)type);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Pcreate((hid_t) type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Pcreate */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pclose
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Pclose
- (JNIEnv *env, jclass clss, jlong plist)
-{
- herr_t retVal = 0;
-
- if (plist > 0)
- retVal = H5Pclose((hid_t)plist);
-
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5__1H5Pclose */
-
-/*
- * Class: hdf_hdf5lib_H5
* Method: H5Pget_class
* Signature: (J)J
*/
@@ -101,12 +90,19 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1class
(JNIEnv *env, jclass clss, jlong plist)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_class((hid_t) plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Pget_class((hid_t) plist);
- if (retVal == H5P_ROOT)
- h5libraryError(env);
+ /*
+ * if (retVal == H5P_ROOT)
+ * H5_LIBRARY_ERROR(ENVONLY);
+ */
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1class */
@@ -119,2066 +115,264 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Pcopy
(JNIEnv *env, jclass clss, jlong plist)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Pcopy((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Pcopy((hid_t) plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Pcopy */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_version
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1version
- (JNIEnv *env, jclass clss, jlong plist, jintArray version_info)
-{
- herr_t status = -1;
- jint *theArray;
- jboolean isCopy;
-
- if (version_info == NULL) {
- h5nullArgument(env, "H5Pget_version: version_info input array is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR version_info) < 4) {
- h5badArgument(env, "H5Pget_version: version_info input array < 4");
- } /* end else if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR version_info, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_version: version_info not pinned");
- } /* end if */
- else {
- status = H5Pget_version((hid_t)plist, (unsigned *)&(theArray[0]),
- (unsigned *)&(theArray[1]), (unsigned *)&(theArray[2]), (unsigned *)&(theArray[3]));
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1version */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_userblock
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1userblock
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
-{
- herr_t retVal = -1;
- long sz = (long)size;
-
- retVal = H5Pset_userblock((hid_t)plist, (hsize_t)sz);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1userblock */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_userblock
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1userblock
- (JNIEnv *env, jclass clss, jlong plist, jlongArray size)
-{
- herr_t status = -1;
- jlong *theArray;
- jboolean isCopy;
- hsize_t s;
-
- if (size == NULL) {
- h5nullArgument(env, "H5Pget_userblock: size is NULL");
- } /* end if */
- else {
- theArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_userblock: size not pinned");
- } /* end if */
- else {
- status = H5Pget_userblock((hid_t)plist, &s);
-
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jlong)s;
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1userblock */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sizes
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sizes
- (JNIEnv *env, jclass clss, jlong plist, jint sizeof_addr, jint sizeof_size)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_sizes((hid_t)plist, (size_t)sizeof_addr, (size_t)sizeof_size);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1sizes */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sizes
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sizes
- (JNIEnv *env, jclass clss, jlong plist, jlongArray size)
-{
- herr_t status = -1;
- jlong *theArray;
- jboolean isCopy;
- size_t ss;
- size_t sa;
-
- if (size == NULL) {
- h5nullArgument(env, "H5Pget_sizes: size is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR size) < 2) {
- h5badArgument(env, "H5Pget_sizes: size input array < 2 elements");
- }
- else {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_sizes: size not pinned");
- } /* end if */
- else {
- status = H5Pget_sizes((hid_t)plist, &sa, &ss);
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jlong)sa;
- theArray[1] = (jlong)ss;
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1sizes */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sym_k
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sym_1k
- (JNIEnv *env, jclass clss, jlong plist, jint ik, jint lk)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_sym_k((hid_t)plist, (unsigned)ik, (unsigned)lk);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1sym_1k */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sym_k
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sym_1k
- (JNIEnv *env, jclass clss, jlong plist, jintArray size)
-{
- herr_t status = -1;
- jint *theArray;
- jboolean isCopy;
-
- if (size == NULL) {
- h5nullArgument(env, "H5Pget_sym_k: size is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR size) < 2) {
- h5badArgument(env, "H5Pget_sym_k: size < 2 elements");
- } /* end else if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_sym_k: size not pinned");
- } /* end if */
- else {
- status = H5Pget_sym_k((hid_t)plist, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]));
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR size, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR size, theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1sym_1k */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_istore_k
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1istore_1k
- (JNIEnv *env, jclass clss, jlong plist, jint ik)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_istore_k((hid_t)plist, (unsigned)ik);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1istore_1k */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_istore_k
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1istore_1k
- (JNIEnv *env, jclass clss, jlong plist, jintArray ik)
-{
- herr_t status = -1;
- jint *theArray;
- jboolean isCopy;
-
- if (ik == NULL) {
- h5nullArgument(env, "H5Pget_store_k: ik is NULL");
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR ik, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_store_k: size not pinned");
- } /* end if */
- else {
- status = H5Pget_istore_k((hid_t)plist, (unsigned *)&(theArray[0]));
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR ik, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR ik, theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1istore_1k */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_layout
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1layout
- (JNIEnv *env, jclass clss, jlong plist, jint layout)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_layout((hid_t)plist, (H5D_layout_t)layout);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1layout */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_layout
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1layout
- (JNIEnv *env, jclass clss, jlong plist)
-{
- H5D_layout_t retVal = H5D_LAYOUT_ERROR;
-
- retVal = H5Pget_layout((hid_t)plist);
- if (retVal == H5D_LAYOUT_ERROR)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1layout */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_chunk
- * Signature: (JI[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk
- (JNIEnv *env, jclass clss, jlong plist, jint ndims, jbyteArray dim)
-{
- herr_t status = -1;
- jbyte *theArray;
- jboolean isCopy;
- hsize_t *da;
- hsize_t *lp;
- jlong *jlp;
- size_t i;
- size_t rank;
-
- if (dim == NULL) {
- h5nullArgument(env, "H5Pset_chunk: dim array is NULL");
- } /* end if */
- else {
- i = (size_t)ENVPTR->GetArrayLength(ENVPAR dim);
- rank = i / sizeof(jlong);
- if (rank < ndims) {
- h5badArgument(env, "H5Pset_chunk: dims array < ndims");
- } /* end if */
- else {
- theArray = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR dim, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pset_chunk: dim array not pinned");
- } /* end if */
- else {
- da = lp = (hsize_t *)HDmalloc(rank * sizeof(hsize_t));
- if (da == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR dim, theArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pset_chunk: dims not converted to hsize_t");
- } /* end if */
- else {
- jlp = (jlong *)theArray;
- for (i = 0; i < rank; i++) {
- *lp = (hsize_t)*jlp;
- lp++;
- jlp++;
- } /* end if */
-
- status = H5Pset_chunk((hid_t)plist, (int)ndims, da);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR dim, theArray, JNI_ABORT);
- HDfree(da);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_chunk
- * Signature: (JI[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk
- (JNIEnv *env, jclass clss, jlong plist, jint max_ndims, jlongArray dims)
-{
- herr_t status = -1;
- jlong *theArray;
- jboolean isCopy;
- hsize_t *da;
- int i;
-
- if (dims == NULL) {
- h5nullArgument(env, "H5Pget_chunk: dims is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR dims) < max_ndims) {
- h5badArgument(env, "H5Pget_chunk: dims array < max_ndims");
- } /* end else if */
- else {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_chunk: input dims not pinned");
- } /* end if */
- else {
- da = (hsize_t *)HDmalloc((size_t)max_ndims * sizeof(hsize_t));
- if (da == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_chunk: dims not converted to hsize_t");
- } /* end if */
- else {
- status = H5Pget_chunk((hid_t)plist, (int)max_ndims, da);
-
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, JNI_ABORT);
- HDfree (da);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < max_ndims; i++) {
- theArray[i] = (jlong)da[i];
- }
- HDfree (da);
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_alignment
- * Signature: (JJJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alignment
- (JNIEnv *env, jclass clss, jlong plist, jlong threshold, jlong alignment)
-{
- herr_t retVal = -1;
- long thr = (long)threshold;
- long align = (long)alignment;
-
- retVal = H5Pset_alignment((hid_t)plist, (hsize_t)thr, (hsize_t)align);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1alignment */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_alignment
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alignment
- (JNIEnv *env, jclass clss, jlong plist, jlongArray alignment)
-{
- herr_t status = -1;
- jlong *theArray;
- jboolean isCopy;
- hsize_t t;
- hsize_t a;
-
- if (alignment == NULL) {
- h5nullArgument(env, "H5Pget_alignment: input alignment is NULL");
- } /* end if */
- else {
- if (ENVPTR->GetArrayLength(ENVPAR alignment) < 2) {
- h5badArgument(env, "H5Pget_alignment: alignment input array < 2");
- } /* end if */
- else {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR alignment, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_alignment: input array not pinned");
- } /* end if */
- else {
- status = H5Pget_alignment((hid_t)plist, &t, &a);
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR alignment, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jlong)t;
- theArray[1] = (jlong)a;
- ENVPTR->ReleaseLongArrayElements(ENVPAR alignment, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1alignment */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_external
- * Signature: (JLjava/lang/String;JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1external
- (JNIEnv *env, jclass clss, jlong plist, jstring name, jlong offset, jlong size)
-{
- herr_t status = -1;
- const char *fileName;
- off_t off;
- hsize_t sz;
- hid_t plid;
-
- plid = (hid_t)plist;
- off = (off_t)offset;
- sz = (hsize_t)size;
-
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- status = H5Pset_external(plid, fileName, off, sz);
-
- UNPIN_JAVA_STRING(name, fileName);
-
- if (status < 0)
- h5libraryError(env);
- }
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1external */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_external_count
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external_1count
- (JNIEnv *env, jclass clss, jlong plist)
-{
- int retVal = -1;
-
- retVal = H5Pget_external_count((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1external_1count */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_external
- * Signature: (JIJ[Ljava/lang/String;[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external
- (JNIEnv *env, jclass clss, jlong plist, jint idx, jlong name_size,
- jobjectArray name, jlongArray size)
-{
- herr_t status = -1;
- jlong *theArray;
- jboolean isCopy;
- char *file = NULL;
- jstring str;
- off_t o;
- hsize_t s;
-
- if (name_size < 0) {
- h5badArgument(env, "H5Pget_external: name_size < 0");
- } /* end if */
- else if ((size != NULL) && (ENVPTR->GetArrayLength(ENVPAR size) < 2)) {
- h5badArgument(env, "H5Pget_external: size input array < 2");
- } /* end else if */
- else {
- if (name_size > 0) {
- file = (char *)HDmalloc(sizeof(char)*(size_t)name_size);
- } /* end else */
-
- status = H5Pget_external((hid_t) plist, (unsigned)idx, (size_t)name_size,
- file, (off_t *)&o, (hsize_t *)&s);
- if (status < 0) {
- HDfree(file);
- h5libraryError(env);
- } /* end if */
- else {
- if (size != NULL) {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError( env, "H5Pget_external: size array not pinned");
- } /* end if */
- else {
- theArray[0] = o;
- theArray[1] = (jlong)s;
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0);
- }
- } /* end if */
-
- if (file != NULL) {
- /* NewStringUTF may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR file);
- if (str == NULL) {
- HDfree(file);
- h5JNIFatalError(env, "H5Pget_external: return array not created");
- } /* end if */
- else {
- /* SetObjectArrayElement may raise exceptions */
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str);
- HDfree(file);
- } /* end else */
- } /* end if */
- } /* end else */
- }
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1external */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fill_value
- * Signature: (JJ[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1value
- (JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value)
-{
- jint status = -1;
- jbyte *byteP = NULL;
- jboolean isCopy;
-
- if (value != NULL) {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Pget_fill_value: value array not pinned");
- } /* end if */
- else {
- status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
- }
- } /* end if */
- else {
- status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP);
- }
-
- if (status < 0)
- h5libraryError(env);
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1value */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fill_value
- * Signature: (JJ[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1value
- (JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value)
-{
- jint status = -1;
- jbyte *byteP;
- jboolean isCopy;
-
- if (value == NULL) {
- h5badArgument(env, "H5Pget_fill_value: value is NULL");
- } /* end if */
- else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Pget_fill_value: value array not pinned");
- } /* end if */
- else {
- status = H5Pget_fill_value((hid_t)plist_id, (hid_t)type_id, byteP);
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0);
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1value */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_filter
- * Signature: (JIIJ[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1filter
- (JNIEnv *env, jclass clss, jlong plist, jint filter, jint flags,
- jlong cd_nelmts, jintArray cd_values)
-{
- herr_t status = -1;
- jint *theArray;
- jboolean isCopy;
-
- if (cd_values == NULL) {
- status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int)flags, (size_t)cd_nelmts, NULL);
- if (status < 0)
- h5libraryError(env);
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pset_filter: input array not pinned");
- }/* end if */
- else {
- status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int)flags, (size_t)cd_nelmts, (const unsigned int *)theArray);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, theArray, JNI_ABORT);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1filter */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_nfilters
+ * Method: H5Pclose
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nfilters
- (JNIEnv *env, jclass clss, jlong plist)
-{
- int retVal = -1;
-
- retVal = H5Pget_nfilters((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1nfilters */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter
- * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter
- (JNIEnv *env, jclass clss, jlong plist, jint filter_number, jintArray flags,
- jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name)
-{
- herr_t status = -1;
- jint *flagsArray;
- jlong *cd_nelmtsArray;
- jint *cd_valuesArray;
- jint mode = JNI_ABORT;
- jboolean isCopy;
- jstring str;
- char *filter;
-
- if (namelen <= 0) {
- h5badArgument(env, "H5Pget_filter: namelen <= 0");
- } /* end if */
- else if (flags == NULL) {
- h5badArgument(env, "H5Pget_filter: flags is NULL");
- } /* end else if */
- else if (cd_nelmts == NULL) {
- h5badArgument(env, "H5Pget_filter: cd_nelmts is NULL");
- } /* end else if */
- else if (cd_values == NULL) {
- h5badArgument(env, "H5Pget_filter: cd_values is NULL");
- } /* end else if */
- else {
- filter = (char *)HDmalloc(sizeof(char)*(size_t)namelen);
- if (filter == NULL) {
- h5outOfMemory(env, "H5Pget_filter: namelen malloc failed");
- } /* end if */
- else {
- flagsArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy);
- if (flagsArray == NULL) {
- h5JNIFatalError(env, "H5Pget_filter: flags array not pinned");
- } /* end if */
- else {
- cd_nelmtsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy);
- if (cd_nelmtsArray == NULL) {
- h5JNIFatalError(env, "H5Pget_filter: nelmts array not pinned");
- } /* end if */
- else {
- cd_valuesArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy);
- if (cd_valuesArray == NULL) {
- h5JNIFatalError(env, "H5Pget_filter: elmts array not pinned");
- } /* end if */
- else {
- /* direct cast (size_t *)variable fails on 32-bit environment */
- long long cd_nelmts_temp = *(cd_nelmtsArray);
- size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
- unsigned int filter_config;
- status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, filter, &filter_config);
-
- *cd_nelmtsArray = (jlong)cd_nelmts_t;
- /* end direct cast special */
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- mode = 0;
-
- /* NewStringUTF may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR filter);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Pget_filter: return string not pinned");
- } /* end if */
- else {
- /* SetObjectArrayElement may throw exceptiosn */
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str);
- } /* end else */
- } /* end else */
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, mode);
- }
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, mode);
- }
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, mode);
- }
- HDfree(filter);
- }
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_driver
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1driver
+Java_hdf_hdf5lib_H5__1H5Pclose
(JNIEnv *env, jclass clss, jlong plist)
{
- hid_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Pget_driver((hid_t) plist);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jlong)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1driver */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_cache
- * Signature: (JIJJD)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1cache
- (JNIEnv *env, jclass clss, jlong plist, jint mdc_nelmts, jlong rdcc_nelmts,
- jlong rdcc_nbytes, jdouble rdcc_w0)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_cache((hid_t)plist, (int)mdc_nelmts, (size_t)rdcc_nelmts,
- (size_t)rdcc_nbytes, (double) rdcc_w0);
- if (retVal < 0)
- h5libraryError(env);
+ if (plist >= 0)
+ if ((retVal = H5Pclose((hid_t) plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1cache */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_cache
- * Signature: (J[I[J[J[D)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1cache
- (JNIEnv *env, jclass clss, jlong plist, jintArray mdc_nelmts,
- jlongArray rdcc_nelmts, jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
-{
- herr_t status = -1;
- jint mode;
- jdouble *w0Array = (jdouble *)NULL;
- jlong *rdcc_nelmtsArray = (jlong *)NULL;
- jlong *nbytesArray = (jlong *)NULL;
- jboolean isCopy;
-
- if (rdcc_w0 != NULL) {
- w0Array = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR rdcc_w0, &isCopy);
- if (w0Array == NULL) {
- h5JNIFatalError(env, "H5Pget_cache: w0_array array not pinned");
- return -1;
- } /* end if */
- } /* end else */
-
- if (rdcc_nelmts != NULL) {
- rdcc_nelmtsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nelmts, &isCopy);
- if (rdcc_nelmtsArray == NULL) {
- /* exception -- out of memory */
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT);
- }
- h5JNIFatalError(env, "H5Pget_cache: rdcc_nelmts array not pinned");
- return -1;
- } /* end if */
- } /* end else */
-
- if (rdcc_nbytes != NULL) {
- nbytesArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nbytes, &isCopy);
- if (nbytesArray == NULL) {
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT);
- } /* end if */
- if (rdcc_nelmtsArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nelmts, rdcc_nelmtsArray, JNI_ABORT);
- } /* end if */
- h5JNIFatalError(env, "H5Pget_cache: nbytesArray array not pinned");
- return -1;
- } /* end if */
- } /* end else */
-
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- long long rdcc_nelmts_temp = *(rdcc_nelmtsArray);
- size_t rdcc_nelmts_t = (size_t)rdcc_nelmts_temp;
- long long nbytes_temp = *(nbytesArray);
- size_t nbytes_t = (size_t)nbytes_temp;
-
- status = H5Pget_cache((hid_t)plist, (int *)NULL, &rdcc_nelmts_t,
- &nbytes_t, (double *)w0Array);
-
- *rdcc_nelmtsArray = (jlong)rdcc_nelmts_t;
- *nbytesArray = (jlong)nbytes_t;
- } /* end direct cast special */
-
-
- if (status < 0) {
- mode = JNI_ABORT;
- } /* end if */
- else {
- mode = 0; /* commit and free */
- } /* end else */
-
- if (rdcc_nelmtsArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nelmts, rdcc_nelmtsArray, mode);
- } /* end if */
-
- if (nbytesArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nbytes, nbytesArray, mode);
- } /* end if */
-
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, mode);
- } /* end if */
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1cache */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_buffer
- * Signature: (JJ[B[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer
- (JNIEnv *env, jclass clss, jlong plist, jlong size, jbyteArray tconv, jbyteArray bkg)
-{
- h5unimplemented(env, "H5Pset_buffer: not implemented");
- return -1;
-#ifdef notdef
-
-/* DON'T IMPLEMENT THIS!!! */
- jint status = -1;
- jbyte *tconvP;
- jbyte *bkgP;
- jboolean isCopy;
-
- if (tconv == NULL)
- tconvP = (jbyte *)NULL;
- else {
- tconvP = ENVPTR->GetByteArrayElements(ENVPAR tconv, &isCopy);
- if (tconvP == NULL) {
- h5JNIFatalError(env, "H5Pset_buffer: tconv not pinned");
- return -1;
- }
- }
- if (bkg == NULL)
- bkgP = (jbyte *)NULL;
- else {
- bkgP = ENVPTR->GetByteArrayElements(ENVPAR bkg, &isCopy);
- if (bkgP == NULL) {
- h5JNIFatalError(env, "H5Pset_buffer: bkg not pinned");
- return -1;
- }
- }
-
- status = H5Pset_buffer((hid_t)plist, (size_t)size, tconvP, bkgP);
- if (status < 0) {
- if (tconv != NULL)
- ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, JNI_ABORT);
- if (bkg != NULL)
- ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, JNI_ABORT);
- h5libraryError(env);
- return -1;
- }
-
- if (tconv != NULL)
- ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, 0);
- if (bkg != NULL)
- ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, 0);
-
- return (jint)status;
-#endif
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer */
+} /* end Java_hdf_hdf5lib_H5__1H5Pclose */
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_buffer
- * Signature: (J[B[B)I
+ * TODO: H5Pencode
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer
- (JNIEnv *env, jclass clss, jlong plist, jbyteArray tconv, jbyteArray bkg)
-{
- h5unimplemented(env, "H5Pget_buffer: not implemented");
- return -1;
-#ifdef notdef
-
-/* DON'T IMPLEMENT THIS!!! */
- jlong status = -1;
- jbyte *tconvP;
- jbyte *bkgP;
- jboolean isCopy;
-
- if (tconv == NULL) {
- h5nullArgument(env, "H5Pget_buffer: tconv input array is NULL");
- return -1;
- }
- tconvP = ENVPTR->GetByteArrayElements(ENVPAR tconv, &isCopy);
- if (tconvP == NULL) {
- h5JNIFatalError(env, "H5Pget_buffer: tconv not pinned");
- return -1;
- }
- if (bkg == NULL) {
- h5nullArgument(env, "H5Pget_buffer: bkg array is NULL");
- return -1;
- }
- bkgP = ENVPTR->GetByteArrayElements(ENVPAR bkg, &isCopy);
- if (bkgP == NULL) {
- h5JNIFatalError(env, "H5Pget_buffer: bkg not pinned");
- return -1;
- }
-
- status = H5Pget_buffer((hid_t)plist, tconvP, bkgP);
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, JNI_ABORT);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, JNI_ABORT);
- h5libraryError(env);
- return -1;
- }
- ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, 0);
-
- return (jint)status;
-#endif
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer */
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_buffer_size
- * Signature: (JJ)V
+ * TODO: H5Pdecode
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
-{
- if (H5Pset_buffer((hid_t)plist, (size_t)size, NULL, NULL) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_buffer_size
- * Signature: (J)J
+ * Method: _H5Pcreate_class
+ * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size
- (JNIEnv *env, jclass clss, jlong plist)
-{
- size_t size = 0;
-
- size = H5Pget_buffer((hid_t)plist, NULL, NULL);
- if (size == 0)
- h5libraryError(env);
-
- return (jlong)size;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_preserve
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1preserve
- (JNIEnv *env, jclass clss, jlong plist, jboolean status)
-{
- hbool_t st;
- herr_t retVal = -1;
-
- if (status == JNI_TRUE) {
- st = TRUE;
- } /* end if */
- else if (status == JNI_FALSE) {
- st = false;
- } /* end else if */
- else {
- h5badArgument(env, "H5Pset_preserve: status not TRUE or FALSE");
- return -1;
- } /* end else */
-
- retVal = H5Pset_preserve((hid_t)plist, st);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1preserve */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_preserve
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1preserve
- (JNIEnv *env, jclass clss, jlong plist)
-{
- herr_t retVal = -1;
-
- retVal = H5Pget_preserve((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1preserve */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_deflate
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1deflate
- (JNIEnv *env, jclass clss, jlong plist, jint level)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_deflate((hid_t)plist, (unsigned)level);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1deflate */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_gc_references
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1gc_1references
- (JNIEnv *env, jclass clss, jlong fapl_id, jboolean gc_ref)
-{
- herr_t retVal = -1;
- unsigned gc_ref_val;
-
- if (gc_ref == JNI_TRUE)
- gc_ref_val = 1;
- else
- gc_ref_val = 0;
-
- retVal = H5Pset_gc_references((hid_t)fapl_id, gc_ref_val);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1gc_1references */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_gc_references
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1gc_1references
- (JNIEnv *env, jclass clss, jlong fapl_id)
-{
- unsigned gc_ref_val = 0;
- jboolean bval = JNI_FALSE;
-
- if (H5Pget_gc_references((hid_t)fapl_id, (unsigned *)&gc_ref_val) < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- if (gc_ref_val == 1)
- bval = JNI_TRUE;
- } /* end else */
-
- return bval;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1gc_1references */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_btree_ratios
- * Signature: (JDDD)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios
- (JNIEnv *env, jclass clss, jlong plist_id, jdouble left, jdouble middle, jdouble right)
+Java_hdf_hdf5lib_H5__1H5Pcreate_1class
+ (JNIEnv *env, jclass clss, jlong parent_class, jstring name, jobject create_op,
+ jobject create_data, jobject copy_op, jobject copy_data, jobject close_op, jobject close_data)
{
- herr_t status = -1;
+ const char *cstr = NULL;
+ hid_t class_id = H5I_INVALID_HID;
- status = H5Pset_btree_ratios((hid_t)plist_id, (double)left,(double)middle, (double)right);
- if (status < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios */
+ create_callback = create_op;
+ close_callback = close_op;
+ copy_callback = copy_op;
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_btree_ratios
- * Signature: (J[D[D[D)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios
- (JNIEnv *env, jclass clss, jlong plist_id, jdoubleArray left,
- jdoubleArray middle, jdoubleArray right)
-{
- herr_t status = -1;
- jdouble *leftP;
- jdouble *middleP;
- jdouble *rightP;
- jboolean isCopy;
-
- if (left == NULL) {
- h5nullArgument(env, "H5Pget_btree_ratios: left input array is NULL");
- } /* end if */
- else if (middle == NULL) {
- h5nullArgument(env, "H5Pget_btree_ratios: middle input array is NULL");
- } /* end else if */
- else if (right == NULL) {
- h5nullArgument(env, "H5Pget_btree_ratios: right input array is NULL");
- } /* end else if */
- else {
- leftP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR left, &isCopy);
- if (leftP == NULL) {
- h5JNIFatalError(env, "H5Pget_btree_ratios: left not pinned");
- } /* end if */
- else {
- middleP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR middle, &isCopy);
- if (middleP == NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_btree_ratios: middle not pinned");
- } /* end if */
- else {
- rightP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR right, &isCopy);
- if (rightP == NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_btree_ratios: middle not pinned");
- } /* end if */
- else {
- status = H5Pget_btree_ratios((hid_t)plist_id, (double *)leftP,
- (double *)middleP, (double *)rightP);
- if (status < 0) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, JNI_ABORT);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR right, rightP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, 0);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, 0);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR right, rightP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "_H5Pcreate_class: class name is NULL");
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "_H5Pcreate_class: class name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_small_data_block_size
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
-{
- long sz = (long)size;
- herr_t retVal = -1;
+ if ((class_id = H5Pcreate_class((hid_t)parent_class, cstr, (H5P_cls_create_func_t)H5P_cls_create_cb, (void *) create_data,
+ (H5P_cls_copy_func_t)H5P_cls_copy_cb, (void *) copy_data, (H5P_cls_close_func_t)H5P_cls_close_cb, (void *) close_data)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Pset_small_data_block_size((hid_t)plist, (hsize_t)sz);
- if (retVal < 0)
- h5libraryError(env);
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size */
+ return (jlong)class_id;
+} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_small_data_block_size
- * Signature: (J)J
+ * Method: _H5Pcreate_class_nocb
+ * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size
- (JNIEnv *env, jclass clss, jlong plist)
-{
- hsize_t s;
-
- if (H5Pget_small_data_block_size((hid_t)plist, &s) < 0)
- h5libraryError(env);
-
- return (jlong)s;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_alloc_time
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time
- (JNIEnv *env, jclass clss, jlong plist, jint alloc_time)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_alloc_time((hid_t)plist, (H5D_alloc_time_t)alloc_time);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_alloc_time
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time
- (JNIEnv *env, jclass clss, jlong plist, jintArray alloc_time)
-{
- herr_t retVal = -1;
- jint *theArray;
- jboolean isCopy;
- H5D_alloc_time_t time;
-
- if (alloc_time == NULL) {
- /* exception ? */
- h5nullArgument(env, "H5Pget_alloc_time: alloc_time is NULL");
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR alloc_time, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_alloc_time: alloc_time not pinned");
- } /* end if */
- else {
- retVal = H5Pget_alloc_time((hid_t)plist, &time);
- if (retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR alloc_time, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = time;
- ENVPTR->ReleaseIntArrayElements(ENVPAR alloc_time, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fill_time
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1time
- (JNIEnv *env, jclass clss, jlong plist, jint fill_time)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_fill_time((hid_t)plist, (H5D_fill_time_t)fill_time);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1time */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fill_time
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1time
- (JNIEnv *env, jclass clss, jlong plist, jintArray fill_time)
-{
- herr_t retVal = -1;
- jint *theArray;
- jboolean isCopy;
- H5D_fill_time_t time;
-
- if (fill_time == NULL) {
- /* exception ? */
- h5nullArgument(env, "H5Pget_fill_time: fill_time is NULL");
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR fill_time, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fill_time: fill_time not pinned");
- } /* end if */
- else {
- retVal = H5Pget_fill_time((hid_t)plist, &time);
- if (retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR fill_time, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jint)time;
- ENVPTR->ReleaseIntArrayElements(ENVPAR fill_time, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1time */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pfill_value_defined
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined
- (JNIEnv *env, jclass clss, jlong plist, jintArray status)
-{
- herr_t retVal = -1;
- jint *theArray;
- jboolean isCopy;
- H5D_fill_value_t value;
-
- if (status == NULL) {
- /* exception ? */
- h5nullArgument(env, "H5Pfill_value_defined: status is NULL");
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR status, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pfill_value_defined: status not pinned");
- } /* end if */
- else {
- retVal = H5Pfill_value_defined((hid_t)plist, &value);
- if (retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR status, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = value;
- ENVPTR->ReleaseIntArrayElements(ENVPAR status, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fletcher32
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fletcher32
- (JNIEnv *env, jclass clss, jlong plist)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_fletcher32((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fletcher32 */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_edc_check
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1edc_1check
- (JNIEnv *env, jclass clss, jlong plist, jint check)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_edc_check((hid_t)plist, (H5Z_EDC_t)check);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1edc_1check */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_edc_check
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1edc_1check
- (JNIEnv *env, jclass clss, jlong plist)
-{
- H5Z_EDC_t retVal = -1;
-
- retVal = H5Pget_edc_check((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1edc_1check */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shuffle
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shuffle
- (JNIEnv *env, jclass clss, jlong plist)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_shuffle((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1shuffle */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_szip
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1szip
- (JNIEnv *env, jclass clss, jlong plist, jint options_mask, jint pixels_per_block)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_szip((hid_t)plist, (unsigned int)options_mask, (unsigned int)pixels_per_block);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1szip */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_hyper_vector_size
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong vector_size)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_hyper_vector_size((hid_t)plist, (size_t)vector_size);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_hyper_vector_size
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size
- (JNIEnv *env, jclass clss, jlong plist, jlongArray vector_size)
-{
- herr_t retVal = -1;
- jlong *theArray;
- size_t size;
- jboolean isCopy;
-
- if (vector_size == NULL) {
- /* exception ? */
- h5nullArgument(env, "H5Pget_hyper_vector_size: vector_size is NULL");
- } /* end if */
- else {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR vector_size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_hyper_vector_size: vector_size not pinned");
- } /* end if */
- else {
- retVal = H5Pget_hyper_vector_size((hid_t)plist, &size);
- if (retVal < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR vector_size, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jlong)size;
- ENVPTR->ReleaseLongArrayElements(ENVPAR vector_size, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pall_filters_avail
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail
- (JNIEnv *env, jclass clss, jlong dcpl_id)
-{
- htri_t bval = JNI_FALSE;
-
- bval = H5Pall_filters_avail((hid_t)dcpl_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
-
- return (jboolean)bval;
-} /* end Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pmodify_filter
- * Signature: (JIIJ[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pmodify_1filter
- (JNIEnv *env, jclass clss, jlong plist, jint filter,
- jint flags, jlong cd_nelmts, jintArray cd_values)
+Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
+ (JNIEnv *env, jclass clss, jlong parent_class, jstring name)
{
- herr_t status = -1;
- jint *cd_valuesP;
- jboolean isCopy;
+ const char *cstr = NULL;
+ hid_t class_id = H5I_INVALID_HID;
- if (cd_values == NULL) {
- h5nullArgument(env, "H5Pmodify_filter: cd_values is NULL");
- } /* end if */
- else {
- cd_valuesP = ENVPTR->GetIntArrayElements(ENVPAR cd_values,&isCopy);
- if (cd_valuesP == NULL) {
- h5JNIFatalError(env, "H5Pmodify_filter: cd_values not pinned");
- } /* end if */
- else {
- status = H5Pmodify_filter((hid_t)plist, (H5Z_filter_t)filter,(const unsigned int)flags,
- (size_t)cd_nelmts, (unsigned int *)cd_valuesP);
+ UNUSED(clss);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesP, JNI_ABORT);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "_H5Pcreate_class_nocb: class name is NULL");
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "_H5Pcreate_class_nocb: class name not pinned");
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pmodify_1filter */
+ if ((class_id = H5Pcreate_class((hid_t)parent_class, cstr, NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter_by_id
- * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
- (JNIEnv *env, jclass clss, jlong plist, jint filter,
- jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name)
-{
- jboolean isCopy;
- herr_t status = -1;
- jint *cd_valuesArray;
- jint *flagsArray;
- jlong *cd_nelmtsArray;
- jstring str;
- char *aName;
- int i = 0;
- int rank;
- long bs;
-
- bs = (long)namelen;
- if (bs <= 0) {
- h5badArgument(env, "H5Pget_filter_by_id: namelen <= 0");
- } /* end if */
- else if (flags == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: flags is NULL");
- } /* end else if */
- else if (cd_nelmts == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: cd_nelms is NULL");
- } /* end else if */
- else if (cd_values == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: cd_values is NULL");
- } /* end else if */
- else if (name == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: name is NULL");
- } /* end else if */
- else {
- aName = (char*)HDmalloc(sizeof(char) * (size_t)bs);
- if (aName == NULL) {
- h5outOfMemory(env, "H5Pget_filter_by_id: malloc failed");
- return -1;
- } /* end if */
-
- flagsArray = ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy);
- if (flagsArray == NULL) {
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned");
- return -1;
- } /* end if */
-
- cd_nelmtsArray = ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy);
- if (cd_nelmtsArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: cd_nelms not pinned");
- return -1;
- } /* end if */
-
- cd_valuesArray = ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy);
- rank = ENVPTR->GetArrayLength(ENVPAR cd_values);
- if (cd_valuesArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT);
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: cd_values array not converted to unsigned int.");
- return -1;
- } /* end if */
-
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- long long cd_nelmts_temp = *(cd_nelmtsArray);
- size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
- unsigned int filter_config;
-
- status = H5Pget_filter_by_id2( (hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, (char *)aName, &filter_config);
-
- *cd_nelmtsArray = (jlong)cd_nelmts_t;
- } /* end direct cast special */
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT);
- HDfree(aName);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0);
-
- HDfree(aName);
- } /* end else */
- } /* end else */
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id */
+ return (jlong)class_id;
+} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_fclose_degree
- * Signature: (JI)I
+ * Method: H5Pregister2
+ * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree
- (JNIEnv *env, jclass clss, jlong plist, jint fc_degree)
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pregister2
+ (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
+ jbyteArray def_value, jobject prp_create, jobject prp_set, jobject prp_get, jobject prp_delete,
+ jobject prp_copy, jobject prp_cmp, jobject prp_close)
{
- herr_t retVal = -1;
+ const char *cstr = NULL;
+ jboolean isCopy;
+ herr_t status = FAIL;
+ jbyte *propValBuf = NULL;
- retVal = H5Pset_fclose_degree((hid_t)plist, (H5F_close_degree_t)fc_degree);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree */
+ copy_callback = prp_copy;
+ close_callback = prp_close;
+ create_callback = prp_create;
+ compare_callback = prp_cmp;
+ set_callback = prp_set;
+ get_callback = prp_get;
+ delete_callback = prp_delete;
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fclose_degree
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree
- (JNIEnv *env, jclass clss, jlong plist)
-{
- H5F_close_degree_t degree;
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pregister2: property name is NULL");
- if (H5Pget_fclose_degree((hid_t)plist, &degree) < 0)
- h5libraryError(env);
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pregister2: property name not pinned");
- return (jint)degree;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree */
+ PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pregister2: default property value buffer not pinned");
+ if ((status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf, (H5P_prp_create_func_t)H5P_prp_create_cb,
+ (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb,
+ (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
-/**********************************************************************
- * *
- * File access properties *
- * *
- **********************************************************************/
+done:
+ if (propValBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, (status < 0) ? JNI_ABORT : 0);
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pregister2 */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_family
- * Signature: (JJJ)I
+ * Method: H5Pregister2_nocb
+ * Signature: (JLjava/lang/String;J[B)V
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family
- (JNIEnv *env, jclass clss, jlong plist, jlong memb_size, jlong memb_plist)
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
+ (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value)
{
- long ms = (long)memb_size;
- herr_t retVal = -1;
+ const char *cstr = NULL;
+ jboolean isCopy;
+ herr_t status = FAIL;
+ jbyte *propValBuf = NULL;
- retVal = H5Pset_fapl_family((hid_t)plist, (hsize_t)ms, (hid_t)memb_plist);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_family
- * Signature: (J[J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
- (JNIEnv *env, jclass clss, jlong tid, jlongArray memb_size, jlongArray memb_plist)
-{
- herr_t status = -1;
- jlong *sizeArray;
- jlong *plistArray;
- jint mode = JNI_ABORT;
- jboolean isCopy;
- hsize_t *sa;
- size_t i;
- size_t rank;
-
- if (memb_size == NULL) {
- h5nullArgument(env, "H5Pget_family: memb_size is NULL");
- } /* end if */
- else if (memb_plist == NULL) {
- h5nullArgument(env, "H5Pget_family: memb_plist is NULL");
- } /* end else if */
- else {
- sizeArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_size, &isCopy);
- if (sizeArray == NULL) {
- h5JNIFatalError(env, "H5Pget_family: sizeArray not pinned");
- } /* end if */
- else {
- rank = (size_t)ENVPTR->GetArrayLength(ENVPAR memb_size);
- sa = (hsize_t *)HDmalloc(rank * sizeof(hsize_t));
- if (sa == NULL) {
- h5JNIFatalError(env, "H5Screate-simple: dims not converted to hsize_t");
- } /* end if */
- else {
- plistArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_plist, &isCopy);
- if (plistArray == NULL) {
- h5JNIFatalError(env, "H5Pget_family: plistArray not pinned");
- } /* end if */
- else {
- status = H5Pget_fapl_family ((hid_t)tid, sa, (hid_t *)plistArray);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < rank; i++) {
- sizeArray[i] = (jlong)sa[i];
- } /* end for */
- mode = 0;
- } /* end else */
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_plist, plistArray, mode);
- }
- HDfree(sa);
- }
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, mode);
- }
- } /* end else */
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pregister2_nocb: property name is NULL");
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pregister2_nocb: property name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_core
- * Signature: (JJZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core
- (JNIEnv *env, jclass clss, jlong fapl_id, jlong increment, jboolean backing_store)
-{
- herr_t retVal = -1;
+ PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pregister2_nocb: default property value buffer not pinned");
- retVal = H5Pset_fapl_core((hid_t)fapl_id, (size_t)increment, (hbool_t)backing_store);
- if (retVal < 0)
- h5libraryError(env);
+ if ((status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core */
+done:
+ if (propValBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, (status < 0) ? JNI_ABORT : 0);
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pregister2_1nocb */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_core
- * Signature: (J[J[Z)I
+ * Method: H5Pinsert2
+ * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
- (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray increment, jbooleanArray backing_store)
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pinsert2
+ (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
+ jbyteArray def_value, jobject prp_set, jobject prp_get, jobject prp_delete,
+ jobject prp_copy, jobject prp_cmp, jobject prp_close)
{
- herr_t status = -1;
- jint mode = JNI_ABORT;
- jlong *incArray;
- jboolean *backArray;
- jboolean isCopy;
-
- if (increment == NULL) {
- h5nullArgument(env, "H5Pget_fapl_core: increment is NULL");
- } /* end if */
- else if (backing_store == NULL) {
- h5nullArgument(env, "H5Pget_fapl_core: backing_store is NULL");
- } /* end else if */
- else {
- incArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR increment, &isCopy);
- if (incArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fapl_core: incArray not pinned");
- } /* end if */
- else {
- backArray = (jboolean *)ENVPTR->GetBooleanArrayElements(ENVPAR backing_store, &isCopy);
- if (backArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fapl_core: backArray not pinned");
- } /* end if */
- else {
- /* direct cast (size_t *)variable fails on 32-bit environment */
- long long inc_temp = *(incArray);
- size_t inc_t = (size_t)inc_temp;
-
- status = H5Pget_fapl_core((hid_t)fapl_id, &inc_t, (hbool_t *)backArray);
-
- *incArray = (jlong)inc_t;
- /* end direct cast special */
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- mode = 0;
- } /* end else */
- ENVPTR->ReleaseBooleanArrayElements(ENVPAR backing_store, backArray, mode);
- }
- ENVPTR->ReleaseLongArrayElements(ENVPAR increment, incArray, mode);
- }
- } /* end else */
+ const char *cstr = NULL;
+ jboolean isCopy;
+ herr_t status = FAIL;
+ jbyte *propValBuf = NULL;
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core */
+ UNUSED(clss);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_family_offset
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1family_1offset
- (JNIEnv *env, jclass clss, jlong fapl_id, jlong offset)
-{
- herr_t retVal = -1;
+ copy_callback = prp_copy;
+ close_callback = prp_close;
+ compare_callback = prp_cmp;
+ set_callback = prp_set;
+ get_callback = prp_get;
+ delete_callback = prp_delete;
- retVal = H5Pset_family_offset ((hid_t)fapl_id, (hsize_t)offset);
- if (retVal < 0)
- h5libraryError(env);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pinsert2: property name is NULL");
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1family_1offset */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pinsert2: property name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_family_offset
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1family_1offset
- (JNIEnv *env, jclass clss, jlong fapl_id)
-{
- hsize_t offset = 0;
- herr_t retVal = -1;
+ PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pinsert2: property value buffer not pinned");
- retVal = H5Pget_family_offset ((hid_t)fapl_id, &offset);
- if (retVal < 0)
- h5libraryError(env);
+ if ((status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf,
+ (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb,
+ (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jlong)offset;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1family_1offset */
+done:
+ if (propValBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, (status < 0) ? JNI_ABORT : 0);
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_log
- * Signature: (JLjava/lang/String;JJ)V
+ * Method: H5Pinsert2_nocb
+ * Signature: (JLjava/lang/String;J[B)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
- (JNIEnv *env, jclass clss, jlong fapl_id, jstring logfile, jlong flags, jlong buf_size)
+Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
+ (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value)
{
- herr_t retVal = -1;
- const char *pLogfile;
+ const char *cstr = NULL;
+ jboolean isCopy;
+ herr_t status = FAIL;
+ jbyte *propValBuf = NULL;
- PIN_JAVA_STRING(logfile, pLogfile);
- if (pLogfile != NULL) {
- retVal = H5Pset_fapl_log( (hid_t)fapl_id, pLogfile, (unsigned long long)flags, (size_t)buf_size );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(logfile, pLogfile);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pinsert2_nocb: property name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Premove_filter
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5P1remove_1filter
- (JNIEnv *env, jclass clss, jlong obj_id, jint filter)
-{
- herr_t status = -1;
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pinsert2_nocb: property name not pinned");
- status = H5Premove_filter ((hid_t)obj_id, (H5Z_filter_t)filter);
- if (status < 0)
- h5libraryError(env);
+ PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pinsert2_nocb: property value buffer not pinned");
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5P1remove_1filter */
+ if ((status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf, NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
+ if (propValBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, (status < 0) ? JNI_ABORT : 0);
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb */
/*
* Class: hdf_hdf5lib_H5
@@ -2189,18 +383,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pset
(JNIEnv *env, jclass clss, jlong plid, jstring name, jint val)
{
- hid_t retVal = -1;
- const char *cstr;
+ const char *cstr = NULL;
+ hid_t retVal = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Pset((hid_t)plid, cstr, &val);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset: property name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pset: property name not pinned");
+
+ if ((retVal = H5Pset((hid_t)plid, cstr, &val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset */
@@ -2214,20 +412,24 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Pexist
(JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- htri_t bval = JNI_FALSE;
- const char *cstr;
+ const char *cstr = NULL;
+ htri_t bval = JNI_FALSE;
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- bval = H5Pexist((hid_t)plid, cstr);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pexist: property name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pexist: property name not pinned");
+
+ if ((bval = H5Pexist((hid_t)plid, cstr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Pexist */
@@ -2241,19 +443,23 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1size
(JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- hid_t retVal = -1;
- const char *cstr;
+ const char *cstr = NULL;
size_t size = 0;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Pget_size((hid_t)plid, cstr, &size);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_size: property name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pget_size: property name not pinned");
+
+ if ((status = H5Pget_size((hid_t)plid, cstr, &size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jlong) size;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1size */
@@ -2267,11 +473,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1nprops
(JNIEnv *env, jclass clss, jlong plid)
{
- size_t nprops;
+ size_t nprops = 0;
+
+ UNUSED(clss);
if (H5Pget_nprops((hid_t)plid, &nprops) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)nprops;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1nprops */
@@ -2284,20 +493,23 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1class_1name
(JNIEnv *env, jclass clss, jlong plid)
{
- char *c_str;
- jstring j_str = NULL;
+ char *c_str = NULL;
+ jstring j_str = NULL;
- c_str = H5Pget_class_name((hid_t)plid);
- if (c_str == NULL) {
- h5libraryError(env);
- } /* end if */
- else {
- j_str = ENVPTR->NewStringUTF(ENVPAR c_str);
+ UNUSED(clss);
+
+ if (NULL == (c_str = H5Pget_class_name((hid_t)plid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (j_str = ENVPTR->NewStringUTF(ENVONLY, c_str))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_class_name: out of memory - unable to construct string from UTF characters");
+ }
+
+done:
+ if (c_str)
H5free_memory(c_str);
- if (j_str == NULL)
- h5JNIFatalError(env,"H5Pget_class_name: return string failed");
- } /* end else */
return j_str;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1class_1name */
@@ -2310,12 +522,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1class_1parent
(JNIEnv *env, jclass clss, jlong plid)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Pget_class_parent((hid_t)plid);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Pget_class_parent((hid_t)plid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1class_1parent */
@@ -2328,12 +542,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pisa_1class
(JNIEnv *env, jclass clss, jlong plid, jlong pcls)
{
- htri_t retVal = -1;
+ htri_t retVal = FAIL;
- retVal = H5Pisa_class((hid_t)plid, (hid_t)pcls);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Pisa_class((hid_t)plid, (hid_t)pcls)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pisa_1class */
@@ -2346,19 +562,23 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget
(JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- herr_t retVal = -1;
- const char *cstr;
+ const char *cstr = NULL;
jint val;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Pget((hid_t)plid, cstr, &val);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget: property name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pget: property name not pinned");
+
+ if ((status = H5Pget((hid_t)plid, cstr, &val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jint)val;
} /* end Java_hdf_hdf5lib_H5_H5Pget */
@@ -2372,3366 +592,526 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pequal
(JNIEnv *env, jclass clss, jlong plid1, jlong plid2)
{
- htri_t retVal = -1;
-
- retVal = H5Pequal((hid_t)plid1, (hid_t)plid2);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pequal */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pcopy_prop
- * Signature: (JJLjava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pcopy_1prop
- (JNIEnv *env, jclass clss, jlong dst_plid, jlong src_plid, jstring name)
-{
- herr_t retVal = -1;
- const char *cstr;
+ htri_t retVal = FAIL;
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Pcopy_prop((hid_t)dst_plid, (hid_t)src_plid, cstr);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, cstr);
-
- if (retVal < 0)
- h5libraryError(env);
- }
+ if ((retVal = H5Pequal((hid_t)plid1, (hid_t)plid2)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pcopy_1prop */
+} /* end Java_hdf_hdf5lib_H5_H5Pequal */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Premove
- * Signature: (JLjava/lang/String;)I
+ * Method: H5Piterate
+ * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Premove
- (JNIEnv *env, jclass clss, jlong plid, jstring name)
+Java_hdf_hdf5lib_H5_H5Piterate
+ (JNIEnv *env, jclass clss, jlong prop_id, jintArray idx, jobject callback_op, jobject op_data)
{
- herr_t retVal = -1;
- const char *cstr;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Premove((hid_t)plid, cstr);
-
- UNPIN_JAVA_STRING(name, cstr);
-
- if (retVal < 0)
- h5libraryError(env);
- }
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Premove */
+ cb_wrapper wrapper = { callback_op, op_data };
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t status = FAIL;
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Punregister
- * Signature: (JLjava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Punregister
- (JNIEnv *env, jclass clss, jlong plid, jstring name)
-{
- herr_t retVal = -1;
- const char *cstr;
+ UNUSED(clss);
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Punregister((hid_t)plid, cstr);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Piterate: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Piterate: callback_op is NULL");
- if (retVal < 0)
- h5libraryError(env);
+ if (NULL == idx) {
+ if ((status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
}
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Punregister */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pclose_class
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Pclose_1class
- (JNIEnv *env, jclass clss, jlong plid)
-{
- herr_t retVal = -1;
-
- retVal = H5Pclose_class((hid_t)plid);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5__1H5Pclose_1class */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter2
- * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter2
- (JNIEnv *env, jclass clss, jlong plist, jint filter_number,
- jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen,
- jobjectArray name, jintArray filter_config)
-{
- herr_t status = -1;
- jint *flagsArray;
- jlong *cd_nelmtsArray;
- jint *cd_valuesArray;
- jint *filter_configArray;
- jboolean isCopy;
- char *filter;
- jstring str;
-
- if (namelen <= 0) {
- h5badArgument(env, "H5Pget_filter: namelen <= 0");
- } /* end if */
- else if (flags == NULL) {
- h5badArgument(env, "H5Pget_filter: flags is NULL");
- } /* end else if */
- else if (cd_nelmts == NULL) {
- h5badArgument(env, "H5Pget_filter: cd_nelmts is NULL");
- } /* end else if */
- else if (filter_config == NULL) {
- h5badArgument(env, "H5Pget_filter: filter_config is NULL");
- } /* end else if */
else {
- filter = (char*)HDmalloc(sizeof(char)*(size_t)namelen);
- if (filter == NULL) {
- h5outOfMemory(env, "H5Pget_filter: namelent malloc failed");
- return -1;
- } /* end if */
- flagsArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy);
- if (flagsArray == NULL) {
- HDfree(filter);
- h5JNIFatalError(env, "H5Pget_filter: flags array not pinned");
- return -1;
- } /* end if */
-
- cd_nelmtsArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy);
- if (cd_nelmtsArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(filter);
- h5JNIFatalError(env, "H5Pget_filter: nelmts array not pinned");
- return -1;
- } /* end if */
- filter_configArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR filter_config, &isCopy);
- if (filter_configArray == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(filter);
- h5JNIFatalError(env, "H5Pget_filter: filter_config array not pinned");
- return -1;
- } /* end if */
-
- if (*cd_nelmtsArray == 0 && cd_values == NULL) {
- /* direct cast (size_t *)variable fails on 32-bit environment */
- long long cd_nelmts_temp = 0;
- size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
-
- status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
- (unsigned int *)flagsArray, &cd_nelmts_t, NULL,
- (size_t)namelen, filter, (unsigned int *)filter_configArray);
-
- *cd_nelmtsArray = (jlong)cd_nelmts_t;
- } /* end if */
- else {
- if (cd_values == NULL) {
- h5badArgument(env, "H5Pget_filter: cd_values is NULL");
- return -1;
- } /* end if */
- cd_valuesArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy);
- if (cd_valuesArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(filter);
- h5JNIFatalError(env, "H5Pget_filter: elmts array not pinned");
- return -1;
- } /* end if */
-
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- long long cd_nelmts_temp = *(cd_nelmtsArray);
- size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
-
- status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, filter, (unsigned int *)filter_configArray);
-
- *cd_nelmtsArray = (jlong)cd_nelmts_t;
- } /* end direct cast special */
- } /* end else */
-
- if (status < 0) {
- if (cd_values)
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(filter);
- h5libraryError(env);
- } /* end if */
- else {
- if (cd_values)
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0);
- /* NewStringUTF may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR filter);
- HDfree(filter);
- if (str == NULL)
- h5JNIFatalError(env, "H5Pget_filter: return string not pinned");
- else
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str);
- } /* end else */
- } /* end else */
+ PIN_INT_ARRAY(ENVONLY, idx, theArray, &isCopy, "H5Piterate: idx not pinned");
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter2 */
+ if ((status = H5Piterate((hid_t)prop_id, (int *)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter_by_id2
- * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
- (JNIEnv *env, jclass clss, jlong plist, jint filter,
- jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name, jintArray filter_config)
-{
- herr_t status = -1;
- int i = 0;
- jint *cd_valuesArray;
- jint *flagsArray;
- jint *filter_configArray;
- jlong *cd_nelmtsArray;
- jboolean isCopy;
- long bs;
- char *aName;
- jstring str;
-
- bs = (long)namelen;
- if (bs <= 0) {
- h5badArgument(env, "H5Pget_filter_by_id: namelen <= 0");
- } /* end if */
- else if (flags == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: flags is NULL");
- } /* end else if */
- else if (cd_nelmts == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: cd_nelms is NULL");
- } /* end else if */
- else if (cd_values == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: cd_values is NULL");
- } /* end else if */
- else if (name == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: name is NULL");
- } /* end else if */
- else if (filter_config == NULL) {
- h5badArgument(env, "H5Pget_filter_by_id: filter_config is NULL");
- } /* end else if */
- else {
- aName = (char*)HDmalloc(sizeof(char) * (size_t)bs);
- if (aName == NULL) {
- h5outOfMemory(env, "H5Pget_filter_by_id: malloc failed");
- return -1;
- } /* end if */
- flagsArray = ENVPTR->GetIntArrayElements(ENVPAR flags,&isCopy);
- if (flagsArray == NULL) {
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned");
- return -1;
- } /* end if */
- cd_nelmtsArray = ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy);
- if (cd_nelmtsArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: cd_nelms not pinned");
- return -1;
- } /* end if */
- cd_valuesArray = ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy);
- if (cd_valuesArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: cd_values array not converted to unsigned int.");
- return -1;
- } /* end if */
- filter_configArray = ENVPTR->GetIntArrayElements(ENVPAR filter_config, &isCopy);
- if (filter_configArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT);
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned");
- return -1;
- } /* end if */
-
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- long long cd_nelmts_temp = *(cd_nelmtsArray);
- size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
-
- status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, (char *)aName, (unsigned int *)filter_configArray);
-
- *cd_nelmtsArray = (jlong)cd_nelmts_t;
- } /* end direct cast special handling */
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT);
- HDfree(aName);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- HDfree(aName);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, 0);
- } /* end else */
- } /* end else */
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, idx, theArray, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2 */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_nlinks
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nlinks
- (JNIEnv *env, jclass clss, jlong lapl_id)
-{
- size_t nlinks;
- if (H5Pget_nlinks((hid_t)lapl_id, &nlinks) < 0)
- h5libraryError(env);
-
- return (jlong) nlinks;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1nlinks */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_nlinks
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nlinks
- (JNIEnv *env, jclass clss, jlong lapl_id, jlong nlinks)
-{
- herr_t retVal = -1;
-
- if (nlinks <= 0) {
- h5badArgument(env, "H5Pset_1nlinks: nlinks_l <= 0");
- } /* end if */
- else {
- retVal = H5Pset_nlinks((hid_t)lapl_id, (size_t)nlinks);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1nlinks */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_libver_bounds
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
- (JNIEnv *env, jclass clss, jlong fapl_id, jintArray libver)
-{
- herr_t retVal = -1;
- H5F_libver_t *theArray = NULL;
- jboolean isCopy;
-
- if (libver == NULL) {
- h5nullArgument(env, "H5Pget_libver_bounds: libversion bounds is NULL");
- } /* end if */
- else {
- theArray = (H5F_libver_t*)ENVPTR->GetIntArrayElements(ENVPAR libver, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_libver_bounds: input not pinned");
- } /* end if */
- else {
- retVal = H5Pget_libver_bounds((hid_t)fapl_id, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR libver, (jint*)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR libver, (jint*)theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_libver_bounds
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds
- (JNIEnv *env, jclass clss, jlong fapl_id, jint low, jint high)
-{
- herr_t retVal = -1;
-
- if ((H5F_libver_t)high != H5F_LIBVER_LATEST) {
- h5badArgument(env, "H5Pset_libver_bounds: invalid high library version bound");
- } /* end if */
- else if(((H5F_libver_t)low !=H5F_LIBVER_EARLIEST) && ((H5F_libver_t)low != H5F_LIBVER_LATEST)) {
- h5badArgument(env, "H5Pset_libver_bounds: invalid low library version bound");
- } /* end else if */
- else {
- retVal = H5Pset_libver_bounds((hid_t)fapl_id, (H5F_libver_t)low, (H5F_libver_t)high);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_link_creation_order
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order
- (JNIEnv *env, jclass clss, jlong gcpl_id)
-{
- unsigned crt_order_flags;
-
- if(H5Pget_link_creation_order((hid_t)gcpl_id, &crt_order_flags) < 0)
- h5libraryError(env);
-
- return (jint)crt_order_flags;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order */
+} /* end Java_hdf_hdf5lib_H5_H5Piterate */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_link_creation_order
- * Signature: (JI)I
+ * Method: H5Pcopy_prop
+ * Signature: (JJLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
- (JNIEnv *env, jclass clss, jlong gcpl_id, jint crt_order_flags)
+Java_hdf_hdf5lib_H5_H5Pcopy_1prop
+ (JNIEnv *env, jclass clss, jlong dst_plid, jlong src_plid, jstring name)
{
- herr_t retVal = -1;
+ const char *cstr = NULL;
+ herr_t retVal = FAIL;
- retVal = H5Pset_link_creation_order((hid_t)gcpl_id, (unsigned)crt_order_flags);
- if(retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_attr_creation_order
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order
- (JNIEnv *env, jclass clss, jlong ocpl_id)
-{
- unsigned crt_order_flags;
-
- if(H5Pget_attr_creation_order((hid_t)ocpl_id, &crt_order_flags) < 0)
- h5libraryError(env);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pcopy_prop: property name is NULL");
- return (jint)crt_order_flags;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pcopy_prop: property name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_attr_creation_order
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order
- (JNIEnv *env, jclass clss, jlong ocpl_id, jint crt_order_flags)
-{
- herr_t retVal = -1;
+ if ((retVal = H5Pcopy_prop((hid_t)dst_plid, (hid_t)src_plid, cstr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Pset_attr_creation_order((hid_t)ocpl_id, (unsigned)crt_order_flags);
- if(retVal < 0)
- h5libraryError(env);
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_copy_object
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1copy_1object
- (JNIEnv *env, jclass clss, jlong ocp_plist_id, jint copy_options)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_copy_object((hid_t)ocp_plist_id, (unsigned)copy_options);
- if(retVal < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1copy_1object */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_copy_object
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1copy_1object
- (JNIEnv *env, jclass clss, jlong ocp_plist_id)
-{
- unsigned copy_options;
-
- if(H5Pget_copy_object((hid_t)ocp_plist_id, &copy_options) < 0)
- h5libraryError(env);
-
- return (jint)copy_options;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1copy_1object */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_create_intermediate_group
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group
- (JNIEnv *env, jclass clss, jlong lcpl_id, jboolean crt_intermed_group)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_create_intermediate_group((hid_t)lcpl_id, (unsigned)crt_intermed_group);
- if(retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_create_intermediate_group
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group
- (JNIEnv *env, jclass clss, jlong lcpl_id)
-{
- unsigned crt_intermed_group;
-
- if(H5Pget_create_intermediate_group((hid_t)lcpl_id, &crt_intermed_group) < 0)
- h5libraryError(env);
-
- return (jboolean)crt_intermed_group;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group */
+} /* end Java_hdf_hdf5lib_H5_H5Pcopy_1prop */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_data_transform
+ * Method: H5Premove
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1data_1transform
- (JNIEnv *env, jclass clss, jlong plist_id, jstring expression)
-{
- herr_t retVal = -1;
- const char *express;
-
- PIN_JAVA_STRING(expression, express);
- if (express != NULL) {
- retVal = H5Pset_data_transform((hid_t)plist_id, express);
-
- UNPIN_JAVA_STRING(expression, express);
-
- if (retVal < 0)
- h5libraryError(env);
- }
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1data_1transform */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_data_transform
- * Signature: (J[Ljava/lang/String;J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
- (JNIEnv *env, jclass clss, jlong plist_id, jobjectArray expression, jlong size)
-{
- size_t buf_size;
- char *express;
- jlong express_size = -1;
- jstring str = NULL;
-
- if (size <= 0) {
- h5badArgument(env, "H5Pget_data_transform: size <= 0");
- } /* end if */
- else {
- express_size = (jlong)H5Pget_data_transform((hid_t)plist_id, (char*)NULL, (size_t)size);
- if(express_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- buf_size = (size_t)express_size + 1;/* add extra space for the null terminator */
- express = (char*)HDmalloc(sizeof(char) * buf_size);
- if (express == NULL) {
- h5outOfMemory(env, "H5Pget_data_transform: malloc failed ");
- } /* end if */
- else {
- express_size = (jlong)H5Pget_data_transform((hid_t)plist_id, express, (size_t)size);
- if (express_size < 0) {
- HDfree(express);
- h5libraryError(env);
- }
- else {
- str = ENVPTR->NewStringUTF(ENVPAR express);
- HDfree(express);
- if (str == NULL)
- h5JNIFatalError(env, "H5Pget_data_transform: return string not created");
- else
- ENVPTR->SetObjectArrayElement(ENVPAR expression, 0, str);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- return express_size;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1data_1transform */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_acc_flags
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags
- (JNIEnv *env, jclass clss, jlong lapl_id)
-{
- unsigned flags;
-
- if(H5Pget_elink_acc_flags((hid_t)lapl_id, &flags) < 0)
- h5libraryError(env);
-
- return (jint)flags;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_acc_flags
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags
- (JNIEnv *env, jclass clss, jlong lapl_id, jint flags)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_elink_acc_flags((hid_t)lapl_id, (unsigned)flags);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint) retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_link_phase_change
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change
- (JNIEnv *env, jclass clss, jlong gcpl_id, jint max_compact, jint min_dense)
-{
- herr_t retVal = -1;
-
- if(max_compact < min_dense) {
- h5badArgument(env, "H5Pset_link_phase_change: max compact value must be >= min dense value");
- } /* end if */
- else if(max_compact > 65535) {
- h5badArgument(env, "H5Pset_link_phase_change: max compact value must be < 65536");
- } /* end else if */
- else if(min_dense > 65535) {
- h5badArgument(env, "H5Pset_link_phase_change: min dense value must be < 65536");
- } /* end else if */
- else {
- retVal = H5Pset_link_phase_change((hid_t)gcpl_id, (unsigned)max_compact, (unsigned)min_dense);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_link_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
- (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray links)
-{
- herr_t retVal = -1;
- unsigned *theArray = NULL;
- jboolean isCopy;
-
- if (links == NULL) {
- h5nullArgument( env, "H5Pget_link_phase_change: links is NULL");
- } /* end if */
- else {
- theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR links, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError( env, "H5Pget_link_phase_change: input not pinned");
- } /* end if */
- else {
- retVal = H5Pget_link_phase_change((hid_t)gcpl_id, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR links, (jint *)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR links, (jint *)theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_attr_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change
- (JNIEnv *env, jclass clss, jlong ocpl_id, jintArray attributes)
-{
- herr_t retVal = -1;
- unsigned *theArray = NULL;
- jboolean isCopy;
-
- if (attributes == NULL) {
- h5nullArgument(env, "H5Pget_attr_phase_change: attributes is NULL");
- } /* end if */
- else {
- theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR attributes, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_attr_phase_change: input not pinned");
- } /* end if */
- else {
- retVal = H5Pget_attr_phase_change((hid_t)ocpl_id, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR attributes, (jint *)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR attributes, (jint *)theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_attr_phase_change
- * Signature: (JII)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change
- (JNIEnv *env, jclass clss, jlong ocpl_id, jint max_compact, jint min_dense)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_attr_phase_change((hid_t)ocpl_id, (unsigned)max_compact, (unsigned)min_dense);
- if(retVal < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change
- (JNIEnv *env, jclass clss, jlong fcpl_id, jintArray size)
-{
- herr_t retVal = -1;
- unsigned *theArray = NULL;
- jboolean isCopy;
-
- if (size == NULL) {
- h5nullArgument(env, "H5Pget_shared_mesg_phase_change: size is NULL");
- } /* end if */
- else {
- theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_shared_mesg_phase_change: input not pinned");
- } /* end if */
- else {
- retVal = H5Pget_shared_mesg_phase_change((hid_t)fcpl_id, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR size, (jint *)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR size, (jint *)theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_phase_change
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint max_list, jint min_btree)
-{
- herr_t retVal = -1;
-
- /* Check that values are sensible. The min_btree value must be no greater
- * than the max list plus one.
- *
- * Range check to make certain they will fit into encoded form.
- */
-
- if(max_list + 1 < min_btree) {
- h5badArgument(env, "H5Pset_shared_mesg_phase_change: minimum B-tree value is greater than maximum list value");
- } /* end if */
- else if(max_list > H5O_SHMESG_MAX_LIST_SIZE) {
- h5badArgument(env, "H5Pset_shared_mesg_phase_change: max list value is larger than H5O_SHMESG_MAX_LIST_SIZE");
- } /* end else if */
- else if(min_btree > H5O_SHMESG_MAX_LIST_SIZE) {
- h5badArgument(env, "H5Pset_shared_mesg_phase_change: min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE");
- } /* end else if */
- else {
- retVal = H5Pset_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned)max_list, (unsigned)min_btree);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_nindexes
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes
- (JNIEnv *env, jclass clss, jlong fcpl_id)
-{
- unsigned nindexes;
-
- if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0)
- h5libraryError(env);
-
- return (jint)nindexes;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_nindexes
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes
- (JNIEnv *env, jclass clss, jlong plist_id, jint nindexes)
-{
- herr_t retVal = -1;
-
- if (nindexes > H5O_SHMESG_MAX_NINDEXES) {
- h5badArgument(env, "H5Pset_shared_mesg_nindexes: number of indexes is greater than H5O_SHMESG_MAX_NINDEXES");
- } /* end if */
- else {
- retVal = H5Pset_shared_mesg_nindexes((hid_t)plist_id, (unsigned)nindexes);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_index
- * Signature: (JIII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num,
- jint mesg_type_flags, jint min_mesg_size)
-{
- herr_t retVal = -1;
- unsigned nindexes;/* Number of SOHM indexes */
-
- /* Check arguments */
- if(mesg_type_flags > H5O_SHMESG_ALL_FLAG) {
- h5badArgument(env, "H5Pset_shared_mesg_index: unrecognized flags in mesg_type_flags");
- } /* end if */
- else if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0) { /* Read the current number of indexes */
- h5libraryError(env);
- } /* end else if */
- else {
- /* Range check */
- if((unsigned)index_num >= nindexes) {
- h5badArgument(env, "H5Pset_shared_mesg_index: index_num is too large; no such index");
- } /* end if */
- else {
- retVal = H5Pset_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned) mesg_type_flags, (unsigned) min_mesg_size);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_index
- * Signature: (JI[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num, jintArray mesg_info)
-{
- herr_t retVal = -1;
- unsigned nindexes;/* Number of SOHM indexes */
- unsigned *theArray = NULL;
- jboolean isCopy;
-
- /* Read the current number of indexes */
- if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes)<0) {
- h5libraryError(env);
- } /* end if */
- else {
- /* Range check */
- if((unsigned)index_num >= nindexes) {
- h5badArgument(env, "H5Pget_shared_mesg_index: index_num is too large; no such index");
- } /* end if */
- else if (mesg_info == NULL) {
- h5nullArgument(env, "H5Pget_shared_mesg_index: mesg_info is NULL");
- } /* end else if */
- else {
- theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR mesg_info, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_shared_mesg_index: input not pinned");
- } /* end if */
- else {
- retVal = H5Pget_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR mesg_info, (jint*)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR mesg_info, (jint*)theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_local_heap_size_hint
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint
- (JNIEnv *env, jclass clss, jlong gcpl_id, jlong size_hint)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_local_heap_size_hint((hid_t)gcpl_id, (size_t)size_hint);
- if(retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_local_heap_size_hint
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint
- (JNIEnv *env, jclass clss, jlong gcpl_id)
-{
- size_t size_hint;
-
- if(H5Pget_local_heap_size_hint((hid_t)gcpl_id, &size_hint) < 0)
- h5libraryError(env);
-
- return (jlong)size_hint;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_nbit
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nbit
- (JNIEnv *env, jclass clss, jlong plist_id)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_nbit((hid_t)plist_id);
- if(retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1nbit */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_scaleoffset
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset
- (JNIEnv *env, jclass clss, jlong plist_id, jint scale_type, jint scale_factor)
-{
- herr_t retVal = -1;
-
- /* Check arguments */
- if(scale_factor < 0) {
- h5badArgument(env, "H5Pset_scaleoffset: scale factor must be > 0");
- } /* end if */
- else {
- if(scale_type != H5Z_SO_FLOAT_DSCALE && scale_type != H5Z_SO_FLOAT_ESCALE && scale_type != H5Z_SO_INT){
- h5badArgument(env, "H5Pset_scaleoffset: invalid scale type");
- } /* end if */
- else {
- retVal = H5Pset_scaleoffset((hid_t)plist_id, (H5Z_SO_scale_type_t)scale_type, scale_factor);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_est_link_info
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
- (JNIEnv *env, jclass clss, jlong gcpl_id, jint est_num_entries, jint est_name_len)
+Java_hdf_hdf5lib_H5_H5Premove
+ (JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- herr_t retVal = -1;
+ const char *cstr = NULL;
+ herr_t retVal = FAIL;
- /* Range check values */
- if((est_num_entries > 65535) || (est_name_len > 65535)) {
- h5badArgument(env, "H5Pset_est_link_info: est. name length or number of entries must be < 65536");
- } /* end if */
- else {
- retVal = H5Pset_est_link_info((hid_t)gcpl_id, (unsigned)est_num_entries, (unsigned)est_name_len);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
+ UNUSED(clss);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info */
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Premove: property name is NULL");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_est_link_info
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
- (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray link_info)
-{
- herr_t retVal = -1;
- unsigned *theArray = NULL;
- jboolean isCopy;
-
- if (link_info == NULL) {
- h5nullArgument(env, "H5Pget_est_link_info: link_info is NULL");
- } /* end if */
- else {
- theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR link_info,&isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_est_link_info: input not pinned");
- } /* end if */
- else {
- retVal= H5Pget_est_link_info((hid_t)gcpl_id, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR link_info, (jint *)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR link_info, (jint *)theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Premove: property name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_fapl
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl
- (JNIEnv *env, jclass clss, jlong lapl_id, jlong fapl_id)
-{
- herr_t retVal = -1;
+ if ((retVal = H5Premove((hid_t)plid, cstr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Pset_elink_fapl((hid_t)lapl_id, (hid_t)fapl_id);
- if(retVal < 0)
- h5libraryError(env);
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pget_elink_fapl
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl
- (JNIEnv *env, jclass clss, jlong lapl_id)
-{
- hid_t retVal = -1;
-
- retVal = H5Pget_elink_fapl((hid_t)lapl_id);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jlong)retVal;
-} /* end Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl */
+} /* end Java_hdf_hdf5lib_H5_H5Premove */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_prefix
+ * Method: H5Punregister
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix
- (JNIEnv *env, jclass clss, jlong lapl_id, jstring prefix)
-{
- herr_t retVal = -1;
- const char *aName;
-
- PIN_JAVA_STRING(prefix, aName);
- if (aName != NULL) {
- retVal = H5Pset_elink_prefix((hid_t)lapl_id, aName);
-
- UNPIN_JAVA_STRING(prefix, aName);
-
- if(retVal < 0)
- h5libraryError(env);
- }
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_prefix
- * Signature: (J[Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
- (JNIEnv *env, jclass clss, jlong lapl_id, jobjectArray prefix)
-{
- size_t size = 0;
- char *pre;
- jlong prefix_size = -1;
- jstring str = NULL;
-
- if (prefix == NULL) {
- h5nullArgument(env, "H5Pget_elink_prefix: prefix is NULL");
- } /* end if */
- else {
- prefix_size = (jlong)H5Pget_elink_prefix((hid_t)lapl_id, (char*)NULL, size);
- if(prefix_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- size = (size_t)prefix_size + 1;/* add extra space for the null terminator */
- pre = (char*)HDmalloc(sizeof(char)*size);
- if (pre == NULL) {
- h5outOfMemory(env, "H5Pget_elink_prefix: malloc failed ");
- } /* end if */
- else {
- prefix_size = (jlong)H5Pget_elink_prefix((hid_t)lapl_id, (char*)pre, size);
-
- if (prefix_size < 0) {
- HDfree(pre);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR pre);
- HDfree(pre);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Pget_elink_prefix: return string not created");
- } /* end if */
- else
- ENVPTR->SetObjectArrayElement(ENVPAR prefix, 0, str);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
-
- return prefix_size;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_direct
- * Signature: (JJJJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct
- (JNIEnv *env, jclass clss, jlong fapl_id, jlong alignment,
- jlong block_size, jlong cbuf_size)
+Java_hdf_hdf5lib_H5_H5Punregister
+ (JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- herr_t retVal = -1;
+ const char *cstr = NULL;
+ herr_t retVal = FAIL;
-#ifdef H5_HAVE_DIRECT
- retVal = H5Pset_fapl_direct((hid_t)fapl_id, (size_t)alignment, (size_t)block_size, (size_t)cbuf_size);
-#endif
- if(retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct */
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Punregister: property name is NULL");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_direct
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct
- (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray info)
-{
- herr_t retVal = -1;
-
-#ifdef H5_HAVE_DIRECT
- size_t alignment = 0;
- size_t block_size = 0;
- size_t cbuf_size = 0;
- jlong *theArray;
- jboolean isCopy;
- if (info == NULL) {
- h5nullArgument(env, "H5Pget_fapl_direct: info input array is NULL");
- } /* end if */
- else {
- if (ENVPTR->GetArrayLength(ENVPAR info) < 3) {
- h5badArgument( env, "H5Pget_fapl_direct: info input array < 4");
- } /* end if */
- else {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR info, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fapl_direct: info not pinned");
- } /* end if */
- else {
- retVal = H5Pget_fapl_direct((hid_t)fapl_id, &alignment, &block_size, &cbuf_size);
- if(retVal < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR info, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jlong)alignment;
- theArray[1] = (jlong)block_size;
- theArray[2] = (jlong)cbuf_size;
- ENVPTR->ReleaseLongArrayElements(ENVPAR info, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
-#else
- if (retVal < 0)
- h5libraryError(env);
-#endif
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Punregister: property name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_sec2
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2
- (JNIEnv *env, jclass clss, jlong fapl_id)
-{
- herr_t retVal = -1;
+ if ((retVal = H5Punregister((hid_t)plid, cstr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Pset_fapl_sec2((hid_t) fapl_id);
- if (retVal < 0)
- h5libraryError(env);
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2 */
+} /* end Java_hdf_hdf5lib_H5_H5Punregister */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_stdio
+ * Method: _H5Pclose_class
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5__1H5Pclose_1class
+ (JNIEnv *env, jclass clss, jlong plid)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Pset_fapl_stdio((hid_t) fapl_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_windows
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
- (JNIEnv *env, jclass clss, jlong fapl_id)
-{
- herr_t retVal = -1;
-
-#ifdef H5_HAVE_WINDOWS
- retVal = H5Pset_fapl_windows((hid_t) fapl_id);
-#endif
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Pclose_class((hid_t)plid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_muti
- * Signature: (J[I[J[Ljava/lang/String;[J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
- (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
- jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr)
-{
- herr_t status = -1;
- int i;
- jint *themapArray = NULL;
- jlong *thefaplArray = NULL;
- jlong *theaddrArray = NULL;
- char **mName = NULL;
- jstring str;
- jboolean isCopy;
- int relax = 0;
-
- if (memb_map) {
- themapArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR memb_map, &isCopy);
- if (themapArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_map not pinned");
- return 0;
- } /* end if */
- } /* end if */
-
- if (memb_fapl) {
- thefaplArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR memb_fapl, &isCopy);
- if (thefaplArray == NULL) {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_fapl not pinned");
- return 0;
- } /* end if */
- } /* end if */
-
- if (memb_addr) {
- theaddrArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR memb_addr, &isCopy);
- if (theaddrArray == NULL) {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_addr not pinned");
- return 0;
- } /* end if */
- } /* end if */
-
- if (memb_name)
- mName = (char**)HDcalloc(H5FD_MEM_NTYPES, sizeof (*mName));
-
- status = H5Pget_fapl_multi((hid_t)tid, (H5FD_mem_t*)themapArray, (hid_t*)thefaplArray, mName, (haddr_t*)theaddrArray, (hbool_t*)&relax);
-
- if (status < 0) {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT);
- if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, JNI_ABORT);
- if (memb_name) h5str_array_free(mName, H5FD_MEM_NTYPES);
- h5libraryError(env);
- } /* end if */
- else {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, 0);
- if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, 0);
- if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, 0);
-
- if (memb_name) {
- if (mName) {
- for (i = 0; i < H5FD_MEM_NTYPES; i++) {
- if (*(mName + i)) {
- str = ENVPTR->NewStringUTF(ENVPAR *(mName+i));
- ENVPTR->SetObjectArrayElement(ENVPAR memb_name, i, (jobject)str);
- } /* end if */
- } /* for (i=0; i<n; i++)*/
- } /* end if */
- h5str_array_free(mName, H5FD_MEM_NTYPES);
- } /* end if */
- } /* end else */
-
- return (relax!=0);
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_muti
- * Signature: (J[I[J[Ljava/lang/String;[JZ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
- (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
- jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr, jboolean relax)
-{
- herr_t status = -1;
- jint *themapArray = NULL;
- jlong *thefaplArray = NULL;
- jlong *theaddrArray = NULL;
- jboolean isCopy;
- jclass Sjc;
- jstring rstring;
- jobject o;
- jboolean bb;
- const char **mName = NULL;
- char *member_name[H5FD_MEM_NTYPES];
-
- if (memb_map) {
- themapArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR memb_map, &isCopy);
- if (themapArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_map not pinned");
- return;
- } /* end if */
- } /* end if */
-
- if (memb_fapl) {
- thefaplArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_fapl, &isCopy);
- if (thefaplArray == NULL) {
- if (memb_map)
- ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_fapl not pinned");
- return;
- } /* end if */
- } /* end if */
-
- if (memb_addr) {
- theaddrArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_addr, &isCopy);
- if (theaddrArray == NULL) {
- if (memb_map)
- ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- if (memb_fapl)
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_addr not pinned");
- return;
- } /* end if */
- } /* end if */
-
- HDmemset(member_name, 0, H5FD_MEM_NTYPES * sizeof(char*));
- if (memb_name) {
- int i;
- for (i = 0; i < H5FD_MEM_NTYPES; i++) {
- jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray) memb_name, i);
- if (obj != 0) {
- jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj);
- const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
-
- if (utf8) {
- member_name[i] = (char*)HDmalloc(strlen(utf8) + 1);
- if (member_name[i]) {
- strcpy(member_name[i], utf8);
- } /* end if */
- } /* end if */
-
- ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
- ENVPTR->DeleteLocalRef(ENVPAR obj);
- } /* end if */
- } /* end for */
- mName = (const char **)member_name;
- } /* end if */
-
- status = H5Pset_fapl_multi((hid_t)tid, (const H5FD_mem_t *)themapArray, (const hid_t *)thefaplArray, mName, (const haddr_t *)theaddrArray, (hbool_t)relax);
-
- if (status < 0) {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT);
- if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, JNI_ABORT);
- if (memb_name) {
- int i;
- for (i = 0; i < H5FD_MEM_NTYPES; i++)
- HDfree(member_name[i]);
- } /* end if */
- h5libraryError(env);
- } /* end if */
- else {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, 0);
- if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, 0);
- if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, 0);
- if (memb_name) {
- if (mName != NULL) {
- int i;
- Sjc = ENVPTR->FindClass(ENVPAR "java/lang/String");
- if (Sjc != NULL) {
- for (i = 0; i < H5FD_MEM_NTYPES; i++) {
- rstring = ENVPTR->NewStringUTF(ENVPAR member_name[i]);
- o = ENVPTR->GetObjectArrayElement(ENVPAR memb_name, i);
- if (o != NULL) {
- bb = ENVPTR->IsInstanceOf(ENVPAR o, Sjc);
- if (bb == JNI_TRUE) {
- ENVPTR->SetObjectArrayElement(ENVPAR memb_name, i, (jobject)rstring);
- } /* end if */
- ENVPTR->DeleteLocalRef(ENVPAR o);
- } /* end if */
- HDfree(member_name[i]);
- } /* end for */
- } /* end if */
- } /* end if */
- } /* end if */
- } /* end else */
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi */
+} /* end Java_hdf_hdf5lib_H5__1H5Pclose_1class */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_split
- * Signature: (JLjava/lang/String;JLjava/lang/String;J)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
- (JNIEnv *env, jclass clss, jlong fapl_id, jstring metaext, jlong meta_pl_id, jstring rawext, jlong raw_pl_id)
+static herr_t
+H5P_cls_create_cb
+ (hid_t prop_id, void *create_data)
{
- herr_t retVal = -1;
- const char *mstr;
- const char *rstr;
-
- PIN_JAVA_STRING_TWO(metaext, mstr, rawext, rstr);
- if (mstr != NULL && rstr != NULL) {
- retVal = H5Pset_fapl_split((hid_t)fapl_id, mstr, (hid_t)meta_pl_id, rstr, (hid_t)raw_pl_id);
-
- UNPIN_JAVA_STRING_TWO(metaext, mstr, rawext, rstr);
+ jmethodID mid;
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ jint status = -1;
- if (retVal < 0)
- h5libraryError(env);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_cls_create_cb: failed to attach current thread to JVM");
}
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_meta_block_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
-{
- long sz = (long)size;
-
- if (H5Pset_meta_block_size((hid_t)plist, (hsize_t)sz) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_meta_block_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
- (JNIEnv *env, jclass clss, jlong plist)
-{
- hsize_t s;
-
- if (H5Pget_meta_block_size((hid_t)plist, &s) < 0)
- h5libraryError(env);
-
- return (jlong)s;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sieve_buf_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
-{
- size_t sz = (size_t)size;
-
- if (H5Pset_sieve_buf_size((hid_t)plist, (size_t)sz) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sieve_buf_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
- (JNIEnv *env, jclass clss, jlong plist)
-{
- size_t s;
-
- if (H5Pget_sieve_buf_size((hid_t)plist, &s) < 0)
- h5libraryError(env);
-
- return (jlong)s;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_file_cache_size
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size
- (JNIEnv *env, jclass clss, jlong plist, jint size)
-{
- unsigned sz = (unsigned)size;
-
- if (H5Pset_elink_file_cache_size((hid_t)plist, (unsigned)sz) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_file_cache_size
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size
- (JNIEnv *env, jclass clss, jlong plist)
-{
- unsigned s;
-
- if (H5Pget_elink_file_cache_size((hid_t)plist, &s) < 0)
- h5libraryError(env);
- return (jint)s;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, create_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_create_func_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_mdc_config
- * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t;
- */
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
- (JNIEnv *env, jclass clss, jlong plist)
-{
- H5AC_cache_config_t cacheinfo;
- herr_t status = -1;
- jvalue args[30];
- jstring j_str = NULL;
- jobject ret_obj = NULL;
-
- HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t));
- cacheinfo.version = H5AC__CURR_CACHE_CONFIG_VERSION;
-
- status = H5Pget_mdc_config((hid_t)plist, &cacheinfo);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = cacheinfo.version;
- args[1].z = cacheinfo.rpt_fcn_enabled;
- args[2].z = cacheinfo.open_trace_file;
- args[3].z = cacheinfo.close_trace_file;
- if (cacheinfo.trace_file_name != NULL) {
- j_str = ENVPTR->NewStringUTF(ENVPAR cacheinfo.trace_file_name);
- } /* end if */
- args[4].l = j_str;
- args[5].z = cacheinfo.evictions_enabled;
- args[6].z = cacheinfo.set_initial_size;
- args[7].j = (jlong)cacheinfo.initial_size;
- args[8].d = cacheinfo.min_clean_fraction;
- args[9].j = (jlong)cacheinfo.max_size;
- args[10].j = (jlong)cacheinfo.min_size;
- args[11].j = cacheinfo.epoch_length;
- args[12].i = cacheinfo.incr_mode;
- args[13].d = cacheinfo.lower_hr_threshold;
- args[14].d = cacheinfo.increment;
- args[15].z = cacheinfo.apply_max_increment;
- args[16].j = (jlong)cacheinfo.max_increment;
- args[17].i = cacheinfo.flash_incr_mode;
- args[18].d = cacheinfo.flash_multiple;
- args[19].d = cacheinfo.flash_threshold;
- args[20].i = cacheinfo.decr_mode;
- args[21].d = cacheinfo.upper_hr_threshold;
- args[22].d = cacheinfo.decrement;
- args[23].z = cacheinfo.apply_max_decrement;
- args[24].j = (jlong)cacheinfo.max_decrement;
- args[25].i = cacheinfo.epochs_before_eviction;
- args[26].z = cacheinfo.apply_empty_reserve;
- args[27].d = cacheinfo.empty_reserve;
- args[28].j = (jlong)cacheinfo.dirty_bytes_threshold;
- args[29].i = cacheinfo.metadata_write_strategy;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5AC_cache_config_t", "(IZZZLjava/lang/String;ZZJDJJJIDDZJIDDIDDZJIZDJI)V", args);
- } /* end else */
- return ret_obj;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_mdc_config
- * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
- (JNIEnv *env, jclass clss, jlong plist, jobject cache_config)
-{
- herr_t status = -1;
- jclass cls;
- jfieldID fid;
- jstring j_str;
- const char *str;
- H5AC_cache_config_t cacheinfo;
-
- cls = ENVPTR->GetObjectClass(ENVPAR cache_config);
- fid = ENVPTR->GetFieldID(ENVPAR cls, "version", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: version");
- return;
- } /* end if */
- cacheinfo.version = ENVPTR->GetIntField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading version failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "rpt_fcn_enabled", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: rpt_fcn_enabled");
- return;
- } /* end if */
- cacheinfo.rpt_fcn_enabled = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading rpt_fcn_enabled failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "open_trace_file", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: open_trace_file");
- return;
- } /* end if */
- cacheinfo.open_trace_file = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading open_trace_file failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "close_trace_file", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: close_trace_file");
- return;
- } /* end if */
- cacheinfo.close_trace_file = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading close_trace_file failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "trace_file_name", "Ljava/lang/String;");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: trace_file_name");
- return;
- } /* end if */
- j_str = (jstring)ENVPTR->GetObjectField(ENVPAR cache_config, fid);
- str = ENVPTR->GetStringUTFChars(ENVPAR j_str, NULL);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Pset_mdc_config: out of memory trace_file_name");
- return;
- } /* end if */
- strncpy(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");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "evictions_enabled", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: evictions_enabled");
- return;
- } /* end if */
- cacheinfo.evictions_enabled = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading evictions_enabled failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "set_initial_size", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: set_initial_size");
- return;
- } /* end if */
- cacheinfo.set_initial_size = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading set_initial_size failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "initial_size", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: initial_size");
- return;
- } /* end if */
- cacheinfo.initial_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading initial_size failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "min_clean_fraction", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: min_clean_fraction");
- return;
- } /* end if */
- cacheinfo.min_clean_fraction = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading min_clean_fraction failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "max_size", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: max_size");
- return;
- } /* end if */
- cacheinfo.max_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading max_size failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "min_size", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: min_size");
- return;
- } /* end if */
- cacheinfo.min_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading min_size failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "epoch_length", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: epoch_length");
- return;
- }
- cacheinfo.epoch_length = (long int)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading epoch_length failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "incr_mode", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: incr_mode");
- return;
- } /* end if */
- cacheinfo.incr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_incr_mode) */
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading incr_mode failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "lower_hr_threshold", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: lower_hr_threshold");
- return;
- } /* end if */
- cacheinfo.lower_hr_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading lower_hr_threshold failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "increment", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: increment");
- return;
- } /* end if */
- cacheinfo.increment = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading increment failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_max_increment", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: apply_max_increment");
- return;
- } /* end if */
- cacheinfo.apply_max_increment = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_max_increment failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "max_increment", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: max_increment");
- return;
- } /* end if */
- cacheinfo.max_increment = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading max_increment failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_incr_mode", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: flash_incr_mode");
- return;
- } /* end if */
- cacheinfo.flash_incr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_flash_incr_mode) */
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_incr_mode failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_multiple", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: flash_multiple");
- return;
- } /* end if */
- cacheinfo.flash_multiple = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_multiple failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_threshold", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: flash_threshold");
- return;
- } /* end if */
- cacheinfo.flash_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_threshold failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "decr_mode", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: decr_mode");
- return;
- } /* end if */
- cacheinfo.decr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_decr_mode) */
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading decr_mode failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "upper_hr_threshold", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: upper_hr_threshold");
- return;
- } /* end if */
- cacheinfo.upper_hr_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading upper_hr_threshold failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "decrement", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: decrement");
- return;
- } /* end if */
- cacheinfo.decrement = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading decrement failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_max_decrement", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: apply_max_decrement");
- return;
- } /* end if */
- cacheinfo.apply_max_decrement = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_max_decrement failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "max_decrement", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: max_decrement");
- return;
- } /* end if */
- cacheinfo.max_decrement = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading max_decrement failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "epochs_before_eviction", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: epochs_before_eviction");
- return;
- } /* end if */
- cacheinfo.epochs_before_eviction = ENVPTR->GetIntField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading epochs_before_eviction failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_empty_reserve", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: apply_empty_reserve");
- return;
- } /* end if */
- cacheinfo.apply_empty_reserve = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_empty_reserve failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "empty_reserve", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: empty_reserve");
- return;
- } /* end if */
- cacheinfo.empty_reserve = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading empty_reserve failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "dirty_bytes_threshold", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: dirty_bytes_threshold");
- return;
- } /* end if */
- cacheinfo.dirty_bytes_threshold = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading dirty_bytes_threshold failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "metadata_write_strategy", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: metadata_write_strategy");
- return;
- } /* end if */
- cacheinfo.metadata_write_strategy = ENVPTR->GetIntField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading metadata_write_strategy failed");
- } /* end if */
- else {
- status = H5Pset_mdc_config((hid_t)plist, &cacheinfo);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, create_callback, mid, prop_id, create_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (status < 0)
- h5libraryError(env);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config */
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_chunk_cache
- * Signature: (JJJD)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache
- (JNIEnv *env, jclass clss, jlong dapl, jlong rdcc_nslots,
- jlong rdcc_nbytes, jdouble rdcc_w0)
-{
- if (H5Pset_chunk_cache((hid_t)dapl, (size_t)rdcc_nslots, (size_t)rdcc_nbytes, (double) rdcc_w0) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache */
+ return (herr_t)status;
+} /* end H5P_cls_create_cb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_chunk_cache
- * Signature: (J[J[J[D)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
- (JNIEnv *env, jclass clss, jlong dapl, jlongArray rdcc_nslots,
- jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
+static herr_t
+H5P_cls_copy_cb
+ (hid_t new_prop_id, hid_t old_prop_id, void *copy_data)
{
- herr_t status = -1;
- jint mode;
- jdouble *w0Array = (jdouble *)NULL;
- jlong *rdcc_nslotsArray = (jlong *)NULL;
- jlong *nbytesArray = (jlong *)NULL;
- jboolean isCopy;
-
- if (rdcc_w0 != NULL) {
- w0Array = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR rdcc_w0, &isCopy);
- if (w0Array == NULL) {
- h5JNIFatalError(env, "H5Pget_chunk_cache: w0_array array not pinned");
- return;
- } /* end if */
- } /* end else */
-
- if (rdcc_nslots != NULL) {
- rdcc_nslotsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nslots, &isCopy);
- if (rdcc_nslotsArray == NULL) {
- /* exception -- out of memory */
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT);
- } /* end if */
- h5JNIFatalError(env, "H5Pget_chunk_cache: rdcc_nslots array not pinned");
- return;
- } /* end if */
- } /* end else */
-
- if (rdcc_nbytes != NULL) {
- nbytesArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nbytes, &isCopy);
- if (nbytesArray == NULL) {
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT);
- } /* end if */
- if (rdcc_nslotsArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nslots, rdcc_nslotsArray, JNI_ABORT);
- } /* end if */
- h5JNIFatalError(env, "H5Pget_chunk_cache: nbytesArray array not pinned");
- return;
- } /* end if */
- } /* end else */
-
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- long long rdcc_nslots_temp = *(rdcc_nslotsArray);
- size_t rdcc_nslots_t = (size_t)rdcc_nslots_temp;
- long long nbytes_temp = *(nbytesArray);
- size_t nbytes_t = (size_t)nbytes_temp;
-
- status = H5Pget_chunk_cache((hid_t)dapl, &rdcc_nslots_t, &nbytes_t, (double *)w0Array);
-
- *rdcc_nslotsArray = (jlong)rdcc_nslots_t;
- *nbytesArray = (jlong)nbytes_t;
- } /* end direct cast special handling */
-
- if (status < 0) {
- mode = JNI_ABORT;
- } /* end if */
- else {
- mode = 0; /* commit and free */
- } /* end else */
+ jmethodID mid;
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ jint status = -1;
- if (rdcc_nslotsArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nslots, rdcc_nslotsArray, mode);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_cls_copy_cb: failed to attach current thread to JVM");
}
- /* end if */
- if (nbytesArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nbytes, nbytesArray, mode);
- } /* end if */
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, mode);
- } /* end if */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, copy_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (status < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JJLhdf/hdf5lib/callbacks/H5P_cls_copy_func_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_obj_track_times
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times
- (JNIEnv *env, jclass clss, jlong objplid)
-{
- hbool_t track_times;
-
- if (H5Pget_obj_track_times((hid_t)objplid, &track_times) < 0) {
- h5libraryError(env);
- return JNI_FALSE;
- } /* end if */
- if (track_times == 1) {
- return JNI_TRUE;
- } /* end if */
- return JNI_FALSE;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times */
+ status = CBENVPTR->CallIntMethod(CBENVONLY, copy_callback, mid, new_prop_id, old_prop_id, copy_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_obj_track_times
- * Signature: (JZ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times
- (JNIEnv *env, jclass clss, jlong objplid, jboolean track_times)
-{
- hbool_t track;
-
- if (track_times == JNI_TRUE) {
- track = 1;
- } /* end if */
- else {
- track = 0;
- } /* end else */
-
- if (H5Pset_obj_track_times((hid_t)objplid, track) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_char_encoding
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding
- (JNIEnv *env, jclass clss, jlong acpl)
-{
- H5T_cset_t encoding;
-
- if (H5Pget_char_encoding((hid_t)acpl, &encoding) < 0)
- h5libraryError(env);
-
- return encoding;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding */
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_char_encoding
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding
- (JNIEnv *env, jclass clss, jlong acpl, jint encoding)
-{
- if (H5Pset_char_encoding((hid_t)acpl, (H5T_cset_t)encoding) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding */
+ return (herr_t)status;
+} /* end H5P_cls_copy_cb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual
- * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong vspace_id,
- jstring src_file_name, jstring src_dset_name, jlong src_space_id)
+static herr_t
+H5P_cls_close_cb
+ (hid_t prop_id, void *close_data)
{
- herr_t retVal = -1;
- const char *fstr;
- const char *dstr;
-
- PIN_JAVA_STRING_TWO(src_file_name, fstr, src_dset_name, dstr);
- if (fstr != NULL && dstr != NULL) {
- retVal = H5Pset_virtual((hid_t)dcpl_id, (hid_t)vspace_id, fstr, dstr, (hid_t)src_space_id);
-
- UNPIN_JAVA_STRING_TWO(src_file_name, fstr, src_dset_name, dstr);
+ jmethodID mid;
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ jint status = -1;
- if (retVal < 0)
- h5libraryError(env);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_cls_close_cb: failed to attach current thread to JVM");
}
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_count
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count
- (JNIEnv *env, jclass clss, jlong dcpl_id)
-{
- size_t s;
-
- if (H5Pget_virtual_count((hid_t)dcpl_id, &s) < 0)
- h5libraryError(env);
- return (jlong)s;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, close_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_vspace
- * Signature: (JJ)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
-{
- hid_t space_id = -1;
-
- space_id = H5Pget_virtual_vspace((hid_t)dcpl_id, (size_t)index);
- if (space_id < 0)
- h5libraryError(env);
-
- return (jlong)space_id;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_srcspace
- * Signature: (JJ)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
-{
- hid_t space_id = -1;
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_close_func_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- space_id = H5Pget_virtual_srcspace((hid_t)dcpl_id, (size_t)index);
- if (space_id < 0)
- h5libraryError(env);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, close_callback, mid, prop_id, close_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jlong)space_id;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace */
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_filename
- * Signature: (JJ)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
-{
- char *fname;
- ssize_t buf_size;
- ssize_t status;
- jstring str = NULL;
-
- /* get the length of the filename */
- buf_size = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, NULL, 0);
- if (buf_size < 0) {
- h5badArgument( env, "H5Pget_virtual_filename: buf_size < 0");
- } /* end if */
- else if (buf_size >= 0) {
- buf_size++; /* add extra space for the null terminator */
- fname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (fname == NULL) {
- h5outOfMemory( env, "H5Pget_virtual_filename: malloc failed");
- } /* end if */
- else {
- status = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, fname, (size_t)buf_size);
-
- if (status >= 0) {
- str = ENVPTR->NewStringUTF(ENVPAR fname);
- HDfree(fname);
- if (str == NULL)
- h5JNIFatalError( env, "H5Pget_virtual_filename: return string not allocated");
- } /* end if */
- else {
- HDfree(fname);
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else if */
-
- return (jstring)str;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename */
+ return (herr_t)status;
+} /* end H5P_cls_close_cb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_dsetname
- * Signature: (JJ)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
+static herr_t
+H5P_prp_create_cb
+ (const char *name, size_t size, void *value)
{
- char *dname;
- ssize_t buf_size;
- ssize_t status;
- jstring str = NULL;
-
- /* get the length of the filename */
- buf_size = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, NULL, 0);
- if (buf_size < 0) {
- h5badArgument( env, "H5Pget_virtual_dsetname: buf_size < 0");
- } /* end if */
- else if (buf_size > 0) {
- buf_size++; /* add extra space for the null terminator */
- dname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (dname == NULL) {
- h5outOfMemory( env, "H5Pget_virtual_dsetname: malloc failed");
- } /* end if */
- else {
- status = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, dname, (size_t)buf_size);
-
- if (status >= 0) {
- str = ENVPTR->NewStringUTF(ENVPAR dname);
- HDfree(dname);
- if (str == NULL)
- h5JNIFatalError( env, "H5Pget_virtual_dsetname: return string not allocated");
- } /* end if */
- else {
- HDfree(dname);
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else if */
- return (jstring)str;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname */
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_view
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view
- (JNIEnv *env, jclass clss, jlong dapl_id)
-{
- H5D_vds_view_t virtual_view;
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_create_cb: failed to attach current thread to JVM");
+ }
- if (H5Pget_virtual_view((hid_t)dapl_id, &virtual_view) < 0)
- h5libraryError(env);
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, create_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jint)virtual_view;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(Ljava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual_view
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view
- (JNIEnv *env, jclass clss, jlong dapl_id, jint view)
-{
- if (H5Pset_virtual_view((hid_t)dapl_id, (H5D_vds_view_t)view) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view */
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_printf_gap
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap
- (JNIEnv *env, jclass clss, jlong dapl_id)
-{
- hsize_t gap_size;
+ status = CBENVPTR->CallIntMethod(CBENVONLY, create_callback, mid, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (H5Pget_virtual_printf_gap((hid_t)dapl_id, &gap_size) < 0)
- h5libraryError(env);
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- return (jlong)gap_size;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap */
+ return (herr_t)status;
+} /* end H5P_prp_create_cb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual_printf_gap
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
- (JNIEnv *env, jclass clss, jlong dapl_id, jlong gap_size)
+static herr_t
+H5P_prp_set_cb
+ (hid_t prop_id, const char *name, size_t size, void *value)
{
- if (H5Pset_virtual_printf_gap((hid_t)dapl_id, (hsize_t)gap_size) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap */
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy
- * Signature: (J[Z[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
- (JNIEnv *env, jclass clss, jlong fcpl_id, jbooleanArray persist, jlongArray threshold)
-{
- herr_t status = -1;
- H5F_fspace_strategy_t thestrategy = H5F_FSPACE_STRATEGY_FSM_AGGR; /* Library default */
- jlong *thethresholdArray = NULL;
- jboolean *thepersistArray = NULL;
- jboolean isCopy;
-
- if (persist) {
- thepersistArray = (jboolean*)ENVPTR->GetBooleanArrayElements(ENVPAR persist, &isCopy);
- if (thepersistArray == NULL) {
- h5JNIFatalError(env, "H5Pget_file_space: persist not pinned");
- return -1;
- }
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_set_cb: failed to attach current thread to JVM");
}
- if (threshold) {
- thethresholdArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR threshold, &isCopy);
- if (thethresholdArray == NULL) {
- if (persist) ENVPTR->ReleaseBooleanArrayElements(ENVPAR persist, thepersistArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_file_space: threshold not pinned");
- return -1;
- } /* end if */
- } /* end if */
-
- status = H5Pget_file_space_strategy((hid_t)fcpl_id, &thestrategy, (hbool_t*)thepersistArray, (hsize_t*)thethresholdArray);
-
- if (status < 0) {
- if (persist) ENVPTR->ReleaseBooleanArrayElements(ENVPAR persist, thepersistArray, JNI_ABORT);
- if (threshold) ENVPTR->ReleaseLongArrayElements(ENVPAR threshold, thethresholdArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- if (persist) ENVPTR->ReleaseBooleanArrayElements(ENVPAR persist, thepersistArray, 0);
- if (threshold) ENVPTR->ReleaseLongArrayElements(ENVPAR threshold, thethresholdArray, 0);
- } /* end else */
- return (jint)thestrategy;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy_persist
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
- (JNIEnv *env, jclass clss, jlong fcpl_id)
-{
- herr_t status = -1;
- hbool_t thepersist = FALSE;
-
- status = H5Pget_file_space_strategy((hid_t)fcpl_id, NULL, &thepersist, NULL);
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, set_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (status < 0)
- h5libraryError(env);
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jboolean)thepersist;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist */
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy_threshold
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
- (JNIEnv *env, jclass clss, jlong fcpl_id)
-{
- herr_t status = -1;
- hsize_t thethreshold;
-
- status = H5Pget_file_space_strategy((hid_t)fcpl_id, NULL, NULL, &thethreshold);
-
- if (status < 0)
- h5libraryError(env);
-
- return (jlong)thethreshold;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1threshold */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_file_space_strategy
- * Signature: (JIZJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint strategy, jboolean persist, jlong threshold)
-{
- if (H5Pset_file_space_strategy((hid_t)fcpl_id, (H5F_fspace_strategy_t)strategy, (hbool_t)persist, (hsize_t)threshold) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_file_space_strategy */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_file_space_page_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
- (JNIEnv *env, jclass clss, jlong fcpl_id, jlong fsp_size)
-{
- if (H5Pset_file_space_page_size((hid_t)fcpl_id, (hsize_t)fsp_size) < 0)
- h5libraryError(env);
-}
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_page_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
- (JNIEnv *env, jclass clss, jlong fcpl_id)
-{
- hsize_t fsp_size = 0;
- if (H5Pget_file_space_page_size((hid_t)fcpl_id, &fsp_size) < 0)
- h5libraryError(env);
- return (jlong)fsp_size;
-}
+ status = CBENVPTR->CallIntMethod(CBENVONLY, set_callback, mid, prop_id, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-static herr_t
-H5P_cls_create_cb
- (hid_t prop_id, void *create_data)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR create_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_create_func_t;)I");
- if (mid != 0) {
- /* fprintf(stderr, "JNI H5P_cls_create_func_cb execute\n"); fflush(stderr); */
- status = CBENVPTR->CallIntMethod(CBENVPAR create_callback, mid, prop_id, create_data);
- /* fprintf(stderr, "\nJNI H5P_cls_create_func_cb status: %d\n", status); fflush(stderr); */
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5P_cls_create_cb */
+} /* end H5P_prp_set_cb */
static herr_t
-H5P_cls_copy_cb
- (hid_t new_prop_id, hid_t old_prop_id, void *copy_data)
+H5P_prp_get_cb
+ (hid_t prop_id, const char *name, size_t size, void *value)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
jmethodID mid;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR copy_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JJLhdf/hdf5lib/callbacks/H5P_cls_copy_func_t;)I");
- if (mid != 0) {
- status = CBENVPTR->CallIntMethod(CBENVPAR copy_callback, mid, new_prop_id, old_prop_id, copy_data);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_cls_ccopy_cb */
-
-static herr_t
-H5P_cls_close_cb
- (hid_t prop_id, void *close_data)
-{
- JNIEnv *cbenv;
- jint status = -1;
+ jstring str;
jclass cls;
- jmethodID mid;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR close_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_close_func_t;)I");
- if (mid != 0) {
- status = CBENVPTR->CallIntMethod(CBENVPAR close_callback, mid, prop_id, close_data);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_cls_close_cb */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_mdc_log_options
- * Signature: (JZLjava/lang/String;Z)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
- (JNIEnv *env, jclass clss, jlong fapl_id, jboolean is_enabled, jstring location, jboolean start_on_access)
-{
- herr_t retVal = -1;
- const char *lstr;
-
- PIN_JAVA_STRING(location, lstr);
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (hbool_t)is_enabled, lstr, (hbool_t)start_on_access);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_get_cb: failed to attach current thread to JVM");
+ }
- UNPIN_JAVA_STRING(location, lstr);
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, get_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (retVal < 0) {
- h5libraryError(env);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_mdc_log_options
- * Signature: (J[Z)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
- (JNIEnv *env, jclass clss, jlong fapl_id, jbooleanArray mdc_log_options)
-{
- hbool_t is_enabled;
- hbool_t start_on_access;
- jboolean *mdc_log_options_ptr;
- char *lname;
- size_t location_size;
- ssize_t status;
- jstring str = NULL;
- jint size;
- jboolean isCopy;
-
- if (mdc_log_options == NULL) {
- h5nullArgument(env, "H5Fget_mdc_log_options: mdc_log_options is NULL");
- } /* end if */
- else {
- size = (int)ENVPTR->GetArrayLength(ENVPAR mdc_log_options);
- if (size < 2) {
- h5badArgument(env, "H5Fget_mdc_log_options: length of mdc_log_options < 2.");
- } /* end if */
- else {
- /* get the length of the filename */
- H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, NULL, &location_size, &start_on_access);
- if (location_size == 0) {
- h5badArgument(env, "H5Pget_mdc_log_options: location_size is 0");
- }/* end if */
- else if (location_size > 0) {
- location_size++; /* add extra space for the null terminator */
- lname = (char *)HDmalloc(sizeof(char) * location_size);
- if (lname == NULL) {
- h5outOfMemory(env, "H5Pget_mdc_log_options: malloc failed");
- } /* end if */
- else {
- status = H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, lname, &location_size, &start_on_access);
-
- if (status < 0) {
- HDfree(lname);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR lname);
- HDfree(lname);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Pget_mdc_log_options: return string not allocated");
- } /* end if */
- else {
- mdc_log_options_ptr = ENVPTR->GetBooleanArrayElements(ENVPAR mdc_log_options, &isCopy);
- mdc_log_options_ptr[0] = (jboolean)is_enabled;
- mdc_log_options_ptr[1] = (jboolean)start_on_access;
- ENVPTR->ReleaseBooleanArrayElements(ENVPAR mdc_log_options, mdc_log_options_ptr, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else if*/
- } /* end else */
- } /* end else */
-
- return (jstring)str;
-} /* end if */
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-static herr_t
-H5D_append_cb
- (hid_t dataset_id, hsize_t *cur_dims, void *op_data)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jlongArray cur_dimsArray;
+ status = CBENVPTR->CallIntMethod(CBENVONLY, get_callback, mid, prop_id, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
+done:
+ if (cbenv)
JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(J[JLhdf/hdf5lib/callbacks/H5D_append_t;)I");
- if (mid != 0) {
- if (cur_dims != NULL) {
- cur_dimsArray = CBENVPTR->NewLongArray(CBENVPAR 2);
- if (cur_dimsArray != NULL) {
- CBENVPTR->SetLongArrayRegion(CBENVPAR cur_dimsArray, 0, 2, (const jlong *)cur_dims);
-
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, dataset_id, cur_dims, op_data);
- }
- }
- }
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5D_append_cb */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_append_flush
- * Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-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;
-
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
-
- if (op_data == NULL) {
- h5nullArgument(env, "H5Ovisit: op_data is NULL");
- } /* end if */
- else if (callback_op == NULL) {
- h5nullArgument(env, "H5Ovisit: 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);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1append_1flush */
+} /* end H5P_prp_get_cb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pcreate_class_nocb
- * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
- (JNIEnv *env, jclass clss, jlong parent_class, jstring name)
+static herr_t
+H5P_prp_delete_cb
+ (hid_t prop_id, const char *name, size_t size, void *value)
{
- hid_t class_id = -1;
- const char *cstr;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- class_id = H5Pcreate_class((hid_t)parent_class, cstr, NULL, NULL, NULL, NULL, NULL, NULL);
-
- UNPIN_JAVA_STRING(name, cstr);
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- if (class_id < 0)
- h5libraryError(env);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_delete_cb: failed to attach current thread to JVM");
}
- return (jlong)class_id;
-} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pcreate_class
- * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class
- (JNIEnv *env, jclass clss, jlong parent_class, jstring name, jobject create_op,
- jobject create_data, jobject copy_op, jobject copy_data, jobject close_op, jobject close_data)
-{
- hid_t class_id = -1;
- const char *cstr;
- copy_callback = copy_op;
- close_callback = close_op;
- create_callback = create_op;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- class_id = H5Pcreate_class((hid_t)parent_class, cstr, (H5P_cls_create_func_t)H5P_cls_create_cb, (void*) create_data,
- (H5P_cls_copy_func_t)H5P_cls_copy_cb, (void*) copy_data, (H5P_cls_close_func_t)H5P_cls_close_cb, (void*) close_data);
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, delete_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (class_id < 0)
- h5libraryError(env);
- }
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jlong)class_id;
-} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class */
+ status = CBENVPTR->CallIntMethod(CBENVONLY, delete_callback, mid, prop_id, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-static herr_t
-H5P_prp_create_cb
- (const char *name, size_t size, void *value)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR create_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR create_callback, mid, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5P_prp_create_cb */
+} /* end H5P_prp_delete_cb */
static herr_t
H5P_prp_copy_cb
(const char *name, size_t size, void *value)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
jmethodID mid;
jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR copy_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR copy_callback, mid, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_prp_copy_cb */
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_copy_cb: failed to attach current thread to JVM");
+ }
-static herr_t
-H5P_prp_close_cb
- (const char *name, size_t size, void *value)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, copy_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(Ljava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, copy_callback, mid, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR close_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR close_callback, mid, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5P_prp_close_cb */
+} /* end H5P_prp_copy_cb */
static int
H5P_prp_compare_cb
(void *value1, void *value2, size_t size)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
jmethodID mid;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR compare_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "([B[BJ)I");
- if (mid != 0) {
- status = CBENVPTR->CallIntMethod(CBENVPAR compare_callback, mid, value1, value2, size);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_prp_compare_cb */
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_compare_cb: failed to attach current thread to JVM");
+ }
-static herr_t
-H5P_prp_get_cb
- (hid_t prop_id, const char *name, size_t size, void *value)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, compare_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR get_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR get_callback, mid, prop_id, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_prp_get_cb */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "([B[BJ)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-static herr_t
-H5P_prp_set_cb
- (hid_t prop_id, const char *name, size_t size, void *value)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
+ status = CBENVPTR->CallIntMethod(CBENVONLY, compare_callback, mid, value1, value2, size);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR set_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR set_callback, mid, prop_id, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5P_prp_set_cb */
+} /* end H5P_prp_compare_cb */
static herr_t
-H5P_prp_delete_cb
- (hid_t prop_id, const char *name, size_t size, void *value)
+H5P_prp_close_cb
+ (const char *name, size_t size, void *value)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
jmethodID mid;
jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR delete_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR delete_callback, mid, prop_id, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_prp_delete_cb */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pregister2_nocb
- * Signature: (JLjava/lang/String;J[B)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value)
-{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy2;
- const char *cstr;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2);
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Pregister2: buf not pinned");
- } /* end if */
- else {
- status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, cstr);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_close_cb: failed to attach current thread to JVM");
}
-} /* end Java_hdf_hdf5lib_H5_H5Pregister2_1nocb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pregister2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
- jbyteArray def_value, jobject prp_create, jobject prp_set, jobject prp_get, jobject prp_delete,
- jobject prp_copy, jobject prp_cmp, jobject prp_close)
-{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy2;
- const char *cstr;
- copy_callback = prp_copy;
- close_callback = prp_close;
- create_callback = prp_create;
- compare_callback = prp_cmp;
- set_callback = prp_set;
- get_callback = prp_get;
- delete_callback = prp_delete;
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, close_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2);
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Pregister2: buf not pinned");
- } /* end if */
- else {
- status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, (H5P_prp_create_func_t)H5P_prp_create_cb,
- (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb,
- (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, cstr);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pregister2 */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(Ljava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pinsert2_nocb
- * Signature: (JLjava/lang/String;J[B)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value)
-{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy2;
- const char *cstr;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2);
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Pinsert2: buf not pinned");
- } /* end if */
- else {
- status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, NULL, NULL, NULL, NULL, NULL, NULL);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, cstr);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, close_callback, mid, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pinsert2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
- jbyteArray def_value, jobject prp_set, jobject prp_get, jobject prp_delete,
- jobject prp_copy, jobject prp_cmp, jobject prp_close)
-{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy2;
- const char *cstr;
- copy_callback = prp_copy;
- close_callback = prp_close;
- compare_callback = prp_cmp;
- set_callback = prp_set;
- get_callback = prp_get;
- delete_callback = prp_delete;
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2);
- if (buffP == NULL) {
- UNPIN_JAVA_STRING(name, cstr);
- h5JNIFatalError(env, "H5Pinsert2: buf not pinned");
- } /* end if */
- else {
- status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP,
- (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb,
- (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, cstr);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */
+ return (herr_t)status;
+} /* end H5P_prp_close_cb */
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;
+ jmethodID mid;
+ jobject visit_callback = wrapper->visit_callback;
+ jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ void *op_data = (void *) wrapper->op_data;
+ jint status = -1;
- /* fprintf(stderr, "\nJNI H5P_iterate_cb entered\n"); fflush(stderr); */
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
- /* fprintf(stderr, "\nJNI H5P_iterate_cb error: AttachCurrentThread failed\n"); fflush(stderr); */
- JVMPTR->DetachCurrentThread(JVMPAR);
- } /* end if */
- else {
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls == 0) {
- /* fprintf(stderr, "\nJNI H5P_iterate_cb error: GetObjectClass failed\n"); fflush(stderr); */
- JVMPTR->DetachCurrentThread(JVMPAR);
- } /* end if */
- else {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/callbacks/H5P_iterate_t;)I");
- if (mid == 0) {
- /* fprintf(stderr, "\nJNI H5P_iterate_cb error: GetMethodID failed\n"); fflush(stderr); */
- JVMPTR->DetachCurrentThread(JVMPAR);
- } /* end if */
- else {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
-
- /* fprintf(stderr, "JNI H5P_iterate_cb execute\n"); fflush(stderr); */
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, prop_id, str, op_data);
- /* fprintf(stderr, "\nJNI H5P_iterate_cb status: %d\n", status); fflush(stderr); */
- } /* end else */
- } /* end else */
- } /* end else */
-
- JVMPTR->DetachCurrentThread(JVMPAR);
- /* fprintf(stderr, "\nJNI H5P_iterate_cb leave\n"); fflush(stderr); */
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void**)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_iterate_cb: failed to attach current thread to JVM");
+ }
- return status;
-} /* end H5P_iterate_cb */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Piterate
- * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Piterate
- (JNIEnv *env, jclass clss, jlong prop_id, jintArray idx, jobject callback_op, jobject op_data)
-{
- herr_t status = -1;
- jint *theArray = NULL;
- jboolean isCopy;
-
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- visit_callback = callback_op;
-
- if (op_data == NULL) {
- h5nullArgument(env, "H5Piterate: op_data is NULL");
- } /* end if */
- else if (callback_op == NULL) {
- h5nullArgument(env, "H5Piterate: callback_op is NULL");
- } /* end else if */
- else {
- if (idx == NULL) {
- status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)op_data);
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR idx, &isCopy);
- if (theArray == NULL) {
- 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);
- } /* end else */
-
- if (status < 0) {
- if(idx)
- ENVPTR->ReleaseIntArrayElements(ENVPAR idx, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else if (idx)
- ENVPTR->ReleaseIntArrayElements(ENVPAR idx, theArray, 0);
- } /* end else */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/callbacks/H5P_iterate_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Piterate */
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_metadata_read_attempts
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
- (JNIEnv *env, jclass clss, jlong plist_id)
-{
- unsigned attempts;
- if (H5Pget_metadata_read_attempts((hid_t)plist_id, &attempts) < 0)
- h5libraryError(env);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, prop_id, str, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jlong) attempts;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts */
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_metadata_read_attempts
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
- (JNIEnv *env, jclass clss, jlong plist_id, jlong attempts)
-{
- if (attempts <= 0) {
- h5badArgument(env, "H5Pset_metadata_read_attempts: attempts <= 0");
- } /* end if */
- else {
- if(H5Pset_metadata_read_attempts((hid_t)plist_id, (unsigned)attempts) < 0)
- h5libraryError(env);
- } /* end else */
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts */
+ return status;
+} /* end H5P_iterate_cb */
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h
index d413f69..8318be4 100644
--- a/java/src/jni/h5pImp.h
+++ b/java/src/jni/h5pImp.h
@@ -11,12 +11,13 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <jni.h>
/* Header for class hdf_hdf5lib_H5_H5_H5P */
#ifndef _Included_hdf_hdf5lib_H5_H5P
#define _Included_hdf_hdf5lib_H5_H5P
+#include <jni.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -32,15 +33,6 @@ Java_hdf_hdf5lib_H5__1H5Pcreate
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pclose
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Pclose
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
* Method: H5Pget_class
* Signature: (J)J
*/
@@ -59,579 +51,74 @@ Java_hdf_hdf5lib_H5__1H5Pcopy
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_version
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1version
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_userblock
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1userblock
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_userblock
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1userblock
-(JNIEnv *, jclass, jlong, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sizes
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sizes
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sizes
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sizes
-(JNIEnv *, jclass, jlong, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sym_k
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sym_1k
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sym_k
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sym_1k
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_istore_k
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1istore_1k
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_istore_k
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1istore_1k
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_layout
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1layout
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_layout
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1layout
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_chunk
- * Signature: (JI[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk
-(JNIEnv *, jclass, jlong, jint, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_chunk
- * Signature: (JI[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk
-(JNIEnv *, jclass, jlong, jint, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_alignment
- * Signature: (JJJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alignment
-(JNIEnv *, jclass, jlong, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_alignment
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alignment
-(JNIEnv *, jclass, jlong, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_external
- * Signature: (JLjava/lang/String;JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1external
-(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_external_count
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external_1count
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_external
- * Signature: (JIJ[Ljava/lang/String;[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external
-(JNIEnv *, jclass, jlong, jint, jlong, jobjectArray, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fill_value
- * Signature: (JJ[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1value
-(JNIEnv *, jclass, jlong, jlong, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fill_value
- * Signature: (JJ[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1value
-(JNIEnv *, jclass, jlong, jlong, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_filter
- * Signature: (JIIJ[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1filter
-(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_nfilters
+ * Method: H5Pclose
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nfilters
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter
- * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_driver
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1driver
+Java_hdf_hdf5lib_H5__1H5Pclose
(JNIEnv *, jclass, jlong);
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_cache
- * Signature: (JIJJD)I
+ * TODO: H5Pencode
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1cache
-(JNIEnv *, jclass, jlong, jint, jlong, jlong, jdouble);
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_cache
- * Signature: (J[I[J[J[D)I
+ * TODO: H5Pdecode
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1cache
-(JNIEnv *, jclass, jlong, jintArray, jlongArray, jlongArray, jdoubleArray);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_buffer
- * Signature: (JJ[B[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer
-(JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_buffer
- * Signature: (J[B[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer
-(JNIEnv *, jclass, jlong, jbyteArray, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_buffer_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_buffer_size
- * Signature: (J)J
+ * Method: _H5Pcreate_class
+ * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_preserve
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1preserve
-(JNIEnv *, jclass, jlong, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_preserve
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1preserve
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_deflate
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1deflate
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_gc_references
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1gc_1references
-(JNIEnv *, jclass, jlong, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_gc_references
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1gc_1references
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_btree_ratios
- * Signature: (JDDD)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios
-(JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_btree_ratios
- * Signature: (J[D[D[D)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios
-(JNIEnv *, jclass, jlong, jdoubleArray, jdoubleArray, jdoubleArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_small_data_block_size
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size
-(JNIEnv *, jclass, jlong, jlong);
+Java_hdf_hdf5lib_H5__1H5Pcreate_1class
+ (JNIEnv*, jclass, jlong, jstring, jobject, jobject, jobject, jobject, jobject, jobject);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_small_data_block_size
- * Signature: (J)J
+ * Method: _H5Pcreate_class_nocb
+ * Signature: (JLjava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_alloc_time
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_alloc_time
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fill_time
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1time
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fill_time
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1time
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pfill_value_defined
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fletcher32
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fletcher32
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_edc_check
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1edc_1check
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_edc_check
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1edc_1check
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shuffle
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shuffle
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_szip
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1szip
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_hyper_vector_size
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_hyper_vector_size
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size
-(JNIEnv *, jclass, jlong, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pall_filters_avail
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pmodify_filter
- * Signature: (JIIJ[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pmodify_1filter
-(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter_by_id
- * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fclose_degree
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fclose_degree
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_family
- * Signature: (JJJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family
-(JNIEnv *, jclass, jlong, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_family
- * Signature: (J[J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
-(JNIEnv *, jclass, jlong, jlongArray, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_core
- * Signature: (JJZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core
-(JNIEnv *, jclass, jlong, jlong, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_core
- * Signature: (J[J[Z)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
-(JNIEnv *, jclass, jlong, jlongArray, jbooleanArray);
+Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
+ (JNIEnv*, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_family_offset
- * Signature: (JJ)I
+ * Method: H5Pregister2
+ * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1family_1offset
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pregister2
+ (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject, jobject);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_family_offset
- * Signature: (J)J
+ * Method: H5Pregister2_nocb
+ * Signature: (JLjava/lang/String;J[B)V
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1family_1offset
-(JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
+ (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_log
- * Signature: (JLjava/lang/String;JJ)V
+ * Method: H5Pinsert2
+ * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
-(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
+Java_hdf_hdf5lib_H5_H5Pinsert2
+ (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Premove_filter
- * Signature: (JI)I
+ * Method: H5Pinsert2_nocb
+ * Signature: (JLjava/lang/String;J[B)V
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5P1remove_1filter
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
+ (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
@@ -716,6 +203,15 @@ Java_hdf_hdf5lib_H5_H5Pequal
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Piterate
+ * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Piterate
+ (JNIEnv*, jclass, jlong, jintArray, jobject, jobject);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Pcopy_prop
* Signature: (JJLjava/lang/String;)I
*/
@@ -750,800 +246,6 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Pclose_1class
(JNIEnv *, jclass, jlong);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter2
- * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter2
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter_by_id2
- * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_nlinks
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nlinks
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_nlinks
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nlinks
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_libver_bounds
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_libver_bounds
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_link_creation_order
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_link_creation_order
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_attr_creation_order
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_attr_creation_order
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_copy_object
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1copy_1object
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_copy_object
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1copy_1object
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_create_intermediate_group
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group
-(JNIEnv *, jclass, jlong, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_create_intermediate_group
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_data_transform
- * Signature: (JLjava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1data_1transform
-(JNIEnv *, jclass, jlong, jstring);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_data_transform
- * Signature: (J[Ljava/lang/String;J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
-(JNIEnv *, jclass, jlong, jobjectArray, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_acc_flags
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_acc_flags
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_link_phase_change
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_link_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_attr_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_attr_phase_change
- * Signature: (JII)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_phase_change
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_nindexes
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_nindexes
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_index
- * Signature: (JIII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
-(JNIEnv *, jclass, jlong, jint, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_index
- * Signature: (JI[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index
-(JNIEnv *, jclass, jlong, jint, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_local_heap_size_hint
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_local_heap_size_hint
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_nbit
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nbit
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_scaleoffset
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_est_link_info
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_est_link_info
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_fapl
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pget_elink_fapl
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_prefix
- * Signature: (JLjava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix
-(JNIEnv *, jclass, jlong, jstring);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_prefix
- * Signature: (J[Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
-(JNIEnv *, jclass, jlong, jobjectArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_direct
- * Signature: (JJJJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct
-(JNIEnv *, jclass, jlong, jlong, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_direct
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct
-(JNIEnv *, jclass, jlong, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_sec2
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_stdio
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_windows
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_muti
- * Signature: (J[I[J[Ljava/lang/String;[J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
-(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_muti
- * Signature: (J[I[J[Ljava/lang/String;[JZ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
-(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_split
- * Signature: (JLjava/lang/String;JLjava/lang/String;J)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
-(JNIEnv *, jclass, jlong, jstring, jlong, jstring, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_meta_block_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_meta_block_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sieve_buf_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sieve_buf_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_file_cache_size
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_file_cache_size
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size
-(JNIEnv *, jclass, jlong);
-
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_mdc_config
- * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t;
- */
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_mdc_config
- * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
-(JNIEnv *, jclass, jlong, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_chunk_cache
- * Signature: (JJJD)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache
-(JNIEnv *, jclass, jlong, jlong, jlong, jdouble);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_chunk_cache
- * Signature: (J[J[J[D)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
-(JNIEnv *, jclass, jlong, jlongArray, jlongArray, jdoubleArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_obj_track_times
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_obj_track_times
- * Signature: (JZ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times
-(JNIEnv *, jclass, jlong, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_char_encoding
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_char_encoding
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual
- * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual
-(JNIEnv *, jclass, jlong, jlong, jstring, jstring, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_count
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_vspace
- * Signature: (JJ)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_srcspace
- * Signature: (JJ)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_filename
- * Signature: (JJ)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_dsetname
- * Signature: (JJ)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_view
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual_view
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_printf_gap
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual_printf_gap
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy
- * Signature: (J[Z[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
-(JNIEnv *, jclass, jlong, jbooleanArray, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy_persist
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy_threshold
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_file_space_strategy
- * Signature: (JIZJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
-(JNIEnv *, jclass, jlong, jint, jboolean, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_page_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_file_space_page_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_mdc_log_options
- * Signature: (JZLjava/lang/String;Z)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
-(JNIEnv *, jclass, jlong, jboolean, jstring, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_mdc_log_options
- * Signature: (J[Z)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
-(JNIEnv *, jclass, jlong, jbooleanArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_append_flush
- * Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
- (JNIEnv*, jclass, jlong, jint, jlongArray, jobject, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pcreate_class_nocb
- * Signature: (JLjava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
- (JNIEnv*, jclass, jlong, jstring);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pcreate_class
- * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class
- (JNIEnv*, jclass, jlong, jstring, jobject, jobject, jobject, jobject, jobject, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pregister2_nocb
- * Signature: (JLjava/lang/String;J[B)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pregister2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pinsert2_nocb
- * Signature: (JLjava/lang/String;J[B)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pinsert2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Piterate
- * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Piterate
- (JNIEnv*, jclass, jlong, jintArray, jobject, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_metadata_read_attempts
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
-(JNIEnv *, jclass, jlong);
-
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_metadata_read_attempts
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
-(JNIEnv *, jclass, jlong, jlong);
-
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5pLAPLImp.c b/java/src/jni/h5pLAPLImp.c
new file mode 100644
index 0000000..754bece
--- /dev/null
+++ b/java/src/jni/h5pLAPLImp.c
@@ -0,0 +1,240 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pLAPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_nlinks
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1nlinks
+ (JNIEnv *env, jclass clss, jlong lapl_id, jlong nlinks)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (nlinks <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_nlinks: nlinks <= 0");
+
+ if ((retVal = H5Pset_nlinks((hid_t)lapl_id, (size_t)nlinks)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1nlinks */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_nlinks
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1nlinks
+ (JNIEnv *env, jclass clss, jlong lapl_id)
+{
+ size_t nlinks = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_nlinks((hid_t)lapl_id, &nlinks) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong) nlinks;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1nlinks */
+
+/*
+ * TODO: H5Pset_elink_cb
+ */
+
+/*
+ * TODO: H5Pget_elink_cb
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_prefix
+ * Signature: (JLjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix
+ (JNIEnv *env, jclass clss, jlong lapl_id, jstring prefix)
+{
+ const char *linkPrefix = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == prefix)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_elink_prefix: prefix is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, prefix, linkPrefix, NULL, "H5Pset_elink_prefix: link prefix not pinned");
+
+ if ((retVal = H5Pset_elink_prefix((hid_t)lapl_id, linkPrefix)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (linkPrefix)
+ UNPIN_JAVA_STRING(ENVONLY, prefix, linkPrefix);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_prefix
+ * Signature: (J[Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
+ (JNIEnv *env, jclass clss, jlong lapl_id, jobjectArray prefix)
+{
+ ssize_t prefix_size = -1;
+ size_t size = 0;
+ char *pre = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == prefix)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_elink_prefix: prefix is NULL");
+
+ if ((prefix_size = H5Pget_elink_prefix((hid_t)lapl_id, (char *)NULL, size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t) prefix_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_elink_prefix: memory allocation failed");
+
+ if (H5Pget_elink_prefix((hid_t)lapl_id, (char *)pre, (size_t) prefix_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ pre[prefix_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Pget_elink_prefix: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, prefix, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (pre)
+ HDfree(pre);
+
+ return (jlong)prefix_size;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_fapl
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl
+ (JNIEnv *env, jclass clss, jlong lapl_id, jlong fapl_id)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_elink_fapl((hid_t)lapl_id, (hid_t)fapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: _H5Pget_elink_fapl
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl
+ (JNIEnv *env, jclass clss, jlong lapl_id)
+{
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_elink_fapl((hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)retVal;
+} /* end Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_acc_flags
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags
+ (JNIEnv *env, jclass clss, jlong lapl_id, jint flags)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_elink_acc_flags((hid_t)lapl_id, (unsigned)flags)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint) retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_acc_flags
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags
+ (JNIEnv *env, jclass clss, jlong lapl_id)
+{
+ unsigned flags;
+
+ UNUSED(clss);
+
+ if (H5Pget_elink_acc_flags((hid_t)lapl_id, &flags) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)flags;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pLAPLImp.h b/java/src/jni/h5pLAPLImp.h
new file mode 100644
index 0000000..8efcfb5
--- /dev/null
+++ b/java/src/jni/h5pLAPLImp.h
@@ -0,0 +1,107 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PLAPL
+#define _Included_hdf_hdf5lib_H5_H5PLAPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_nlinks
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1nlinks
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_nlinks
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1nlinks
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pset_elink_cb
+ */
+
+/*
+ * TODO: H5Pget_elink_cb
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_prefix
+ * Signature: (JLjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix
+(JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_prefix
+ * Signature: (J[Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
+(JNIEnv *, jclass, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_fapl
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: _H5Pget_elink_fapl
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_acc_flags
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_acc_flags
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags
+(JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PLAPL */
diff --git a/java/src/jni/h5pLCPLImp.c b/java/src/jni/h5pLCPLImp.c
new file mode 100644
index 0000000..7c79796
--- /dev/null
+++ b/java/src/jni/h5pLCPLImp.c
@@ -0,0 +1,36 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pLCPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pLCPLImp.h b/java/src/jni/h5pLCPLImp.h
new file mode 100644
index 0000000..009d1b4
--- /dev/null
+++ b/java/src/jni/h5pLCPLImp.h
@@ -0,0 +1,27 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PLCPL
+#define _Included_hdf_hdf5lib_H5_H5PLCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PLCPL */
diff --git a/java/src/jni/h5pOCPLImp.c b/java/src/jni/h5pOCPLImp.c
new file mode 100644
index 0000000..241842e
--- /dev/null
+++ b/java/src/jni/h5pOCPLImp.c
@@ -0,0 +1,211 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pOCPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_create_intermediate_group
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group
+ (JNIEnv *env, jclass clss, jlong lcpl_id, jboolean crt_intermed_group)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_create_intermediate_group((hid_t)lcpl_id, (unsigned)crt_intermed_group)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_create_intermediate_group
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group
+ (JNIEnv *env, jclass clss, jlong lcpl_id)
+{
+ unsigned crt_intermed_group = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_create_intermediate_group((hid_t)lcpl_id, &crt_intermed_group) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jboolean)crt_intermed_group;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_obj_track_times
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times
+ (JNIEnv *env, jclass clss, jlong objplid, jboolean track_times)
+{
+ hbool_t track = FALSE;
+
+ UNUSED(clss);
+
+ track = (JNI_TRUE == track_times) ? 1 : 0;
+
+ if (H5Pset_obj_track_times((hid_t)objplid, track) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_obj_track_times
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times
+ (JNIEnv *env, jclass clss, jlong objplid)
+{
+ hbool_t track_times = FALSE;
+ jboolean retVal = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (H5Pget_obj_track_times((hid_t)objplid, &track_times) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ retVal = (track_times == TRUE) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_attr_phase_change
+ * Signature: (JII)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change
+ (JNIEnv *env, jclass clss, jlong ocpl_id, jint max_compact, jint min_dense)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_attr_phase_change((hid_t)ocpl_id, (unsigned)max_compact, (unsigned)min_dense)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_attr_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change
+ (JNIEnv *env, jclass clss, jlong ocpl_id, jintArray attributes)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == attributes)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_attr_phase_change: attributes is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, attributes, theArray, &isCopy, "H5Pget_attr_phase_change: input not pinned");
+
+ if ((retVal = H5Pget_attr_phase_change((hid_t)ocpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, attributes, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_attr_creation_order
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order
+ (JNIEnv *env, jclass clss, jlong ocpl_id, jint crt_order_flags)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_attr_creation_order((hid_t)ocpl_id, (unsigned)crt_order_flags)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_attr_creation_order
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order
+ (JNIEnv *env, jclass clss, jlong ocpl_id)
+{
+ unsigned crt_order_flags = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_attr_creation_order((hid_t)ocpl_id, &crt_order_flags) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)crt_order_flags;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pOCPLImp.h b/java/src/jni/h5pOCPLImp.h
new file mode 100644
index 0000000..fe01f06
--- /dev/null
+++ b/java/src/jni/h5pOCPLImp.h
@@ -0,0 +1,99 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5POCPL
+#define _Included_hdf_hdf5lib_H5_H5POCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_create_intermediate_group
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group
+(JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_create_intermediate_group
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_obj_track_times
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times
+(JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_obj_track_times
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_attr_phase_change
+ * Signature: (JII)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_attr_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_attr_creation_order
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_attr_creation_order
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order
+(JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5POCPL */
diff --git a/java/src/jni/h5pOCpyPLImp.c b/java/src/jni/h5pOCpyPLImp.c
new file mode 100644
index 0000000..9481f91
--- /dev/null
+++ b/java/src/jni/h5pOCpyPLImp.c
@@ -0,0 +1,92 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pOCpyPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_copy_object
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1copy_1object
+ (JNIEnv *env, jclass clss, jlong ocp_plist_id, jint copy_options)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_copy_object((hid_t)ocp_plist_id, (unsigned)copy_options)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1copy_1object */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_copy_object
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1copy_1object
+ (JNIEnv *env, jclass clss, jlong ocp_plist_id)
+{
+ unsigned copy_options = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_copy_object((hid_t)ocp_plist_id, &copy_options) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)copy_options;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1copy_1object */
+
+/*
+ * TODO: H5Padd_merge_committed_dtype_path
+ */
+
+/*
+ * TODO: H5Pfree_merge_committed_dtype_paths
+ */
+
+/*
+ * TODO: H5Pset_mcdt_search_cb
+ */
+
+/*
+ * TODO: H5Pget_mcdt_search_cb
+ */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pOCpyPLImp.h b/java/src/jni/h5pOCpyPLImp.h
new file mode 100644
index 0000000..f1dca58
--- /dev/null
+++ b/java/src/jni/h5pOCpyPLImp.h
@@ -0,0 +1,61 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5POCpyPL
+#define _Included_hdf_hdf5lib_H5_H5POCpyPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_copy_object
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1copy_1object
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_copy_object
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1copy_1object
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Padd_merge_committed_dtype_path
+ */
+
+/*
+ * TODO: H5Pfree_merge_committed_dtype_paths
+ */
+
+/*
+ * TODO: H5Pset_mcdt_search_cb
+ */
+
+/*
+ * TODO: H5Pget_mcdt_search_cb
+ */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5POCpyPL */
diff --git a/java/src/jni/h5pStrCPLImp.c b/java/src/jni/h5pStrCPLImp.c
new file mode 100644
index 0000000..e69847d
--- /dev/null
+++ b/java/src/jni/h5pStrCPLImp.c
@@ -0,0 +1,74 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pStrCPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_char_encoding
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding
+ (JNIEnv *env, jclass clss, jlong acpl, jint encoding)
+{
+ UNUSED(clss);
+
+ if (H5Pset_char_encoding((hid_t)acpl, (H5T_cset_t)encoding) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_char_encoding
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding
+ (JNIEnv *env, jclass clss, jlong acpl)
+{
+ H5T_cset_t encoding = H5T_CSET_ERROR;
+
+ UNUSED(clss);
+
+ if (H5Pget_char_encoding((hid_t)acpl, &encoding) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return encoding;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pStrCPLImp.h b/java/src/jni/h5pStrCPLImp.h
new file mode 100644
index 0000000..6e140d3
--- /dev/null
+++ b/java/src/jni/h5pStrCPLImp.h
@@ -0,0 +1,45 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PStrCPL
+#define _Included_hdf_hdf5lib_H5_H5PStrCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_char_encoding
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_char_encoding
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding
+(JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PStrCPL */
diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c
index ffd5b7a..ce42842 100644
--- a/java/src/jni/h5plImp.c
+++ b/java/src/jni/h5plImp.c
@@ -26,8 +26,10 @@ extern "C" {
#include "h5jni.h"
#include "h5plImp.h"
-extern JavaVM *jvm;
-extern jobject visit_callback;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -38,9 +40,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLset_1loading_1state
(JNIEnv *env, jclass clss, jint plugin_flags)
{
- if (H5PLset_loading_state((unsigned int)plugin_flags) < 0) {
- h5libraryError(env);
- }
+ UNUSED(clss);
+
+ if (H5PLset_loading_state((unsigned int)plugin_flags) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5PLset_1loading_1state */
/*
@@ -53,9 +59,13 @@ Java_hdf_hdf5lib_H5_H5PLget_1loading_1state
(JNIEnv *env, jclass clss)
{
unsigned int plugin_type = 0;
- if (H5PLget_loading_state(&plugin_type) < 0) {
- h5libraryError(env);
- }
+
+ UNUSED(clss);
+
+ if (H5PLget_loading_state(&plugin_type) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)plugin_type;
} /* end Java_hdf_hdf5lib_H5_H5PLget_1loading_1state */
@@ -68,18 +78,22 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLappend
(JNIEnv *env, jclass clss, jobjectArray plugin_path)
{
- const char *aName;
- herr_t retVal = -1;
+ const char *newPath = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- PIN_JAVA_STRING(plugin_path, aName);
- if (aName != NULL) {
- retVal = H5PLappend(aName);
+ if (NULL == plugin_path)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLappend: new path is NULL");
- UNPIN_JAVA_STRING(plugin_path, aName);
+ PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLappend: new path not pinned");
- if (retVal < 0)
- h5libraryError(env);
- }
+ if ((retVal = H5PLappend(newPath)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newPath)
+ UNPIN_JAVA_STRING(ENVONLY, plugin_path, newPath);
} /* end Java_hdf_hdf5lib_H5_H5PLappend */
/*
* Class: hdf_hdf5lib_H5
@@ -90,18 +104,22 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLprepend
(JNIEnv *env, jclass clss, jobjectArray plugin_path)
{
- const char *aName;
- herr_t retVal = -1;
+ const char *newPath = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- PIN_JAVA_STRING(plugin_path, aName);
- if (aName != NULL) {
- retVal = H5PLprepend(aName);
+ if (NULL == plugin_path)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLprepend: new path is NULL");
- UNPIN_JAVA_STRING(plugin_path, aName);
+ PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLprepend: new path not pinned");
- if (retVal < 0)
- h5libraryError(env);
- }
+ if ((retVal = H5PLprepend(newPath)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newPath)
+ UNPIN_JAVA_STRING(ENVONLY, plugin_path, newPath);
} /* end Java_hdf_hdf5lib_H5_H5PLprepend */
/*
@@ -111,20 +129,27 @@ Java_hdf_hdf5lib_H5_H5PLprepend
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLreplace
- (JNIEnv *env, jclass clss, jobjectArray plugin_path, jint index)
+ (JNIEnv *env, jclass clss, jobjectArray plugin_path, jint idx)
{
- const char *aName;
- herr_t retVal = -1;
+ const char *newPath = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- PIN_JAVA_STRING(plugin_path, aName);
- if (aName != NULL) {
- retVal = H5PLreplace(aName, index);
+ if (NULL == plugin_path)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLreplace: new path is NULL");
- UNPIN_JAVA_STRING(plugin_path, aName);
+ if (idx < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLreplace: index < 0");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLreplace: new path not pinned");
+
+ if ((retVal = H5PLreplace(newPath, (unsigned) idx)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newPath)
+ UNPIN_JAVA_STRING(ENVONLY, plugin_path, newPath);
} /* end Java_hdf_hdf5lib_H5_H5PLreplace */
/*
@@ -134,20 +159,27 @@ Java_hdf_hdf5lib_H5_H5PLreplace
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLinsert
- (JNIEnv *env, jclass clss, jobjectArray plugin_path, jint index)
+ (JNIEnv *env, jclass clss, jobjectArray plugin_path, jint idx)
{
- const char *aName;
- herr_t retVal = -1;
+ const char *newPath = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- PIN_JAVA_STRING(plugin_path, aName);
- if (aName != NULL) {
- retVal = H5PLinsert(aName, index);
+ if (NULL == plugin_path)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLinsert: new path is NULL");
- UNPIN_JAVA_STRING(plugin_path, aName);
+ if (idx < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLinsert: index < 0");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLinsert: new path not pinned");
+
+ if ((retVal = H5PLinsert(newPath, (unsigned) idx)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newPath)
+ UNPIN_JAVA_STRING(ENVONLY, plugin_path, newPath);
} /* end Java_hdf_hdf5lib_H5_H5PLinsert */
/*
@@ -157,10 +189,18 @@ Java_hdf_hdf5lib_H5_H5PLinsert
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLremove
- (JNIEnv *env, jclass clss, jint index)
+ (JNIEnv *env, jclass clss, jint idx)
{
- if (H5PLremove(index) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (idx < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLremove: index < 0");
+
+ if (H5PLremove((unsigned) idx) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5PLremove */
/*
@@ -170,35 +210,35 @@ Java_hdf_hdf5lib_H5_H5PLremove
*/
JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5PLget
- (JNIEnv *env, jclass clss, jint index)
+ (JNIEnv *env, jclass clss, jint idx)
{
- char *aName;
jstring str = NULL;
ssize_t buf_size;
+ char *aName = NULL;
+
+ UNUSED(clss);
+
+ if (idx < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLget: index < 0");
+
+ /* Get the length of the name */
+ if ((buf_size = H5PLget((unsigned) idx, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5PLget: failed to allocate plugin name buffer");
+
+ if ((H5PLget((unsigned) idx, aName, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ aName[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (aName)
+ HDfree(aName);
- /* get the length of the name */
- buf_size = H5PLget(index, NULL, 0);
-
- if (buf_size <= 0) {
- h5badArgument(env, "H5PLget: buf_size <= 0");
- } /* end if */
- else {
- buf_size++; /* add extra space for the null terminator */
- aName = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (aName == NULL) {
- h5outOfMemory(env, "H5PLget: malloc failed");
- } /* end if */
- else {
- buf_size = H5PLget(index, aName, (size_t)buf_size);
- if (buf_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- }
- HDfree(aName);
- }
- }
return str;
} /* end Java_hdf_hdf5lib_H5_H5PLget */
@@ -212,9 +252,13 @@ Java_hdf_hdf5lib_H5_H5PLsize
(JNIEnv *env, jclass clss)
{
unsigned int listsize = 0;
- if (H5PLsize(&listsize) < 0) {
- h5libraryError(env);
- }
+
+ UNUSED(clss);
+
+ if (H5PLsize(&listsize) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)listsize;
} /* end Java_hdf_hdf5lib_H5_H5PLsize */
diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c
index b250550..e24fc2a 100644
--- a/java/src/jni/h5rImp.c
+++ b/java/src/jni/h5rImp.c
@@ -26,9 +26,596 @@ extern "C" {
#include "h5jni.h"
#include "h5rImp.h"
-extern JavaVM *jvm;
-extern jobject visit_callback;
+/* 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 = HDcalloc(1, H5R_REF_BUF_SIZE)))
+ H5_OUT_OF_MEMORY_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 = HDcalloc(1, H5R_REF_BUF_SIZE)))
+ H5_OUT_OF_MEMORY_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 = HDcalloc(1, H5R_REF_BUF_SIZE)))
+ H5_OUT_OF_MEMORY_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 = HDcalloc(1, H5R_REF_BUF_SIZE)))
+ H5_OUT_OF_MEMORY_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 = HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_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 */
+
+/*
+ * 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 = HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_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;
+ */
+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 = HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_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
@@ -39,47 +626,44 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Rcreate
(JNIEnv *env, jclass clss, jbyteArray ref, jlong loc_id, jstring name, jint ref_type, jlong space_id)
{
- const char *rName;
- herr_t status = -1;
- jbyte *refP;
- jboolean isCopy2;
-
- PIN_JAVA_STRING(name, rName);
- if (rName != NULL) {
- if (ref == NULL) {
- h5nullArgument( env, "H5Rcreate: ref is NULL");
- } /* end if */
- else {
- if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) {
- h5badArgument( env, "H5Rcreate: ref input array != H5R_OBJ_REF_BUF_SIZE");
- } /* end if */
- else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) {
- h5badArgument( env, "H5Rcreate: region ref input array != H5R_DSET_REG_REF_BUF_SIZE");
- } /* end else if */
- else if ((ref_type != H5R_OBJECT) && (ref_type != H5R_DATASET_REGION)) {
- h5badArgument( env, "H5Rcreate: ref_type unknown type ");
- } /* end else if */
- else {
- refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy2);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rcreate: ref not pinned");
- } /* end if */
- else {
- status = H5Rcreate(refP, (hid_t)loc_id, rName, (H5R_type_t)ref_type, (hid_t)space_id);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, rName);
+ const char *refName = NULL;
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: reference is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: name is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: ref array length < 0");
}
+ if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: reference input array length != H5R_OBJ_REF_BUF_SIZE");
+ else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
+ else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: unknown reference type");
+
+ PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate: reference name not pinned");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rcreate: reference buffer not pinned");
+
+ if ((status = H5Rcreate(refBuf, (hid_t)loc_id, refName, (H5R_type_t)ref_type, (hid_t)space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (status < 0) ? JNI_ABORT : 0);
+ if (refName)
+ UNPIN_JAVA_STRING(ENVONLY, name, refName);
+
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Rcreate */
@@ -92,33 +676,36 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Rdereference
(JNIEnv *env, jclass clss, jlong dataset, jlong access_list, jint ref_type, jbyteArray ref)
{
- jboolean isCopy;
- jbyte *refP;
- hid_t retVal = -1;
-
- if (ref == NULL) {
- h5nullArgument( env, "H5Rdereference: ref is NULL");
- } /* end if */
- else if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) {
- h5badArgument( env, "H5Rdereference: obj ref input array != H5R_OBJ_REF_BUF_SIZE");
- } /* end else if */
- else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) {
- h5badArgument( env, "H5Rdereference: region ref input array != H5R_DSET_REG_REF_BUF_SIZE");
- } /* end else if */
- else {
- refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rderefernce: ref not pinned");
- } /* end if */
- else {
- retVal = H5Rdereference2((hid_t)dataset, (hid_t)access_list, (H5R_type_t)ref_type, refP);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
-
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: reference buffer is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: ref array length < 0");
+ }
+
+ if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: reference input array length != H5R_OBJ_REF_BUF_SIZE");
+ else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
+ else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: unknown reference type");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rderefernce: reference buffer not pinned");
+
+ if ((retVal = H5Rdereference2((hid_t)dataset, (hid_t)access_list, (H5R_type_t)ref_type, refBuf)) < 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__1H5Rdereference */
@@ -132,33 +719,34 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Rget_1region
(JNIEnv *env, jclass clss, jlong dataset, jint ref_type, jbyteArray ref)
{
- hid_t retVal = -1;
- jboolean isCopy;
- jbyte *refP;
-
- if (ref_type != H5R_DATASET_REGION) {
- h5badArgument( env, "H5Rget_region: bad ref_type ");
- } /* end if */
- else if (ref == NULL) {
- h5nullArgument( env, "H5Rget_region: ref is NULL");
- } /* end if */
- else if ( ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) {
- h5badArgument( env, "H5Rget_region: region ref input array != H5R_DSET_REG_REF_BUF_SIZE");
- } /* end if */
- else {
- refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rget_region: ref not pinned");
- } /* end if */
- else {
- retVal = H5Rget_region((hid_t)dataset, (H5R_type_t)ref_type, refP);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
-
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (H5R_DATASET_REGION != ref_type)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_region: bad reference type");
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_region: reference buffer is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_region: ref array length < 0");
+ }
+
+ if (refBufLen != H5R_DSET_REG_REF_BUF_SIZE)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_region: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_region: reference buffer not pinned");
+
+ if ((retVal = H5Rget_region((hid_t)dataset, (H5R_type_t)ref_type, refBuf)) < 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__1H5Rget_1region */
@@ -172,31 +760,27 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Rget_1obj_1type
(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref)
{
- int retVal =-1;
- jboolean isCopy;
- jbyte *refP;
- H5O_type_t object_info;
-
-
- if (ref == NULL) {
- h5nullArgument( env, "H5Rget_object_type: ref is NULL");
- } /* end if */
- else {
- refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rget_object_type: ref not pinned");
- } /* end if */
- else {
- retVal = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refP, &object_info);
- if(retVal >= 0)
- retVal = object_info;
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
-
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ H5O_type_t object_info;
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ int retVal = -1;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_type: reference buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_type: reference buffer not pinned");
+
+ if ((retVal = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, &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_1type */
@@ -210,46 +794,33 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2
(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jintArray ref_obj)
{
+ jboolean isCopy, isCopy2;
+ jbyte *refBuf = NULL;
+ jint *ref_objP = NULL;
+ jint status = -1;
+ int retVal = -1;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_type: reference buffer is NULL");
+ if (NULL == ref_obj)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_type: reference object is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_type: reference buffer not pinned");
- jint status;
- jboolean isCopy;
- jbyte *refP;
- jint *ref_objP;
- int retVal = -1;
-
-
- if (ref == NULL) {
- h5nullArgument( env, "H5Rget_object_type: ref is NULL");
- } /* end if */
- else if (ref_obj == NULL) {
- h5nullArgument( env, "H5Rget_object_type: ref_obj is NULL");
- } /* end else if */
- else {
- refP = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rget_object_type: ref not pinned");
- } /* end if */
- else {
- ref_objP = (jint *)ENVPTR->GetIntArrayElements(ENVPAR ref_obj, &isCopy);
- if (ref_objP == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref,refP,0);
- h5JNIFatalError(env, "H5Rget_object_type: ref_obj not pinned");
- } /* end if */
- else {
- status = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refP, (H5O_type_t*)ref_objP);
- retVal = ref_objP[0];
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR ref_obj,ref_objP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseIntArrayElements(ENVPAR ref_obj, ref_objP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ PIN_INT_ARRAY(ENVONLY, ref_obj, ref_objP, &isCopy2, "H5Rget_obj_type: reference object array not pinned");
+
+ if ((status = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, (H5O_type_t *)ref_objP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ retVal = ref_objP[0];
+
+done:
+ if (ref_objP)
+ UNPIN_INT_ARRAY(ENVONLY, ref_obj, ref_objP, (status < 0) ? JNI_ABORT : 0);
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, JNI_ABORT);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2 */
@@ -263,57 +834,52 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Rget_1name
(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jobjectArray name, jlong size)
{
- jlong ret_val = -1;
- jbyte *refP;
- jboolean isCopy;
- char *aName = NULL;
- jstring str;
- size_t bs;
-
- bs = (size_t)size;
- if (bs <= 0) {
- h5badArgument(env, "H5Rget_name: size <= 0");
- } /* end if */
- else if (ref == NULL) {
- h5nullArgument(env, "H5Rget_name: ref is NULL");
- } /* end else if */
- else {
- if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) {
- h5badArgument(env, "H5Rget_name: obj ref input array != H5R_OBJ_REF_BUF_SIZE");
- } /* end if */
- else if ((ref_type == H5R_DATASET_REGION)
- && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) {
- h5badArgument(env, "H5Rget_name: region ref input array != H5R_DSET_REG_REF_BUF_SIZE");
- } /* end else if */
- else {
- refP = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rget_name: ref not pinned");
- } /* end if */
- else {
- aName = (char*)HDmalloc(sizeof(char)*bs);
- if (aName == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
- h5outOfMemory(env, "H5Rget_name: malloc failed");
- } /* end if */
- else {
- ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refP, aName, bs) ;
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
- if (ret_val < 0) {
- HDfree(aName);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, str);
-
- HDfree(aName);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jstring str;
+ jsize refBufLen;
+ jbyte *refBuf = NULL;
+ char *aName = NULL;
+ jlong ret_val = -1;
+
+ UNUSED(clss);
+
+ if (size <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: size <= 0");
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: reference buffer is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: ref array length < 0");
+ }
+
+ if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: reference input array length != H5R_OBJ_REF_BUF_SIZE");
+ else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
+ else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: unknown reference type");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_name: reference buffer not pinned");
+
+ if (NULL == (aName = HDmalloc(sizeof(char) * (size_t)size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Rget_name: failed to allocate referenced object name buffer");
+
+ if ((ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, aName, (size_t)size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ aName[(size_t)size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, (jsize) 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (aName)
+ HDfree(aName);
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, JNI_ABORT);
return ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Rget_1name */
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 10f69eb..3498392 100644
--- a/java/src/jni/h5sImp.c
+++ b/java/src/jni/h5sImp.c
@@ -26,8 +26,10 @@ extern "C" {
#include "h5jni.h"
#include "h5sImp.h"
-extern JavaVM *jvm;
-extern jobject visit_callback;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -38,12 +40,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Screate
(JNIEnv *env, jclass clss, jint type)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Screate((H5S_class_t) type);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Screate((H5S_class_t) type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Screate */
@@ -56,98 +60,83 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Screate_1simple
(JNIEnv *env, jclass clss, jint rank, jlongArray dims, jlongArray maxdims)
{
- hid_t retVal = -1;
- jlong *dimsP, *maxdimsP;
- jboolean isCopy;
- hsize_t *sa = NULL;
- hsize_t *msa = NULL;
- int i;
- int drank, mrank;
- hsize_t *lp;
- jlong *jlp;
-
- if (rank < 0) {
- h5badArgument(env, "H5Screate_simple: rank is invalid");
- } /* end if */
- else if (dims == NULL) {
- h5nullArgument(env, "H5Screate_simple: dims is NULL");
- } /* end else if */
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ hsize_t *msa = NULL;
+ hsize_t *lp = NULL;
+ jlong *dimsP = NULL, *maxdimsP = NULL;
+ jlong *jlp = NULL;
+ jsize drank = 0, mrank = 0;
+ int i;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (rank < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: rank is invalid");
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: dims is NULL");
+
+ if ((drank = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: dims array length < 0");
+ }
+
+ if (drank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: dims rank is invalid");
+
+ if (NULL != maxdims) {
+ if ((mrank = ENVPTR->GetArrayLength(ENVONLY, maxdims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: maxdims array length < 0");
+ }
+
+ if (mrank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: maxdims rank is invalid");
+ }
+
+ PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Screate_simple: dims not pinned");
+
+ if (NULL == (sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Screate_simple: failed to allocate dims buffer");
+
+ jlp = (jlong *) dimsP;
+ for (i = 0; i < rank; i++) {
+ *lp = (hsize_t) *jlp;
+ lp++;
+ jlp++;
+ } /* end for */
+
+ if (NULL == maxdims) {
+ maxdimsP = NULL;
+ msa = (hsize_t *)maxdimsP;
+ }
else {
- drank = (int)ENVPTR->GetArrayLength(ENVPAR dims);
- if (drank != rank) {
- h5badArgument(env, "H5Screate_simple: dims rank is invalid");
- return -1;
- } /* end if */
- if (maxdims != NULL) {
- mrank = (int)ENVPTR->GetArrayLength(ENVPAR maxdims);
- if (mrank != rank) {
- h5badArgument(env, "H5Screate_simple: maxdims rank is invalid");
- return -1;
- } /* end if */
- } /* end if */
- dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError(env, "H5Screate_simple: dims not pinned");
- return -1;
- } /* end if */
+ PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Screate_simple: maxdims not pinned");
- sa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (sa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- h5JNIFatalError(env, "H5Screate_simple: dims not converted to hsize_t");
- return -1;
- } /* end if */
+ if (NULL == (msa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Screate_simple: failed to allocate maxdims buffer");
- jlp = (jlong *) dimsP;
- for (i = 0; i < rank; i++) {
+ jlp = (jlong *) maxdimsP;
+ for (i = 0; i < mrank; i++) {
*lp = (hsize_t) *jlp;
lp++;
jlp++;
} /* end for */
+ }
- if (maxdims == NULL) {
- maxdimsP = NULL;
- msa = (hsize_t *)maxdimsP;
- } /* end if */
- else {
- maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy);
- if (maxdimsP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- h5JNIFatalError(env, "H5Screate_simple: maxdims not pinned");
- return -1;
- } /* end if */
- msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (msa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- HDfree(sa);
- h5JNIFatalError(env, "H5Screate_simple: dims not converted to hsize_t");
- return -1;
- } /* end if */
- jlp = (jlong *)maxdimsP;
- for (i = 0; i < mrank; i++) {
- *lp = (hsize_t)*jlp;
- lp++;
- jlp++;
- } /* end for */
- } /* end else */
-
- retVal = H5Screate_simple(rank, (const hsize_t *)sa, (const hsize_t *)msa);
-
- if (maxdimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- if (msa)
- HDfree(msa);
- } /* end if */
+ if ((retVal = H5Screate_simple(rank, (const hsize_t *)sa, (const hsize_t *)msa)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- if (sa)
- HDfree(sa);
-
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
+done:
+ if (msa)
+ HDfree(msa);
+ if (maxdimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, JNI_ABORT);
+ if (sa)
+ HDfree(sa);
+ if (dimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, JNI_ABORT);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Screate_1simple */
@@ -161,19 +150,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Scopy
(JNIEnv *env, jclass clss, jlong space_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Scopy(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Scopy(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* 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.
@@ -186,41 +178,37 @@ Java_hdf_hdf5lib_H5__1H5Scopy
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sselect_1elements
- (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jlongArray coord)
+ (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jlongArray coords)
{
- herr_t status = -1;
- jint i;
- jlong *P;
- jboolean isCopy;
- hssize_t *sa;
- int rank;
-
- if (coord == NULL) {
- h5nullArgument( env, "H5Sselect_elements: coord is NULL");
- return -1;
- } /* end if */
+ jboolean isCopy;
+ hssize_t *sa = NULL;
+ jlong *P = NULL;
+ jint i;
+ int rank;
+ herr_t status = FAIL;
- P = ENVPTR->GetLongArrayElements(ENVPAR env,coord,&isCopy);
- if (P == NULL) {
- h5JNIFatalError(env, "H5Sselect_elements: coord not pinned");
- return -1;
- } /* end if */
- sa = (hssize_t *)HDmalloc( (size_t)num_elems * 2 * sizeof(hssize_t));
- if (sa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR env,coord,P,JNI_ABORT);
- h5JNIFatalError(env, "H5Sselect_elements: coord array not converted to hssize_t");
- return -1;
- } /* end if */
- for (i= 0; i < (num_elsms * 2); i++) {
+ UNUSED(clss);
+
+ if (NULL == coords)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sselect_elements: coords is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, coords, P, &isCopy, "H5Sselect_elements: coords not pinned");
+
+ if (NULL == (sa = (hssize_t *) HDmalloc( (size_t)num_elemn * 2 * sizeof(hssize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer");
+
+ for (i = 0; i < (num_elemn * 2); i++) {
sa[i] = P[i];
} /* end for */
- status = H5Sselect_elements (space_id, (H5S_seloper_t)op, num_elemn, (const hssize_t **)&sa);
- ENVPTR->ReleaseLongArrayElements(ENVPAR env, coord, P, JNI_ABORT);
- HDfree(sa);
+ if ((status = H5Sselect_elements(space_id, (H5S_seloper_t)op, num_elemn, (const hssize_t **)&sa)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0)
- h5libraryError(env);
+done:
+ if (sa)
+ HDfree(sa);
+ if (P)
+ UNPIN_LONG_ARRAY(ENVONLY, coords, P, JNI_ABORT);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1elements */
@@ -233,49 +221,51 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sselect_1elements
- (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jbyteArray coord)
+ (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jbyteArray coords)
{
- int ii;
- hsize_t *lp = NULL;
- hsize_t *llp;
- jlong *jlp;
- herr_t status = -1;
- jbyte *P;
- jboolean isCopy;
- jsize size;
- int nlongs;
-
- if (coord == NULL) {
- h5nullArgument(env, "H5Sselect_elements: coord is NULL");
- } /* end if */
- else {
- P = ENVPTR->GetByteArrayElements(ENVPAR coord, &isCopy);
- if (P == NULL) {
- h5JNIFatalError(env, "H5Sselect_elements: coord not pinned");
- } /* end if */
- else {
- size = (int)ENVPTR->GetArrayLength(ENVPAR coord);
- nlongs = (int)((size_t)size / sizeof(jlong));
- lp = (hsize_t *)HDmalloc((size_t)nlongs * sizeof(hsize_t));
- jlp = (jlong *) P;
- llp = lp;
- for (ii = 0; ii < nlongs; ii++) {
- *lp = (hsize_t) *jlp;
- lp++;
- jlp++;
- } /* end for */
-
- status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, (const hsize_t *)llp);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR coord, P, JNI_ABORT);
-
- if (llp)
- HDfree(llp);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *lp = NULL;
+ hsize_t *llp = NULL;
+ jlong *jlp = NULL;
+ jbyte *P = NULL;
+ jsize size;
+ int ii;
+ int nlongs;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == coords)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sselect_elements: coords is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, coords, P, &isCopy, "H5Sselect_elements: coords not pinned");
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, coords)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_elements: coords array length < 0");
+ }
+
+ nlongs = (int)((size_t)size / sizeof(jlong));
+
+ if (NULL == (lp = (hsize_t *) HDmalloc((size_t)nlongs * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer");
+
+ jlp = (jlong *) P;
+ llp = lp;
+ for (ii = 0; ii < nlongs; ii++) {
+ *lp = (hsize_t) *jlp;
+ lp++;
+ jlp++;
+ } /* end for */
+
+ if ((status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, (const hsize_t *)llp)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (llp)
+ HDfree(llp);
+ if (P)
+ UNPIN_BYTE_ARRAY(ENVONLY, coords, P, JNI_ABORT);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1elements */
@@ -289,12 +279,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sselect_1all
(JNIEnv *env, jclass clss, jlong space_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Sselect_all(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Sselect_all(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1all */
@@ -307,12 +299,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sselect_1none
(JNIEnv *env, jclass clss, jlong space_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Sselect_none(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Sselect_none(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1none */
@@ -327,12 +321,14 @@ Java_hdf_hdf5lib_H5_H5Sselect_1valid
{
htri_t bval = JNI_FALSE;
- bval = H5Sselect_valid(space_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Sselect_valid(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1valid */
@@ -345,11 +341,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints
(JNIEnv *env, jclass clss, jlong space_id)
{
- hssize_t retVal = H5Sget_simple_extent_npoints(space_id);
+ hssize_t retVal = -1;
+
+ UNUSED(clss);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Sget_simple_extent_npoints(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints */
@@ -362,11 +361,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints
(JNIEnv *env, jclass clss, jlong space_id)
{
- hssize_t retVal = H5Sget_select_npoints(space_id);
+ hssize_t retVal = -1;
+
+ UNUSED(clss);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Sget_select_npoints(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints */
@@ -381,10 +383,12 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1type
{
int retVal = -1;
- retVal = H5Sget_select_type(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if (H5S_SEL_ERROR == (retVal = H5Sget_select_type(space_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1type */
@@ -399,10 +403,12 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims
{
int retVal = -1;
- retVal = H5Sget_simple_extent_ndims(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((retVal = H5Sget_simple_extent_ndims(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims */
@@ -415,100 +421,78 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims
(JNIEnv *env, jclass clss, jlong space_id, jlongArray dims, jlongArray maxdims)
{
- int status = -1;
- jlong *dimsP, *maxdimsP;
- jboolean isCopy;
- hsize_t *sa;
- hsize_t *msa;
- int i;
- int rank = -1;
- int mrank;
-
- if (dims == NULL) {
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ hsize_t *msa = NULL;
+ jlong *dimsP = NULL, *maxdimsP = NULL;
+ int i;
+ int rank = -1;
+ int mrank;
+ int status = -1;
+
+ UNUSED(clss);
+
+ if (NULL == dims) {
dimsP = NULL;
sa = (hsize_t *) dimsP;
- } /* end if */
+ }
else {
- dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError(env, "H5Pget_simple_extent_dims: dims not pinned");
- return -1;
- } /* end if */
- rank = (int)ENVPTR->GetArrayLength(ENVPAR dims);
- sa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (sa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sget_simple_extent_dims: dims not converted to hsize_t");
- return -1;
- } /* end if */
- } /* end else */
- if (maxdims == NULL) {
+ PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Sget_simple_extent_dims: dims not pinned");
+
+ if ((rank = (int)ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: dims array length < 0");
+ }
+
+ if (NULL == (sa = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate dimension buffer");
+ }
+
+ if (NULL == maxdims) {
maxdimsP = NULL;
msa = (hsize_t *) maxdimsP;
- } /* end if */
+ }
else {
- maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy);
- if (maxdimsP == NULL) {
- if (dimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- } /* end if */
- h5JNIFatalError(env, "H5Pget_simple_extent_dims: maxdims not pinned");
- return -1;
- } /* end if */
- mrank = (int) ENVPTR->GetArrayLength(ENVPAR maxdims);
+ PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Sget_simple_extent_dims: maxdims not pinned");
+
+ if ((mrank = (int) ENVPTR->GetArrayLength(ENVONLY, maxdims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims array length < 0");
+ }
+
if (rank < 0)
rank = mrank;
- else if (mrank != rank) {
- if (dimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- } /* end if */
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sget_simple_extent_dims: maxdims rank not same as dims");
- return -1;
- } /* end else if */
- msa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (msa == NULL) {
- if (dimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- } /* end if */
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sget_simple_extent_dims: maxdims not converted to hsize_t");
- return -1;
- } /* end if */
- } /* end else */
+ else if (mrank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims rank not same as dims");
- status = H5Sget_simple_extent_dims(space_id, (hsize_t *)sa, (hsize_t *)msa);
+ if (NULL == (msa = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate maximum dimension buffer");
+ }
- if (status < 0) {
- if (dimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- } /* end if */
- if (maxdimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- HDfree(msa);
- } /* end if */
- h5libraryError(env);
- return -1;
- } /* end if */
+ if ((status = H5Sget_simple_extent_dims(space_id, (hsize_t *)sa, (hsize_t *)msa)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (dimsP != NULL) {
+ if (NULL != dimsP) {
for (i = 0; i < rank; i++) {
dimsP[i] = (jlong)sa[i];
} /* end for */
- HDfree(sa);
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0);
- } /* end if */
- if (maxdimsP != NULL) {
+ }
+
+ if (NULL != maxdimsP) {
for (i = 0; i < rank; i++) {
maxdimsP[i] = (jlong)msa[i];
} /* end for */
+ }
+
+done:
+ if (msa)
HDfree(msa);
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, 0);
- } /* end if */
+ if (maxdimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, (status < 0) ? JNI_ABORT : 0);
+ if (sa)
+ HDfree(sa);
+ if (dimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims */
@@ -524,11 +508,15 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type
{
H5S_class_t retVal = H5S_NO_CLASS;
+ UNUSED(clss);
+
if (space_id < 0)
- h5libraryError(env);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_type: space_id < 0");
- retVal = H5Sget_simple_extent_type(space_id);
+ if (H5S_NO_CLASS == (retVal = H5Sget_simple_extent_type(space_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type */
@@ -541,87 +529,81 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple
(JNIEnv *env, jclass clss, jlong space_id, jint rank, jlongArray dims, jlongArray maxdims)
{
- herr_t status = -1;
- jlong *dimsP, *maxdimsP;
- jboolean isCopy;
- hsize_t *sa;
- hsize_t *msa;
- int i;
- int drank, mrank;
- hsize_t *lp;
- jlong *jlp;
-
- if (dims == NULL) {
- h5nullArgument(env, "H5Sset_simple_extent: dims is NULL");
- return -1;
- } /* end if */
- drank = (int) ENVPTR->GetArrayLength(ENVPAR dims);
- if (drank != rank) {
- h5badArgument(env, "H5Screate_simple: dims rank is invalid");
- return -1;
- } /* end if */
- if (maxdims != NULL) {
- mrank = (int) ENVPTR->GetArrayLength(ENVPAR maxdims);
- if (mrank != rank) {
- h5badArgument(env, "H5Screate_simple: maxdims rank is invalid");
- return -1;
- } /* end if */
- } /* end if */
- dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError(env, "H5Pset_simple_extent: dims not pinned");
- return -1;
- } /* end if */
- sa = lp = (hsize_t *) malloc((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");
- return -1;
- } /* end if */
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ hsize_t *msa = NULL;
+ hsize_t *lp = NULL;
+ jlong *dimsP = NULL, *maxdimsP = NULL;
+ jlong *jlp = NULL;
+ jsize drank, mrank;
+ int i;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sset_extent_simple: dims is NULL");
+
+ if ((drank = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sset_extent_simple: dims array length < 0");
+ }
+
+ if (drank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sset_extent_simple: dims rank is invalid");
+
+ if (NULL != maxdims) {
+ if ((mrank = ENVPTR->GetArrayLength(ENVONLY, maxdims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sset_extent_simple: maxdims array length < 0");
+ }
+
+ if (mrank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sset_extent_simple: maxdims rank is invalid");
+ }
+
+ PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Sset_extent_simple: dims not pinned");
+
+ if (NULL == (sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate dimension buffer");
+
jlp = (jlong *) dimsP;
for (i = 0; i < rank; i++) {
*lp = (hsize_t) *jlp;
lp++;
jlp++;
} /* end for */
- if (maxdims == NULL) {
+
+ if (NULL == maxdims) {
maxdimsP = NULL;
msa = (hsize_t *) maxdimsP;
- } /* end if */
+ }
else {
- maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy);
- if (maxdimsP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- h5JNIFatalError(env, "H5Pset_simple_extent: maxdims not pinned");
- return -1;
- } /* end if */
- msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (msa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- HDfree(sa);
- h5JNIFatalError(env, "H5Sset_simple_extent: maxdims not converted to hsize_t");
- return -1;
- } /* end if */
+ PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Sset_extent_simple: maxdims not pinned");
+
+ if (NULL == (msa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate maximum dimension buffer");
+
jlp = (jlong *) maxdimsP;
for (i = 0; i < rank; i++) {
*lp = (hsize_t) *jlp;
lp++;
jlp++;
} /* end for */
- } /* end else */
+ }
- status = H5Sset_extent_simple(space_id, rank, (hsize_t *) sa, (hsize_t *) msa);
+ if ((status = H5Sset_extent_simple(space_id, rank, (hsize_t *) sa, (hsize_t *) msa)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- if (maxdimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
+done:
+ if (msa)
HDfree(msa);
- } /* end if */
-
- if (status < 0)
- h5libraryError(env);
+ if (maxdimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, JNI_ABORT);
+ if (sa)
+ HDfree(sa);
+ if (dimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, JNI_ABORT);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple */
@@ -637,12 +619,14 @@ Java_hdf_hdf5lib_H5_H5Sis_1simple
{
htri_t bval = JNI_FALSE;
- bval = H5Sis_simple(space_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Sis_simple(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Sis_1simple */
@@ -655,49 +639,50 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Soffset_1simple
(JNIEnv *env, jclass clss, jlong space_id, jbyteArray offset)
{
- herr_t status;
- jbyte *P = NULL;
jboolean isCopy;
- hssize_t *sa;
+ hssize_t *sa = NULL;
+ hssize_t *lp = NULL;
size_t rank;
- size_t i;
- hssize_t *lp;
- jlong *jlp;
-
- if (offset != NULL) {
- P = ENVPTR->GetByteArrayElements(ENVPAR offset, &isCopy);
- if (P == NULL) {
- h5JNIFatalError(env, "H5Soffset_simple: offset not pinned");
- return -1;
- } /* end if */
- i = (size_t)ENVPTR->GetArrayLength(ENVPAR offset);
- rank = i / sizeof(jlong);
- sa = lp = (hssize_t *)HDmalloc((size_t)rank * sizeof(hssize_t));
- if (sa == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR offset, P, JNI_ABORT);
- h5JNIFatalError(env, "H5Soffset_simple: offset not converted to hssize_t");
- return -1;
- } /* end if */
+ jsize i;
+ jbyte *P = NULL;
+ jlong *jlp = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL != offset) {
+ PIN_BYTE_ARRAY(ENVONLY, offset, P, &isCopy, "H5Soffset_simple: offset not pinned");
+
+ if ((i = ENVPTR->GetArrayLength(ENVONLY, offset)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Soffset_simple: offset array length < 0");
+ }
+
+ rank = (size_t) i / sizeof(jlong);
+
+ if (NULL == (sa = lp = (hssize_t *) HDmalloc((size_t)rank * sizeof(hssize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Soffset_simple: failed to allocate offset buffer");
+
jlp = (jlong *) P;
- for (i = 0; i < rank; i++) {
+ for (i = 0; (size_t) i < rank; i++) {
*lp = (hssize_t) *jlp;
lp++;
jlp++;
} /* end for */
- } /* end if */
+ }
else {
P = NULL;
sa = (hssize_t *) P;
- } /* end else */
+ }
- status = H5Soffset_simple(space_id, sa);
- if (P != NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR offset, P, JNI_ABORT);
- HDfree(sa);
- } /* end if */
+ if ((status = H5Soffset_simple(space_id, sa)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0)
- h5libraryError(env);
+done:
+ if (sa)
+ HDfree(sa);
+ if (P)
+ UNPIN_BYTE_ARRAY(ENVONLY, offset, P, JNI_ABORT);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Soffset_1simple */
@@ -711,12 +696,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sextent_1copy
(JNIEnv *env, jclass clss, jlong space_id, jlong src_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Sextent_copy(space_id, src_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Sextent_copy(space_id, src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sextent_1copy */
@@ -731,12 +718,14 @@ Java_hdf_hdf5lib_H5_H5Sextent_1equal
{
htri_t bval = JNI_FALSE;
- bval = H5Sextent_equal(space_id, src_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Sextent_equal(space_id, src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Sextent_1equal */
@@ -749,12 +738,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sset_1extent_1none
(JNIEnv *env, jclass clss, jlong space_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Sset_extent_none(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Sset_extent_none(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sset_1extent_1none */
@@ -767,162 +758,131 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab
(JNIEnv *env, jclass clss, jlong space_id, jint op, jlongArray start, jlongArray stride, jlongArray count, jlongArray block)
{
- herr_t status = -1;
- jlong *startP, *strideP, *countP, *blockP;
- jboolean isCopy;
- hsize_t *strt;
- hsize_t *strd;
- hsize_t *cnt;
- hsize_t *blk;
- int rank;
- int i;
- hsize_t *lp;
- jlong *jlp;
-
- if (start == NULL) {
- h5nullArgument(env, "H5Sselect_hyperslab: start is NULL");
+ jboolean isCopy;
+ hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL;
+ hsize_t *lp = NULL;
+ jlong *startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL;
+ jlong *jlp = NULL;
+ jsize start_rank, stride_rank, count_rank, block_rank;
+ int i;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == start)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: start is NULL");
+ if (NULL == count)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: count is NULL");
+
+ if ((start_rank = ENVPTR->GetArrayLength(ENVONLY, start)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: start array length < 0");
+ }
+ if ((count_rank = ENVPTR->GetArrayLength(ENVONLY, count)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: count array length < 0");
+ }
+
+ if (start_rank != count_rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: count and start have different rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sselect_hyperslab: start not pinned");
+
+ if (NULL == (strt = lp = (hsize_t *) HDmalloc((size_t)start_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate start buffer");
+
+ jlp = (jlong *) startP;
+ for (i = 0; i < start_rank; i++) {
+ *lp = (hsize_t) *jlp;
+ lp++;
+ jlp++;
} /* end if */
- else if (count == NULL) {
- h5nullArgument(env, "H5Sselect_hyperslab: count is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sselect_hyperslab: count not pinned");
+
+ if (NULL == (cnt = lp = (hsize_t *) HDmalloc((size_t)count_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate count buffer");
+
+ jlp = (jlong *) countP;
+ for (i = 0; i < count_rank; i++) {
+ *lp = (hsize_t) *jlp;
+ lp++;
+ jlp++;
} /* end if */
+
+ if (NULL == stride) {
+ strideP = NULL;
+ strd = (hsize_t *) strideP;
+ }
else {
- rank = (int) ENVPTR->GetArrayLength(ENVPAR start);
- if (rank != ENVPTR->GetArrayLength(ENVPAR count)) {
- h5badArgument(env, "H5Sselect_hyperslab: count and start have different rank!");
- return -1;
- } /* end if */
+ if ((stride_rank = ENVPTR->GetArrayLength(ENVONLY, stride)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: stride array length < 0");
+ }
- startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy);
- if (startP == NULL) {
- h5JNIFatalError(env, "H5Sselect_hyperslab: start not pinned");
- return -1;
- } /* end if */
- strt = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (strt == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sselect_hyperslab: start not converted to hsize_t");
- return -1;
- } /* end if */
+ if (stride_rank != start_rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: stride and start have different rank!");
- jlp = (jlong *) startP;
- for (i = 0; i < rank; i++) {
+ PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sselect_hyperslab: stride not pinned");
+
+ if (NULL == (strd = lp = (hsize_t *) HDmalloc((size_t)stride_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate stride buffer");
+
+ jlp = (jlong *) strideP;
+ for (i = 0; i < stride_rank; i++) {
*lp = (hsize_t) *jlp;
lp++;
jlp++;
} /* end if */
+ }
- countP = ENVPTR->GetLongArrayElements(ENVPAR count, &isCopy);
- if (countP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sselect_hyperslab: count not pinned");
- return -1;
- } /* end if */
- cnt = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (cnt == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sselect_hyperslab: count not converted to hsize_t");
- return -1;
- } /* end if */
+ if (NULL == block) {
+ blockP = NULL;
+ blk = (hsize_t *) blockP;
+ }
+ else {
+ if ((block_rank = ENVPTR->GetArrayLength(ENVONLY, block)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: block array length < 0");
+ }
- jlp = (jlong *) countP;
- for (i = 0; i < rank; i++) {
+ if (block_rank != start_rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: block and start have different rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sselect_hyperslab: block not pinned");
+
+ if (NULL == (blk = lp = (hsize_t *) HDmalloc((size_t)block_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate block buffer");
+
+ jlp = (jlong *) blockP;
+ for (i = 0; i < block_rank; i++) {
*lp = (hsize_t) *jlp;
lp++;
jlp++;
- } /* end if */
- if (stride == NULL) {
- strideP = NULL;
- strd = (hsize_t *) strideP;
- } /* end if */
- else {
- strideP = ENVPTR->GetLongArrayElements(ENVPAR stride, &isCopy);
- if (strideP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- h5badArgument(env, "H5Sselect_hyperslab: stride not pinned");
- return -1;
- } /* end if */
- strd = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (strd == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sselect_hyperslab: stride not converted to hsize_t");
- return -1;
- } /* end if */
- jlp = (jlong *) strideP;
- for (i = 0; i < rank; i++) {
- *lp = (hsize_t) *jlp;
- lp++;
- jlp++;
- } /* end if */
- } /* end if */
- if (block == NULL) {
- blockP = NULL;
- blk = (hsize_t *) blockP;
- } /* end if */
- else {
- blockP = ENVPTR->GetLongArrayElements(ENVPAR block, &isCopy);
- if (blockP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- if (strd != NULL)
- free(strd);
-
- h5JNIFatalError(env, "H5Sselect_hyperslab: block not pinned");
- return -1;
- } /* end if */
- blk = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (blk == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- if (strd != NULL)
- free(strd);
-
- h5JNIFatalError(env, "H5Sget_simple_extent: block not converted to hsize_t");
- return -1;
- } /* end if */
- jlp = (jlong *) blockP;
- for (i = 0; i < rank; i++) {
- *lp = (hsize_t) *jlp;
- lp++;
- jlp++;
- } /* end for */
- } /* end else */
-
- status = H5Sselect_hyperslab(space_id, (H5S_seloper_t) op, (const hsize_t *) strt, (const hsize_t *) strd,
- (const hsize_t *) cnt, (const hsize_t *) blk);
-
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- HDfree(strt);
+ } /* end for */
+ }
+
+ if ((status = H5Sselect_hyperslab(space_id, (H5S_seloper_t) op, (const hsize_t *) strt, (const hsize_t *) strd,
+ (const hsize_t *) cnt, (const hsize_t *) blk)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (blk)
+ HDfree(blk);
+ if (blockP)
+ UNPIN_LONG_ARRAY(ENVONLY, block, blockP, JNI_ABORT);
+ if (strd)
+ HDfree(strd);
+ if (strideP)
+ UNPIN_LONG_ARRAY(ENVONLY, stride, strideP, JNI_ABORT);
+ if (cnt)
HDfree(cnt);
- if (strideP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- HDfree(strd);
- } /* end if */
- if (blockP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT);
- HDfree(blk);
- } /* end if */
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ if (countP)
+ UNPIN_LONG_ARRAY(ENVONLY, count, countP, JNI_ABORT);
+ if (strt)
+ HDfree(strt);
+ if (startP)
+ UNPIN_LONG_ARRAY(ENVONLY, start, startP, JNI_ABORT);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab */
@@ -936,12 +896,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Sclose
(JNIEnv *env, jclass clss, jlong space_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Sclose(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Sclose(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Sclose */
@@ -956,10 +918,12 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks
{
hssize_t retVal = -1;
- retVal = H5Sget_select_hyper_nblocks((hid_t) spaceid);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((retVal = H5Sget_select_hyper_nblocks((hid_t) spaceid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks */
@@ -974,10 +938,12 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints
{
hssize_t retVal = -1;
- retVal = H5Sget_select_elem_npoints((hid_t) spaceid);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Sget_select_elem_npoints((hid_t) spaceid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints */
@@ -990,58 +956,53 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist
(JNIEnv *env, jclass clss, jlong spaceid, jlong startblock, jlong numblocks, jlongArray buf)
{
- herr_t status = -1;
- jlong *bufP;
- jboolean isCopy;
- hsize_t *ba;
- int i;
- int rank;
- hsize_t st;
- hsize_t nb;
-
- st = (hsize_t) startblock;
- nb = (hsize_t) numblocks;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Sget_select_hyper_blocklist: buf is NULL");
- } /* end if */
- else {
- rank = H5Sget_simple_extent_ndims(spaceid);
- if (rank <= 0)
- rank = 1;
- if (ENVPTR->GetArrayLength(ENVPAR buf) < (numblocks * rank)) {
- h5badArgument(env, "H5Sget_select_hyper_blocklist: buf input array too small");
- } /* end if */
- else {
- bufP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy);
- if (bufP == NULL) {
- 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));
- if (ba == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT);
- h5JNIFatalError(env, "H5Screate-simple: buffer not converted to hsize_t");
- } /* end if */
- else {
- status = H5Sget_select_hyper_blocklist((hid_t)spaceid, st, nb, (hsize_t *)ba);
-
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT);
- free(ba);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < (numblocks * 2 * rank); i++) {
- bufP[i] = (jlong)ba[i];
- } /* end for */
- free(ba);
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *ba = NULL;
+ size_t i, buf_size;
+ jlong *bufP = NULL;
+ jsize buflen;
+ int rank;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: buf is NULL");
+ if (numblocks < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: numblocks < 0");
+
+ if ((rank = H5Sget_simple_extent_ndims(spaceid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (rank == 0)
+ rank = 1;
+
+ if ((buflen = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: buf array length < 0");
+ }
+
+ if (buflen < (numblocks * rank))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: buffer input array too small");
+
+ PIN_LONG_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sget_select_hyper_blocklist: buffer not pinned");
+
+ buf_size = (size_t) numblocks * (size_t) 2 * (size_t) rank * sizeof(hsize_t);
+ if (NULL == (ba = (hsize_t *) HDmalloc(buf_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: failed to allocate block list buffer");
+
+ if ((status = H5Sget_select_hyper_blocklist((hid_t)spaceid, (hsize_t) startblock, (hsize_t) numblocks, (hsize_t *)ba)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (buf_size / sizeof(hsize_t)); i++) {
+ bufP[i] = (jlong) ba[i];
+ } /* end for */
+
+done:
+ if (ba)
+ HDfree(ba);
+ if (bufP)
+ UNPIN_LONG_ARRAY(ENVONLY, buf, bufP, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist */
@@ -1055,53 +1016,49 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist
(JNIEnv *env, jclass clss, jlong spaceid, jlong startpoint, jlong numpoints, jlongArray buf)
{
- herr_t status = -1;
- jlong *bufP;
- jboolean isCopy;
- hsize_t *ba;
- int i;
- int rank;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Sget_select_elem_pointlist: buf is NULL");
- } /* end if */
- else {
- rank = H5Sget_simple_extent_ndims(spaceid);
- if (rank <= 0)
- rank = 1;
- if (ENVPTR->GetArrayLength(ENVPAR buf) < (numpoints * rank)) {
- h5badArgument(env, "H5Sget_select_elem_pointlist: buf input array too small");
- } /* end if */
- else {
- bufP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy);
- if (bufP == NULL) {
- h5JNIFatalError(env, "H5Sget_select_elem_pointlist: buf not pinned");
- } /* end if */
- else {
- ba = (hsize_t *)HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t));
- if (ba == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sget_select_elem_pointlist: buf not converted to hsize_t");
- } /* end if */
- else {
- status = H5Sget_select_elem_pointlist((hid_t) spaceid, (hsize_t)startpoint, (hsize_t)numpoints, (hsize_t *)ba);
-
- if (status < 0) {
- HDfree(ba);
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < (numpoints * rank); i++) {
- bufP[i] = (jlong)ba[i];
- } /* end for */
- HDfree(ba);
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *ba = NULL;
+ jlong *bufP = NULL;
+ jsize buflen;
+ int i, rank;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: buffer is NULL");
+
+ if ((rank = H5Sget_simple_extent_ndims(spaceid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (rank == 0)
+ rank = 1;
+
+ if ((buflen = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: buf array length < 0");
+ }
+
+ if (buflen < (numpoints * rank))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: buffer input array too small");
+
+ PIN_LONG_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sget_select_elem_pointlist: buffer not pinned");
+
+ if (NULL == (ba = (hsize_t *) HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: failed to allocate point list buffer");
+
+ if ((status = H5Sget_select_elem_pointlist((hid_t)spaceid, (hsize_t)startpoint, (hsize_t)numpoints, (hsize_t *)ba)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (numpoints * rank); i++) {
+ bufP[i] = (jlong) ba[i];
+ } /* end for */
+
+done:
+ if (ba)
+ HDfree(ba);
+ if (bufP)
+ UNPIN_LONG_ARRAY(ENVONLY, buf, bufP, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end if */
@@ -1115,70 +1072,53 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds
(JNIEnv *env, jclass clss, jlong spaceid, jlongArray start, jlongArray end)
{
- herr_t status = -1;
- jlong *startP, *endP;
- jboolean isCopy;
- hsize_t *strt;
- hsize_t *en;
- int rank;
- int i;
-
- if (start == NULL) {
- h5nullArgument(env, "H5Sget_select_bounds: start is NULL");
- } /* end if */
- else if (end == NULL) {
- h5nullArgument(env, "H5Sget_select_bounds: end is NULL");
- } /* end else if */
- else {
- startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy);
- if (startP == NULL) {
- h5JNIFatalError(env, "H5Sget_select_bounds: start not pinned");
- return -1;
- } /* end if */
- rank = (int) ENVPTR->GetArrayLength(ENVPAR start);
- strt = (hsize_t *)malloc((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");
- return -1;
- } /* end if */
+ jboolean isCopy;
+ hsize_t *strt = NULL;
+ hsize_t *en = NULL;
+ size_t i;
+ jlong *startP = NULL, *endP = NULL;
+ jsize rank;
+ herr_t status = FAIL;
- endP = ENVPTR->GetLongArrayElements(ENVPAR end, &isCopy);
- if (endP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- free(strt);
- h5JNIFatalError(env, "H5Sget_select_bounds: end not pinned");
- return -1;
- } /* end if */
- en = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (en == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sget_simple_extent: dims not converted to hsize_t");
- return -1;
- } /* end if */
+ UNUSED(clss);
- status = H5Sget_select_bounds((hid_t) spaceid, (hsize_t *) strt, (hsize_t *) en);
+ if (NULL == start)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_bounds: start is NULL");
+ if (NULL == end)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_bounds: end is NULL");
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, JNI_ABORT);
- HDfree(strt);
- HDfree(en);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < rank; i++) {
- startP[i] = (jlong)strt[i];
- endP[i] = (jlong)en[i];
- } /* end for */
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, 0);
- HDfree(strt);
- HDfree(en);
- } /* end else */
- } /* end else */
+ PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sget_select_bounds: start not pinned");
+
+ if ((rank = ENVPTR->GetArrayLength(ENVONLY, start)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_bounds: start array length < 0");
+ }
+
+ if (NULL == (strt = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate start buffer");
+
+ PIN_LONG_ARRAY(ENVONLY, end, endP, &isCopy, "H5Sget_select_bounds: end not pinned");
+
+ if (NULL == (en = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate end buffer");
+
+ if ((status = H5Sget_select_bounds((hid_t) spaceid, (hsize_t *) strt, (hsize_t *) en)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (size_t) rank; i++) {
+ startP[i] = (jlong) strt[i];
+ endP[i] = (jlong) en[i];
+ } /* end for */
+
+done:
+ if (en)
+ HDfree(en);
+ if (endP)
+ UNPIN_LONG_ARRAY(ENVONLY, end, endP, (status < 0) ? JNI_ABORT : 0);
+ if (strt)
+ HDfree(strt);
+ if (startP)
+ UNPIN_LONG_ARRAY(ENVONLY, start, startP, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds */
@@ -1190,45 +1130,39 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds
*/
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_H5_H5Sencode
- (JNIEnv *env, jclass cls, jlong obj_id)
+ (JNIEnv *env, jclass clss, jlong obj_id)
{
- herr_t status = -1;
- unsigned char *bufPtr;
- size_t buf_size = 0;
- jbyteArray returnedArray = NULL;
-
- if (obj_id < 0) {
- h5badArgument(env, "H5Sencode: invalid argument");
- } /* end if */
- else {
- status = H5Sencode(obj_id, NULL, &buf_size);
+ unsigned char *bufPtr = NULL;
+ size_t buf_size = 0;
+ herr_t status = FAIL;
+ jbyteArray returnedArray = NULL;
- if (status < 0) {
- h5libraryError(env);
- } /* end else if */
- else if (buf_size == 0) {
- h5badArgument(env, "H5Sencode: buf_size = 0");
- } /* end if */
- else {
- bufPtr = (unsigned char*)HDcalloc((size_t) 1, buf_size);
- if (bufPtr == NULL) {
- h5outOfMemory(env, "H5Sencode: calloc failed");
- } /* end if */
- else {
- status = H5Sencode((hid_t) obj_id, bufPtr, &buf_size);
-
- if (status < 0) {
- HDfree(bufPtr);
- h5libraryError(env);
- } /* end if */
- else {
- returnedArray = ENVPTR->NewByteArray(ENVPAR (jsize)buf_size);
- ENVPTR->SetByteArrayRegion(ENVPAR returnedArray, 0, (jsize)buf_size, (jbyte*) bufPtr);
- HDfree(bufPtr);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNUSED(clss);
+
+ if (obj_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: invalid object ID");
+
+ if ((status = H5Sencode2(obj_id, NULL, &buf_size, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (buf_size == 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: buf_size = 0");
+
+ if (NULL == (bufPtr = (unsigned char *) HDcalloc((size_t) 1, buf_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sencode: failed to allocate encoding buffer");
+
+ if ((status = H5Sencode2((hid_t) obj_id, bufPtr, &buf_size, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (returnedArray = ENVPTR->NewByteArray(ENVONLY, (jsize) buf_size)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetByteArrayRegion(ENVONLY, returnedArray, 0, (jsize) buf_size, (jbyte *) bufPtr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (bufPtr)
+ HDfree(bufPtr);
return returnedArray;
} /* end Java_hdf_hdf5lib_H5_H5Sencode */
@@ -1240,29 +1174,25 @@ Java_hdf_hdf5lib_H5_H5Sencode
*/
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Sdecode
- (JNIEnv *env, jclass cls, jbyteArray buf)
+ (JNIEnv *env, jclass clss, jbyteArray buf)
{
- hid_t sid = -1;
- jbyte *bufP;
- jboolean isCopy;
+ jboolean isCopy;
+ jbyte *bufP = NULL;
+ hid_t sid = H5I_INVALID_HID;
- if (buf == NULL) {
- h5nullArgument(env, "H5Sdecode: buf is NULL");
- } /* end if */
- else {
- bufP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (bufP == NULL) {
- h5JNIFatalError( env, "H5Sdecode: buf not pinned");
- } /* end if */
- else {
- sid = H5Sdecode(bufP);
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sdecode: buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sdecode: buffer not pinned");
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, bufP, JNI_ABORT);
+ if ((sid = H5Sdecode(bufP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (sid < 0)
- h5libraryError(env);
- } /* end else if */
- } /* end else if */
+done:
+ if (bufP)
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, bufP, JNI_ABORT);
return (jlong)sid;
} /* end Java_hdf_hdf5lib_H5_H5Sdecode */
@@ -1274,16 +1204,18 @@ Java_hdf_hdf5lib_H5_H5Sdecode
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab
- (JNIEnv *env, jclass cls, jlong obj_id)
+ (JNIEnv *env, jclass clss, jlong obj_id)
{
htri_t bval = JNI_FALSE;
- bval = H5Sis_regular_hyperslab((hid_t)obj_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((bval = H5Sis_regular_hyperslab((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab */
@@ -1296,131 +1228,126 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab
(JNIEnv *env, jclass clss, jlong space_id, jlongArray start, jlongArray stride, jlongArray count, jlongArray block)
{
- herr_t status;
- jlong *startP, *strideP, *countP, *blockP;
- jboolean isCopy;
- hsize_t *strt;
- hsize_t *strd;
- hsize_t *cnt;
- hsize_t *blk;
- int rank;
- int i;
-
- if (start == NULL) {
- h5nullArgument(env, "H5Sget_regular_hyperslab: start is NULL");
- } /* end if */
- else if (count == NULL) {
- h5nullArgument(env, "H5Sget_regular_hyperslab: count is NULL");
- } /* end else if */
+ jboolean isCopy;
+ hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL;
+ jlong *startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL;
+ jsize start_rank = -1, stride_rank = -1, count_rank = -1, block_rank = -1;
+ int i, rank = -1;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (space_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: invalid dataspace ID");
+
+ if ((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == start) {
+ startP = NULL;
+ strt = (hsize_t *) startP;
+ }
else {
- rank = (int) ENVPTR->GetArrayLength(ENVPAR start);
- if (rank != ENVPTR->GetArrayLength(ENVPAR count)) {
- h5badArgument(env, "H5Sget_regular_hyperslab: count and start have different rank!");
- return;
- } /* end if */
+ if ((start_rank = ENVPTR->GetArrayLength(ENVONLY, start)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: start array length < 0");
+ }
- startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy);
- if (startP == NULL) {
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: start not pinned");
- return;
- } /* end if */
- strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (strt == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: start not converted to hsize_t");
- return;
- } /* end if */
+ if (start_rank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: start rank doesn't match dataspace rank!");
- countP = ENVPTR->GetLongArrayElements(ENVPAR count, &isCopy);
- if (countP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: count not pinned");
- return;
- } /* end if */
- cnt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (cnt == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: count not converted to hsize_t");
- return;
- } /* end if */
+ PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sget_regular_hyperslab: start not pinned");
- strideP = ENVPTR->GetLongArrayElements(ENVPAR stride, &isCopy);
- if (strideP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- h5badArgument(env, "H5Sget_regular_hyperslab: stride not pinned");
- return;
- } /* end if */
- strd = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (strd == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: stride not converted to hsize_t");
- return;
- } /* end if */
+ if (NULL == (strt = (hsize_t *) HDmalloc((size_t)start_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate start buffer");
+ }
- blockP = ENVPTR->GetLongArrayElements(ENVPAR block, &isCopy);
- if (blockP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- HDfree(strd);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: block not pinned");
- return;
- } /* end if */
- blk = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (blk == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- HDfree(strd);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: block not converted to hsize_t");
- return;
- } /* end if */
+ if (NULL == stride) {
+ strideP = NULL;
+ strd = (hsize_t *) strideP;
+ }
+ else {
+ if ((stride_rank = ENVPTR->GetArrayLength(ENVONLY, stride)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: stride array length < 0");
+ }
- status = H5Sget_regular_hyperslab(space_id, (hsize_t *) strt, (hsize_t *) strd, (hsize_t *) cnt, (hsize_t *) blk);
-
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT);
- HDfree(strt);
- HDfree(cnt);
- HDfree(strd);
- HDfree(blk);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < (rank); i++) {
- startP[i] = (jlong)strt[i];
- countP[i] = (jlong)cnt[i];
- strideP[i] = (jlong)strd[i];
- blockP[i] = (jlong)blk[i];
- } /* end for */
- HDfree(strt);
- HDfree(cnt);
- HDfree(strd);
- HDfree(blk);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, 0);
- } /* end else */
- } /* end else */
+ if (stride_rank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: stride rank doesn't match dataspace rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sget_regular_hyperslab: stride not pinned");
+
+ if (NULL == (strd = (hsize_t *) HDmalloc((size_t)stride_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate stride buffer");
+ }
+
+ if (NULL == count) {
+ countP = NULL;
+ cnt = (hsize_t *) countP;
+ }
+ else {
+ if ((count_rank = ENVPTR->GetArrayLength(ENVONLY, count)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: count array length < 0");
+ }
+
+ if (count_rank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: count rank doesn't match dataspace rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sget_regular_hyperslab: count not pinned");
+
+ if (NULL == (cnt = (hsize_t *) HDmalloc((size_t)count_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate count buffer");
+ }
+
+ if (NULL == block) {
+ blockP = NULL;
+ blk = (hsize_t *) blockP;
+ }
+ else {
+ if ((block_rank = ENVPTR->GetArrayLength(ENVONLY, block)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: block array length < 0");
+ }
+
+ if (block_rank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: block rank doesn't match dataspace rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sget_regular_hyperslab: block not pinned");
+
+ if (NULL == (blk = (hsize_t *) HDmalloc((size_t)block_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate block buffer");
+ }
+
+ if ((status = H5Sget_regular_hyperslab(space_id, (hsize_t *) strt, (hsize_t *) strd, (hsize_t *) cnt, (hsize_t *) blk)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < start_rank; i++) {
+ startP[i] = (jlong) strt[i];
+ countP[i] = (jlong) cnt[i];
+ strideP[i] = (jlong) strd[i];
+ blockP[i] = (jlong) blk[i];
+ } /* end for */
+
+done:
+ if (blk)
+ HDfree(blk);
+ if (blockP)
+ UNPIN_LONG_ARRAY(ENVONLY, block, blockP, (status < 0) ? JNI_ABORT : 0);
+ if (cnt)
+ HDfree(cnt);
+ if (countP)
+ UNPIN_LONG_ARRAY(ENVONLY, count, countP, (status < 0) ? JNI_ABORT : 0);
+ if (strd)
+ HDfree(strd);
+ if (strideP)
+ UNPIN_LONG_ARRAY(ENVONLY, stride, strideP, (status < 0) ? JNI_ABORT : 0);
+ if (strt)
+ HDfree(strt);
+ if (startP)
+ UNPIN_LONG_ARRAY(ENVONLY, start, startP, (status < 0) ? JNI_ABORT : 0);
+
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab */
#ifdef __cplusplus
diff --git a/java/src/jni/h5sImp.h b/java/src/jni/h5sImp.h
index 141e504..cea2ebf 100644
--- a/java/src/jni/h5sImp.h
+++ b/java/src/jni/h5sImp.h
@@ -49,9 +49,10 @@ 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 7b4af56..1cbf1a5 100644
--- a/java/src/jni/h5tImp.c
+++ b/java/src/jni/h5tImp.c
@@ -29,8 +29,10 @@ extern "C" {
#include "h5jni.h"
#include "h5tImp.h"
-extern JavaVM *jvm;
-extern jobject visit_callback;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -41,18 +43,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Topen2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist)
{
- hid_t status = -1;
- const char *tName;
+ const char *datatypeName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, tName);
- if (tName != NULL) {
- status = H5Topen2((hid_t)loc_id, tName, (hid_t)access_plist);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, tName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Topen2: datatype name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, datatypeName, NULL, "H5Topen2: datatype name not pinned");
+
+ if ((status = H5Topen2((hid_t)loc_id, datatypeName, (hid_t)access_plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (datatypeName)
+ UNPIN_JAVA_STRING(ENVONLY, name, datatypeName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Topen2 */
@@ -68,12 +74,14 @@ Java_hdf_hdf5lib_H5_H5Tcommitted
{
htri_t bval = JNI_FALSE;
- bval = H5Tcommitted(type_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Tcommitted(type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Tcommitted */
@@ -86,12 +94,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tcreate
(JNIEnv *env, jclass clss, jint dclass, jlong size)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tcreate((H5T_class_t )dclass, (size_t)size);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tcreate((H5T_class_t )dclass, (size_t)size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tcreate */
@@ -104,12 +114,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tcopy
(JNIEnv *env, jclass clss, jlong type_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tcopy((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tcopy((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tcopy */
@@ -124,12 +136,14 @@ Java_hdf_hdf5lib_H5_H5Tequal
{
htri_t bval = JNI_FALSE;
- bval = H5Tequal((hid_t)type_id1, (hid_t)type_id2);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((bval = H5Tequal((hid_t)type_id1, (hid_t)type_id2)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Tequal */
@@ -142,12 +156,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tlock
(JNIEnv *env, jclass clss, jlong type_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tlock((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tlock((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tlock */
@@ -162,10 +178,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1class
{
H5T_class_t retVal = H5T_NO_CLASS;
- retVal = H5Tget_class((hid_t)type_id);
- if (retVal == H5T_NO_CLASS)
- h5libraryError(env);
+ UNUSED(clss);
+ if (H5T_NO_CLASS == (retVal = H5Tget_class((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1class */
@@ -180,10 +198,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1size
{
size_t retVal = 0;
- retVal = H5Tget_size((hid_t)type_id);
- if (retVal == 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (!(retVal = H5Tget_size((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1size*/
@@ -197,12 +217,14 @@ Java_hdf_hdf5lib_H5_H5Tset_1size
(JNIEnv *env, jclass clss, jlong type_id, jlong size)
{
size_t tsize = (size_t)size;
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_size((hid_t)type_id, tsize);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_size((hid_t)type_id, tsize)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end ifJava_hdf_hdf5lib_H5_H5Tset_1size */
@@ -217,10 +239,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1order
{
H5T_order_t retVal = H5T_ORDER_ERROR;
- retVal = H5Tget_order((hid_t)type_id);
- if (retVal == H5T_ORDER_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+ if (H5T_ORDER_ERROR == (retVal = H5Tget_order((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1order */
@@ -233,12 +257,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1order
(JNIEnv *env, jclass clss, jlong type_id, jint order)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_order((hid_t)type_id, (H5T_order_t)order);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_order((hid_t)type_id, (H5T_order_t)order)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1order */
@@ -253,10 +279,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1precision
{
size_t retVal = 0;
- retVal = H5Tget_precision((hid_t)type_id);
- if (retVal == 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (!(retVal = H5Tget_precision((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1precision */
@@ -271,10 +299,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1precision_1long
{
size_t retVal = 0;
- retVal = H5Tget_precision((hid_t)type_id);
- if (retVal == 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if (!(retVal = H5Tget_precision((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1precision_1long */
@@ -287,12 +317,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1precision
(JNIEnv *env, jclass clss, jlong type_id, jlong precision)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_precision((hid_t)type_id, (size_t)precision);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_precision((hid_t)type_id, (size_t)precision)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1precision */
@@ -307,10 +339,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1offset
{
int retVal = -1;
- retVal = H5Tget_offset((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((retVal = H5Tget_offset((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1offset */
@@ -323,12 +357,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1offset
(JNIEnv *env, jclass clss, jlong type_id, jlong offset)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Tset_offset((hid_t)type_id, (size_t)offset);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Tset_offset((hid_t)type_id, (size_t)offset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1offset */
@@ -341,29 +377,23 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1pad
(JNIEnv *env, jclass clss, jlong type_id, jintArray pad)
{
- herr_t status = -1;
- jboolean isCopy;
- jint *P;
-
- if (pad == NULL) {
- h5nullArgument(env, "H5Tget_pad: pad is NULL");
- } /* end if */
- else {
- P = ENVPTR->GetIntArrayElements(ENVPAR pad, &isCopy);
- if (P == NULL) {
- h5JNIFatalError(env, "H5Tget_pad: pad not pinned");
- } /* end if */
- else {
- status = H5Tget_pad((hid_t)type_id, (H5T_pad_t *)&(P[0]), (H5T_pad_t *)&(P[1]));
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR pad, P, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR pad, P, 0);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jint *P = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == pad)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_pad: pad is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, pad, P, &isCopy, "H5Tget_pad: pad not pinned");
+
+ if ((status = H5Tget_pad((hid_t)type_id, (H5T_pad_t *)&(P[0]), (H5T_pad_t *)&(P[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (P)
+ UNPIN_INT_ARRAY(ENVONLY, pad, P, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1pad */
@@ -377,12 +407,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1pad
(JNIEnv *env, jclass clss, jlong type_id, jint lsb, jint msb)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Tset_pad((hid_t)type_id, (H5T_pad_t)lsb, (H5T_pad_t)msb);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Tset_pad((hid_t)type_id, (H5T_pad_t)lsb, (H5T_pad_t)msb)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1pad */
@@ -397,10 +429,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1sign
{
H5T_sign_t retVal = H5T_SGN_ERROR;
- retVal = H5Tget_sign((hid_t)type_id);
- if (retVal == H5T_SGN_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5T_SGN_ERROR == (retVal = H5Tget_sign((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1sign */
@@ -413,12 +447,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1sign
(JNIEnv *env, jclass clss, jlong type_id, jint sign)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_sign((hid_t)type_id, (H5T_sign_t)sign);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_sign((hid_t)type_id, (H5T_sign_t)sign)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1sign */
@@ -431,32 +467,31 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1fields_1int
(JNIEnv *env, jclass clss, jlong type_id, jintArray fields)
{
- herr_t status;
- jboolean isCopy;
- jint *P;
-
- if (fields == NULL) {
- h5nullArgument(env, "H5Tget_fields: fields is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR fields) < 5) {
- h5badArgument(env, "H5Tget_fields: fields input array < order 5");
- } /* end else if */
- else {
- P = ENVPTR->GetIntArrayElements(ENVPAR fields, &isCopy);
- if (P == NULL) {
- h5JNIFatalError(env, "H5Tget_fields: fields not pinned");
- } /* end if */
- else {
- status = H5Tget_fields((hid_t)type_id, (size_t *)&(P[0]), (size_t *)&(P[1]), (size_t *)&(P[2]), (size_t *)&(P[3]), (size_t *)&(P[4]));
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR fields, P, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR fields, P, 0);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jsize arrLen;
+ jint *P = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == fields)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields_int: fields is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, fields)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields_int: fields array length < 0");
+ }
+ if (arrLen < 5)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields_int: fields input array < order 5");
+
+ PIN_INT_ARRAY(ENVONLY, fields, P, &isCopy, "H5Tget_fields_int: fields not pinned");
+
+ if ((status = H5Tget_fields((hid_t)type_id, (size_t *)&(P[0]), (size_t *)&(P[1]), (size_t *)&(P[2]), (size_t *)&(P[3]), (size_t *)&(P[4]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (P)
+ UNPIN_INT_ARRAY(ENVONLY, fields, P, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1fields_1int */
@@ -470,56 +505,57 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1fields
(JNIEnv *env, jclass clss, jlong type_id, jlongArray fields)
{
- herr_t status;
- jboolean isCopy;
- jlong *fieldsArray;
-
- if (fields == NULL) {
- h5nullArgument(env, "H5Tget_fields: fields is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR fields) < 5) {
- h5badArgument(env, "H5Tget_fields: fields input array < order 5");
- } /* end else if */
- else {
- fieldsArray = ENVPTR->GetLongArrayElements(ENVPAR fields, &isCopy);
- if (fieldsArray == NULL) {
- h5JNIFatalError(env, "H5Tget_fields: fields not pinned");
- } /* end if */
- else {
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- size_t spos_t = 0;
- size_t epos_t = 0;
- size_t esize_t = 0;
- size_t mpos_t = 0;
- size_t msize_t = 0;
- long long fields_temp = *(&fieldsArray[0]);
- spos_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[1]);
- epos_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[2]);
- esize_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[3]);
- mpos_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[4]);
- msize_t = (size_t)fields_temp;
-
- status = H5Tget_fields((hid_t)type_id, &spos_t, &epos_t, &esize_t, &mpos_t, &msize_t);
-
- *(&fieldsArray[0]) = (jlong)spos_t;
- *(&fieldsArray[1]) = (jlong)epos_t;
- *(&fieldsArray[2]) = (jlong)esize_t;
- *(&fieldsArray[3]) = (jlong)mpos_t;
- *(&fieldsArray[4]) = (jlong)msize_t;
- } /* end direct cast special handling */
-
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR fields, fieldsArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseLongArrayElements(ENVPAR fields, fieldsArray, 0);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jlong *fieldsArray = NULL;
+ jsize arrLen;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == fields)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields: fields is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, fields)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields: fields array length < 0");
+ }
+ if (arrLen < 5)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields: fields input array < order 5");
+
+ PIN_LONG_ARRAY(ENVONLY, fields, fieldsArray, &isCopy, "H5Tget_fields: fields not pinned");
+
+ { /* Direct cast (size_t *)variable fails on 32-bit environment */
+ size_t spos_t = 0;
+ size_t epos_t = 0;
+ size_t esize_t = 0;
+ size_t mpos_t = 0;
+ size_t msize_t = 0;
+ long long fields_temp = *(&fieldsArray[0]);
+ spos_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[1]);
+ epos_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[2]);
+ esize_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[3]);
+ mpos_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[4]);
+ msize_t = (size_t)fields_temp;
+
+ if ((status = H5Tget_fields((hid_t)type_id, &spos_t, &epos_t, &esize_t, &mpos_t, &msize_t)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ *(&fieldsArray[0]) = (jlong)spos_t;
+ *(&fieldsArray[1]) = (jlong)epos_t;
+ *(&fieldsArray[2]) = (jlong)esize_t;
+ *(&fieldsArray[3]) = (jlong)mpos_t;
+ *(&fieldsArray[4]) = (jlong)msize_t;
+ } /* end direct cast special handling */
+
+done:
+ if (fieldsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, fields, fieldsArray, (status < 0) ? JNI_ABORT : 0);
+
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1fields */
/*
@@ -532,8 +568,13 @@ Java_hdf_hdf5lib_H5_H5Tset_1fields
(JNIEnv *env, jclass clss, jlong type_id, jlong spos, jlong epos,
jlong esize, jlong mpos, jlong msize)
{
+ UNUSED(clss);
+
if (H5Tset_fields((hid_t)type_id, (size_t)spos, (size_t)epos, (size_t)esize, (size_t)mpos, (size_t)msize) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1fields */
/*
@@ -547,10 +588,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1ebias
{
size_t retVal = 0;
- retVal = H5Tget_ebias((hid_t)type_id);
- if (retVal == 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (!(retVal = H5Tget_ebias((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1ebias */
@@ -565,10 +608,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long
{
size_t retVal = 0;
- retVal = H5Tget_ebias((hid_t)type_id);
- if (retVal == 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (!(retVal = H5Tget_ebias((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long */
@@ -581,12 +626,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1ebias
(JNIEnv *env, jclass clss, jlong type_id, jlong ebias)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Tset_ebias((hid_t)type_id, (size_t)ebias);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Tset_ebias((hid_t)type_id, (size_t)ebias)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1ebias */
@@ -601,10 +648,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1norm
{
H5T_norm_t retVal = H5T_NORM_ERROR;
- retVal = H5Tget_norm((hid_t)type_id);
- if (retVal == H5T_NORM_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5T_NORM_ERROR == (retVal = H5Tget_norm((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1norm */
@@ -617,12 +666,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1norm
(JNIEnv *env, jclass clss, jlong type_id, jint norm)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Tset_norm((hid_t)type_id, (H5T_norm_t )norm);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Tset_norm((hid_t)type_id, (H5T_norm_t )norm)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1norm */
@@ -637,10 +688,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1inpad
{
H5T_pad_t retVal = H5T_PAD_ERROR;
- retVal = H5Tget_inpad((hid_t)type_id );
- if (retVal == H5T_PAD_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5T_PAD_ERROR == (retVal = H5Tget_inpad((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1inpad */
@@ -653,12 +706,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1inpad
(JNIEnv *env, jclass clss, jlong type_id, jint inpad)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_inpad((hid_t)type_id, (H5T_pad_t) inpad);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_inpad((hid_t)type_id, (H5T_pad_t) inpad)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1inpad */
@@ -673,10 +728,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1cset
{
H5T_cset_t retVal = H5T_CSET_ERROR;
- retVal = H5Tget_cset((hid_t)type_id);
- if (retVal == H5T_CSET_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+ if (H5T_CSET_ERROR == (retVal = H5Tget_cset((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1cset */
@@ -689,12 +746,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1cset
(JNIEnv *env, jclass clss, jlong type_id, jint cset)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_cset((hid_t)type_id, (H5T_cset_t)cset);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_cset((hid_t)type_id, (H5T_cset_t)cset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1cset */
@@ -709,10 +768,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1strpad
{
H5T_str_t retVal = H5T_STR_ERROR;
- retVal = H5Tget_strpad((hid_t)type_id);
- if (retVal == H5T_STR_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5T_STR_ERROR == (retVal = H5Tget_strpad((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1strpad */
@@ -725,12 +786,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1strpad
(JNIEnv *env, jclass clss, jlong type_id, jint strpad)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Tset_strpad((hid_t)type_id, (H5T_str_t)strpad);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Tset_strpad((hid_t)type_id, (H5T_str_t)strpad)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1strpad */
@@ -745,10 +808,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1nmembers
{
int retVal = -1;
- retVal = H5Tget_nmembers((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((retVal = H5Tget_nmembers((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1nmembers */
@@ -761,17 +826,20 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1name
(JNIEnv *env, jclass clss, jlong type_id, jint field_idx)
{
- char *name;
- jstring str = NULL;
+ char *member_name = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
- name = H5Tget_member_name((hid_t)type_id, (unsigned)field_idx);
- if (name != NULL) {
- str = ENVPTR->NewStringUTF(ENVPAR name);
- H5free_memory(name);
+ if (NULL == (member_name = H5Tget_member_name((hid_t)type_id, (unsigned)field_idx)))
+ H5_LIBRARY_ERROR(ENVONLY);
- if (str == NULL)
- h5JNIFatalError(env, "H5Tget_member_name: returned string not created");
- } /* end if */
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, member_name)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (member_name)
+ H5free_memory(member_name);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1name */
@@ -785,18 +853,22 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1index
(JNIEnv *env, jclass clss, jlong type_id, jstring field_name)
{
- const char *tName;
+ const char *datatypeName = NULL;
int index = -1;
- PIN_JAVA_STRING(field_name, tName);
- if (tName != NULL) {
- index = H5Tget_member_index((hid_t)type_id, tName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(field_name, tName);
+ if (NULL == field_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_member_index: field name is NULL");
- if (index < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, field_name, datatypeName, NULL, "H5Tget_member_index: field name not pinned");
+
+ if ((index = H5Tget_member_index((hid_t)type_id, datatypeName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (datatypeName)
+ UNPIN_JAVA_STRING(ENVONLY, field_name, datatypeName);
return (jint)index;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1index */
@@ -810,12 +882,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tget_1member_1type
(JNIEnv *env, jclass clss, jlong type_id, jint field_idx)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tget_member_type((hid_t)type_id, (unsigned)field_idx);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tget_member_type((hid_t)type_id, (unsigned)field_idx)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tget_1member_1type */
@@ -828,6 +902,9 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1offset
(JNIEnv *env, jclass clss, jlong type_id, jint memno)
{
+ UNUSED(env);
+ UNUSED(clss);
+
return (jlong)H5Tget_member_offset((hid_t)type_id, (unsigned)memno);
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1offset */
@@ -840,12 +917,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1class
(JNIEnv *env, jclass clss, jlong type_id, jint memno)
{
- int retVal = -1;
+ H5T_class_t retVal = H5T_NO_CLASS;
+
+ UNUSED(clss);
- retVal = H5Tget_member_class((hid_t)type_id, (unsigned)memno);
- if (retVal < 0)
- h5libraryError(env);
+ if (H5T_NO_CLASS == (retVal = H5Tget_member_class((hid_t)type_id, (unsigned)memno)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1class */
@@ -858,18 +937,23 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tinsert
(JNIEnv *env, jclass clss, jlong type_id, jstring name, jlong offset, jlong field_id)
{
- herr_t status = -1;
- const char *tName;
+ const char *datatypeName = NULL;
long off = (long)offset;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, tName);
- if (tName != NULL) {
- status = H5Tinsert((hid_t)type_id, tName, (size_t)off, field_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name,tName);
- if (status < 0)
- h5libraryError(env);
- }
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tinsert: datatype name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, datatypeName, NULL, "H5Tinsert: datatype name not pinned");
+
+ if ((status = H5Tinsert((hid_t)type_id, datatypeName, (size_t)off, field_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (datatypeName)
+ UNPIN_JAVA_STRING(ENVONLY, name, datatypeName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tinsert */
@@ -883,17 +967,48 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tpack
(JNIEnv *env, jclass clss, jlong type_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tpack((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tpack((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tpack */
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Treclaim
+ * Signature: (JJJ[B)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Treclaim
+ (JNIEnv *env, jclass clss, jlong type_id, jlong space_id,
+ jlong xfer_plist_id, jbyteArray buf)
+{
+ jboolean bufIsCopy;
+ jbyte *pinBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Treclaim: buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, buf, pinBuf, &bufIsCopy, "H5Treclaim: buffer not pinned");
+
+ if ((status = H5Treclaim((hid_t)type_id, (hid_t)space_id, (hid_t)xfer_plist_id, pinBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (pinBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, pinBuf, (status < 0) ? JNI_ABORT : 0);
+} /* end Java_hdf_hdf5lib_H5_H5Treclaim */
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: _H5Tclose
* Signature: (J)I
*/
@@ -901,12 +1016,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Tclose
(JNIEnv *env, jclass clss, jlong type_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tclose((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tclose((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tclose */
@@ -919,12 +1036,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tvlen_1create
(JNIEnv *env, jclass clss, jlong base_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tvlen_create((hid_t)base_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tvlen_create((hid_t)base_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tvlen_1create */
@@ -937,18 +1056,22 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1tag
(JNIEnv *env, jclass clss, jlong type, jstring tag)
{
- herr_t status = -1;
- const char *tagP;
+ const char *tagBuf = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(tag, tagP);
- if (tagP != NULL) {
- status = H5Tset_tag((hid_t)type, tagP);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(tag,tagP);
+ if (NULL == tag)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tset_tag: tag is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, tag, tagBuf, NULL, "H5Tset_tag: tag buffer not pinned");
+
+ if ((status = H5Tset_tag((hid_t)type, tagBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (tagBuf)
+ UNPIN_JAVA_STRING(ENVONLY, tag, tagBuf);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1tag */
@@ -962,17 +1085,20 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1tag
(JNIEnv *env, jclass clss, jlong type)
{
- jstring str = NULL;
- char *tag;
+ jstring str = NULL;
+ char *tag = NULL;
- tag = H5Tget_tag((hid_t)type);
- if (tag != NULL) {
- str = ENVPTR->NewStringUTF(ENVPAR tag);
- H5free_memory(tag);
+ UNUSED(clss);
+
+ if (NULL == (tag = H5Tget_tag((hid_t)type)))
+ H5_LIBRARY_ERROR(ENVONLY);
- if (str == NULL)
- h5JNIFatalError(env, "H5Tget_tag: returned string not created");
- } /* end if */
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, tag)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (tag)
+ H5free_memory(tag);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1tag */
@@ -986,12 +1112,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tget_1super
(JNIEnv *env, jclass clss, jlong type_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tget_super((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tget_super((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tget_1super */
@@ -1004,12 +1132,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tenum_1create
(JNIEnv *env, jclass clss, jlong base_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tenum_create((hid_t)base_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tenum_create((hid_t)base_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tenum_1create */
@@ -1022,32 +1152,30 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int
(JNIEnv *env, jclass clss, jlong type_id, jstring name, jintArray value)
{
- herr_t status = -1;
- jint *intP;
- const char *nameP;
- jboolean isCopy2;
-
- if (value == NULL ) {
- h5nullArgument(env, "H5Tenum_insert: value is NULL");
- } /* end if */
- else {
- PIN_JAVA_STRING(name, nameP);
- if (nameP != NULL) {
- intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy2);
- if (intP == NULL) {
- h5JNIFatalError(env, "H5Tenum_insert: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_insert((hid_t)type_id, nameP, intP);
-
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
- }
- } /* end else */
+ const char *memberName = NULL;
+ jboolean isCopy;
+ jint *intBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert_int: value is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert_int: member name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, memberName, NULL, "H5Tenum_insert_int: member name not pinned");
+
+ PIN_INT_ARRAY(ENVONLY, value, intBuf, &isCopy, "H5Tenum_insert_int: int buffer not pinned");
+
+ if ((status = H5Tenum_insert((hid_t)type_id, memberName, intBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (intBuf)
+ UNPIN_INT_ARRAY(ENVONLY, value, intBuf, (status < 0) ? JNI_ABORT : 0);
+ if (memberName)
+ UNPIN_JAVA_STRING(ENVONLY, name, memberName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int */
@@ -1061,32 +1189,30 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Tenum_1insert
(JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value)
{
- herr_t status = -1;
- jbyte *byteP;
- const char *nameP;
- jboolean isCopy2;
-
- if (value == NULL) {
- h5nullArgument(env, "H5Tenum_insert: value is NULL");
- } /* end if */
- else {
- PIN_JAVA_STRING(name, nameP);
- if (nameP != NULL) {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy2);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Tenum_insert: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_insert((hid_t)type_id, nameP, byteP);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
- }
- } /* end else */
+ const char *memberName = NULL;
+ jboolean isCopy;
+ jbyte *memberBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert: value is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert: member name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, memberName, NULL, "H5Tenum_insert: member name not pinned");
+
+ PIN_BYTE_ARRAY(ENVONLY, value, memberBuf, &isCopy, "H5Tenum_insert: member buffer not pinned");
+
+ if ((status = H5Tenum_insert((hid_t)type_id, memberName, memberBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (memberBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, memberBuf, (status < 0) ? JNI_ABORT : 0);
+ if (memberName)
+ UNPIN_JAVA_STRING(ENVONLY, name, memberName);
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1insert */
/*
@@ -1099,51 +1225,39 @@ Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int
(JNIEnv *env, jclass clss, jlong type_id, jintArray value, jobjectArray name,
jint size)
{
- herr_t status = -1;
- jint *intP;
- char *nameP;
- jboolean isCopy;
- jstring str;
-
- if (size <= 0) {
- h5badArgument(env, "H5Tenum_nameof: name size < 0");
- } /* end if */
- else if (value == NULL) {
- h5nullArgument(env, "H5Tenum_nameof: value is NULL");
- } /* end if */
- else {
- nameP = (char*)HDmalloc(sizeof(char) * (size_t)size);
- if (nameP == NULL) {
- /* exception -- out of memory */
- h5outOfMemory(env, "H5Tenum_nameof: malloc name size");
- } /* end if */
- else {
- intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy);
- if (intP == NULL) {
- HDfree(nameP);
- h5JNIFatalError(env, "H5Tenum_nameof: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_nameof((hid_t)type_id, intP, nameP, (size_t)size);
-
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT);
-
- if (status < 0) {
- HDfree(nameP);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR nameP);
- HDfree(nameP);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Tenum_nameof: return array not created");
- } /* end if */
- else
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jstring str;
+ jint *intP = NULL;
+ char *nameP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof_int: value is NULL");
+ if (size <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof_int: name size < 0");
+
+ if (NULL == (nameP = (char *) HDmalloc(sizeof(char) * (size_t)size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tenum_nameof_int: failed to allocate name buffer");
+
+ PIN_INT_ARRAY(ENVONLY, value, intP, &isCopy, "H5Tenum_nameof_int: value not pinned");
+
+ if ((status = H5Tenum_nameof((hid_t)type_id, intP, nameP, (size_t)size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nameP[(size_t)size - 1] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, nameP)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (intP)
+ UNPIN_INT_ARRAY(ENVONLY, value, intP, JNI_ABORT);
+ if (nameP)
+ HDfree(nameP);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int */
@@ -1157,49 +1271,36 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Tenum_1nameof
(JNIEnv *env, jclass clss, jlong type_id, jbyteArray value, jlong size)
{
- herr_t status = -1;
- jbyte *byteP;
- char *nameP;
- jboolean isCopy;
- jstring str = NULL;
-
- if (size <= 0) {
- h5badArgument(env, "H5Tenum_nameof: name size < 0");
- } /* end if */
- else if (value == NULL ) {
- h5nullArgument(env, "H5Tenum_nameof: value is NULL");
- } /* end if */
- else {
- nameP = (char*)HDmalloc(sizeof(char) * (size_t)size);
- if (nameP == NULL) {
- h5outOfMemory(env, "H5Tenum_nameof: malloc name size");
- } /* end if */
- else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy);
- if (byteP == NULL) {
- HDfree(nameP);
- h5JNIFatalError(env, "H5Tenum_nameof: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_nameof((hid_t)type_id, byteP, nameP, (size_t)size);
-
- /* free the buffer without copying back */
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
-
- if (status < 0) {
- HDfree(nameP);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR nameP);
- HDfree(nameP);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Tenum_nameof: return array not created");
- } /* end if */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jstring str = NULL;
+ jbyte *byteP = NULL;
+ char *nameP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (size <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof: name size < 0");
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof: value is NULL");
+
+ if (NULL == (nameP = (char *) HDmalloc(sizeof(char) * (size_t)size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tenum_nameof: failed to allocate name buffer");
+
+ PIN_BYTE_ARRAY(ENVONLY, value, byteP, &isCopy, "H5Tenum_nameof: value not pinned");
+
+ if ((status = H5Tenum_nameof((hid_t)type_id, byteP, nameP, (size_t)size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nameP[(size_t)size - 1] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, nameP)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (byteP)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, byteP, JNI_ABORT);
+ if (nameP)
+ HDfree(nameP);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1nameof */
@@ -1213,34 +1314,30 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int
(JNIEnv *env, jclass clss, jlong type_id, jstring name, jintArray value)
{
- herr_t status = -1;
- jint *intP;
- const char *nameP;
- jboolean isCopy2;
-
- if (value == NULL) {
- h5nullArgument(env, "H5Tenum_valueof: value is NULL");
- } /* end if */
- else {
- PIN_JAVA_STRING(name, nameP);
- if (nameP != NULL) {
- intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy2);
- if (intP == NULL) {
- h5JNIFatalError(env, "H5Tenum_valueof: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_valueof((hid_t)type_id, nameP, intP);
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, 0);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
- }
- } /* end else */
+ const char *enumValue = NULL;
+ jboolean isCopy;
+ jint *enumValueBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof_int: value is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof_int: enum value name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, enumValue, NULL, "H5Tenum_valueof_int: enum value not pinned");
+
+ PIN_INT_ARRAY(ENVONLY, value, enumValueBuf, &isCopy, "H5Tenum_valueof_int: enum value buffer not pinned");
+
+ if ((status = H5Tenum_valueof((hid_t)type_id, enumValue, enumValueBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (enumValueBuf)
+ UNPIN_INT_ARRAY(ENVONLY, value, enumValueBuf, (status < 0) ? JNI_ABORT : 0);
+ if (enumValue)
+ UNPIN_JAVA_STRING(ENVONLY, name, enumValue);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int */
@@ -1254,34 +1351,30 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Tenum_1valueof
(JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value)
{
- herr_t status = -1;
- jbyte *byteP;
- const char *nameP;
- jboolean isCopy2;
-
- if (value == NULL) {
- h5nullArgument(env, "H5Tenum_valueof: value is NULL");
- } /* end if */
- else {
- PIN_JAVA_STRING(name, nameP);
- if (nameP != NULL) {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy2);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Tenum_valueof: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_valueof((hid_t)type_id, nameP, byteP);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
- }
- } /* end else */
+ const char *enumValue = NULL;
+ jboolean isCopy;
+ jbyte *enumValueBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof: value is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof: enum value name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, enumValue, NULL, "H5Tenum_valueof: enum value not pinned");
+
+ PIN_BYTE_ARRAY(ENVONLY, value, enumValueBuf, &isCopy, "H5Tenum_valueof: enum value buffer not pinned");
+
+ if ((status = H5Tenum_valueof((hid_t)type_id, enumValue, enumValueBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (enumValueBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, enumValueBuf, (status < 0) ? JNI_ABORT : 0);
+ if (enumValue)
+ UNPIN_JAVA_STRING(ENVONLY, name, enumValue);
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1valueof */
/*
@@ -1293,30 +1386,23 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int
(JNIEnv *env, jclass clss, jlong type_id, jint membno, jintArray value)
{
- herr_t status = -1;
- jint *intP;
- jboolean isCopy;
-
- if (value == NULL) {
- h5nullArgument(env, "H5Tget_member_value: value is NULL");
- } /* end if */
- else {
- intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy);
- if (intP == NULL) {
- h5JNIFatalError(env, "H5Tget_member_value: value not pinned");
- } /* end if */
- else {
- status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, intP);
-
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, 0);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jint *intP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_member_value: value is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, value, intP, &isCopy, "H5Tget_member_value: value not pinned");
+
+ if ((status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, intP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (intP)
+ UNPIN_INT_ARRAY(ENVONLY, value, intP, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int */
@@ -1330,29 +1416,23 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1value
(JNIEnv *env, jclass clss, jlong type_id, jint membno, jbyteArray value)
{
- herr_t status = -1;
- jbyte *byteP;
- jboolean isCopy;
-
- if (value == NULL) {
- h5nullArgument( env, "H5Tget_member_value: value is NULL");
- } /* end if */
- else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value,&isCopy);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Tget_member_value: value not pinned");
- } /* end if */
- else {
- status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, byteP);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jbyte *byteP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_member_value: value is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, value, byteP, &isCopy, "H5Tget_member_value: value not pinned");
+
+ if ((status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, byteP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (byteP)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, byteP, (status < 0) ? JNI_ABORT : 0);
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1value */
/*
@@ -1366,10 +1446,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims
{
int ndims = -1;
- ndims = H5Tget_array_ndims((hid_t)type_id);
- if (ndims < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((ndims = H5Tget_array_ndims((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)ndims;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims */
@@ -1382,41 +1464,41 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1array_1dims
(JNIEnv *env, jclass clss, jlong type_id, jintArray dims, jintArray perms)
{
- int ndims = -1;
- int dlen;
- int i;
- jint *dimsP;
- hsize_t *cdims = NULL;
- jboolean isCopy;
-
- if (dims == NULL) {
- h5nullArgument( env, "H5Tget_array_dims: value is NULL");
- } /* end if */
- else {
- dimsP = ENVPTR->GetIntArrayElements(ENVPAR dims, &isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError(env, "H5Tget_array_dims: dimsP not pinned");
- } /* end if */
- else {
- dlen = ENVPTR->GetArrayLength(ENVPAR dims);
- cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t));
-
- ndims = H5Tget_array_dims2((hid_t)type_id, cdims);
-
- if (ndims < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < dlen; i++) {
- dimsP[i] = (jint) cdims[i];
- } /* end for */
- ENVPTR->ReleaseIntArrayElements(ENVPAR dims, dimsP, 0);
-
- if (cdims) HDfree(cdims);
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *cdims = NULL;
+ size_t i;
+ jsize dlen;
+ jint *dimsP = NULL;
+ int ndims = -1;
+
+ UNUSED(clss);
+ UNUSED(perms);
+
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_array_dims: dims array is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Tget_array_dims: dimsP not pinned");
+
+ if ((dlen = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_array_dims: dims array length < 0");
+ }
+
+ if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tget_array_dims: failed to allocate dimension buffer");
+
+ if ((ndims = H5Tget_array_dims2((hid_t)type_id, cdims)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (size_t) dlen; i++) {
+ dimsP[i] = (jint) cdims[i];
+ } /* end for */
+
+done:
+ if (cdims)
+ HDfree(cdims);
+ if (dimsP)
+ UNPIN_INT_ARRAY(ENVONLY, dims, dimsP, (ndims < 0) ? JNI_ABORT : 0);
return (jint)ndims;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1dims */
@@ -1432,12 +1514,14 @@ Java_hdf_hdf5lib_H5_H5Tis_1variable_1str
{
htri_t bval = JNI_FALSE;
- bval = H5Tis_variable_str((hid_t)type_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Tis_variable_str((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Tis_1variable_1str */
@@ -1450,13 +1534,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tget_1native_1type
(JNIEnv *env, jclass clss, jlong type_id, jint direction)
{
- hid_t native_tid = -1;
+ hid_t native_tid = H5I_INVALID_HID;
- native_tid = H5Tget_native_type((hid_t)type_id, (H5T_direction_t)direction);
+ UNUSED(clss);
- if (native_tid < 0)
- h5libraryError(env);
+ if ((native_tid = H5Tget_native_type((hid_t)type_id, (H5T_direction_t)direction)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)native_tid;
} /* end Java_hdf_hdf5lib_H5__1H5Tget_1native_1type */
@@ -1471,12 +1556,14 @@ Java_hdf_hdf5lib_H5_H5Tdetect_1class
{
htri_t bval = JNI_FALSE;
- bval = H5Tdetect_class((hid_t)type_id, (H5T_class_t)dtype_class);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((bval = H5Tdetect_class((hid_t)type_id, (H5T_class_t)dtype_class)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Tdetect_1class */
@@ -1490,18 +1577,22 @@ Java_hdf_hdf5lib_H5_H5Tcommit
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type,
jlong link_plist_id, jlong create_plist_id, jlong access_plist_id)
{
- herr_t status = -1;
- const char *tName;
+ const char *datatypeName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, tName);
- if (tName != NULL) {
- status = H5Tcommit2((hid_t)loc_id, tName, (hid_t)type, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, tName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tcommit: datatype name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, datatypeName, NULL, "H5Tcommit: datatype name not pinned");
+
+ if ((status = H5Tcommit2((hid_t)loc_id, datatypeName, (hid_t)type, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (datatypeName)
+ UNPIN_JAVA_STRING(ENVONLY, name, datatypeName);
} /* end Java_hdf_hdf5lib_H5_H5Tcommit */
/*
@@ -1513,96 +1604,92 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tarray_1create2
(JNIEnv *env, jclass clss, jlong base_id, jint rank, jlongArray dims)
{
- hid_t retVal = -1;
- jlong *dimsP;
- int dlen;
- hsize_t *cdims = NULL;
- jboolean isCopy;
- int i;
-
- if (rank <= 0) {
- h5badArgument(env, "H5Tarray_create: rank is < 1");
- } /* end if */
- else if (dims == NULL) {
- h5nullArgument(env, "H5Tarray_create: dims is NULL");
- } /* end else if */
- else {
- dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError( env, "H5Tarray_create: dimsP not pinned");
- } /* end if */
- else {
- dlen = ENVPTR->GetArrayLength(ENVPAR dims);
- if (dlen != rank) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- } /* end if */
- else {
- cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t));
- for (i = 0; i < dlen; i++) {
- cdims[i] = (hsize_t)dimsP[i];
- } /* end for */
-
- retVal = H5Tarray_create2((hid_t)base_id, (unsigned)rank, (const hsize_t*)cdims);
-
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0);
-
- HDfree(cdims);
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *cdims = NULL;
+ size_t i;
+ jlong *dimsP = NULL;
+ jsize dlen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (rank <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: rank is < 1");
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: dims is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Tarray_create: dimsP not pinned");
+
+ if ((dlen = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: dims array length < 0");
+ }
+
+ if (dlen != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: dimension array length != array rank");
+
+ if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tarray_create: failed to allocate dimension buffer");
+
+ for (i = 0; i < (size_t) dlen; i++) {
+ cdims[i] = (hsize_t)dimsP[i];
+ } /* end for */
+
+ if ((retVal = H5Tarray_create2((hid_t)base_id, (unsigned)rank, (const hsize_t *)cdims)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (cdims)
+ HDfree(cdims);
+ if (dimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, (retVal < 0) ? JNI_ABORT : 0);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tarray_1create2 */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Tarray_get_dims2
+ * Method: H5Tget_array_dims2
* Signature: (J[J)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2
(JNIEnv *env, jclass clss, jlong type_id, jlongArray dims)
{
- int ndims = -1;
- int dlen;
- int i;
- jlong *dimsP;
- hsize_t *cdims=NULL;
- jboolean isCopy;
-
- if (dims == NULL) {
- h5nullArgument(env, "H5Tget_array_dims: value is NULL");
- } /* end if */
- else {
- dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims,&isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError(env, "H5Tget_array_dims: dimsP not pinned");
- } /* end if */
- else {
- dlen = ENVPTR->GetArrayLength(ENVPAR dims);
- cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t));
-
- ndims = H5Tget_array_dims2((hid_t)type_id, (hsize_t*)cdims);
-
- if (ndims < 0) {
- if (cdims)
- free(cdims);
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < dlen; i++) {
- dimsP[i] = (jlong) cdims[i];
- } /* end for */
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0);
-
- if (cdims)
- HDfree(cdims);
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *cdims = NULL;
+ size_t i;
+ jlong *dimsP = NULL;
+ jsize dlen;
+ int ndims = -1;
+
+ UNUSED(clss);
+
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tarray_get_dims2: value is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Tarray_get_dims2: dimsP not pinned");
+
+ if ((dlen = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_get_dims2: dims array length < 0");
+ }
+
+ if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Tarray_get_dims2: failed to allocate dimension buffer");
+
+ if ((ndims = H5Tget_array_dims2((hid_t)type_id, (hsize_t*)cdims)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (size_t) dlen; i++) {
+ dimsP[i] = (jlong) cdims[i];
+ } /* end for */
+
+done:
+ if (cdims)
+ HDfree(cdims);
+ if (dimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, (ndims < 0) ? JNI_ABORT : 0);
return (jint)ndims;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2 */
@@ -1617,34 +1704,29 @@ Java_hdf_hdf5lib_H5_H5Tconvert
(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id, jlong nelmts,
jbyteArray buf, jbyteArray background, jlong plist_id)
{
- herr_t status;
- jbyte *bufP;
- jbyte *bgP = NULL;
- jboolean isCopy;
-
- if (nelmts <= 0) {
- h5badArgument(env, "H5Tconvert: name nelmts < 0");
- } /* end if */
- else {
- bufP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (bufP == NULL) {
- h5JNIFatalError(env, "H5Tconvert: value not pinned");
- } /* end if */
- else {
- if (background)
- bgP = ENVPTR->GetByteArrayElements(ENVPAR background, &isCopy);
-
- status = H5Tconvert((hid_t)src_id, (hid_t)dst_id, (size_t)nelmts, (void *)bufP, (void *)bgP, (hid_t)plist_id) ;
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, bufP, 0);
-
- if (bgP)
- ENVPTR->ReleaseByteArrayElements(ENVPAR background, bgP, 0);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jbyte *bufP = NULL;
+ jbyte *bgP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (nelmts <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tconvert: nelmts < 0");
+
+ PIN_BYTE_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Tconvert: buffer not pinned");
+
+ if (background)
+ PIN_BYTE_ARRAY(ENVONLY, background, bgP, &isCopy, "H5Tconvert: background buffer not pinned");
+
+ if ((status = H5Tconvert((hid_t)src_id, (hid_t)dst_id, (size_t)nelmts, (void *)bufP, (void *)bgP, (hid_t)plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (bgP)
+ UNPIN_BYTE_ARRAY(ENVONLY, background, bgP, (status < 0) ? JNI_ABORT : 0);
+ if (bufP)
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, bufP, (status < 0) ? JNI_ABORT : 0);
} /* end Java_hdf_hdf5lib_H5_H5Tconvert */
/*
@@ -1655,8 +1737,13 @@ Java_hdf_hdf5lib_H5_H5Tconvert
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Tflush(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Tflush((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
}
/*
@@ -1667,10 +1754,14 @@ Java_hdf_hdf5lib_H5_H5Tflush(JNIEnv *env, jclass clss, jlong loc_id)
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Trefresh(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Trefresh((hid_t)loc_id) < 0)
- h5libraryError(env);
-}
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
+ return;
+}
#ifdef __cplusplus
diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h
index 374d992..78e4561 100644
--- a/java/src/jni/h5tImp.h
+++ b/java/src/jni/h5tImp.h
@@ -401,6 +401,15 @@ Java_hdf_hdf5lib_H5_H5Tpack
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Treclaim
+ * Signature: (JJJ[B)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Treclaim
+ (JNIEnv*, jclass, jlong, jlong, jlong, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: _H5Tclose
* Signature: (J)I
*/
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index bd9fc0f..f45902f 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -21,18 +21,24 @@
extern "C" {
#endif /* __cplusplus */
+#include <jni.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "hdf5.h"
#include "h5util.h"
+#define SKIP_UNUSED_DUMP_ROUTINES
+
/* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */
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 */
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
JavaVM *jvm;
-jobject visit_callback;
+
jobject copy_callback;
jobject close_callback;
jobject create_callback;
@@ -41,19 +47,24 @@ jobject get_callback;
jobject set_callback;
jobject delete_callback;
+H5E_auto2_t efunc;
+void *edata;
+
/********************/
/* Local Prototypes */
/********************/
-static int h5str_dump_region_blocks(h5str_t *str, hid_t region, hid_t region_obj);
-static int h5str_dump_region_points(h5str_t *str, hid_t region, hid_t region_obj);
+#ifndef SKIP_UNUSED_DUMP_ROUTINES
+static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
+static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
+#endif
static int h5str_is_zero(const void *_mem, size_t size);
static hid_t h5str_get_native_type(hid_t type);
static hid_t h5str_get_little_endian_type(hid_t type);
static hid_t h5str_get_big_endian_type(hid_t type);
static htri_t h5str_detect_vlen(hid_t tid);
static htri_t h5str_detect_vlen_str(hid_t tid);
-static int h5tools_dump_simple_data(FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts);
+static int h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts);
static int h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts);
static int render_bin_output_region_data_blocks(FILE *stream, hid_t region_id,
hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata);
@@ -64,6 +75,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
@@ -75,9 +92,10 @@ h5str_array_free
return;
for (i = 0; i < len; i++) {
- if (*(strs + i))
- HDfree(*(strs + i));
+ if (strs[i])
+ HDfree(strs[i]);
} /* for (i=0; i<n; i++)*/
+
HDfree(strs);
} /* end h5str_array_free */
@@ -105,6 +123,9 @@ h5str_free
} /* end h5str_free */
/** reset the max size of the string */
+/*
+ * TODO: no error return. malloc can fail.
+ */
void
h5str_resize
(h5str_t *str, size_t new_len)
@@ -114,7 +135,9 @@ h5str_resize
if (!str || new_len <= 0 || str->max == new_len)
return;
- new_str = (char *)HDmalloc(new_len);
+ if (NULL == (new_str = (char *) HDmalloc(new_len)))
+ return;
+
if (new_len > str->max) /* increase memory */
HDstrcpy(new_str, str->s);
else
@@ -149,355 +172,1149 @@ h5str_append
return HDstrcat(str->s, cstr);
} /* end h5str_append */
-/** print value of a data point into string.
- Return Value:
- On success, the total number of characters printed is returned.
- On error, a negative number is returned.
+/*
+ * Converts the given data point string into a real data point.
+ *
+ * Returns:
+ * SUCCESS: Length of string token processed
+ * FAILURE: 0
*/
size_t
-h5str_sprintf
- (h5str_t *str, hid_t container, hid_t tid, void *ptr, int expand_data)
+h5str_convert
+ (JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset)
{
- unsigned char tmp_uchar = 0;
- char tmp_char = 0;
- unsigned short tmp_ushort = 0;
- short tmp_short = 0;
- unsigned int tmp_uint = 0;
- int tmp_int = 0;
- unsigned long tmp_ulong = 0;
- long tmp_long = 0;
- unsigned long long tmp_ullong = 0;
- long long tmp_llong = 0;
- float tmp_float = 0.0;
- double tmp_double = 0.0;
- long double tmp_ldouble = 0.0;
- static char fmt_llong[8], fmt_ullong[8];
-
- hid_t mtid = -1;
- size_t offset;
- size_t nll;
- char *this_str;
- size_t this_strlen;
- int n;
- hvl_t *vlptr;
- char *cptr = (char*) ptr;
- unsigned char *ucptr = (unsigned char*) ptr;
- H5T_class_t tclass = H5Tget_class(tid);
- size_t size = H5Tget_size(tid);
- H5T_sign_t nsign = H5Tget_sign(tid);
- int bdata_print = 0;
-
- if (!str || !ptr)
- return 0;
+ unsigned char *ucptr = NULL;
+ static char fmt_llong[8], fmt_ullong[8];
+ H5T_class_t tclass = H5T_NO_CLASS;
+ const char delimiter[] = " ," H5_COMPOUND_BEGIN_INDICATOR H5_COMPOUND_END_INDICATOR \
+ H5_ARRAY_BEGIN_INDICATOR H5_ARRAY_END_INDICATOR \
+ H5_VLEN_BEGIN_INDICATOR H5_VLEN_END_INDICATOR;
+ size_t typeSize = 0;
+ hid_t mtid = H5I_INVALID_HID;
+ char *this_str = NULL;
+ char *token;
+ char *cptr = NULL;
+ int n;
+ size_t retVal = 0;
+
+ if (!in_str)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_convert: in_str is NULL");
+ if (!out_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_convert: out_buf is NULL");
+
+ this_str = *in_str;
+ cptr = &(((char *) out_buf)[out_buf_offset]);
+ ucptr = &(((unsigned char *) out_buf)[out_buf_offset]);
+
+ if (H5T_NO_CLASS == (tclass = H5Tget_class(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+ if (!(typeSize = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
/* Build default formats for long long types */
if (!fmt_llong[0]) {
- sprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH);
- sprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH);
+ if (HDsprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsprintf failure");
+ if (HDsprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsprintf failure");
} /* end if */
- this_str = NULL;
- this_strlen = 0;
-
switch (tclass) {
- case H5T_FLOAT:
- if (sizeof(float) == size) {
- /* if (H5Tequal(tid, H5T_NATIVE_FLOAT)) */
- HDmemcpy(&tmp_float, ptr, sizeof(float));
- this_str = (char*)HDmalloc(25);
- sprintf(this_str, "%g", tmp_float);
- }
- else if (sizeof(double) == size) {
- /* if (H5Tequal(tid, H5T_NATIVE_DOUBLE)) */
- HDmemcpy(&tmp_double, ptr, sizeof(double));
- this_str = (char*)HDmalloc(25);
- sprintf(this_str, "%g", tmp_double);
- }
-#if H5_SIZEOF_LONG_DOUBLE !=0
- else if (sizeof(long double) == size) {
- /* if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) */
- HDmemcpy(&tmp_ldouble, ptr, sizeof(long double));
- this_str = (char*)HDmalloc(27);
- sprintf(this_str, "%Lf", tmp_ldouble);
- }
+ case H5T_FLOAT:
+ {
+ token = HDstrtok(this_str, delimiter);
+
+ switch (typeSize) {
+ case sizeof(float):
+ {
+ float tmp_float = 0.0f;
+
+ sscanf(token, "%f", &tmp_float);
+ HDmemcpy(cptr, &tmp_float, sizeof(float));
+ break;
+ }
+
+ case sizeof(double):
+ {
+ double tmp_double = 0.0;
+
+ sscanf(token, "%lf", &tmp_double);
+ HDmemcpy(cptr, &tmp_double, sizeof(double));
+ break;
+ }
+#if H5_SIZEOF_LONG_DOUBLE != 0 && H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ case sizeof(long double):
+ {
+ long double tmp_ldouble = 0.0;
+
+ sscanf(token, "%Lf", &tmp_ldouble);
+ HDmemcpy(cptr, &tmp_ldouble, sizeof(long double));
+ break;
+ }
#endif
- break;
- case H5T_STRING:
- {
- char *tmp_str;
- size = 0;
- if (H5Tis_variable_str(tid)) {
- tmp_str = *(char**) ptr;
- if (tmp_str != NULL)
- size = HDstrlen(tmp_str);
- }
- else {
- tmp_str = cptr;
+ default:
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_convert: floating-point datatype size didn't match any of expected sizes");
+ break;
+ }
+
+ retVal = typeSize;
+
+ break;
}
- /* Check for NULL pointer for string */
- if (tmp_str == NULL) {
- this_str = (char *)HDmalloc(5);
- HDstrncpy(this_str, "NULL", 4);
+ case H5T_STRING:
+ {
+ size_t len = HDstrlen(this_str);
+
+ if (len > 0) {
+ HDstrncpy(cptr, this_str, typeSize);
+ cptr[typeSize - 1] = '\0';
+
+ retVal = typeSize;
+ }
+ else {
+ cptr = NULL;
+ }
+
+ break;
}
- else {
- if (size > 0) {
- this_str = (char *)HDmalloc(size+1);
- HDstrncpy(this_str, tmp_str, size);
+
+ case H5T_INTEGER:
+ {
+ H5T_sign_t nsign = H5T_SGN_ERROR;
+
+ if (H5T_SGN_ERROR == (nsign = H5Tget_sign(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ token = HDstrtok(this_str, delimiter);
+
+ switch (typeSize) {
+ case sizeof(char):
+ {
+ unsigned char tmp_uchar = 0;
+ signed char tmp_char = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ sscanf(token, "%hhu", &tmp_uchar);
+ HDmemcpy(cptr, &tmp_uchar, sizeof(unsigned char));
+ }
+ else {
+ sscanf(token, "%hhd", &tmp_char);
+ HDmemcpy(cptr, &tmp_char, sizeof(char));
+ }
+
+ break;
+ }
+
+ case sizeof(short):
+ {
+ unsigned short tmp_ushort = 0;
+ short tmp_short = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ sscanf(token, "%hu", &tmp_ushort);
+ HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short));
+ }
+ else {
+ sscanf(token, "%hd", &tmp_short);
+ HDmemcpy(&tmp_short, cptr, sizeof(short));
+ }
+
+ break;
+ }
+
+ case sizeof(int):
+ {
+ unsigned int tmp_uint = 0;
+ int tmp_int = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ sscanf(token, "%u", &tmp_uint);
+ HDmemcpy(cptr, &tmp_uint, sizeof(unsigned int));
+ }
+ else {
+ sscanf(token, "%d", &tmp_int);
+ HDmemcpy(cptr, &tmp_int, sizeof(int));
+ }
+
+ break;
+ }
+
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
+ case sizeof(long):
+ {
+ unsigned long tmp_ulong = 0;
+ long tmp_long = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ sscanf(token, "%lu", &tmp_ulong);
+ HDmemcpy(cptr, &tmp_ulong, sizeof(unsigned long));
+ }
+ else {
+ sscanf(token, "%ld", &tmp_long);
+ HDmemcpy(cptr, &tmp_long, sizeof(long));
+ }
+
+ break;
+ }
+#endif
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
+ case sizeof(long long):
+ {
+ unsigned long long tmp_ullong = 0;
+ long long tmp_llong = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ sscanf(token, fmt_ullong, &tmp_ullong);
+ HDmemcpy(cptr, &tmp_ullong, sizeof(unsigned long long));
+ }
+ else {
+ sscanf(token, fmt_llong, &tmp_llong);
+ HDmemcpy(cptr, &tmp_llong, sizeof(long long));
+ }
+
+ break;
+ }
+#endif
+
+ default:
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_convert: integer datatype size didn't match any of expected sizes");
+ break;
}
+
+ retVal = typeSize;
+
+ break;
}
- }
- break;
- case H5T_INTEGER:
- if (sizeof(char) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_UCHAR)) */
- HDmemcpy(&tmp_uchar, ptr, sizeof(unsigned char));
- this_str = (char*)HDmalloc(7);
- sprintf(this_str, "%u", tmp_uchar);
+
+ case H5T_COMPOUND:
+ {
+ unsigned i;
+ size_t member_offset;
+
+ if ((n = H5Tget_nmembers(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Skip whitespace and compound indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == '{') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ for (i = 0; i < (unsigned) n; i++) {
+ member_offset = H5Tget_member_offset(tid, i);
+
+ if ((mtid = H5Tget_member_type(tid, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!h5str_convert(ENVONLY, &this_str, container, mtid, out_buf, member_offset)) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ goto done;
+ }
+
+ /* Skip whitespace and commas */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == ',') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
}
- else {
- /* if (H5Tequal(tid, H5T_NATIVE_SCHAR)) */
- HDmemcpy(&tmp_char, ptr, sizeof(char));
- this_str = (char*)HDmalloc(7);
- sprintf(this_str, "%hhd", tmp_char);
+
+ /* Skip whitespace and compound indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == '}') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ retVal = typeSize * (size_t) n;
+
+ break;
+ }
+
+ /* TODO handle reference writing */
+ case H5T_REFERENCE:
+ cptr = NULL;
+ break;
+
+ case H5T_ENUM:
+ {
+ void *value;
+
+ token = HDstrtok(this_str, delimiter);
+
+ switch (typeSize) {
+ case sizeof(char):
+ {
+ unsigned char tmp_uchar = 0;
+ value = &tmp_uchar;
+ break;
+ }
+
+ case sizeof(short):
+ {
+ unsigned short tmp_ushort = 0;
+ value = &tmp_ushort;
+ break;
+ }
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
+ case sizeof(long):
+ {
+ unsigned long tmp_ulong = 0;
+ value = &tmp_ulong;
+ break;
+ }
+#endif
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
+ case sizeof(long long):
+ {
+ unsigned long long tmp_ullong = 0;
+ value = &tmp_ullong;
+ break;
+ }
+#endif
+
+ default:
+ {
+ unsigned int tmp_uint = 0;
+ value = &tmp_uint;
+ break;
+ }
}
+
+ if (H5Tenum_valueof(tid, token, value) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ HDmemcpy(ucptr, value, typeSize);
+
+ retVal = typeSize;
+
+ break;
}
- else if (sizeof(int) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_UINT)) */
- HDmemcpy(&tmp_uint, ptr, sizeof(unsigned int));
- this_str = (char*)HDmalloc(14);
- sprintf(this_str, "%u", tmp_uint);
+
+ case H5T_ARRAY:
+ {
+ hsize_t i, dims[H5S_MAX_RANK], total_elmts;
+ size_t baseTypeSize;
+ int rank = 0;
+
+ /* Skip whitespace and array indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == '[') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ if ((mtid = H5Tget_super(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(baseTypeSize = H5Tget_size(mtid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((rank = H5Tget_array_ndims(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Tget_array_dims2(tid, dims) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0, total_elmts = 1; i < (hsize_t) rank; i++)
+ total_elmts *= dims[i];
+
+ if (NULL == (cptr = (char *) HDcalloc((size_t)total_elmts, baseTypeSize)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to allocate array buffer");
+
+ for (i = 0; i < total_elmts; i++) {
+ if (!(h5str_convert(ENVONLY, &this_str, container, mtid, out_buf, i * baseTypeSize))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ goto done;
+ }
+
+ /* Skip whitespace and commas */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == ',') this_str++;
+ while (*this_str == ' ') this_str++;
}
- else {
- /* if (H5Tequal(tid, H5T_NATIVE_INT)) */
- HDmemcpy(&tmp_int, ptr, sizeof(int));
- this_str = (char*)HDmalloc(14);
- sprintf(this_str, "%d", tmp_int);
+
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
+
+ /* Skip whitespace and array indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == ']') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ retVal = typeSize * total_elmts;
+
+ break;
+ }
+
+ case H5T_VLEN:
+ {
+ size_t i, baseTypeSize;
+ hvl_t *vl_buf = (hvl_t *) out_buf;
+ char cur_char;
+
+ if ((mtid = H5Tget_super(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(baseTypeSize = H5Tget_size(mtid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (vl_buf->p = HDmalloc(baseTypeSize)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to allocate vlen buffer");
+ vl_buf->len = 1;
+
+ /* Skip whitespace and vlen indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == '(') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ cur_char = *this_str;
+ for (i = 0; cur_char != ')' && cur_char != '\0'; i++) {
+ if (i >= vl_buf->len) {
+ char *tmp_realloc;
+
+ if (NULL == (tmp_realloc = (char *) HDrealloc(vl_buf->p, vl_buf->len * 2 * baseTypeSize)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_convert: failed to reallocate vlen buffer");
+ vl_buf->len *= 2;
+ vl_buf->p = tmp_realloc;
+ }
+
+ if (!(h5str_convert(ENVONLY, &this_str, container, mtid, vl_buf->p, i * baseTypeSize))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ vl_buf->len = i;
+ goto done;
+ }
+
+ /* Skip whitespace and commas */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == ',') this_str++;
+ while (*this_str == ' ') this_str++;
}
+
+ vl_buf->len = i;
+
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
+
+ /* Skip whitespace and vlen indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == ')') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ retVal = typeSize;
+
+ break;
+ }
+
+ case H5T_NCLASSES:
+ case H5T_NO_CLASS:
+ {
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_convert: invalid datatype class");
+ break;
+ }
+
+ case H5T_TIME:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ default:
+ {
+ /* All other types get copied raw */
+ HDmemcpy(ucptr, this_str, typeSize);
+
+ retVal = typeSize;
+
+ break;
+ }
+ } /* end switch */
+
+done:
+ if (mtid >= 0)
+ H5Tclose(mtid);
+
+ 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);
}
- else if (sizeof(short) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_USHORT)) */
- HDmemcpy(&tmp_ushort, ptr, sizeof(unsigned short));
- this_str = (char*)HDmalloc(9);
- sprintf(this_str, "%u", tmp_ushort);
+ 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);
}
- else {
- /* if (H5Tequal(tid, H5T_NATIVE_SHORT)) */
- HDmemcpy(&tmp_short, ptr, sizeof(short));
- this_str = (char*)HDmalloc(9);
- sprintf(this_str, "%d", tmp_short);
+ 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.
+ *
+ * Returns:
+ * SUCCESS: Total number of characters printed
+ * FAILURE: 0
+ */
+size_t
+h5str_sprintf
+ (JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, size_t in_buf_len, int expand_data)
+{
+ unsigned char *ucptr = (unsigned char *) in_buf;
+ static char fmt_llong[8], fmt_ullong[8];
+ H5T_class_t tclass = H5T_NO_CLASS;
+ 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;
+ size_t retVal = 0;
+
+ if (!out_str)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: out_str is NULL");
+ if (!in_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: in_buf is NULL");
+
+ if (H5T_NO_CLASS == (tclass = H5Tget_class(tid)))
+ 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 (HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
+ if (HDsnprintf(fmt_ullong, sizeof(fmt_ullong), "%%%su", H5_PRINTF_LL_WIDTH) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure");
+ } /* end if */
+
+ switch (tclass) {
+ case H5T_FLOAT:
+ {
+ switch (typeSize) {
+ case sizeof(float):
+ {
+ float tmp_float = 0.0f;
+
+ HDmemcpy(&tmp_float, cptr, sizeof(float));
+
+ if (NULL == (this_str = (char *) HDmalloc(25)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%g", tmp_float) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+
+ break;
+ }
+
+ case sizeof(double):
+ {
+ double tmp_double = 0.0;
+
+ HDmemcpy(&tmp_double, cptr, sizeof(double));
+
+ if (NULL == (this_str = (char *) HDmalloc(25)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%g", tmp_double) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+
+ break;
+ }
+#if H5_SIZEOF_LONG_DOUBLE != 0 && H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ case sizeof(long double):
+ {
+ long double tmp_ldouble = 0.0;
+
+ HDmemcpy(&tmp_ldouble, cptr, sizeof(long double));
+
+ if (NULL == (this_str = (char *) HDmalloc(27)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%Lf", tmp_ldouble) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+
+ break;
+ }
+#endif
+
+ default:
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: floating-point datatype size didn't match any of expected sizes");
+ break;
}
+
+ break;
}
- else if (sizeof(long) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_ULONG)) */
- HDmemcpy(&tmp_ulong, ptr, sizeof(unsigned long));
- this_str = (char*)HDmalloc(23);
- sprintf(this_str, "%lu", tmp_ulong);
+
+ case H5T_STRING:
+ {
+ htri_t is_variable;
+ char *tmp_str;
+
+ if ((is_variable = H5Tis_variable_str(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (is_variable) {
+ /* 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 {
- /* if (H5Tequal(tid, H5T_NATIVE_LONG)) */
- HDmemcpy(&tmp_long, ptr, sizeof(long));
- this_str = (char*)HDmalloc(23);
- sprintf(this_str, "%ld", tmp_long);
+ tmp_str = cptr;
}
- }
- else if (sizeof(long long) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_ULLONG)) */
- HDmemcpy(&tmp_ullong, ptr, sizeof(unsigned long long));
- this_str = (char*)HDmalloc(25);
- sprintf(this_str, fmt_ullong, tmp_ullong);
+
+ /* Check for NULL pointer for string */
+ if (!tmp_str) {
+ if (NULL == (this_str = (char *) HDmalloc(5)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ HDstrncpy(this_str, "NULL", 5);
}
else {
- /* if (H5Tequal(tid, H5T_NATIVE_LLONG)) */
- HDmemcpy(&tmp_llong, ptr, sizeof(long long));
- this_str = (char*)HDmalloc(25);
- sprintf(this_str, fmt_llong, tmp_llong);
+ if (typeSize > 0) {
+ if (NULL == (this_str = (char *) HDmalloc(typeSize + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ HDstrncpy(this_str, tmp_str, typeSize);
+ this_str[typeSize] = '\0';
+ }
}
+
+ break;
}
- break;
- case H5T_COMPOUND:
- {
- unsigned i;
- n = H5Tget_nmembers(tid);
- h5str_append(str, " {");
-
- for (i = 0; i < n; i++) {
- offset = H5Tget_member_offset(tid, i);
- mtid = H5Tget_member_type(tid, i);
- h5str_sprintf(str, container, mtid, cptr + offset, expand_data);
- if (i < n - 1)
- h5str_append(str, ", ");
- H5Tclose(mtid);
+
+ case H5T_INTEGER:
+ {
+
+ if (H5T_SGN_ERROR == (nsign = H5Tget_sign(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ switch (typeSize) {
+ case sizeof(char):
+ {
+ unsigned char tmp_uchar = 0;
+ char tmp_char = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ HDmemcpy(&tmp_uchar, cptr, sizeof(unsigned char));
+
+ if (NULL == (this_str = (char *) HDmalloc(7)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%hhu", tmp_uchar) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ HDmemcpy(&tmp_char, cptr, sizeof(char));
+
+ if (NULL == (this_str = (char *) HDmalloc(7)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%hhd", tmp_char) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
+ }
+
+ case sizeof(short):
+ {
+ unsigned short tmp_ushort = 0;
+ short tmp_short = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short));
+
+ if (NULL == (this_str = (char *) HDmalloc(9)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%hu", tmp_ushort) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ HDmemcpy(&tmp_short, cptr, sizeof(short));
+
+ if (NULL == (this_str = (char *) HDmalloc(9)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%hd", tmp_short) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
+ }
+
+ case sizeof(int):
+ {
+ unsigned int tmp_uint = 0;
+ int tmp_int = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ HDmemcpy(&tmp_uint, cptr, sizeof(unsigned int));
+
+ if (NULL == (this_str = (char *) HDmalloc(14)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%u", tmp_uint) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ HDmemcpy(&tmp_int, cptr, sizeof(int));
+
+ if (NULL == (this_str = (char *) HDmalloc(14)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%d", tmp_int) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
+ }
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
+ case sizeof(long):
+ {
+ unsigned long tmp_ulong = 0;
+ long tmp_long = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ HDmemcpy(&tmp_ulong, cptr, sizeof(unsigned long));
+
+ if (NULL == (this_str = (char *) HDmalloc(23)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%lu", tmp_ulong) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ HDmemcpy(&tmp_long, cptr, sizeof(long));
+
+ if (NULL == (this_str = (char *) HDmalloc(23)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%ld", tmp_long) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
+ }
+#endif
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
+ case sizeof(long long):
+ {
+ unsigned long long tmp_ullong = 0;
+ long long tmp_llong = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ HDmemcpy(&tmp_ullong, cptr, sizeof(unsigned long long));
+
+ if (NULL == (this_str = (char *) HDmalloc(25)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, fmt_ullong, tmp_ullong) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ HDmemcpy(&tmp_llong, cptr, sizeof(long long));
+
+ if (NULL == (this_str = (char *) HDmalloc(25)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, fmt_llong, tmp_llong) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
+ }
+#endif
+
+ default:
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: integer datatype size didn't match any of expected sizes");
+ break;
+ }
+
+ break;
}
- h5str_append(str, "} ");
- }
- break;
- case H5T_ENUM:
- {
- char enum_name[1024];
- if (H5Tenum_nameof(tid, ptr, enum_name, sizeof enum_name) >= 0) {
- h5str_append(str, enum_name);
+
+ case H5T_COMPOUND:
+ {
+ unsigned i;
+ size_t offset;
+
+ if ((n = H5Tget_nmembers(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!h5str_append(out_str, H5_COMPOUND_BEGIN_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ for (i = 0; i < (unsigned) n; i++) {
+ offset = H5Tget_member_offset(tid, i);
+
+ if ((mtid = H5Tget_member_type(tid, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &cptr[offset], in_buf_len, expand_data))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if ((i + 1) < (unsigned) n)
+ if (!h5str_append(out_str, ", "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
+ }
+
+ if (!h5str_append(out_str, H5_COMPOUND_END_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
}
- else {
- size_t i;
- nll = H5Tget_size(tid);
- this_str = (char*)HDmalloc(4 * (nll + 1));
- if (1 == nll) {
- sprintf(this_str, "%#02x", ucptr[0]);
+ case H5T_ENUM:
+ {
+ char enum_name[1024];
+
+ if (H5Tenum_nameof(tid, cptr, enum_name, sizeof enum_name) >= 0) {
+ if (!h5str_append(out_str, enum_name))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
else {
- for (i = 0; i < (int)nll; i++)
- sprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]);
+ size_t i;
+
+ if (NULL == (this_str = (char *) HDmalloc(4 * (typeSize + 1))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (1 == typeSize) {
+ if (HDsprintf(this_str, "%#02x", ucptr[0]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ for (i = 0; i < typeSize; i++)
+ if (HDsprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
}
+
+ break;
}
- }
- break;
- case H5T_REFERENCE:
- if (h5str_is_zero(ptr, size)) {
- h5str_append(str, "NULL");
- }
- else {
- if (H5R_DSET_REG_REF_BUF_SIZE == size) {
- /* if (H5Tequal(tid, H5T_STD_REF_DSETREG)) */
- /*
- * Dataset region reference --
- * show the type and the referenced object
- */
- char ref_name[1024];
- hid_t region_obj;
- hid_t region;
- H5S_sel_type region_type;
- /* get name of the dataset the region reference points to using H5Rget_name */
- region_obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, ptr);
- if (region_obj >= 0) {
- region = H5Rget_region(container, H5R_DATASET_REGION, ptr);
- if (region >= 0) {
- if(expand_data) {
- region_type = H5Sget_select_type(region);
- if(region_type==H5S_SEL_POINTS) {
- h5str_dump_region_points_data(str, region, region_obj);
- }
- else {
- h5str_dump_region_blocks_data(str, region, region_obj);
- }
+ case H5T_REFERENCE:
+ {
+ if (h5str_is_zero(cptr, typeSize)) {
+ if (!h5str_append(out_str, "NULL"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+ }
+
+ 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_info2_t oi;
+
+ if((obj = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ H5Oget_info3(obj, &oi, H5O_INFO_BASIC);
+ if(H5Oclose(obj) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
- else {
- if(H5Rget_name(region_obj, H5R_DATASET_REGION, ptr, (char*)ref_name, 1024) >= 0) {
- h5str_append(str, ref_name);
- }
+ else
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (this_str = (char *) HDmalloc(14)))
+ H5_OUT_OF_MEMORY_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;
- region_type = H5Sget_select_type(region);
+ case H5O_TYPE_DATASET:
+ if (!h5str_append(out_str, H5_TOOLS_DATASET))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
- if(region_type==H5S_SEL_POINTS) {
- h5str_append(str, " REGION_TYPE POINT");
- h5str_dump_region_points(str, region, region_obj);
- }
- else {
- h5str_append(str, " REGION_TYPE BLOCK");
- h5str_dump_region_blocks(str, region, region_obj);
- }
+ 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 */
+ {
+ char *token_str;
+
+ H5Otoken_to_str(tid, &oi.token, &token_str);
+
+ if (NULL == (this_str = (char *) HDmalloc(64 + strlen(token_str) + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+ if (HDsprintf(this_str, "%lu:%s", oi.fileno, token_str) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+
+ H5free_memory(token_str);
}
- H5Sclose(region);
- }
- H5Dclose(region_obj);
- }
+ }
+
+ break;
+ case H5R_DATASET_REGION1:
+ if (!h5str_append(out_str, H5_TOOLS_DATASET))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ 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);
+ 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);
+ 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 == size) {
- /* if (H5Tequal(tid, H5T_STD_REF_OBJ)) */
- /*
- * Object references -- show the type and OID of the referenced
- * object.
- */
- H5O_info_t oi;
- hid_t obj;
-
- this_str = (char*)HDmalloc(64);
- obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, ptr);
- H5Oget_info(obj, &oi);
-
- /* Print object data and close object */
- sprintf(this_str, "%u-%lu", (unsigned) oi.type, oi.addr);
- H5Oclose(obj);
+ 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;
}
- break;
- case H5T_ARRAY:
- {
- int rank = 0;
- hsize_t i, dims[H5S_MAX_RANK], total_elmts;
- h5str_append(str, "[ ");
- mtid = H5Tget_super(tid);
- size = H5Tget_size(mtid);
- rank = H5Tget_array_ndims(tid);
+ case H5T_ARRAY:
+ {
+ hsize_t dims[H5S_MAX_RANK], i, total_elmts;
+ size_t baseSize;
+ int rank = 0;
- H5Tget_array_dims2(tid, dims);
+ if (!h5str_append(out_str, H5_ARRAY_BEGIN_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- total_elmts = 1;
- for (i = 0; i < rank; i++)
- total_elmts *= dims[i];
+ if ((mtid = H5Tget_super(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- for (i = 0; i < total_elmts; i++) {
- h5str_sprintf(str, container, mtid, cptr + i * size, expand_data);
- if (i < total_elmts - 1)
- h5str_append(str, ", ");
- }
- H5Tclose(mtid);
- h5str_append(str, "] ");
- }
- break;
- case H5T_VLEN:
- {
- unsigned int i;
- mtid = H5Tget_super(tid);
- size = H5Tget_size(mtid);
+ if (!(baseSize = H5Tget_size(mtid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((rank = H5Tget_array_ndims(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Tget_array_dims2(tid, dims) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0, total_elmts = 1; i < (hsize_t) rank; i++)
+ total_elmts *= dims[i];
+
+ for (i = 0; i < total_elmts; i++) {
+ if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(cptr[i * baseSize]), in_buf_len, expand_data))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if ((i + 1) < total_elmts)
+ if (!h5str_append(out_str, ", "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+ if (!h5str_append(out_str, H5_ARRAY_END_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- vlptr = (hvl_t *) cptr;
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
- nll = vlptr->len;
- for (i = 0; i < (int)nll; i++) {
- h5str_sprintf(str, container, mtid, ((char *) (vlptr->p)) + i * size, expand_data);
- if (i < (int)nll - 1)
- h5str_append(str, ", ");
+ break;
}
- H5Tclose(mtid);
- }
- break;
- default:
- {
- /* All other types get printed as hexadecimal */
- size_t i;
- nll = H5Tget_size(tid);
- this_str = (char*)HDmalloc(4 * (nll + 1));
+ case H5T_VLEN:
+ {
+ unsigned int i;
+ size_t baseSize;
+ hvl_t *vl_buf = (hvl_t *) in_buf;
+
+ if ((mtid = H5Tget_super(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(baseSize = H5Tget_size(mtid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!h5str_append(out_str, H5_VLEN_BEGIN_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ for (i = 0; i < (unsigned) vl_buf->len; i++) {
+ if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(((char *) vl_buf->p)[i * baseSize]), vl_buf->len, expand_data))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (1 == nll) {
- sprintf(this_str, "%#02x", ucptr[0]);
+ if ((i + 1) < (unsigned) vl_buf->len)
+ if (!h5str_append(out_str, ", "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+ if (!h5str_append(out_str, H5_VLEN_END_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
+
+ break;
}
- else {
- for (i = 0; i < (int)nll; i++)
- sprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]);
+
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ {
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: invalid datatype class");
+ break;
+ }
+
+ case H5T_TIME:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ default:
+ {
+ size_t i;
+
+ /* All other types get printed as hexadecimal */
+
+ if (NULL == (this_str = (char *) HDmalloc(4 * (typeSize + 1))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (1 == typeSize) {
+ if (HDsprintf(this_str, "%#02x", ucptr[0]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ for (i = 0; i < typeSize; i++)
+ if (HDsprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
}
}
- break;
- } /* end switch */
if (this_str) {
- h5str_append(str, this_str);
- this_strlen = HDstrlen(str->s);
+ if (!h5str_append(out_str, this_str))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
HDfree(this_str);
+ this_str = NULL;
} /* end if */
- return this_strlen;
+ retVal = HDstrlen(out_str->s);
+
+done:
+ if (mtid >= 0)
+ H5Tclose(mtid);
+
+ return retVal;
} /* end h5str_sprintf */
/*-------------------------------------------------------------------------
@@ -512,113 +1329,115 @@ h5str_sprintf
*/
static int
h5str_print_region_data_blocks
- (hid_t region_id, h5str_t *str, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
+ (JNIEnv *env, hid_t region_id, h5str_t *str, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
{
- hsize_t *dims1 = NULL;
- hsize_t *start = NULL;
- hsize_t *count = NULL;
- hsize_t blkndx;
- hsize_t total_size[H5S_MAX_RANK];
- hsize_t numelem;
- hsize_t numindex;
- size_t jndx;
- unsigned indx;
- size_t type_size;
- int ret_value = SUCCEED;
- hid_t mem_space = -1;
- hid_t sid1 = -1;
- void *region_buf = NULL;
+ unsigned indx;
+ hsize_t *dims1 = NULL;
+ hsize_t *start = NULL;
+ hsize_t *count = NULL;
+ hsize_t blkndx;
+ hsize_t total_size[H5S_MAX_RANK];
+ hsize_t numelem;
+ hsize_t numindex;
+ size_t jndx;
+ size_t type_size;
+ hid_t mem_space = H5I_INVALID_HID;
+ hid_t sid1 = H5I_INVALID_HID;
+ void *region_buf = NULL;
+ int ret_value = FAIL;
+
+ if (ndims < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_print_region_data_blocks: ndims < 0");
+ if (nblocks < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_print_region_data_blocks: nblocks < 0");
/* Get the dataspace of the dataset */
- if((sid1 = H5Dget_space(region_id)) >= 0) {
+ if ((sid1 = H5Dget_space(region_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- /* Allocate space for the dimension array */
- if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
-
- /* find the dimensions of each data space from the block coordinates */
- numelem = 1;
- for (jndx = 0; jndx < ndims; jndx++) {
- dims1[jndx] = ptdata[jndx + (size_t)ndims] - ptdata[jndx] + 1;
- numelem = dims1[jndx] * numelem;
- } /* end for */
-
- /* Create dataspace for reading buffer */
- if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) {
- if((type_size = H5Tget_size(type_id)) > 0) {
- if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) {
- /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
- /* 1 2 n 1 2 n */
- if((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- if((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- for (blkndx = 0; blkndx < nblocks; blkndx++) {
- for (indx = 0; indx < ndims; indx++) {
- start[indx] = ptdata[indx + blkndx * (hsize_t)ndims * 2];
- count[indx] = dims1[indx];
- } /* end for */
-
- if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) {
- if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) {
- if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
- for (numindex = 0; numindex < numelem; numindex++) {
- h5str_sprintf(str, region_id, type_id, ((char*)region_buf + numindex * type_size), 1);
-
- if (numindex + 1 < numelem)
- h5str_append(str, ", ");
- } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */
- } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */
- } /* end if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) */
- } /* end if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) */
- } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
-
- HDfree(count);
- } /* end if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
-
- HDfree(start);
- } /* end if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
+ /* Allocate space for the dimension array */
+ if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate dimension array buffer");
- HDfree(region_buf);
- } /* end if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) */
- else
- ret_value = -1;
- } /* end if((type_size = H5Tget_size(type_id)) > 0) */
- else
- ret_value = -1;
-
- if(H5Sclose(mem_space) < 0)
- ret_value = -1;
- } /* end if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) */
- else
- ret_value = -1;
-
- HDfree(dims1);
- } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
-
- if(H5Sclose(sid1) < 0)
- ret_value = -1;
- } /* end if((sid1 = H5Dget_space(region_id)) >= 0) */
- else
- ret_value = -1;
+ /* Find the dimensions of each data space from the block coordinates */
+ for (jndx = 0, numelem = 1; jndx < (size_t) ndims; jndx++) {
+ dims1[jndx] = ptdata[jndx + (size_t)ndims] - ptdata[jndx] + 1;
+ numelem = dims1[jndx] * numelem;
+ } /* end for */
+
+ /* Create dataspace for reading buffer */
+ if ((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(type_size = H5Tget_size(type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (region_buf = HDmalloc(type_size * (size_t)numelem)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate region buffer");
+
+ /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
+ /* 1 2 n 1 2 n */
+ if (NULL == (start = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab start buffer");
+
+ if (NULL == (count = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab count buffer");
+
+ for (blkndx = 0; blkndx < (hsize_t) nblocks; blkndx++) {
+ for (indx = 0; indx < (unsigned) ndims; indx++) {
+ start[indx] = ptdata[indx + blkndx * (hsize_t)ndims * 2];
+ count[indx] = dims1[indx];
+ } /* end for */
+
+ if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (numindex = 0; numindex < numelem; numindex++) {
+ if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + numindex * type_size), 0, 1))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (numindex + 1 < numelem)
+ if (!h5str_append(str, ", "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */
+ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
+
+ ret_value = SUCCEED;
+
+done:
+ if (count)
+ HDfree(count);
+ if (start)
+ HDfree(start);
+ if (region_buf)
+ HDfree(region_buf);
+ if (mem_space >= 0)
+ H5Sclose(mem_space);
+ if (dims1)
+ HDfree(dims1);
+ if (sid1 >= 0)
+ H5Sclose(sid1);
return ret_value;
} /* end h5str_print_region_data_blocks */
int
h5str_dump_region_blocks_data
- (h5str_t *str, hid_t region, hid_t region_id)
+ (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- int ret_value = 0;
- hssize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata;
- hid_t dtype = -1;
- hid_t type_id = -1;
- int ndims = H5Sget_simple_extent_ndims(region);
+ hssize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims = -1;
+ int ret_value = FAIL;
/*
* This function fails if the region does not have blocks.
@@ -627,50 +1446,57 @@ h5str_dump_region_blocks_data
nblocks = H5Sget_select_hyper_nblocks(region);
} H5E_END_TRY;
+ if (nblocks < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((ndims = H5Sget_simple_extent_ndims(region)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
/* Print block information */
- if (nblocks > 0) {
- alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
- if (alloc_size == (hsize_t)((size_t) alloc_size)) {
- ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
- H5Sget_select_hyper_blocklist(region, (hsize_t) 0,
- (hsize_t) nblocks, ptdata);
+ alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
+ if (alloc_size == (hsize_t)((size_t) alloc_size)) {
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_blocks_data: failed to allocate region block buffer");
+ if (H5Sget_select_hyper_blocklist(region, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if((dtype = H5Dget_type(region_id)) >= 0) {
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) {
+ if ((dtype = H5Dget_type(region_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- h5str_print_region_data_blocks(region_id, str, ndims, type_id, nblocks, ptdata);
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if(H5Tclose(type_id) < 0)
- ret_value = -1;
- } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */
- else
- ret_value = -1;
+ if (h5str_print_region_data_blocks(ENVONLY, region_id, str, ndims, type_id, nblocks, ptdata) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */
- if(H5Tclose(dtype) < 0)
- ret_value = -1;
- } /* end if((dtype = H5Dget_type(region_id)) >= 0) */
- else
- ret_value = -1;
- HDfree(ptdata);
- } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */
- } /* if (nblocks > 0) */
+ ret_value = SUCCEED;
+
+done:
+ if (type_id >= 0)
+ H5Tclose(type_id);
+ if (dtype >= 0)
+ H5Tclose(dtype);
+ if (ptdata)
+ HDfree(ptdata);
return ret_value;
} /* end h5str_dump_region_blocks_data */
+#ifndef SKIP_UNUSED_DUMP_ROUTINES
static int
h5str_dump_region_blocks
- (h5str_t *str, hid_t region, hid_t region_id)
+ (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- int ret_value = 0;
- hssize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata;
- hid_t dtype = -1;
- hid_t type_id = -1;
- char tmp_str[256];
- int ndims = H5Sget_simple_extent_ndims(region);
+ hssize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ char tmp_str[256];
+ int ndims = -1;
+ int ret_value = FAIL;
+
+ UNUSED(region_id);
/*
* This function fails if the region does not have blocks.
@@ -679,47 +1505,74 @@ h5str_dump_region_blocks
nblocks = H5Sget_select_hyper_nblocks(region);
} H5E_END_TRY;
+ if (nblocks < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((ndims = H5Sget_simple_extent_ndims(region)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
/* Print block information */
- if (nblocks > 0) {
+ alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
+ if (alloc_size == (hsize_t)((size_t) alloc_size)) {
int i;
- alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
- if (alloc_size == (hsize_t)((size_t) alloc_size)) {
- ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
- H5Sget_select_hyper_blocklist(region, (hsize_t) 0,
- (hsize_t) nblocks, ptdata);
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_blocks: failed to allocate region block buffer");
- h5str_append(str, " {");
- for (i = 0; i < nblocks; i++) {
- int j;
+ if (H5Sget_select_hyper_blocklist(region, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- h5str_append(str, " ");
+ if (!h5str_append(str, " {"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- /* Start coordinates and opposite corner */
- for (j = 0; j < ndims; j++) {
- tmp_str[0] = '\0';
- sprintf(tmp_str, "%s%lu", j ? "," : "(",
- (unsigned long) ptdata[i * 2 * ndims + j]);
- h5str_append(str, tmp_str);
- }
+ for (i = 0; i < nblocks; i++) {
+ int j;
- for (j = 0; j < ndims; j++) {
- tmp_str[0] = '\0';
- sprintf(tmp_str, "%s%lu", j ? "," : ")-(",
- (unsigned long) ptdata[i * 2 * ndims + j + ndims]);
- h5str_append(str, tmp_str);
- }
- h5str_append(str, ") ");
+ if (!h5str_append(str, " "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /* Start coordinates and opposite corner */
+ for (j = 0; j < ndims; j++) {
tmp_str[0] = '\0';
+
+ if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(",
+ (unsigned long) ptdata[i * 2 * ndims + j]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure");
+
+ if (!h5str_append(str, tmp_str))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
- h5str_append(str, " }");
- HDfree(ptdata);
- } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */
- } /* if (nblocks > 0) */
+ for (j = 0; j < ndims; j++) {
+ tmp_str[0] = '\0';
+
+ if (HDsprintf(tmp_str, "%s%lu", j ? "," : ")-(",
+ (unsigned long) ptdata[i * 2 * ndims + j + ndims]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure");
+
+ if (!h5str_append(str, tmp_str))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+ if (!h5str_append(str, ") "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ tmp_str[0] = '\0';
+ }
+
+ if (!h5str_append(str, " }"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */
+
+ ret_value = SUCCEED;
+
+done:
+ if (ptdata)
+ HDfree(ptdata);
return ret_value;
} /* end h5str_dump_region_blocks */
+#endif
/*-------------------------------------------------------------------------
* Purpose: Print the data values from a dataset referenced by region points.
@@ -733,76 +1586,76 @@ h5str_dump_region_blocks
*/
static int
h5str_print_region_data_points
- (hid_t region_space, hid_t region_id, h5str_t *str, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
+ (JNIEnv *env, hid_t region_space, hid_t region_id, h5str_t *str, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
{
- hsize_t *dims1 = NULL;
- hsize_t total_size[H5S_MAX_RANK];
- size_t jndx;
- size_t type_size;
- int ret_value = SUCCEED;
- hid_t mem_space = -1;
- void *region_buf = NULL;
+ hsize_t *dims1 = NULL;
+ hsize_t total_size[H5S_MAX_RANK];
+ size_t jndx;
+ size_t type_size;
+ hid_t mem_space = H5I_INVALID_HID;
+ void *region_buf = NULL;
+ int ret_value = FAIL;
+
+ UNUSED(ptdata);
+
+ if (npoints < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_print_region_data_points: npoints < 0");
/* Allocate space for the dimension array */
- if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
+ if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_points: failed to allocate dimension array buffer");
- dims1[0] = (hsize_t)npoints;
+ dims1[0] = (hsize_t)npoints;
- /* Create dataspace for reading buffer */
- if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) {
+ /* Create dataspace for reading buffer */
+ if ((mem_space = H5Screate_simple(1, dims1, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if((type_size = H5Tget_size(type_id)) > 0) {
+ if (!(type_size = H5Tget_size(type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
- if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) {
+ if (NULL == (region_buf = HDmalloc(type_size * (size_t)npoints)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_print_region_data_points: failed to allocate region buffer");
- if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) {
+ if (H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- for (jndx = 0; jndx < npoints; jndx++) {
- if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
+ for (jndx = 0; jndx < (size_t) npoints; jndx++) {
+ if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- h5str_sprintf(str, region_id, type_id, ((char*)region_buf + jndx * type_size), 1);
+ if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + jndx * type_size), 0, 1))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (jndx + 1 < npoints)
- h5str_append(str, ", ");
+ if (jndx + 1 < (size_t) npoints)
+ if (!h5str_append(str, ", "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */
- } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */
- } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */
- } /* end if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) */
- else
- ret_value = -1;
+ ret_value = SUCCEED;
- HDfree(region_buf);
- } /* end if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) */
- else
- ret_value = -1;
- } /* end if((type_size = H5Tget_size(type_id)) > 0) */
- else
- ret_value = -1;
-
- if(H5Sclose(mem_space) < 0)
- ret_value = -1;
- } /* end if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) */
- else
- ret_value = -1;
+done:
+ if (region_buf)
+ HDfree(region_buf);
+ if (mem_space >= 0)
+ H5Sclose(mem_space);
+ if (dims1)
HDfree(dims1);
- } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
return ret_value;
} /* end h5str_print_region_data_points */
int
h5str_dump_region_points_data
- (h5str_t *str, hid_t region, hid_t region_id)
+ (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- int ret_value = 0;
- hssize_t npoints;
- hsize_t alloc_size;
- hsize_t *ptdata;
- hid_t dtype = -1;
- hid_t type_id = -1;
- int ndims = H5Sget_simple_extent_ndims(region);
+ hssize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims = -1;
+ int ret_value = FAIL;
/*
* This function fails if the region does not have points.
@@ -811,50 +1664,60 @@ h5str_dump_region_points_data
npoints = H5Sget_select_elem_npoints(region);
} H5E_END_TRY;
+ if (npoints < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((ndims = H5Sget_simple_extent_ndims(region)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
/* Print point information */
if (npoints > 0) {
alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]);
if (alloc_size == (hsize_t)((size_t) alloc_size)) {
- ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
- H5Sget_select_elem_pointlist(region, (hsize_t) 0,
- (hsize_t) npoints, ptdata);
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_points_data: failed to allocate region point data buffer");
- if((dtype = H5Dget_type(region_id)) >= 0) {
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) {
+ if (H5Sget_select_elem_pointlist(region, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- h5str_print_region_data_points(region, region_id,
- str, ndims, type_id, npoints, ptdata);
+ if ((dtype = H5Dget_type(region_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if(H5Tclose(type_id) < 0)
- ret_value = -1;
- } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */
- else
- ret_value = -1;
-
- if(H5Tclose(dtype) < 0)
- ret_value = -1;
- } /* end if((dtype = H5Dget_type(region_id)) >= 0) */
- else
- ret_value = -1;
- HDfree(ptdata);
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (h5str_print_region_data_points(ENVONLY, region, region_id,
+ str, ndims, type_id, npoints, ptdata) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
}
+ ret_value = SUCCEED;
+
+done:
+ if (type_id >= 0)
+ H5Tclose(type_id);
+ if (dtype >= 0)
+ H5Tclose(dtype);
+ if (ptdata)
+ HDfree(ptdata);
+
return ret_value;
} /* end h5str_dump_region_points_data */
+#ifndef SKIP_UNUSED_DUMP_ROUTINES
static int
h5str_dump_region_points
- (h5str_t *str, hid_t region, hid_t region_id)
+ (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- int ret_value = 0;
- hssize_t npoints;
- hsize_t alloc_size;
- hsize_t *ptdata;
- char tmp_str[256];
- hid_t dtype = -1;
- hid_t type_id = -1;
- int ndims = H5Sget_simple_extent_ndims(region);
+ hssize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ char tmp_str[256];
+ int ndims = -1;
+ int ret_value = FAIL;
+
+ UNUSED(region_id);
/*
* This function fails if the region does not have points.
@@ -863,39 +1726,62 @@ h5str_dump_region_points
npoints = H5Sget_select_elem_npoints(region);
} H5E_END_TRY;
+ if (npoints < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((ndims = H5Sget_simple_extent_ndims(region)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
/* Print point information */
if (npoints > 0) {
int i;
alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]);
if (alloc_size == (hsize_t)((size_t) alloc_size)) {
- ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
- H5Sget_select_elem_pointlist(region, (hsize_t) 0,
- (hsize_t) npoints, ptdata);
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_region_points: failed to allocate region point buffer");
+
+ if (H5Sget_select_elem_pointlist(region, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!h5str_append(str, " {"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- h5str_append(str, " {");
for (i = 0; i < npoints; i++) {
int j;
- h5str_append(str, " ");
+ if (!h5str_append(str, " "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
for (j = 0; j < ndims; j++) {
tmp_str[0] = '\0';
- sprintf(tmp_str, "%s%lu", j ? "," : "(",
- (unsigned long) (ptdata[i * ndims + j]));
- h5str_append(str, tmp_str);
+
+ if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(",
+ (unsigned long) (ptdata[i * ndims + j])) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsprintf failure");
+
+ if (!h5str_append(str, tmp_str))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
} /* end for (j = 0; j < ndims; j++) */
- h5str_append(str, ") ");
+ if (!h5str_append(str, ") "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
} /* end for (i = 0; i < npoints; i++) */
- h5str_append(str, " }");
- HDfree(ptdata);
+ if (!h5str_append(str, " }"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
} /* end if (alloc_size == (hsize_t)((size_t) alloc_size)) */
} /* end if (npoints > 0) */
+ ret_value = SUCCEED;
+
+done:
+ if (ptdata)
+ HDfree(ptdata);
+
return ret_value;
} /* end h5str_dump_region_points */
+#endif
static int
h5str_is_zero
@@ -911,6 +1797,37 @@ h5str_is_zero
} /* end h5str_is_zero */
/*-------------------------------------------------------------------------
+ * Function: h5str_detect_vlen
+ *
+ * Purpose: Recursive check for any variable length data in given type.
+ *
+ * Return:
+ * 1 : type contains any variable length data
+ * 0 : type doesn't contain any variable length data
+ * Negative value: error occurred
+ *-------------------------------------------------------------------------
+ */
+static htri_t
+h5str_detect_vlen
+ (hid_t tid)
+{
+ htri_t ret = FAIL;
+
+ /* Recursively detect any vlen data values in type (compound, array ...) */
+ ret = H5Tdetect_class(tid, H5T_VLEN);
+ if ((ret == 1) || (ret < 0))
+ goto done;
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ ret = h5str_detect_vlen_str(tid);
+ if ((ret == 1) || (ret < 0))
+ goto done;
+
+done:
+ return ret;
+} /* end h5str_detect_vlen */
+
+/*-------------------------------------------------------------------------
* Function: h5str_detect_vlen_str
*
* Purpose: Recursive check for variable length string of a datatype.
@@ -951,12 +1868,10 @@ h5str_detect_vlen_str
unsigned i = 0;
int n = H5Tget_nmembers(tid);
- if(n < 0) {
- n = ret;
+ if (n < 0)
goto done;
- } /* end if */
- for(i = 0; i < n; i++) {
+ for(i = 0; i < (unsigned) n; i++) {
hid_t mtid = H5Tget_member_type(tid, i);
ret = h5str_detect_vlen_str(mtid);
@@ -986,15 +1901,18 @@ static hid_t
h5str_get_native_type
(hid_t type)
{
- hid_t p_type;
H5T_class_t type_class;
+ hid_t p_type = H5I_INVALID_HID;
+
+ if ((type_class = H5Tget_class(type)) < 0)
+ goto done;
- type_class = H5Tget_class(type);
- if(type_class==H5T_BITFIELD)
- p_type=H5Tcopy(type);
+ if (type_class == H5T_BITFIELD)
+ p_type = H5Tcopy(type);
else
- p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT);
+ p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
+done:
return(p_type);
} /* end h5str_get_native_type */
@@ -1012,73 +1930,89 @@ static hid_t
h5str_get_little_endian_type
(hid_t tid)
{
- hid_t p_type=-1;
H5T_class_t type_class;
- size_t size;
H5T_sign_t sign;
+ size_t size;
+ hid_t p_type = H5I_INVALID_HID;
- type_class = H5Tget_class(tid);
- size = H5Tget_size(tid);
- sign = H5Tget_sign(tid);
+ if ((type_class = H5Tget_class(tid)) < 0)
+ goto done;
- switch( type_class )
- {
- case H5T_INTEGER:
- {
- if ( size == 1 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I8LE);
- else if ( size == 2 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I16LE);
- else if ( size == 4 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I32LE);
- else if ( size == 8 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I64LE);
- else if ( size == 1 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U8LE);
- else if ( size == 2 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U16LE);
- else if ( size == 4 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U32LE);
- else if ( size == 8 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U64LE);
- }
- break;
+ if (!(size = H5Tget_size(tid)))
+ goto done;
- case H5T_FLOAT:
- if ( size == 4)
- p_type=H5Tcopy(H5T_IEEE_F32LE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_IEEE_F64LE);
- break;
+ if ((sign = H5Tget_sign(tid)) < 0)
+ goto done;
- case H5T_BITFIELD:
- {
- if ( size == 1)
- p_type=H5Tcopy(H5T_STD_B8LE);
- else if ( size == 2)
- p_type=H5Tcopy(H5T_STD_B16LE);
- else if ( size == 4)
- p_type=H5Tcopy(H5T_STD_B32LE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_STD_B64LE);
- }
- break;
+ switch ( type_class ) {
+ case H5T_INTEGER:
+ {
+ if ( size == 1 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I8LE);
+ else if ( size == 2 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I16LE);
+ else if ( size == 4 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I32LE);
+ else if ( size == 8 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I64LE);
+ else if ( size == 1 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U8LE);
+ else if ( size == 2 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U16LE);
+ else if ( size == 4 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U32LE);
+ else if ( size == 8 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U64LE);
+
+ break;
+ }
+
+ case H5T_FLOAT:
+ {
+ if ( size == 4 )
+ p_type = H5Tcopy(H5T_IEEE_F32LE);
+ else if ( size == 8 )
+ p_type = H5Tcopy(H5T_IEEE_F64LE);
+
+ break;
+ }
- case H5T_TIME:
- case H5T_OPAQUE:
- case H5T_STRING:
- case H5T_COMPOUND:
- case H5T_REFERENCE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_ARRAY:
- break;
+ case H5T_BITFIELD:
+ {
+ if ( size == 1 )
+ p_type = H5Tcopy(H5T_STD_B8LE);
+ else if ( size == 2 )
+ p_type = H5Tcopy(H5T_STD_B16LE);
+ else if ( size == 4 )
+ p_type = H5Tcopy(H5T_STD_B32LE);
+ else if ( size == 8 )
+ p_type = H5Tcopy(H5T_STD_B64LE);
+
+ break;
+ }
- default:
- break;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ {
+ goto done;
+ break;
+ }
+ case H5T_TIME:
+ case H5T_OPAQUE:
+ case H5T_STRING:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ break;
+
+ default:
+ break;
}
+done:
return(p_type);
} /* end h5str_get_little_endian_type */
@@ -1095,106 +2029,91 @@ static hid_t
h5str_get_big_endian_type
(hid_t tid)
{
- hid_t p_type=-1;
H5T_class_t type_class;
- size_t size;
H5T_sign_t sign;
+ size_t size;
+ hid_t p_type = H5I_INVALID_HID;
- type_class = H5Tget_class(tid);
- size = H5Tget_size(tid);
- sign = H5Tget_sign(tid);
-
- switch( type_class )
- {
- case H5T_INTEGER:
- {
- if ( size == 1 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I8BE);
- else if ( size == 2 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I16BE);
- else if ( size == 4 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I32BE);
- else if ( size == 8 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I64BE);
- else if ( size == 1 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U8BE);
- else if ( size == 2 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U16BE);
- else if ( size == 4 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U32BE);
- else if ( size == 8 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U64BE);
- }
- break;
+ if ((type_class = H5Tget_class(tid)) < 0)
+ goto done;
- case H5T_FLOAT:
- if ( size == 4)
- p_type=H5Tcopy(H5T_IEEE_F32BE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_IEEE_F64BE);
- break;
+ if (!(size = H5Tget_size(tid)))
+ goto done;
- case H5T_BITFIELD:
- {
- if ( size == 1)
- p_type=H5Tcopy(H5T_STD_B8BE);
- else if ( size == 2)
- p_type=H5Tcopy(H5T_STD_B16BE);
- else if ( size == 4)
- p_type=H5Tcopy(H5T_STD_B32BE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_STD_B64BE);
- }
- break;
+ if ((sign = H5Tget_sign(tid)) < 0)
+ goto done;
- case H5T_TIME:
- case H5T_OPAQUE:
- case H5T_STRING:
- case H5T_COMPOUND:
- case H5T_REFERENCE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_ARRAY:
- break;
+ switch ( type_class ) {
+ case H5T_INTEGER:
+ {
+ if ( size == 1 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I8BE);
+ else if ( size == 2 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I16BE);
+ else if ( size == 4 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I32BE);
+ else if ( size == 8 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I64BE);
+ else if ( size == 1 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U8BE);
+ else if ( size == 2 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U16BE);
+ else if ( size == 4 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U32BE);
+ else if ( size == 8 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U64BE);
+
+ break;
+ }
- default:
- break;
+ case H5T_FLOAT:
+ {
+ if ( size == 4 )
+ p_type = H5Tcopy(H5T_IEEE_F32BE);
+ else if ( size == 8 )
+ p_type = H5Tcopy(H5T_IEEE_F64BE);
- }
-
- return(p_type);
-} /* end h5str_get_big_endian_type */
+ break;
+ }
-/*-------------------------------------------------------------------------
- * Function: h5str_detect_vlen
- *
- * Purpose: Recursive check for any variable length data in given type.
- *
- * Return:
- * 1 : type conatains any variable length data
- * 0 : type doesn't contain any variable length data
- * Negative value: error occur
- *-------------------------------------------------------------------------
- */
-static htri_t
-h5str_detect_vlen
- (hid_t tid)
-{
- htri_t ret;
+ case H5T_BITFIELD:
+ {
+ if ( size == 1 )
+ p_type = H5Tcopy(H5T_STD_B8BE);
+ else if ( size == 2 )
+ p_type = H5Tcopy(H5T_STD_B16BE);
+ else if ( size == 4 )
+ p_type = H5Tcopy(H5T_STD_B32BE);
+ else if ( size == 8 )
+ p_type = H5Tcopy(H5T_STD_B64BE);
+
+ break;
+ }
- /* recursive detect any vlen data values in type (compound, array ...) */
- ret = H5Tdetect_class(tid, H5T_VLEN);
- if((ret == 1) || (ret < 0))
- goto done;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ {
+ goto done;
+ break;
+ }
- /* recursive detect any vlen string in type (compound, array ...) */
- ret = h5str_detect_vlen_str(tid);
- if((ret == 1) || (ret < 0))
- goto done;
+ case H5T_TIME:
+ case H5T_OPAQUE:
+ case H5T_STRING:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ break;
+
+ default:
+ break;
+ }
done:
- return ret;
-} /* end h5str_detect_vlen */
+ return(p_type);
+} /* end h5str_get_big_endian_type */
/*-------------------------------------------------------------------------
* Function: render_bin_output
@@ -1209,201 +2128,263 @@ static int
h5str_render_bin_output
(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts)
{
- int ret_value = 0;
- unsigned char *mem = (unsigned char*)_mem;
- size_t size; /* datum size */
- hsize_t block_index;
- H5T_class_t type_class;
-
- if((size = H5Tget_size(tid)) > 0) {
-
- if((type_class = H5Tget_class(tid)) >= 0) {
-
- switch (type_class) {
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_ENUM:
- block_index = block_nelmts * size;
- while(block_index > 0) {
- size_t bytes_in = 0; /* # of bytes to write */
- size_t bytes_wrote = 0; /* # of bytes written */
- size_t item_size = size; /* size of items in bytes */
-
- if(block_index > sizeof(size_t))
- bytes_in = sizeof(size_t);
- else
- bytes_in = (size_t)block_index;
+ unsigned char *mem = (unsigned char*)_mem;
+ H5T_class_t type_class;
+ hsize_t block_index;
+ size_t size; /* datum size */
+ int ret_value = 0;
+
+ if (!(size = H5Tget_size(tid))) {
+ ret_value = FAIL;
+ goto done;
+ }
- bytes_wrote = fwrite(mem, 1, bytes_in, stream);
+ if ((type_class = H5Tget_class(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
- if(bytes_wrote != bytes_in || (0 == bytes_wrote && ferror(stream))) {
- ret_value = -1;
- break;
- }
+ switch (type_class) {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_ENUM:
+ {
+ block_index = block_nelmts * size;
+ while (block_index > 0) {
+ size_t bytes_in = 0; /* # of bytes to write */
+ size_t bytes_wrote = 0; /* # of bytes written */
+
+ if (block_index > sizeof(size_t))
+ bytes_in = sizeof(size_t);
+ else
+ bytes_in = (size_t)block_index;
- block_index -= (hsize_t)bytes_wrote;
- mem = mem + bytes_wrote;
- }
+ bytes_wrote = fwrite(mem, 1, bytes_in, stream);
+
+ if (bytes_wrote != bytes_in || (0 == bytes_wrote && ferror(stream))) {
+ ret_value = FAIL;
break;
- case H5T_STRING:
- {
- unsigned int i;
- H5T_str_t pad;
- char *s;
- unsigned char tempuchar;
+ }
- pad = H5Tget_strpad(tid);
+ block_index -= (hsize_t)bytes_wrote;
+ mem = mem + bytes_wrote;
+ }
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
+ break;
+ }
- if (H5Tis_variable_str(tid)) {
- s = *(char**) mem;
- if (s != NULL)
- size = strlen(s);
- }
- else {
- s = (char *) mem;
- }
- for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
- HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char));
- if (1 != fwrite(&tempuchar, sizeof(unsigned char), 1, stream)) {
- ret_value = -1;
- break;
- }
- } /* i */
- if(ret_value < 0)
- break;
- } /* for (block_index = 0; block_index < block_nelmts; block_index++) */
- }
- break;
- case H5T_COMPOUND:
- {
- unsigned j;
- hid_t memb;
- unsigned nmembs;
- size_t offset;
-
- nmembs = (unsigned)H5Tget_nmembers(tid);
-
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- for (j = 0; j < nmembs; j++) {
- offset = H5Tget_member_offset(tid, j);
- memb = H5Tget_member_type(tid, j);
-
- if (h5str_render_bin_output(stream, container, memb, mem + offset, 1) < 0) {
- H5Tclose(memb);
- ret_value = -1;
- break;
- }
+ case H5T_STRING:
+ {
+ unsigned char tempuchar;
+ unsigned int i;
+ H5T_str_t pad;
+ char *s;
- H5Tclose(memb);
- }
- if(ret_value < 0)
- break;
- }
+ if ((pad = H5Tget_strpad(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char *)_mem) + block_index * size;
+
+ if (H5Tis_variable_str(tid)) {
+ s = *(char**) mem;
+ if (s != NULL)
+ size = HDstrlen(s);
}
- break;
- case H5T_ARRAY:
- {
- int k, ndims;
- hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts;
- hid_t memb;
-
- /* get the array's base datatype for each element */
- memb = H5Tget_super(tid);
- ndims = H5Tget_array_ndims(tid);
- H5Tget_array_dims2(tid, dims);
-
- /* calculate the number of array elements */
- for (k = 0, nelmts = 1; k < ndims; k++) {
- temp_nelmts = nelmts;
- temp_nelmts *= dims[k];
- nelmts = (size_t) temp_nelmts;
+ else {
+ s = (char *) mem;
+ }
+ for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
+ HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char));
+ if (1 != fwrite(&tempuchar, sizeof(unsigned char), 1, stream)) {
+ ret_value = FAIL;
+ break;
}
+ } /* i */
+ if (ret_value < 0)
+ break;
+ } /* for (block_index = 0; block_index < block_nelmts; block_index++) */
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- /* dump the array element */
- if (h5str_render_bin_output(stream, container, memb, mem, nelmts) < 0) {
- ret_value = -1;
- break;
- }
+ break;
+ }
+
+ case H5T_COMPOUND:
+ {
+ unsigned j;
+ size_t offset;
+ hid_t memb = H5I_INVALID_HID;
+ int nmembs;
+
+ if ((nmembs = H5Tget_nmembers(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+ for (j = 0; j < (unsigned) nmembs; j++) {
+ offset = H5Tget_member_offset(tid, j);
+ memb = H5Tget_member_type(tid, j);
+
+ if (h5str_render_bin_output(stream, container, memb, mem + offset, 1) < 0) {
+ H5Tclose(memb);
+ ret_value = FAIL;
+ break;
}
+
H5Tclose(memb);
}
- break;
- case H5T_VLEN:
- {
- hsize_t nelmts;
- hid_t memb;
- /* get the VL sequences's base datatype for each element */
- memb = H5Tget_super(tid);
+ if (ret_value < 0)
+ break;
+ }
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- /* Get the number of sequence elements */
- nelmts = ((hvl_t *) mem)->len;
+ break;
+ }
- /* dump the array element */
- if (h5str_render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) {
- ret_value = -1;
- break;
- }
- }
- H5Tclose(memb);
+ case H5T_ARRAY:
+ {
+ hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts;
+ hid_t memb;
+ int k, ndims;
+
+ /* Get the array's base datatype for each element */
+ if ((memb = H5Tget_super(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if ((ndims = H5Tget_array_ndims(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Tget_array_dims2(tid, dims) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Calculate the number of array elements */
+ for (k = 0, nelmts = 1; k < ndims; k++) {
+ temp_nelmts = nelmts;
+ temp_nelmts *= dims[k];
+ nelmts = (size_t) temp_nelmts;
+ }
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+
+ /* dump the array element */
+ if (h5str_render_bin_output(stream, container, memb, mem, nelmts) < 0) {
+ ret_value = FAIL;
+ break;
}
- break;
- case H5T_REFERENCE:
- {
- if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
- /* region data */
- hid_t region_id, region_space;
- H5S_sel_type region_type;
-
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem);
- if (region_id >= 0) {
- region_space = H5Rget_region(container, H5R_DATASET_REGION, mem);
- if (region_space >= 0) {
- region_type = H5Sget_select_type(region_space);
- if(region_type == H5S_SEL_POINTS)
- ret_value = render_bin_output_region_points(stream, region_space, region_id, container);
- else
- ret_value = render_bin_output_region_blocks(stream, region_space, region_id, container);
- H5Sclose(region_space);
- } /* end if (region_space >= 0) */
- H5Dclose(region_id);
- } /* end if (region_id >= 0) */
- if(ret_value < 0)
- break;
- }
+ }
+
+ H5Tclose(memb);
+
+ break;
+ }
+
+ case H5T_VLEN:
+ {
+ hsize_t nelmts;
+ hid_t memb;
+
+ /* Get the VL sequences's base datatype for each element */
+ if ((memb = H5Tget_super(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+
+ /* Get the number of sequence elements */
+ nelmts = ((hvl_t *) mem)->len;
+
+ /* dump the array element */
+ if (h5str_render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) {
+ ret_value = FAIL;
+ break;
+ }
+ }
+
+ H5Tclose(memb);
+
+ break;
+ }
+
+ case H5T_REFERENCE:
+ {
+ 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;
+
+ /* Region data */
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+ if((region_id = H5Ropen_object((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ continue;
+ 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);
}
- else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
- ;
+
+ if ((region_type = H5Sget_select_type(region_space)) < 0) {
+ H5Sclose(region_space);
+ H5Dclose(region_id);
+ continue;
}
+ if (ret_value < 0)
+ break;
}
- break;
- default:
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- if (size != fwrite(mem, sizeof(char), size, stream)) {
- ret_value = -1;
- break;
- }
- }
+ }
+ else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
+ ;
+ }
+ else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
+ ;
+ }
+
+ break;
+ }
+
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ {
+ ret_value = FAIL;
+ goto done;
+ break;
+ }
+
+ case H5T_TIME:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ default:
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+ if (size != fwrite(mem, sizeof(char), size, stream)) {
+ ret_value = FAIL;
break;
+ }
}
- } /* end if((type_class = H5Tget_class(tid)) >= 0) */
- else
- ret_value = -1;
- } /* end if((size = H5Tget_size(tid)) > 0) */
- else
- ret_value = -1;
+ break;
+ }
+done:
return ret_value;
} /* end h5str_render_bin_output */
@@ -1422,96 +2403,107 @@ static int
render_bin_output_region_data_blocks
(FILE *stream, hid_t region_id, hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
{
- hsize_t *dims1 = NULL;
- hsize_t *start = NULL;
- hsize_t *count = NULL;
- hsize_t numelem;
- hsize_t total_size[H5S_MAX_RANK];
- int jndx;
- size_t type_size;
- hid_t mem_space = -1;
- void *region_buf = NULL;
- int blkndx;
- hid_t sid1 = -1;
- int ret_value = SUCCEED;
+ hsize_t *dims1 = NULL;
+ hsize_t *start = NULL;
+ hsize_t *count = NULL;
+ hsize_t numelem;
+ hsize_t total_size[H5S_MAX_RANK];
+ size_t type_size;
+ hid_t sid1 = H5I_INVALID_HID;
+ hid_t mem_space = H5I_INVALID_HID;
+ void *region_buf = NULL;
+ int blkndx;
+ int jndx;
+ int ret_value = SUCCEED;
/* Get the dataspace of the dataset */
- if((sid1 = H5Dget_space(region_id)) >= 0) {
- /* Allocate space for the dimension array */
- if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- /* find the dimensions of each data space from the block coordinates */
- numelem = 1;
- for (jndx = 0; jndx < ndims; jndx++) {
- dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1;
- numelem = dims1[jndx] * numelem;
- }
+ if ((sid1 = H5Dget_space(region_id)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
- /* Create dataspace for reading buffer */
- if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) {
- if((type_size = H5Tget_size(type_id)) > 0) {
- if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) {
- /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
- /* 1 2 n 1 2 n */
- if((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- if((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- for (blkndx = 0; blkndx < nblocks; blkndx++) {
- for (jndx = 0; jndx < ndims; jndx++) {
- start[jndx] = ptdata[jndx + blkndx * ndims * 2];
- count[jndx] = dims1[jndx];
- }
-
- if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) {
- if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) {
- if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
- ret_value = h5str_render_bin_output(stream, container, type_id, (char*)region_buf, numelem);
- } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */
- else {
- ret_value = -1;
- break;
- }
- } /* end if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) */
- else {
- ret_value = -1;
- break;
- }
- } /* end if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) */
- else {
- ret_value = -1;
- break;
- }
- /* Render the region data element end */
- } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
-
- HDfree(count);
- } /* end if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
- HDfree(start);
- } /* end if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
- HDfree(region_buf);
- } /* end if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) */
- else
- ret_value = -1;
- } /* end if((type_size = H5Tget_size(type_id)) > 0) */
- else
- ret_value = -1;
-
- if(H5Sclose(mem_space) < 0)
- ret_value = -1;
- } /* end if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) */
- else
- ret_value = -1;
- HDfree(dims1);
- } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
- if(H5Sclose(sid1) < 0)
- ret_value = -1;
- } /* end if((sid1 = H5Dget_space(region_id)) >= 0) */
- else
- ret_value = -1;
+ /* Allocate space for the dimension array */
+ if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Find the dimensions of each data space from the block coordinates */
+ for (jndx = 0, numelem = 1; jndx < ndims; jndx++) {
+ dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1;
+ numelem = dims1[jndx] * numelem;
+ }
+
+ /* Create dataspace for reading buffer */
+ if ((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (!(type_size = H5Tget_size(type_id))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (NULL == (region_buf = HDmalloc(type_size * (size_t)numelem))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
+ /* 1 2 n 1 2 n */
+ if (NULL == (start = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (NULL == (count = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ for (blkndx = 0; blkndx < nblocks; blkndx++) {
+ for (jndx = 0; jndx < ndims; jndx++) {
+ start[jndx] = ptdata[jndx + blkndx * ndims * 2];
+ count[jndx] = dims1[jndx];
+ }
+
+ if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (h5str_render_bin_output(stream, container, type_id, (char *)region_buf, numelem) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Render the region data element end */
+ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
+
+done:
+ if (count)
+ HDfree(count);
+ if (start)
+ HDfree(start);
+ if (region_buf)
+ HDfree(region_buf);
+ if (mem_space >= 0)
+ H5Sclose(mem_space);
+ if (dims1)
+ HDfree(dims1);
+ if (sid1 >= 0)
+ H5Sclose(sid1);
return ret_value;
} /* end render_bin_output_region_data_blocks */
@@ -1531,50 +2523,62 @@ static int
render_bin_output_region_blocks
(FILE *stream, hid_t region_space, hid_t region_id, hid_t container)
{
- int ret_value = SUCCEED;
- hssize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata = NULL;
- int ndims;
- hid_t dtype;
- hid_t type_id;
-
- if((nblocks = H5Sget_select_hyper_nblocks(region_space)) > 0) {
+ hssize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims;
+ int ret_value = SUCCEED;
+
+ if ((nblocks = H5Sget_select_hyper_nblocks(region_space)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (nblocks > 0) {
/* Print block information */
- if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) {
- alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
- if((ptdata = (hsize_t*)HDmalloc((size_t)alloc_size)) != NULL) {
- if(H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, (hsize_t)nblocks, ptdata) >= 0) {
- if((dtype = H5Dget_type(region_id)) >= 0) {
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) {
- ret_value = render_bin_output_region_data_blocks(stream, region_id, container, ndims,
- type_id, nblocks, ptdata);
-
- if(H5Tclose(type_id) < 0)
- ret_value = -1;
- } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */
- else
- ret_value = -1;
-
- if(H5Tclose(dtype) < 0)
- ret_value = -1;
- } /* end if((dtype = H5Dget_type(region_id)) >= 0) */
- else
- ret_value = -1;
- } /* end if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) >= 0) */
- else
- ret_value = -1;
-
- HDfree(ptdata);
- } /* end if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) != NULL) */
- else
- ret_value = -1;
- } /* end if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) */
- else
- ret_value = -1;
- } /* end if((nblocks = H5Sget_select_hyper_nblocks(region_space)) > 0) */
- else
- ret_value = -1;
+ if ((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
+
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t)alloc_size))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if ((dtype = H5Dget_type(region_id)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (render_bin_output_region_data_blocks(stream, region_id, container,
+ ndims, type_id, nblocks, ptdata) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+ }
+
+done:
+ if (type_id >= 0)
+ H5Tclose(type_id);
+ if (dtype >= 0)
+ H5Tclose(dtype);
+ if (ptdata)
+ HDfree(ptdata);
return ret_value;
} /* end render_bin_output_region_blocks */
@@ -1597,43 +2601,57 @@ render_bin_output_region_data_points
{
hsize_t *dims1 = NULL;
size_t type_size;
- hid_t mem_space = -1;
+ hid_t mem_space = H5I_INVALID_HID;
void *region_buf = NULL;
int ret_value = SUCCEED;
- if((type_size = H5Tget_size(type_id)) > 0) {
- if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) {
- /* Allocate space for the dimension array */
- if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- dims1[0] = (hsize_t)npoints;
- if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) {
- if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) {
- if(H5Sget_simple_extent_dims(region_space, dims1, NULL) >= 0) {
- ret_value = h5str_render_bin_output(stream, container, type_id, (char*)region_buf, (hsize_t)npoints);
- } /* end if(H5Sget_simple_extent_dims(region_space, dims1, NULL) >= 0) */
- else
- ret_value = -1;
- } /* end if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) */
- else
- ret_value = -1;
- } /* end if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) */
- else
- ret_value = -1;
-
- HDfree(dims1);
- } /* end if((dims1 = (hsize_t *) malloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
- HDfree(region_buf);
- } /* end if((region_buf = malloc(type_size * (size_t)npoints)) != NULL) */
- else
- ret_value = -1;
-
- if(H5Sclose(mem_space) < 0)
- ret_value = -1;
- } /* end if((type_size = H5Tget_size(type_id)) > 0) */
- else
- ret_value = -1;
+ UNUSED(ptdata);
+
+ if (!(type_size = H5Tget_size(type_id))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (NULL == (region_buf = HDmalloc(type_size * (size_t)npoints))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Allocate space for the dimension array */
+ if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ dims1[0] = (hsize_t)npoints;
+
+ if ((mem_space = H5Screate_simple(1, dims1, NULL)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (h5str_render_bin_output(stream, container, type_id, (char *)region_buf, (hsize_t)npoints) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+done:
+ if (dims1)
+ HDfree(dims1);
+ if (mem_space >= 0)
+ H5Sclose(mem_space);
+ if (region_buf)
+ HDfree(region_buf);
return ret_value;
} /* end render_bin_output_region_data_points */
@@ -1653,248 +2671,343 @@ static int
render_bin_output_region_points
(FILE *stream, hid_t region_space, hid_t region_id, hid_t container)
{
- int ret_value = SUCCEED;
- hssize_t npoints;
- hsize_t alloc_size;
- hsize_t *ptdata;
- int ndims;
- hid_t dtype;
- hid_t type_id;
-
- if((npoints = H5Sget_select_elem_npoints(region_space)) > 0) {
+ hssize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims;
+ int ret_value = SUCCEED;
+
+ if ((npoints = H5Sget_select_elem_npoints(region_space)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (npoints > 0) {
/* Allocate space for the dimension array */
- if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) {
- alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]);
- if(NULL != (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) {
- if(H5Sget_select_elem_pointlist(region_space, (hsize_t)0, (hsize_t)npoints, ptdata) >= 0) {
- if((dtype = H5Dget_type(region_id)) >= 0) {
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) {
- ret_value = render_bin_output_region_data_points(stream, region_space, region_id,
- container, ndims, type_id, npoints, ptdata);
-
- if(H5Tclose(type_id) < 0)
- ret_value = -1;
- } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */
- else
- ret_value = -1;
-
- if(H5Tclose(dtype) < 0)
- ret_value = -1;
- } /* end if((dtype = H5Dget_type(region_id)) >= 0) */
- else
- ret_value = -1;
- } /* end if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) >= 0) */
- else
- ret_value = -1;
+ if ((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
- HDfree(ptdata);
- } /* end if(NULL != (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) */
- else
- ret_value = -1;
- } /* end if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) */
- else
- ret_value = -1;
+ alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]);
- } /* end if((npoints = H5Sget_select_elem_npoints(region_space)) > 0) */
- else
- ret_value = -1;
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t)alloc_size))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Sget_select_elem_pointlist(region_space, (hsize_t)0, (hsize_t)npoints, ptdata) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if ((dtype = H5Dget_type(region_id)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (render_bin_output_region_data_points(stream, region_space, region_id,
+ container, ndims, type_id, npoints, ptdata) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+ }
+
+done:
+ if (type_id >= 0)
+ H5Tclose(type_id);
+ if (dtype >= 0)
+ H5Tclose(dtype);
+ if (ptdata)
+ HDfree(ptdata);
return ret_value;
} /* end render_bin_output_region_points */
int
h5str_dump_simple_dset
- (FILE *stream, hid_t dset, int binary_order)
+ (JNIEnv *env, FILE *stream, hid_t dset, int binary_order)
{
- int ret_value = SUCCEED;
- hid_t f_space = -1; /* file data space */
- hsize_t elmtno; /* counter */
- size_t i; /* counter */
- int ndims;
- int carry; /* counter carry value */
- hsize_t zero[8]; /* vector of zeros */
- hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
+ hsize_t elmtno; /* counter */
+ hsize_t zero[8]; /* vector of zeros */
+ hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
+ size_t i; /* counter */
+ hid_t f_space = H5I_INVALID_HID; /* file data space */
+ int ndims;
+ int carry; /* counter carry value */
/* Print info */
- size_t p_type_nbytes; /* size of memory type */
- hsize_t p_nelmts; /* total selected elmts */
+ hsize_t p_nelmts; /* total selected elmts */
+ size_t p_type_nbytes; /* size of memory type */
/* Stripmine info */
- hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
- hsize_t sm_nbytes; /* bytes per stripmine */
- hsize_t sm_nelmts; /* elements per stripmine*/
- unsigned char *sm_buf = NULL; /* buffer for raw data */
- hid_t sm_space = -1; /* stripmine data space */
+ unsigned char *sm_buf = NULL; /* buffer for raw data */
+ hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
+ hsize_t sm_nbytes; /* bytes per stripmine */
+ hsize_t sm_nelmts; /* elements per stripmine */
+ hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */
/* Hyperslab info */
- hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */
- hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */
- hsize_t hs_nelmts; /* elements in request */
+ hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */
+ hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */
+ hsize_t hs_nelmts; /* elements in request */
/* VL data special information */
- unsigned int vl_data = 0; /* contains VL datatypes */
- hid_t p_type = -1;
- hid_t f_type = -1;
-
- if(dset < 0) return -1;
- f_type = H5Dget_type(dset);
- if (binary_order == 1)
- p_type = h5str_get_native_type(f_type);
- else if (binary_order == 2)
- p_type = h5str_get_little_endian_type(f_type);
- else if (binary_order == 3)
- p_type = h5str_get_big_endian_type(f_type);
- else
- p_type = H5Tcopy(f_type);
+ unsigned int vl_data = 0; /* contains VL datatypes */
+ hid_t p_type = H5I_INVALID_HID;
+ hid_t f_type = H5I_INVALID_HID;
- H5Tclose(f_type);
+ int ret_value = FAIL;
- if (p_type >= 0) {
- if((f_space = H5Dget_space(dset)) >= 0) {
- ndims = H5Sget_simple_extent_ndims(f_space);
+ if (dset < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_dump_simple_dset: dset ID < 0");
- if ((size_t)ndims <= (sizeof(sm_size)/sizeof(sm_size[0]))) {
- H5Sget_simple_extent_dims(f_space, total_size, NULL);
+ if ((f_type = H5Dget_type(dset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- /* calculate the number of elements we're going to print */
- p_nelmts = 1;
+ switch (binary_order) {
+ case 1:
+ {
+ if ((p_type = h5str_get_native_type(f_type)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (ndims > 0) {
- for (i = 0; i < ndims; i++)
- p_nelmts *= total_size[i];
- } /* end if */
+ break;
+ }
- if (p_nelmts > 0) {
- /* Check if we have VL data in the dataset's datatype */
- if (h5str_detect_vlen(p_type) != 0)
- vl_data = 1;
+ case 2:
+ {
+ if ((p_type = h5str_get_little_endian_type(f_type)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- /*
- * Determine the strip mine size and allocate a buffer. The strip mine is
- * a hyperslab whose size is manageable.
- */
- sm_nbytes = p_type_nbytes = H5Tget_size(p_type);
+ break;
+ }
- if (ndims > 0) {
- for (i = (size_t)ndims; i > 0; --i) {
- hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
- if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */
- size = 1;
- sm_size[i - 1] = (((total_size[i - 1]) < (size)) ? (total_size[i - 1]) : (size));
- sm_nbytes *= sm_size[i - 1];
- }
- }
+ case 3:
+ {
+ if ((p_type = h5str_get_big_endian_type(f_type)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if(sm_nbytes > 0) {
- sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes);
+ break;
+ }
- sm_nelmts = sm_nbytes / p_type_nbytes;
- sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
+ default:
+ {
+ if ((p_type = H5Tcopy(f_type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- /* The stripmine loop */
- HDmemset(hs_offset, 0, sizeof hs_offset);
- HDmemset(zero, 0, sizeof zero);
+ break;
+ }
+ }
- for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) {
- /* Calculate the hyperslab size */
- if (ndims > 0) {
- for (i = 0, hs_nelmts = 1; i < ndims; i++) {
- hs_size[i] = (((total_size[i] - hs_offset[i]) < (sm_size[i])) ? (total_size[i] - hs_offset[i]) : (sm_size[i]));
- hs_nelmts *= hs_size[i];
- }
+ if ((f_space = H5Dget_space(dset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL);
- H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL);
- }
- else {
- H5Sselect_all(f_space);
- H5Sselect_all(sm_space);
- hs_nelmts = 1;
- }
+ if ((ndims = H5Sget_simple_extent_ndims(f_space)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- /* Read the data */
- if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) >= 0) {
+ if ((size_t)ndims <= (sizeof(sm_size) / sizeof(sm_size[0]))) {
+ if (H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (binary_order == 99)
- ret_value = h5tools_dump_simple_data(stream, dset, p_type, sm_buf, hs_nelmts);
- else
- ret_value = h5str_render_bin_output(stream, dset, p_type, sm_buf, hs_nelmts);
+ /* Calculate the number of elements we're going to print */
+ p_nelmts = 1;
- /* Reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf);
- }
- else {
- ret_value = -1;
- break;
- }
+ if (ndims > 0) {
+ for (i = 0; i < (size_t) ndims; i++)
+ p_nelmts *= total_size[i];
+ } /* end if */
- if(ret_value < 0) break;
+ if (p_nelmts > 0) {
+ /* Check if we have VL data in the dataset's datatype */
+ if (h5str_detect_vlen(p_type) != 0)
+ vl_data = 1;
- /* Calculate the next hyperslab offset */
- for (i = (size_t)ndims, carry = 1; i > 0 && carry; --i) {
- hs_offset[i - 1] += hs_size[i - 1];
+ /*
+ * Determine the strip mine size and allocate a buffer. The strip mine is
+ * a hyperslab whose size is manageable.
+ */
+ if (!(sm_nbytes = p_type_nbytes = H5Tget_size(p_type)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (ndims > 0) {
+ for (i = (size_t)ndims; i > 0; --i) {
+ hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
+ if ( size == 0 ) /* datum size > H5TOOLS_BUFSIZE */
+ size = 1;
+ sm_size[i - 1] = (((total_size[i - 1]) < (size)) ? (total_size[i - 1]) : (size));
+ sm_nbytes *= sm_size[i - 1];
+ }
+ }
- if (hs_offset[i - 1] == total_size[i - 1])
- hs_offset[i - 1] = 0;
- else
- carry = 0;
- }
+ if (sm_nbytes > 0) {
+ if (NULL == (sm_buf = (unsigned char *) HDmalloc((size_t)sm_nbytes)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_dset: failed to allocate sm_buf");
+
+ sm_nelmts = sm_nbytes / p_type_nbytes;
+
+ if ((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* The stripmine loop */
+ HDmemset(hs_offset, 0, sizeof hs_offset);
+ HDmemset(zero, 0, sizeof zero);
+
+ for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) {
+ /* Calculate the hyperslab size */
+ if (ndims > 0) {
+ for (i = 0, hs_nelmts = 1; i < (size_t) ndims; i++) {
+ hs_size[i] = (((total_size[i] - hs_offset[i]) < (sm_size[i])) ? (total_size[i] - hs_offset[i]) : (sm_size[i]));
+ hs_nelmts *= hs_size[i];
}
- if(sm_buf)
- HDfree(sm_buf);
+ if (H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ else {
+ if (H5Sselect_all(f_space) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Sselect_all(sm_space) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ hs_nelmts = 1;
+ }
+
+ /* Read the data */
+ if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (binary_order == 99) {
+ if (h5tools_dump_simple_data(ENVONLY, stream, dset, p_type, sm_buf, hs_nelmts) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else {
+ if (h5str_render_bin_output(stream, dset, p_type, sm_buf, hs_nelmts) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data) {
+ if (H5Treclaim(p_type, sm_space, H5P_DEFAULT, sm_buf) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+
+ /* Calculate the next hyperslab offset */
+ for (i = (size_t)ndims, carry = 1; i > 0 && carry; --i) {
+ hs_offset[i - 1] += hs_size[i - 1];
+
+ if (hs_offset[i - 1] == total_size[i - 1])
+ hs_offset[i - 1] = 0;
+ else
+ carry = 0;
}
- if(sm_space >= 0 && H5Sclose(sm_space) < 0)
- ret_value = -1;
}
}
- if(f_space >= 0 && H5Sclose(f_space) < 0)
- ret_value = -1;
- } /* end if((f_space = H5Dget_space(dset)) >= 0) */
- else
- ret_value = -1;
-
- if (p_type >= 0)
- H5Tclose(p_type);
+ }
}
+
+ ret_value = SUCCEED;
+
+done:
+ if (sm_space >= 0)
+ H5Sclose(sm_space);
+ if (sm_buf)
+ HDfree(sm_buf);
+ if (f_space >= 0)
+ H5Sclose(f_space);
+ if (p_type >= 0)
+ H5Tclose(p_type);
+ if (f_type >= 0)
+ H5Tclose(f_type);
+
return ret_value;
} /* end h5str_dump_simple_dset */
+htri_t
+H5Tdetect_variable_str(hid_t tid) {
+ htri_t ret_val = 0;
+
+ if (H5Tget_class(tid) == H5T_COMPOUND) {
+ unsigned i;
+ unsigned nm = (unsigned)H5Tget_nmembers(tid);
+ for(i = 0; i < nm; i++) {
+ htri_t status = 0;
+ hid_t mtid = 0;
+ if((mtid = H5Tget_member_type(tid, i)) < 0)
+ return FAIL; /* exit immediately on error */
+ if((status = H5Tdetect_variable_str(mtid)) < 0)
+ return status; /* exit immediately on error */
+ ret_val |= status;
+ H5Tclose (mtid);
+ } /* end for */
+ } /* end if */
+ else
+ ret_val = H5Tis_variable_str(tid);
+
+ return ret_val;
+} /* end H5Tdetect_variable_str */
+
static int
h5tools_dump_simple_data
- (FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts)
+ (JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts)
{
- int ret_value = 0;
- int line_count;
- unsigned char *mem = (unsigned char*)_mem;
- size_t size; /* datum size */
- hsize_t i; /*element counter */
- h5str_t buffer; /*string into which to render */
-
- if((size = H5Tget_size(type)) > 0) {
- for (i = 0, line_count = 0; i < nelmts; i++, line_count++) {
- size_t bytes_in = 0; /* # of bytes to write */
- size_t bytes_wrote = 0; /* # of bytes written */
- void* memref = mem + i * size;
-
- /* Render the data element*/
- h5str_new(&buffer, 32 * size);
- bytes_in = h5str_sprintf(&buffer, container, type, memref, 1);
- if(i > 0) {
- HDfprintf(stream, ", ");
- if (line_count >= H5TOOLS_TEXT_BLOCK) {
- line_count = 0;
- HDfprintf(stream, "\n");
- }
+ unsigned char *mem = (unsigned char *)_mem;
+ h5str_t buffer; /* string into which to render */
+ hsize_t i; /* element counter */
+ size_t size; /* datum size */
+ int line_count;
+ int ret_value = 0;
+
+ if (!(size = H5Tget_size(type)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0, line_count = 0; i < nelmts; i++, line_count++) {
+ size_t bytes_in = 0; /* # of bytes to write */
+ void *memref = mem + i * size;
+
+ /* Render the data element*/
+ h5str_new(&buffer, 32 * size);
+
+ if (!buffer.s)
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5tools_dump_simple_data: failed to allocate buffer");
+
+ if (!(bytes_in = h5str_sprintf(ENVONLY, &buffer, container, type, memref, 0, 1)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (i > 0) {
+ if (HDfprintf(stream, ", ") < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure");
+
+ if (line_count >= H5TOOLS_TEXT_BLOCK) {
+ line_count = 0;
+
+ if (HDfprintf(stream, "\n") < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure");
}
- HDfprintf(stream, "%s", buffer.s);
- h5str_free(&buffer);
- } /* end for (i = 0; i < nelmts... */
- HDfprintf(stream, "\n");
- } /* end if((size = H5Tget_size(tid)) > 0) */
- else
- ret_value = -1;
+ }
+
+ if (HDfprintf(stream, "%s", buffer.s) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure");
+
+ h5str_free(&buffer);
+ } /* end for (i = 0; i < nelmts... */
+
+ if (HDfprintf(stream, "\n") < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure");
+
+done:
+ if (buffer.s)
+ h5str_free(&buffer);
return ret_value;
} /* end h5tools_dump_simple_data */
@@ -1906,170 +3019,75 @@ h5tools_dump_simple_data
/*
* Class: hdf_hdf5lib_H5
- * Method: H5AwriteVL
+ * Method: H5AreadComplex
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AwriteVL
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5AreadComplex
+(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
{
- herr_t status = -1;
- char **wdata;
- jsize size;
- jint i;
+ h5str_t h5str;
+ jstring jstr;
+ size_t size;
+ size_t i;
+ hid_t p_type = H5I_INVALID_HID;
+ jsize n;
+ char *readBuf = NULL;
+ herr_t status = FAIL;
- size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf);
+ UNUSED(clss);
- wdata = (char**)HDcalloc((size_t)size + 1, sizeof(char*));
- if (!wdata) {
- h5JNIFatalError(env, "H5AwriteVL: cannot allocate buffer");
- } /* end if */
- else {
- HDmemset(wdata, 0, (size_t)size * sizeof(char*));
- for (i = 0; i < size; ++i) {
- jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray) buf, i);
- if (obj != 0) {
- jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj);
- const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
-
- if (utf8) {
- wdata[i] = (char*)HDmalloc((size_t)length + 1);
- if (wdata[i]) {
- HDmemset(wdata[i], 0, ((size_t)length + 1));
- HDstrncpy(wdata[i], utf8, (size_t)length);
- } /* end if */
- } /* end if */
-
- ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
- ENVPTR->DeleteLocalRef(ENVPAR obj);
- } /* end if */
- } /* end for (i = 0; i < size; ++i) */
-
- status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, wdata);
-
- for (i = 0; i < size; i++) {
- if(wdata[i]) {
- HDfree(wdata[i]);
- } /* end if */
- } /* end for */
- HDfree(wdata);
+ HDmemset(&h5str, 0, sizeof(h5str_t));
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ if ((p_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5AwriteVL */
+ size = (((H5Tget_size(mem_type_id))>(H5Tget_size(p_type))) ? (H5Tget_size(mem_type_id)) : (H5Tget_size(p_type)));
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5AreadVL
- * Signature: (JJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AreadVL
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
-{
- herr_t status = -1;
- jstring jstr;
- char **strs;
- int i, n;
- hid_t sid;
- hsize_t dims[H5S_MAX_RANK];
-
- n = ENVPTR->GetArrayLength(ENVPAR buf);
-
- strs =(char **)HDmalloc((size_t)n * sizeof(char *));
- if (strs == NULL) {
- h5JNIFatalError( env, "H5AreadVL: failed to allocate buff for read variable length strings");
- } /* end if */
- else {
- status = H5Aread(attr_id, mem_type_id, strs);
- if (status < 0) {
- dims[0] = (hsize_t)n;
- sid = H5Screate_simple(1, dims, NULL);
- H5Dvlen_reclaim(mem_type_id, sid, H5P_DEFAULT, strs);
- H5Sclose(sid);
- HDfree(strs);
- h5JNIFatalError(env, "H5AreadVL: failed to read variable length strings");
- } /* end if */
- else {
- for (i=0; i<n; i++) {
- jstr = ENVPTR->NewStringUTF(ENVPAR strs[i]);
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- HDfree (strs[i]);
- } /* end for */
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadComplex: read buffer length <= 0");
+ }
- /*
- for repeatedly reading an attribute with a large number of strs (e.g., 1,000,000 strings,
- H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect
- free space in time. Instead, use "free(strs[i])" to free individual strings
- after it is done.
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, strs);
- */
-
- HDfree(strs);
- } /* end else */
- } /* end else */
- return status;
-} /* end Java_hdf_hdf5lib_H5_H5AreadVL */
+ if (NULL == (readBuf = (char *) HDmalloc((size_t)n * size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadComplex: failed to allocate read buffer");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5AreadComplex
- * Signature: (JJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AreadComplex
-(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
-{
- herr_t status = -1;
- int i;
- int n;
- char *rdata;
- size_t max_len = 0;
- size_t size;
- h5str_t h5str;
- hid_t p_type = -1;
- jstring jstr;
+ if ((status = H5Aread(attr_id, mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- p_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT);
- size = (((H5Tget_size(mem_type_id))>(H5Tget_size(p_type))) ? (H5Tget_size(mem_type_id)) : (H5Tget_size(p_type)));
- H5Tclose(p_type);
+ h5str_new(&h5str, 4 * size);
+
+ if (!h5str.s)
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AreadComplex: failed to allocate string buffer");
+
+ for (i = 0; i < (size_t) n; i++) {
+ h5str.s[0] = '\0';
+
+ if (!h5str_sprintf(ENVONLY, &h5str, attr_id, mem_type_id, readBuf + (i * size), 0, 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize) i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (h5str.s)
+ h5str_free(&h5str);
+ if (readBuf)
+ HDfree(readBuf);
+ if (p_type >= 0)
+ H5Tclose(p_type);
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- rdata = (char *)malloc((size_t)n * size);
- if (rdata == NULL) {
- h5JNIFatalError(env, "H5AreadComplex: failed to allocate buff for read");
- } /* end if */
- else {
- status = H5Aread(attr_id, mem_type_id, rdata);
- if (status < 0) {
- h5JNIFatalError(env, "H5AreadComplex: failed to read data");
- } /* end if */
- else {
- HDmemset(&h5str, 0, sizeof(h5str_t));
- h5str_new(&h5str, 4 * size);
- if (h5str.s == NULL) {
- h5JNIFatalError(env, "H5AreadComplex: failed to allocate string buf");
- } /* end if */
- else {
- for (i = 0; i < n; i++) {
- h5str.s[0] = '\0';
- h5str_sprintf(&h5str, attr_id, mem_type_id, rdata + ((size_t)i * size), 0);
- jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s);
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- } /* end for */
- } /* end else */
- h5str_free(&h5str);
- } /* end else */
- HDfree(rdata);
- } /* end else */
return status;
}
/*
- * Copies the content of one dataset to another dataset
+ * Copies the content of one attribute to another attribute
* Class: hdf_hdf5lib_H5
* Method: H5Acopy
* Signature: (JJ)I
@@ -2078,62 +3096,51 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Acopy
(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id)
{
- jbyte *buf;
- herr_t retVal = -1;
- hid_t src_did = (hid_t)src_id;
- hid_t dst_did = (hid_t)dst_id;
- hid_t tid = -1;
- hid_t sid = -1;
- hsize_t total_size = 0;
-
-
- sid = H5Aget_space(src_did);
- if (sid < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- tid = H5Aget_type(src_did);
- if (tid < 0) {
- H5Sclose(sid);
- h5libraryError(env);
- } /* end if */
- else {
- total_size = (hsize_t)H5Sget_simple_extent_npoints(sid) * (hsize_t)H5Tget_size(tid);
+ hssize_t npoints;
+ hsize_t total_size = 0;
+ size_t type_size;
+ jbyte *buf = NULL;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ herr_t retVal = FAIL;
- H5Sclose(sid);
+ UNUSED(clss);
- buf = (jbyte *)HDmalloc( (size_t)total_size * sizeof(jbyte));
- if (buf == NULL) {
- H5Tclose(tid);
- h5outOfMemory( env, "H5Acopy: malloc failed");
- } /* end if */
- else {
- retVal = H5Aread(src_did, tid, buf);
- H5Tclose(tid);
+ if ((sid = H5Aget_space((hid_t)src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (retVal < 0) {
- HDfree(buf);
- h5libraryError(env);
- } /* end if */
- else {
- tid = H5Aget_type(dst_did);
- if (tid < 0) {
- HDfree(buf);
- h5libraryError(env);
- } /* end if */
- else {
- retVal = H5Awrite(dst_did, tid, buf);
+ if ((tid = H5Aget_type((hid_t)src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- H5Tclose(tid);
- HDfree(buf);
+ if ((npoints = H5Sget_simple_extent_npoints(sid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ if (!(type_size = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+ total_size = (hsize_t)npoints * (hsize_t)type_size;
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ if (NULL == (buf = (jbyte *) HDmalloc((size_t)total_size * sizeof(jbyte))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Acopy: failed to allocate buffer");
+
+ if ((retVal = H5Aread((hid_t)src_id, tid, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Tclose(tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ tid = H5I_INVALID_HID;
+
+ if ((tid = H5Aget_type((hid_t)dst_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((retVal = H5Awrite((hid_t)dst_id, tid, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (buf)
+ HDfree(buf);
+ if (tid >= 0)
+ H5Tclose(tid);
+ if (sid >= 0)
+ H5Sclose(sid);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Acopy */
@@ -2148,89 +3155,79 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Dcopy
(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id)
{
- jbyte *buf;
- herr_t retVal = -1;
- hid_t src_did = (hid_t)src_id;
- hid_t dst_did = (hid_t)dst_id;
- hid_t tid = -1;
- hid_t sid = -1;
- hsize_t total_size = 0, total_allocated_size;
-
- total_allocated_size = H5Dget_storage_size(src_did);
- if (total_allocated_size <=0)
- return 0; // nothing to write;
-
- sid = H5Dget_space(src_did);
- if (sid < 0) {
- h5libraryError(env);
- return -1;
- } /* end if */
+ hssize_t npoints;
+ hsize_t total_size = 0, total_allocated_size;
+ size_t type_size;
+ jbyte *buf = NULL;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ herr_t retVal = FAIL;
- tid = H5Dget_type(src_did);
- if (tid < 0) {
- H5Sclose(sid);
- h5libraryError(env);
- return -1;
- } /* end if */
+ UNUSED(clss);
- total_size = (hsize_t)H5Sget_simple_extent_npoints(sid) * (hsize_t)H5Tget_size(tid);
+ if (!(total_allocated_size = H5Dget_storage_size((hid_t)src_id)))
+ return 0; /* nothing to write */
- H5Sclose(sid);
+ if ((sid = H5Dget_space((hid_t)src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- buf = (jbyte*)HDmalloc((size_t)total_size * sizeof(jbyte));
- if (buf == NULL) {
- H5Tclose(tid);
- h5outOfMemory(env, "H5Dcopy: malloc failed");
- return -1;
- } /* end if */
+ if ((tid = H5Dget_type((hid_t)src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Dread(src_did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- H5Tclose(tid);
+ if ((npoints = H5Sget_simple_extent_npoints(sid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ if (!(type_size = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+ total_size = (hsize_t)npoints * (hsize_t)type_size;
- if (retVal < 0) {
- HDfree(buf);
- h5libraryError(env);
- return (jint)retVal;
- } /* end if */
+ if (NULL == (buf = (jbyte *) HDmalloc((size_t)total_size * sizeof(jbyte))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dcopy: failed to allocate buffer");
- tid = H5Dget_type(dst_did);
- if (tid < 0) {
- HDfree(buf);
- h5libraryError(env);
- return -1;
- } /* end if */
- retVal = H5Dwrite(dst_did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- H5Tclose(tid);
- HDfree(buf);
+ if ((retVal = H5Dread((hid_t)src_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (retVal < 0) {
- h5libraryError(env);
- } /* end if */
+ if (H5Tclose(tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ tid = H5I_INVALID_HID;
+
+ if ((tid = H5Dget_type((hid_t)dst_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((retVal = H5Dwrite((hid_t)dst_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (buf)
+ HDfree(buf);
+ if (tid >= 0)
+ H5Tclose(tid);
+ if (sid >= 0)
+ H5Sclose(sid);
return (jint)retVal;
} /* 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 object 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);
- herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data);
- int H5Gget_obj_info_max(hid_t, char **, int *, int *, unsigned long *, long);
- int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, unsigned long *objno, int indexType, int indexOrder);
+ herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
+ herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
+ int H5Gget_obj_info_max(hid_t, char **, int *, int *, H5O_token_t *, long);
+ int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, H5O_token_t *obj_token, int indexType, int indexOrder);
#else
- static herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data);
- static herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data);
- static int H5Gget_obj_info_max(hid_t, char **, int *, int *, unsigned long *, long);
- static int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, unsigned long *objno, int indexType, int indexOrder);
+ static herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
+ static herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info2_t *linfo, void *op_data);
+ static int H5Gget_obj_info_max(hid_t, char **, int *, int *, H5O_token_t *, long);
+ static int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, H5O_token_t *obj_token, int indexType, int indexOrder);
#endif
typedef struct info_all
@@ -2238,7 +3235,7 @@ typedef struct info_all
char **objname;
int *otype;
int *ltype;
- unsigned long *objno;
+ H5O_token_t *obj_token;
unsigned long *fno;
unsigned long idxnum;
int count;
@@ -2250,152 +3247,108 @@ typedef struct info_all
* Method: H5Gget_obj_info_full
* Signature: (JLjava/lang/String;[Ljava/lang/String;[I[I[J[JIII)I
*/
+/*
+ * NOTE: This is a dangerous call! The caller can supply any value they'd like
+ * for 'n' and if it exceeds the number of links in the group, we will most likely
+ * end up overwriting memory heap-tracking info.
+ */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full
(JNIEnv *env, jclass clss, jlong loc_id, jstring group_name,
jobjectArray objName, jintArray oType, jintArray lType, jlongArray fNo,
- jlongArray oRef, jint n, jint indx_type, jint indx_order)
+ jobjectArray oToken, jint n, jint indx_type, jint indx_order)
{
- herr_t ret_val = -1;
- const char *gName = NULL;
- char **oName = NULL;
- jboolean isCopy;
- jstring str;
- jint *otarr;
- jint *ltarr;
- jlong *refP;
- jlong *fnoP;
- unsigned long *refs=NULL;
- unsigned long *fnos=NULL;
- hid_t gid = (hid_t)loc_id;
- int i;
- int indexType = indx_type;
- int indexOrder = indx_order;
-
- if (oType == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_full: oType is NULL");
- }
- else if (lType == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_full: lType is NULL");
- }
- else if (oRef == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_full: oRef is NULL");
- }
- else if (fNo == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_full: fNo is NULL");
+ unsigned long *fnos = NULL;
+ H5O_token_t *tokens = NULL;
+ const char *gName = NULL;
+ char **oName = NULL;
+ jboolean isCopy;
+ jstring str;
+ jobject token;
+ jint *otarr = NULL;
+ jint *ltarr = NULL;
+ jlong *fnoP = NULL;
+ hid_t gid = (hid_t)loc_id;
+ int i;
+ int indexType = indx_type;
+ int indexOrder = indx_order;
+ herr_t ret_val = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == oType)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: oType is NULL");
+ if (NULL == lType)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: lType is NULL");
+ if (NULL == oToken)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: oToken is NULL");
+ if (NULL == fNo)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: fNo is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, oType, otarr, &isCopy, "H5Gget_obj_info_full: oType not pinned");
+ PIN_INT_ARRAY(ENVONLY, lType, ltarr, &isCopy, "H5Gget_obj_info_full: lType not pinned");
+ PIN_LONG_ARRAY(ENVONLY, fNo, fnoP, &isCopy, "H5Gget_obj_info_full: fNo not pinned");
+
+ if (NULL == (oName = (char **) HDcalloc((size_t)n, sizeof(*oName))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for object name");
+
+ if (NULL == (tokens = (H5O_token_t *) HDcalloc((size_t)n, sizeof(H5O_token_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for object tokens");
+
+ if (NULL == (fnos = (unsigned long *) HDcalloc((size_t)n, sizeof(unsigned long))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for file number info");
+
+ if (group_name) {
+ PIN_JAVA_STRING(ENVONLY, group_name, gName, &isCopy, "H5Gget_obj_info_full: group_name not pinned");
+
+ if ((gid = H5Gopen2((hid_t)loc_id, gName, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
}
- else {
- otarr = ENVPTR->GetIntArrayElements(ENVPAR oType, &isCopy);
- if (otarr == NULL) {
- h5JNIFatalError(env, "H5Gget_obj_info_full: otype not pinned");
- return -1;
- } /* end if */
- ltarr = ENVPTR->GetIntArrayElements(ENVPAR lType, &isCopy);
- if (ltarr == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_full: ltype not pinned");
- return -1;
- } /* end if */
- refP = ENVPTR->GetLongArrayElements(ENVPAR oRef, &isCopy);
- if (refP == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_full: oRef not pinned");
- return -1;
- } /* end if */
- fnoP = ENVPTR->GetLongArrayElements(ENVPAR fNo, &isCopy);
- if (fnoP == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_full: fNo not pinned");
- return -1;
- } /* end if */
- oName = (char **)HDcalloc((size_t)n, sizeof(*oName));
- if (!oName) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_full: oName not allocated");
- return -1;
- } /* end if */
- refs = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long));
- fnos = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long));
- if (!refs || !fnos) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT);
- h5str_array_free(oName, (size_t)n);
- if (refs)
- HDfree(refs);
- if (fnos)
- HDfree(fnos);
- h5JNIFatalError(env, "H5Gget_obj_info_full: result arrays not allocated");
- return -1;
- } /* end if */
+ if ((ret_val = H5Gget_obj_info_full(gid, oName, (int *)otarr, (int *)ltarr, fnos, tokens, indexType, indexOrder)) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_full: retrieval of object info failed");
- if (group_name != NULL) {
- gid = -1;
- gName = ENVPTR->GetStringUTFChars(ENVPAR group_name, &isCopy);
- if (gName != NULL) {
- gid = H5Gopen2((hid_t)loc_id, gName, H5P_DEFAULT);
-
- ENVPTR->ReleaseStringUTFChars(ENVPAR group_name, gName);
- } /* end if */
- if(gid < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT);
- h5str_array_free(oName, (size_t)n);
- HDfree(refs);
- HDfree(fnos);
- h5JNIFatalError(env, "H5Gget_obj_info_full: could not get group identifier");
- return -1;
- } /* end if */
+ for (i = 0; i < n; i++) {
+ fnoP[i] = (jlong)fnos[i];
+
+ if (oName[i]) {
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, oName[i])))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, objName, i, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, str);
} /* end if */
- ret_val = H5Gget_obj_info_full(gid, oName, (int *)otarr, (int *)ltarr, fnos, refs, indexType, indexOrder);
+ /* Create an H5O_token_t object */
+ if (NULL == (token = create_H5O_token_t(ENVONLY, &tokens[i], TRUE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, 0);
+ ENVPTR->SetObjectArrayElement(ENVONLY, oToken, i, token);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (group_name != NULL)
- H5Gclose(gid);
+ ENVPTR->DeleteLocalRef(ENVONLY, token);
+ }
+
+done:
+ if (gName) {
+ H5Gclose(gid);
+ UNPIN_JAVA_STRING(ENVONLY, group_name, gName);
+ }
+ if (fnos)
+ HDfree(fnos);
+ if (tokens)
+ HDfree(tokens);
+ if (oName)
+ h5str_array_free(oName, (size_t)n);
+ if (fnoP)
+ UNPIN_LONG_ARRAY(ENVONLY, fNo, fnoP, (ret_val < 0) ? JNI_ABORT : 0);
+ if (ltarr)
+ UNPIN_INT_ARRAY(ENVONLY, lType, ltarr, (ret_val < 0) ? JNI_ABORT : 0);
+ if (otarr)
+ UNPIN_INT_ARRAY(ENVONLY, oType, otarr, (ret_val < 0) ? JNI_ABORT : 0);
- if (ret_val < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT);
- h5str_array_free(oName, (size_t)n);
- HDfree(refs);
- HDfree(fnos);
- h5libraryError(env);
- } /* end if */
- else {
- for (i=0; i<n; i++) {
- refP[i] = (jlong)refs[i];
- } /* end for */
- HDfree(refs);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, 0);
-
- for (i=0; i<n; i++) {
- fnoP[i] = (jlong)fnos[i];
- } /* end for */
- HDfree(fnos);
- ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, 0);
-
- for (i=0; i<n; i++) {
- if (*(oName+i)) {
- str = ENVPTR->NewStringUTF(ENVPAR *(oName+i));
- ENVPTR->SetObjectArrayElement(ENVPAR objName, i, (jobject)str);
- } /* end if */
- } /* for (i=0; i<n; i++)*/
- h5str_array_free(oName, (size_t)n);
- } /* end else */
- } /* end else */
return ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full */
@@ -2404,136 +3357,129 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full
* Method: H5Gget_obj_info_max
* Signature: (J[Ljava/lang/String;[I[I[JJI)I
*/
+/*
+ * NOTE: This is a dangerous call! The caller can supply any value they'd like
+ * for 'n' and if it exceeds the number of links reachable from the group, we
+ * will most likely end up overwriting memory heap-tracking info.
+ */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max
(JNIEnv *env, jclass clss, jlong loc_id, jobjectArray objName,
- jintArray oType, jintArray lType, jlongArray oRef, jlong maxnum, jint n)
+ jintArray oType, jintArray lType, jobjectArray oToken, jlong maxnum, jint n)
{
- herr_t ret_val = -1;
- char **oName=NULL;
- jboolean isCopy;
- jstring str;
- jint *otarr;
- jint *ltarr;
- jlong *refP;
- unsigned long *refs;
- int i;
-
- if (oType == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_max: oType is NULL");
- } /* end if */
- else if (lType == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_max: lType is NULL");
- } /* end else if */
- else if (oRef == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_max: oRef is NULL");
- } /* end else if */
- else {
- otarr = ENVPTR->GetIntArrayElements(ENVPAR oType, &isCopy);
- if (otarr == NULL) {
- h5JNIFatalError(env, "H5Gget_obj_info_max: otype not pinned");
- return -1;
- } /* end if */
+ H5O_token_t *tokens = NULL;
+ jboolean isCopy;
+ jstring str;
+ jobject token;
+ char **oName = NULL;
+ jint *otarr = NULL;
+ jint *ltarr = NULL;
+ int i;
+ herr_t ret_val = FAIL;
- ltarr = ENVPTR->GetIntArrayElements(ENVPAR lType, &isCopy);
- if (ltarr == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_max: ltype not pinned");
- return -1;
- } /* end if */
+ UNUSED(clss);
- refP = ENVPTR->GetLongArrayElements(ENVPAR oRef, &isCopy);
- if (refP == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_max: oRef not pinned");
- return -1;
- } /* end if */
+ if (NULL == oType)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_max: oType is NULL");
+ if (NULL == lType)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_max: lType is NULL");
+ if (NULL == oToken)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_max: oToken is NULL");
- oName = (char **)HDcalloc((size_t)n, sizeof(*oName));
- if (!oName) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_max: oName not allocated");
- return -1;
- } /* end if */
- refs = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long));
- if (!refs) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- h5str_array_free(oName, (size_t)n);
- h5JNIFatalError(env, "H5Gget_obj_info_max: result array not allocated");
- return -1;
- } /* end if */
+ PIN_INT_ARRAY(ENVONLY, oType, otarr, &isCopy, "H5Gget_obj_info_max: oType not pinned");
+ PIN_INT_ARRAY(ENVONLY, lType, ltarr, &isCopy, "H5Gget_obj_info_max: lType not pinned");
- ret_val = H5Gget_obj_info_max((hid_t)loc_id, oName, (int*)otarr, (int*)ltarr, refs, maxnum );
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, 0);
+ if (NULL == (oName = (char **) HDcalloc((size_t)n, sizeof(*oName))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for object name");
- if (ret_val < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- h5str_array_free(oName, (size_t)n);
- HDfree(refs);
- h5libraryError(env);
- } /* end if */
- else {
- for (i=0; i<n; i++) {
- refP[i] = (jlong) refs[i];
- } /* end for */
- HDfree(refs);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, 0);
-
- for (i=0; i<n; i++) {
- if (*(oName+i)) {
- str = ENVPTR->NewStringUTF(ENVPAR *(oName+i));
- ENVPTR->SetObjectArrayElement(ENVPAR objName, i, (jobject)str);
- }
- } /* for (i=0; i<n; i++)*/
+ if (NULL == (tokens = (H5O_token_t *) HDcalloc((size_t)n, sizeof(H5O_token_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for object tokens");
- h5str_array_free(oName, (size_t)n);
- } /* end else */
- } /* end else */
+ if ((ret_val = H5Gget_obj_info_max((hid_t)loc_id, oName, (int *)otarr, (int *)ltarr, tokens, maxnum)) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_max: retrieval of object info failed");
+
+ for (i = 0; i < n; i++) {
+ if (oName[i]) {
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, oName[i])))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, objName, i, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, str);
+ }
+
+ /* Create an H5O_token_t object */
+ if (NULL == (token = create_H5O_token_t(ENVONLY, &tokens[i], TRUE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, oToken, i, token);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, token);
+ } /* end for */
+
+done:
+ if (tokens)
+ HDfree(tokens);
+ if (oName)
+ h5str_array_free(oName, (size_t)n);
+ if (ltarr)
+ UNPIN_INT_ARRAY(ENVONLY, lType, ltarr, (ret_val < 0) ? JNI_ABORT : 0);
+ if (otarr)
+ UNPIN_INT_ARRAY(ENVONLY, oType, otarr, (ret_val < 0) ? JNI_ABORT : 0);
return ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max */
int
H5Gget_obj_info_full
- (hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, unsigned long *objno, int indexType, int indexOrder)
+ (hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, H5O_token_t *obj_token, int indexType, int indexOrder)
{
info_all_t info;
+
info.objname = objname;
info.otype = otype;
info.ltype = ltype;
info.idxnum = 0;
info.fno = fno;
- info.objno = objno;
+ info.obj_token = obj_token;
info.count = 0;
- if(H5Literate(loc_id, (H5_index_t)indexType, (H5_iter_order_t)indexOrder, NULL, obj_info_all, (void *)&info) < 0) {
- /* iterate failed, try normal alphabetical order */
- if(H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, obj_info_all, (void *)&info) < 0)
+ if (H5Literate2(loc_id, (H5_index_t)indexType, (H5_iter_order_t)indexOrder, NULL, obj_info_all, (void *)&info) < 0) {
+ /*
+ * Reset info stats; most importantly, reset the count.
+ */
+ info.objname = objname;
+ info.otype = otype;
+ info.ltype = ltype;
+ info.idxnum = 0;
+ info.fno = fno;
+ info.obj_token = obj_token;
+ info.count = 0;
+
+ /* Iteration failed, try normal alphabetical order */
+ if (H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, obj_info_all, (void *)&info) < 0)
return -1;
- } /* end if */
+ }
return info.count;
} /* end H5Gget_obj_info_full */
int
H5Gget_obj_info_max
- (hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *objno, long maxnum)
+ (hid_t loc_id, char **objname, int *otype, int *ltype, H5O_token_t *obj_token, long maxnum)
{
info_all_t info;
+
info.objname = objname;
info.otype = otype;
info.ltype = ltype;
info.idxnum = (unsigned long)maxnum;
- info.objno = objno;
+ info.obj_token = obj_token;
info.count = 0;
- if(H5Lvisit(loc_id, H5_INDEX_NAME, H5_ITER_NATIVE, obj_info_max, (void *)&info) < 0)
+ if (H5Lvisit2(loc_id, H5_INDEX_NAME, H5_ITER_NATIVE, obj_info_max, (void *)&info) < 0)
return -1;
return info.count;
@@ -2541,77 +3487,80 @@ H5Gget_obj_info_max
herr_t
obj_info_all
- (hid_t loc_id, const char *name, const H5L_info_t *info, void *op_data)
+ (hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_data)
{
- int type = -1;
- hid_t oid = -1;
- herr_t retVal = -1;
- info_all_t *datainfo = (info_all_t*)op_data;
- H5O_info_t object_info;
-
- retVal = H5Oget_info_by_name(loc_id, name, &object_info, H5P_DEFAULT);
-
- if (retVal < 0) {
- *(datainfo->otype+datainfo->count) = -1;
- *(datainfo->ltype+datainfo->count) = -1;
- *(datainfo->objname+datainfo->count) = (char *)HDmalloc(strlen(name)+1);
- HDstrcpy(*(datainfo->objname+datainfo->count), name);
- *(datainfo->objno+datainfo->count) = (unsigned long)-1;
- } /* end if */
- else {
- *(datainfo->otype+datainfo->count) = object_info.type;
- *(datainfo->ltype+datainfo->count) = info->type;
- *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1);
- HDstrcpy(*(datainfo->objname+datainfo->count), name);
-
- *(datainfo->fno+datainfo->count) = object_info.fileno;
- *(datainfo->objno+datainfo->count) = (unsigned long)object_info.addr;
- /*
- if(info->type==H5L_TYPE_HARD)
- *(datainfo->objno+datainfo->count) = (unsigned long)info->u.address;
- else
- *(datainfo->objno+datainfo->count) = info->u.val_size;
- */
- } /* end else */
+ info_all_t *datainfo = (info_all_t *)op_data;
+ H5O_info2_t object_info;
+ htri_t object_exists;
+ size_t str_len;
+
+ datainfo->otype[datainfo->count] = -1;
+ datainfo->ltype[datainfo->count] = -1;
+ datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF;
+
+ str_len = HDstrlen(name);
+ if (NULL == (datainfo->objname[datainfo->count] = (char *) HDmalloc(str_len + 1)))
+ goto done;
+
+ HDstrncpy(datainfo->objname[datainfo->count], name, str_len);
+ (datainfo->objname[datainfo->count])[str_len] = '\0';
+
+ if ((object_exists = H5Oexists_by_name(loc_id, name, H5P_DEFAULT)) < 0)
+ goto done;
+ if (object_exists) {
+ if (H5Oget_info_by_name3(loc_id, name, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0)
+ goto done;
+
+ datainfo->otype[datainfo->count] = object_info.type;
+ datainfo->ltype[datainfo->count] = info->type;
+ datainfo->fno[datainfo->count] = object_info.fileno;
+
+ HDmemcpy(&datainfo->obj_token[datainfo->count], &object_info.token, sizeof(object_info.token));
+ }
+
+done:
datainfo->count++;
- return 0;
+ return SUCCEED;
} /* end obj_info_all */
herr_t
obj_info_max
- (hid_t loc_id, const char *name, const H5L_info_t *info, void *op_data)
+ (hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_data)
{
- int type = -1;
- herr_t retVal = 0;
- info_all_t *datainfo = (info_all_t*)op_data;
- H5O_info_t object_info;
-
- retVal = H5Oget_info(loc_id, &object_info);
- if (retVal < 0) {
- *(datainfo->otype+datainfo->count) = -1;
- *(datainfo->ltype+datainfo->count) = -1;
- *(datainfo->objname+datainfo->count) = NULL;
- *(datainfo->objno+datainfo->count) = (unsigned long)-1;
- return 1;
- } /* end if */
- else {
- *(datainfo->otype+datainfo->count) = object_info.type;
- *(datainfo->ltype+datainfo->count) = info->type;
- /* this will be freed by h5str_array_free(oName, n)*/
- *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1);
- strcpy(*(datainfo->objname+datainfo->count), name);
- if(info->type==H5L_TYPE_HARD)
- *(datainfo->objno+datainfo->count) = (unsigned long)info->u.address;
- else
- *(datainfo->objno+datainfo->count) = info->u.val_size;
- } /* end else */
+ info_all_t *datainfo = (info_all_t *)op_data;
+ H5O_info2_t object_info;
+ size_t str_len;
+
+ datainfo->otype[datainfo->count] = -1;
+ datainfo->ltype[datainfo->count] = -1;
+ datainfo->objname[datainfo->count] = NULL;
+ datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF;
+
+ /* This will be freed by h5str_array_free(oName, n) */
+ str_len = HDstrlen(name);
+ if (NULL == (datainfo->objname[datainfo->count] = (char *) HDmalloc(str_len + 1)))
+ goto done;
+
+ HDstrncpy(datainfo->objname[datainfo->count], name, str_len);
+ (datainfo->objname[datainfo->count])[str_len] = '\0';
+
+ if (H5Oget_info3(loc_id, &object_info, H5O_INFO_ALL) < 0)
+ goto done;
+
+ datainfo->otype[datainfo->count] = object_info.type;
+ datainfo->ltype[datainfo->count] = info->type;
+
+ HDmemcpy(&datainfo->obj_token[datainfo->count], &object_info.token, sizeof(object_info.token));
+
+done:
datainfo->count++;
- if(datainfo->count < (int)datainfo->idxnum)
- return 0;
- else
+
+ if (datainfo->count >= (int)datainfo->idxnum)
return 1;
+ else
+ return SUCCEED;
} /* end obj_info_max */
/*
@@ -2621,70 +3570,64 @@ obj_info_max
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5export_1dataset
- (JNIEnv *env, jclass cls, jstring file_export_name, jstring file_name, jstring object_path, jint binary_order)
+ (JNIEnv *env, jclass clss, jstring file_export_name, jstring file_name, jstring object_path, jint binary_order)
{
- herr_t status = -1;
- herr_t ret_val = -1;
- hid_t file_id = -1;
- hid_t dataset_id = -1;
- FILE *stream;
- const char *file_export;
- const char *object_name;
- const char *fileName;
- jboolean isCopy2;
-
- if (file_export_name == NULL) {
- h5nullArgument(env, "HDF5Library_export_data: file_export_name is NULL");
- } /* end if */
- else if (object_path == NULL) {
- h5nullArgument(env, "HDF5Library_export_data: object_path is NULL");
- } /* end else if */
- else {
- PIN_JAVA_STRING(file_name, fileName);
- if (fileName != NULL) {
- file_id = H5Fopen(fileName, (unsigned)H5F_ACC_RDWR, (hid_t)H5P_DEFAULT);
-
- UNPIN_JAVA_STRING(file_name, fileName);
-
- if (file_id < 0) {
- /* throw exception */
- h5libraryError(env);
- } /* end if */
- else {
- object_name = ENVPTR->GetStringUTFChars(ENVPAR object_path, &isCopy2);
- if (object_name == NULL) {
- h5JNIFatalError( env, "H5Dopen: object name not pinned");
- } /* end if */
- else {
- dataset_id = H5Dopen2(file_id, object_name, H5P_DEFAULT);
+ const char *file_export = NULL;
+ const char *object_name = NULL;
+ const char *fileName = NULL;
+ jboolean isCopy;
+ herr_t ret_val = FAIL;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t dataset_id = H5I_INVALID_HID;
+ FILE *stream = NULL;
- ENVPTR->ReleaseStringUTFChars(ENVPAR object_path, object_name);
+ UNUSED(clss);
- if (dataset_id < 0) {
- H5Fclose(file_id);
- h5libraryError(env);
- } /* end if */
- else {
- file_export = ENVPTR->GetStringUTFChars(ENVPAR file_export_name, 0);
- stream = HDfopen(file_export, "w+");
- ENVPTR->ReleaseStringUTFChars(ENVPAR file_export_name, file_export);
+ if (NULL == file_export_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_export_name is NULL");
- ret_val = h5str_dump_simple_dset(stream, dataset_id, binary_order);
+ if (NULL == file_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_name is NULL");
- if (stream)
- HDfclose(stream);
+ if (NULL == object_path)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: object_path is NULL");
- H5Dclose(dataset_id);
+ PIN_JAVA_STRING(ENVONLY, file_name, fileName, NULL, "H5export_dataset: file name not pinned");
- H5Fclose(file_id);
+ if ((file_id = H5Fopen(fileName, (unsigned)H5F_ACC_RDWR, (hid_t)H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (ret_val < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
- }
- } /* end else */
+ PIN_JAVA_STRING(ENVONLY, object_path, object_name, &isCopy, "H5export_dataset: object_path not pinned");
+
+ if ((dataset_id = H5Dopen2(file_id, object_name, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ PIN_JAVA_STRING(ENVONLY, file_export_name, file_export, NULL, "H5export_dataset: file_export name not pinned");
+
+ if (NULL == (stream = HDfopen(file_export, "w+")))
+ H5_JNI_FATAL_ERROR(ENVONLY, "HDfopen failed");
+
+ if ((ret_val = h5str_dump_simple_dset(ENVONLY, stream, dataset_id, binary_order)) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_dset failed");
+
+ if (stream) {
+ HDfclose(stream);
+ stream = NULL;
+ }
+
+done:
+ if (stream)
+ HDfclose(stream);
+ if (file_export)
+ UNPIN_JAVA_STRING(ENVONLY, file_export_name, file_export);
+ if (object_name)
+ UNPIN_JAVA_STRING(ENVONLY, object_path, object_name);
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, file_name, fileName);
+ if (dataset_id >= 0)
+ H5Dclose(dataset_id);
+ if (file_id >= 0)
+ H5Fclose(file_id);
} /* end Java_hdf_hdf5lib_H5_H5export_1dataset */
#ifdef __cplusplus
diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h
index 434a107..51b6594 100644
--- a/java/src/jni/h5util.h
+++ b/java/src/jni/h5util.h
@@ -35,33 +35,30 @@ typedef struct h5str_t {
size_t max; /* the allocated size of the string */
} h5str_t;
-extern void h5str_new (h5str_t *str, size_t len);
-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_sprintf(h5str_t *str, hid_t container, hid_t tid, void *buf, int expand_data);
+extern void h5str_new(h5str_t *str, size_t len);
+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(FILE *stream, hid_t dset, int binary_order);
-extern int h5str_dump_region_blocks_data(h5str_t *str, hid_t region, hid_t region_obj);
-extern int h5str_dump_region_points_data(h5str_t *str, hid_t region, hid_t region_obj);
+extern int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order);
+extern int h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
+extern int h5str_dump_region_points_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5AwriteVL
- * Signature: (JJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AwriteVL
- (JNIEnv *, jclass, jlong, jlong, jobjectArray);
+extern htri_t H5Tdetect_variable_str(hid_t tid);
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5AreadVL
- * Signature: (JJ[Ljava/lang/String;)I
+ * Symbols used to format the output of h5str_sprintf and
+ * to interpret the input to h5str_convert.
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AreadVL
- (JNIEnv *, jclass, jlong, jlong, jobjectArray);
+#define H5_COMPOUND_BEGIN_INDICATOR "{"
+#define H5_COMPOUND_END_INDICATOR "}"
+#define H5_ARRAY_BEGIN_INDICATOR "["
+#define H5_ARRAY_END_INDICATOR "]"
+#define H5_VLEN_BEGIN_INDICATOR "("
+#define H5_VLEN_END_INDICATOR ")"
/*
* Class: hdf_hdf5lib_H5
@@ -99,7 +96,7 @@ Java_hdf_hdf5lib_H5_H5Dcopy
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full
- (JNIEnv*, jclass, jlong, jstring, jobjectArray, jintArray, jintArray, jlongArray, jlongArray, jint, jint, jint);
+ (JNIEnv*, jclass, jlong, jstring, jobjectArray, jintArray, jintArray, jlongArray, jobjectArray, jint, jint, jint);
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5vlImp.c b/java/src/jni/h5vlImp.c
new file mode 100644
index 0000000..1ead30b
--- /dev/null
+++ b/java/src/jni/h5vlImp.c
@@ -0,0 +1,289 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <jni.h>
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5vlImp.h"
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLregister_connector_by_name
+ * Signature: (Ljava/lang/String;J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name
+ (JNIEnv *env, jclass clss, jobject connector_name, jlong vipl_id)
+{
+ const char *volName = NULL;
+ hid_t status = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == connector_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLregister_connector_by_name: VOL connector name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLregister_connector_by_name: VOL connector name not pinned");
+
+ if ((status = H5VLregister_connector_by_name(volName, (hid_t)vipl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (volName)
+ UNPIN_JAVA_STRING(ENVONLY, connector_name, volName);
+
+ return (jlong)status;
+} /* end Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLregister_connector_by_value
+ * Signature: (IJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value
+ (JNIEnv *env, jclass clss, jint connector_value, jlong vipl_id)
+{
+ hid_t status = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((status = H5VLregister_connector_by_value((H5VL_class_value_t)connector_value, (hid_t)vipl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)status;
+} /* end Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLis_connector_registered_by_name
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name
+ (JNIEnv *env, jclass clss, jobject connector_name)
+{
+ const char *volName = NULL;
+ htri_t bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (NULL == connector_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLis_connector_registered_by_name: VOL connector name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLis_connector_registered_by_name: VOL connector name not pinned");
+
+ if ((bval = H5VLis_connector_registered_by_name(volName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (volName)
+ UNPIN_JAVA_STRING(ENVONLY, connector_name, volName);
+
+ return (jboolean)bval;
+} /* end Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLis_connector_registered_by_value
+ * Signature: (I)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value
+ (JNIEnv *env, jclass clss, jint connector_value)
+{
+ htri_t bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (connector_value < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5VLis_connector_registered_by_value: VOL connector value < 0");
+
+ if ((bval = H5VLis_connector_registered_by_value((H5VL_class_value_t)connector_value)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return (jboolean)bval;
+} /* end Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLget_connector_id
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1id
+ (JNIEnv *env, jclass clss, jlong obj_id)
+{
+ hid_t status = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((status = H5VLget_connector_id((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)status;
+} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1id */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLget_connector_id_by_name
+ * Signature: (Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name
+ (JNIEnv *env, jclass clss, jobject connector_name)
+{
+ const char *volName = NULL;
+ hid_t status = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == connector_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5VLget_connector_id_by_name: VOL connector name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLget_connector_id_by_name: VOL connector name not pinned");
+
+ if ((status = H5VLget_connector_id_by_name(volName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (volName)
+ UNPIN_JAVA_STRING(ENVONLY, connector_name, volName);
+
+ return (jlong)status;
+} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLget_connector_id_by_value
+ * Signature: (I)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value
+ (JNIEnv *env, jclass clss, jint connector_value)
+{
+ hid_t status = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (connector_value < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5VLget_connector_id_by_value: VOL connector value < 0");
+
+ if ((status = H5VLget_connector_id_by_value((H5VL_class_value_t)connector_value)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)status;
+} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLget_connector_name
+ * Signature: (J)Ljava/lang/String;
+ */
+
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1name
+ (JNIEnv *env, jclass clss, jlong object_id)
+{
+ ssize_t buf_size, status;
+ char *volName = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ /* Get the length of the comment */
+ if ((buf_size = H5VLget_connector_name((hid_t)object_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (buf_size > 0) {
+ if (NULL == (volName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5VLget_connector_name: failed to allocated VOL connector name buffer");
+
+ if ((status = H5VLget_connector_name((hid_t)object_id, volName, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ volName[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, volName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (volName)
+ HDfree(volName);
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5VLget_1connector_1name */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLclose
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5VLclose
+ (JNIEnv *env, jclass clss, jlong connector_id)
+{
+ herr_t retValue = FAIL;
+
+ UNUSED(clss);
+
+ if ((retValue = H5VLclose((hid_t)connector_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5VLclose */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLunregister_connector
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5VLunregister_1connector
+ (JNIEnv *env, jclass clss, jlong connector_id)
+{
+ herr_t retValue = FAIL;
+
+ UNUSED(clss);
+
+ if ((retValue = H5VLunregister_connector((hid_t)connector_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5VLunregister_1connector */
+
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5vlImp.h b/java/src/jni/h5vlImp.h
new file mode 100644
index 0000000..a58abef
--- /dev/null
+++ b/java/src/jni/h5vlImp.h
@@ -0,0 +1,118 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <jni.h>
+/* Header for class hdf_hdf5lib_H5_H5VL */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5VL
+#define _Included_hdf_hdf5lib_H5_H5VL
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLregister_connector_by_name
+ * Signature: (Ljava/lang/String;J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name
+ (JNIEnv *, jclass, jobject, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLregister_connector_by_value
+ * Signature: (IJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value
+ (JNIEnv *, jclass, jint, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLis_connector_registered_by_name
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1name
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLis_connector_registered_by_value
+ * Signature: (I)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered_1by_1value
+ (JNIEnv *, jclass, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLget_connector_id
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1id
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLget_connector_id_by_name
+ * Signature: (Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1name
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLget_connector_id_by_value
+ * Signature: (I)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1id_1by_1value
+ (JNIEnv *, jclass, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLget_connector_name
+ * Signature: (J)Ljava/lang/String;
+ */
+
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5VLget_1connector_1name
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLclose
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5VLclose
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5VLunregister_connector
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5VLunregister_1connector
+ (JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5VL */
diff --git a/java/src/jni/h5zImp.c b/java/src/jni/h5zImp.c
index a5e6cd8..a1c8517 100644
--- a/java/src/jni/h5zImp.c
+++ b/java/src/jni/h5zImp.c
@@ -36,12 +36,15 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Zunregister
(JNIEnv *env, jclass clss, jint filter)
{
- herr_t retValue = H5Zunregister((H5Z_filter_t)filter);
+ herr_t retVal = FAIL;
- if (retValue < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retValue;
+ if ((retVal = H5Zunregister((H5Z_filter_t)filter)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Zunregister */
/*
@@ -53,12 +56,15 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Zfilter_1avail
(JNIEnv *env, jclass clss, jint filter)
{
- herr_t retValue = H5Zfilter_avail((H5Z_filter_t)filter);
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- if (retValue < 0)
- h5libraryError(env);
+ if ((retVal = H5Zfilter_avail((H5Z_filter_t)filter)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jint)retValue;
+done:
+ return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Zfilter_1avail */
/*
@@ -73,9 +79,12 @@ Java_hdf_hdf5lib_H5_H5Zget_1filter_1info
{
unsigned int flags = 0;
- if (H5Zget_filter_info ((H5Z_filter_t) filter, (unsigned *) &flags) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5Zget_filter_info((H5Z_filter_t) filter, (unsigned *) &flags) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)flags;
} /* end Java_hdf_hdf5lib_H5_H5Zget_1filter_1info */
diff --git a/java/src/jni/nativeData.c b/java/src/jni/nativeData.c
index 33f4953..3c3d3d5 100644
--- a/java/src/jni/nativeData.c
+++ b/java/src/jni/nativeData.c
@@ -50,54 +50,49 @@ JNIEXPORT jintArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jbyte *barr;
- jintArray rarray = NULL;
- int blen;
- jint *iarray;
- jboolean bb;
- char *bp;
- jint *iap;
- int ii;
- int len;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToInt: bdata is NULL?");
- } /* end if */
- else {
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToInt: pin failed");
- } /* end if */
- else {
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
-
- len = blen/(int)sizeof(jint);
- rarray = ENVPTR->NewIntArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToInt" );
- return NULL;
- } /* end if */
-
- iarray = ENVPTR->GetIntArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToInt: pin iarray failed");
- return NULL;
- } /* end if */
-
- bp = (char *)barr;
- iap = iarray;
- for (ii = 0; ii < len; ii++) {
- *iap = *(jint *)bp;
- iap++;
- bp += sizeof(jint);
- } /* end for */
-
- ENVPTR->ReleaseIntArrayElements(ENVPAR rarray,iarray, 0);
- } /* end else */
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- } /* end else */
+ jintArray rarray = NULL;
+ jboolean bb;
+ jbyte *barr = NULL;
+ jint *iarray = NULL;
+ jint *iap = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+ int len;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToInt: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToInt: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToInt: bdata length < 0");
+ }
+
+ len = blen / (int)sizeof(jint);
+
+ if (NULL == (rarray = ENVPTR->NewIntArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_INT_ARRAY(ENVONLY, rarray, iarray, &bb, "byteToInt: int array not pinned");
+
+ bp = (char *)barr;
+ iap = iarray;
+ for (ii = 0; ii < len; ii++) {
+ *iap = *(jint *)bp;
+ iap++;
+ bp += sizeof(jint);
+ } /* end for */
+
+done:
+ if (iarray)
+ UNPIN_INT_ARRAY(ENVONLY, rarray, iarray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
+
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B */
@@ -106,40 +101,34 @@ JNIEXPORT jfloatArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jbyte *barr;
- jfloatArray rarray;
- int blen;
- jfloat *farray;
- jboolean bb;
- char *bp;
- jfloat *iap;
- int ii;
- int len;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToFloat: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToFloat: pin failed");
- return NULL;
- } /* end if */
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
-
- len = blen/(int)sizeof(jfloat);
- rarray = ENVPTR->NewFloatArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToFloat" );
- return NULL;
- } /* end if */
- farray = ENVPTR->GetFloatArrayElements(ENVPAR rarray,&bb);
- if (farray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToFloat: pin farray failed");
- return NULL;
- } /* end if */
+ jfloatArray rarray = NULL;
+ jboolean bb;
+ jfloat *farray = NULL;
+ jfloat *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+ int len;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToFloat: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToFloat: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: bdata length < 0");
+ }
+
+ len = blen / (int)sizeof(jfloat);
+
+ if (NULL == (rarray = ENVPTR->NewFloatArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_FLOAT_ARRAY(ENVONLY, rarray, farray, &bb, "byteToFloat: float array not pinned");
bp = (char *)barr;
iap = farray;
@@ -149,8 +138,11 @@ Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B
bp += sizeof(jfloat);
} /* end for */
- ENVPTR->ReleaseFloatArrayElements(ENVPAR rarray,farray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (farray)
+ UNPIN_FLOAT_ARRAY(ENVONLY, rarray, farray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B */
@@ -160,42 +152,34 @@ JNIEXPORT jshortArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jbyte *barr;
- jshortArray rarray;
- int blen;
- jshort *sarray;
- jboolean bb;
- char *bp;
- jshort *iap;
- int ii;
- int len;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToShort: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToShort: pin failed");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
-
- len = blen/(int)sizeof(jshort);
- rarray = ENVPTR->NewShortArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToShort" );
- return NULL;
- } /* end if */
-
- sarray = ENVPTR->GetShortArrayElements(ENVPAR rarray,&bb);
- if (sarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToShort: pin sarray failed");
- return NULL;
- } /* end if */
+ jshortArray rarray = NULL;
+ jboolean bb;
+ jshort *sarray = NULL;
+ jshort *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+ int len;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToShort: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToShort: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToShort: bdata length < 0");
+ }
+
+ len = blen / (int)sizeof(jshort);
+
+ if (NULL == (rarray = ENVPTR->NewShortArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_SHORT_ARRAY(ENVONLY, rarray, sarray, &bb, "byteToShort: short array not pinned");
bp = (char *)barr;
iap = sarray;
@@ -205,53 +189,48 @@ Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B
bp += sizeof(jshort);
} /* end for */
- ENVPTR->ReleaseShortArrayElements(ENVPAR rarray,sarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (sarray)
+ UNPIN_SHORT_ARRAY(ENVONLY, rarray, sarray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B */
-
/* returns long [] */
JNIEXPORT jlongArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jbyte *barr;
- jlongArray rarray;
- int blen;
- jlong *larray;
- jboolean bb;
- char *bp;
- jlong *iap;
- int ii;
- int len;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToLong: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToLong: pin failed");
- return NULL;
- } /* end if */
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
-
- len = blen/(int)sizeof(jlong);
- rarray = ENVPTR->NewLongArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToLong" );
- return NULL;
- } /* end if */
-
- larray = ENVPTR->GetLongArrayElements(ENVPAR rarray,&bb);
- if (larray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToLong: pin larray failed");
- return NULL;
- } /* end if */
+ jlongArray rarray = NULL;
+ jboolean bb;
+ jlong *larray = NULL;
+ jlong *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+ int len;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToLong: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToLong: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToLong: bdata length < 0");
+ }
+
+ len = blen / (int)sizeof(jlong);
+
+ if (NULL == (rarray = ENVPTR->NewLongArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_LONG_ARRAY(ENVONLY, rarray, larray, &bb, "byteToLong: long array not pinned");
bp = (char *)barr;
iap = larray;
@@ -260,53 +239,49 @@ Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B
iap++;
bp += sizeof(jlong);
} /* end for */
- ENVPTR->ReleaseLongArrayElements(ENVPAR rarray,larray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+
+done:
+ if (larray)
+ UNPIN_LONG_ARRAY(ENVONLY, rarray, larray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B */
-
/* returns double [] */
JNIEXPORT jdoubleArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jbyte *barr;
- jdoubleArray rarray;
- int blen;
- jdouble *darray;
- jboolean bb;
- char *bp;
- jdouble *iap;
- int ii;
- int len;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToDouble: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToDouble: pin failed");
- return NULL;
- } /* end if */
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
-
- len = blen/(int)sizeof(jdouble);
- rarray = ENVPTR->NewDoubleArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToDouble" );
- return NULL;
- } /* end if */
-
- darray = ENVPTR->GetDoubleArrayElements(ENVPAR rarray,&bb);
- if (darray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToDouble: pin darray failed");
- return NULL;
- } /* end if */
+ jdoubleArray rarray = NULL;
+ jboolean bb;
+ jdouble *darray = NULL;
+ jdouble *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+ int len;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToDouble: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToDouble: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToDouble: bdata length < 0");
+ }
+
+ len = blen / (int)sizeof(jdouble);
+
+ if (NULL == (rarray = ENVPTR->NewDoubleArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_DOUBLE_ARRAY(ENVONLY, rarray, darray, &bb, "byteToDouble: double array not pinned");
bp = (char *)barr;
iap = darray;
@@ -316,59 +291,50 @@ Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B
bp += sizeof(jdouble);
} /* end for */
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rarray,darray,0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (darray)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, rarray, darray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B */
-
/* returns int [] */
JNIEXPORT jintArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- char *bp;
- jbyte *barr;
- jintArray rarray;
- int blen;
- jint *iarray;
- jint *iap;
- int ii;
- jboolean bb;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToInt: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToInt: pin failed");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
- if ((start < 0) || ((int)(start + (len*(int)sizeof(jint))) > blen)) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToInt: getLen failed");
- return NULL;
- } /* end if */
+ jintArray rarray = NULL;
+ jboolean bb;
+ jint *iarray = NULL;
+ jint *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToInt: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToInt: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToInt: bdata length < 0");
+ }
+
+ if ((start < 0) || ((int)(start + (len * (int)sizeof(jint))) > blen))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToInt: start < 0 or len exceeded buffer length");
bp = (char *)barr + start;
- rarray = ENVPTR->NewIntArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToInt" );
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewIntArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- iarray = ENVPTR->GetIntArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToInt: pin iarray failed");
- return NULL;
- } /* end if */
+ PIN_INT_ARRAY(ENVONLY, rarray, iarray, &bb, "byteToInt: int array not pinned");
iap = iarray;
for (ii = 0; ii < len; ii++) {
@@ -377,8 +343,11 @@ Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B
bp += sizeof(jint);
} /* end for */
- ENVPTR->ReleaseIntArrayElements(ENVPAR rarray,iarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (iarray)
+ UNPIN_INT_ARRAY(ENVONLY, rarray, iarray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B */
@@ -388,57 +357,49 @@ JNIEXPORT jshortArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- char *bp;
- jbyte *barr;
- jshortArray rarray;
- int blen;
- jshort *iarray;
- jshort *iap;
- int ii;
- jboolean bb;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToShort: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError( env, "byteToShort: getByte failed?");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
- if ((start < 0) || ((int)(start + (len*(int)sizeof(jshort))) > blen)) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5badArgument( env, "byteToShort: start or len is out of bounds");
- return NULL;
- } /* end if */
+ jshortArray rarray = NULL;
+ jboolean bb;
+ jshort *sarray = NULL;
+ jshort *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToShort: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToShort: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToShort: bdata length < 0");
+ }
+
+ if ((start < 0) || ((int)(start + (len * (int)sizeof(jshort))) > blen))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToShort: start < 0 or len exceeded buffer length");
bp = (char *)barr + start;
- rarray = ENVPTR->NewShortArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToShort" );
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewShortArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- iarray = ENVPTR->GetShortArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError( env, "byteToShort: getShort failed?");
- return NULL;
- } /* end if */
+ PIN_SHORT_ARRAY(ENVONLY, rarray, sarray, &bb, "byteToShort: short array not pinned");
- iap = iarray;
+ iap = sarray;
for (ii = 0; ii < len; ii++) {
*iap = *(jshort *)bp;
iap++;
bp += sizeof(jshort);
} /* end for */
- ENVPTR->ReleaseShortArrayElements(ENVPAR rarray,iarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (sarray)
+ UNPIN_SHORT_ARRAY(ENVONLY, rarray, sarray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B */
@@ -448,57 +409,49 @@ JNIEXPORT jfloatArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- char *bp;
- jbyte *barr;
- jfloatArray rarray;
- int blen;
- jfloat *iarray;
- jfloat *iap;
- int ii;
- jboolean bb;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToFloat: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError( env, "byteToFloat: getByte failed?");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
- if ((start < 0) || ((int)(start + (len*(int)sizeof(jfloat))) > blen)) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5badArgument( env, "byteToFloat: start or len is out of bounds");
- return NULL;
- } /* end if */
+ jfloatArray rarray = NULL;
+ jboolean bb;
+ jfloat *farray = NULL;
+ jfloat *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToFloat: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToFloat: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: bdata length < 0");
+ }
+
+ if ((start < 0) || ((int)(start + (len * (int)sizeof(jfloat))) > blen))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: start < 0 or len exceeded buffer length");
bp = (char *)barr + start;
- rarray = ENVPTR->NewFloatArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToFloat" );
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewFloatArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- iarray = ENVPTR->GetFloatArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError( env, "byteToFloat: getFloat failed?");
- return NULL;
- } /* end if */
+ PIN_FLOAT_ARRAY(ENVONLY, rarray, farray, &bb, "byteToFloat: float array not pinned");
- iap = iarray;
+ iap = farray;
for (ii = 0; ii < len; ii++) {
*iap = *(jfloat *)bp;
iap++;
bp += sizeof(jfloat);
} /* end for */
- ENVPTR->ReleaseFloatArrayElements(ENVPAR rarray,iarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (farray)
+ UNPIN_FLOAT_ARRAY(ENVONLY, rarray, farray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B */
@@ -508,58 +461,49 @@ JNIEXPORT jlongArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- char *bp;
- jbyte *barr;
- jlongArray rarray;
- int blen;
- jlong *iarray;
- jlong *iap;
- int ii;
- jboolean bb;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToLong: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError( env, "byteToLong: getByte failed?");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
- if ((start < 0) || ((int)(start + (len*(int)sizeof(jlong))) > blen)) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5badArgument( env, "byteToLong: start or len is out of bounds");
- return NULL;
- } /* end if */
+ jlongArray rarray = NULL;
+ jboolean bb;
+ jlong *larray = NULL;
+ jlong *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToLong: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToLong: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToLong: bdata length < 0");
+ }
+
+ if ((start < 0) || ((int)(start + (len * (int)sizeof(jlong))) > blen))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToLong: start < 0 or len exceeded buffer length");
bp = (char *)barr + start;
- rarray = ENVPTR->NewLongArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToLong" );
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewLongArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- iarray = ENVPTR->GetLongArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError( env, "byteToLong: getLong failed?");
- return NULL;
- } /* end if */
+ PIN_LONG_ARRAY(ENVONLY, rarray, larray, &bb, "byteToLong: long array not pinned");
- iap = iarray;
+ iap = larray;
for (ii = 0; ii < len; ii++) {
-
*iap = *(jlong *)bp;
iap++;
bp += sizeof(jlong);
} /* end for */
- ENVPTR->ReleaseLongArrayElements(ENVPAR rarray,iarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (larray)
+ UNPIN_LONG_ARRAY(ENVONLY, rarray, larray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B */
@@ -569,57 +513,49 @@ JNIEXPORT jdoubleArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- char *bp;
- jbyte *barr;
- jdoubleArray rarray;
- int blen;
- jdouble *iarray;
- jdouble *iap;
- int ii;
- jboolean bb;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToDouble: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError( env, "byteToDouble: getByte failed?");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
- if ((start < 0) || ((int)(start + (len*(int)sizeof(jdouble))) > blen)) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5badArgument( env, "byteToDouble: start or len is out of bounds");
- return NULL;
- } /* end if */
+ jdoubleArray rarray = NULL;
+ jboolean bb;
+ jdouble *darray = NULL;
+ jdouble *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToDouble: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToDouble: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToDouble: bdata length < 0");
+ }
+
+ if ((start < 0) || ((int)(start + (len * (int)sizeof(jdouble))) > blen))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToDouble: start < 0 or len exceeded buffer length");
bp = (char *)barr + start;
- rarray = ENVPTR->NewDoubleArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToDouble" );
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewDoubleArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- iarray = ENVPTR->GetDoubleArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError( env, "byteToDouble: getDouble failed?");
- return NULL;
- } /* end if */
+ PIN_DOUBLE_ARRAY(ENVONLY, rarray, darray, &bb, "byteToDouble: double array not pinned");
- iap = iarray;
+ iap = darray;
for (ii = 0; ii < len; ii++) {
*iap = *(jdouble *)bp;
iap++;
bp += sizeof(jdouble);
} /* end for */
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rarray,iarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (darray)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, rarray, darray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B */
@@ -629,67 +565,59 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I
(JNIEnv *env, jclass clss, jint start, jint len, jintArray idata) /* IN: array of int */
{
- jint *ip;
- jint *iarr;
- int ilen;
- jbyteArray rarray;
- int blen;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ii;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ jint *ip = NULL;
+ jint *iarr = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
int ival;
char bytes[4];
} u;
- if (idata == NULL) {
- h5nullArgument( env, "intToByte: idata is NULL?");
- return NULL;
- } /* end if */
+ UNUSED(clss);
+
+ if (NULL == idata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "intToByte: int array is NULL");
- iarr = ENVPTR->GetIntArrayElements(ENVPAR idata,&bb);
- if (iarr == NULL) {
- h5JNIFatalError( env, "intToByte: getInt failed?");
- return NULL;
- } /* end if */
+ PIN_INT_ARRAY(ENVONLY, idata, iarr, &bb, "intToByte: int array not pinned");
- ilen = ENVPTR->GetArrayLength(ENVPAR idata);
- if ((start < 0) || (((start + len)) > ilen)) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5badArgument( env, "intToByte: start or len is out of bounds");
- return NULL;
- } /* end if */
+ if ((ilen = ENVPTR->GetArrayLength(ENVONLY, idata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "intToByte: idata length < 0");
+ }
+
+ if ((start < 0) || (((start + len)) > ilen))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "intToByte: start < 0 or len exceeded buffer length");
ip = iarr + start;
blen = ilen * (int)sizeof(jint);
- rarray = ENVPTR->NewByteArray(ENVPAR blen);
- if (rarray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5outOfMemory( env, "intToByte" );
- return NULL;
- } /* end if */
-
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5JNIFatalError( env, "intToByte: getByte failed?");
- return NULL;
- } /* end if */
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, blen)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "intToByte: byte array not pinned");
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; ij < sizeof(jint); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jint); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, rarray ? 0 : JNI_ABORT);
+ if (iarr)
+ UNPIN_INT_ARRAY(ENVONLY, idata, iarr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I */
@@ -697,68 +625,61 @@ Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S
- (JNIEnv *env, jclass clss, jint start, jint len, jshortArray idata) /* IN: array of short */
+ (JNIEnv *env, jclass clss, jint start, jint len, jshortArray sdata) /* IN: array of short */
{
- jshort *ip;
- jshort *iarr;
- int ilen;
- jbyteArray rarray;
- int blen;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ii;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jshort *ip = NULL;
+ jshort *sarr = NULL;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
short ival;
char bytes[4];
} u;
- if (idata == NULL) {
- h5nullArgument( env, "shortToByte: idata is NULL?");
- return NULL;
- } /* end if */
- iarr = ENVPTR->GetShortArrayElements(ENVPAR idata,&bb);
- if (iarr == NULL) {
- h5JNIFatalError( env, "shortToByte: getShort failed?");
- return NULL;
- } /* end if */
-
- ilen = ENVPTR->GetArrayLength(ENVPAR idata);
- if ((start < 0) || (((start + len)) > ilen)) {
- ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5badArgument( env, "shortToByte: start or len is out of bounds");
- return NULL;
- } /* end if */
+ UNUSED(clss);
- ip = iarr + start;
+ if (NULL == sdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "shortToByte: short array is NULL");
+
+ PIN_SHORT_ARRAY(ENVONLY, sdata, sarr, &bb, "shortToByte: short array not pinned");
+
+ if ((ilen = ENVPTR->GetArrayLength(ENVONLY, sdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "shortToByte: sdata length < 0");
+ }
+
+ if ((start < 0) || (((start + len)) > ilen))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "shortToByte: start < 0 or len exceeded buffer length");
+
+ ip = sarr + start;
blen = ilen * (int)sizeof(jshort);
- rarray = ENVPTR->NewByteArray(ENVPAR blen);
- if (rarray == NULL) {
- ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5outOfMemory( env, "shortToByte" );
- return NULL;
- } /* end if */
-
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5JNIFatalError( env, "shortToByte: getByte failed?");
- return NULL;
- } /* end if */
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, blen)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "shortToByte: byte array not pinned");
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; ij < sizeof(jshort); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jshort); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
- ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, rarray ? 0 : JNI_ABORT);
+ if (sarr)
+ UNPIN_SHORT_ARRAY(ENVONLY, sdata, sarr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S */
@@ -766,68 +687,61 @@ Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F
- (JNIEnv *env, jclass clss, jint start, jint len, jfloatArray idata) /* IN: array of float */
+ (JNIEnv *env, jclass clss, jint start, jint len, jfloatArray fdata) /* IN: array of float */
{
- jfloat *ip;
- jfloat *iarr;
- int ilen;
- jbyteArray rarray;
- int blen;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ii;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jfloat *ip = NULL;
+ jfloat *farr = NULL;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
float ival;
char bytes[4];
} u;
- if (idata == NULL) {
- h5nullArgument( env, "floatToByte: idata is NULL?");
- return NULL;
- } /* end if */
- iarr = ENVPTR->GetFloatArrayElements(ENVPAR idata,&bb);
- if (iarr == NULL) {
- h5JNIFatalError( env, "floatToByte: getFloat failed?");
- return NULL;
- } /* end if */
-
- ilen = ENVPTR->GetArrayLength(ENVPAR idata);
- if ((start < 0) || (((start + len)) > ilen)) {
- ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5badArgument( env, "floatToByte: start or len is out of bounds");
- return NULL;
- } /* end if */
+ UNUSED(clss);
- ip = iarr + start;
+ if (NULL == fdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "floatToByte: float array is NULL");
+
+ PIN_FLOAT_ARRAY(ENVONLY, fdata, farr, &bb, "floatToByte: float array not pinned");
+
+ if ((ilen = ENVPTR->GetArrayLength(ENVONLY, fdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "floatToByte: fdata length < 0");
+ }
+
+ if ((start < 0) || (((start + len)) > ilen))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "floatToByte: start < 0 or len exceeded buffer length");
+
+ ip = farr + start;
blen = ilen * (int)sizeof(jfloat);
- rarray = ENVPTR->NewByteArray(ENVPAR blen);
- if (rarray == NULL) {
- ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5outOfMemory( env, "floatToByte" );
- return NULL;
- } /* end if */
-
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5JNIFatalError( env, "floatToByte: getByte failed?");
- return NULL;
- } /* end if */
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, blen)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "floatToByte: byte array not pinned");
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; ij < sizeof(jfloat); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jfloat); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
- ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, rarray ? 0 : JNI_ABORT);
+ if (farr)
+ UNPIN_FLOAT_ARRAY(ENVONLY, fdata, farr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F */
@@ -835,178 +749,159 @@ Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D
- (JNIEnv *env, jclass clss, jint start, jint len, jdoubleArray idata) /* IN: array of double */
+ (JNIEnv *env, jclass clss, jint start, jint len, jdoubleArray ddata) /* IN: array of double */
{
- jdouble *ip;
- jdouble *iarr;
- int ilen;
- jbyteArray rarray;
- int blen;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ii;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jdouble *ip = NULL;
+ jdouble *darr = NULL;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
double ival;
char bytes[8];
} u;
- if (idata == NULL) {
- h5nullArgument( env, "doubleToByte: idata is NULL?");
- return NULL;
- } /* end if */
- iarr = ENVPTR->GetDoubleArrayElements(ENVPAR idata,&bb);
- if (iarr == NULL) {
- h5JNIFatalError( env, "doubleToByte: getDouble failed?");
- return NULL;
- } /* end if */
-
- ilen = ENVPTR->GetArrayLength(ENVPAR idata);
- if ((start < 0) || (((start + len)) > ilen)) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5badArgument( env, "doubleToByte: start or len is out of bounds");
- return NULL;
- } /* end if */
+ UNUSED(clss);
- ip = iarr + start;
+ if (NULL == ddata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "doubleToByte: double array is NULL");
+
+ PIN_DOUBLE_ARRAY(ENVONLY, ddata, darr, &bb, "doubleToByte: double array not pinned");
+
+ if ((ilen = ENVPTR->GetArrayLength(ENVONLY, ddata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "doubleToByte: ddata length < 0");
+ }
+
+ if ((start < 0) || (((start + len)) > ilen))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "doubleToByte: start < 0 or len exceeded buffer length");
+
+ ip = darr + start;
blen = ilen * (int)sizeof(jdouble);
- rarray = ENVPTR->NewByteArray(ENVPAR blen);
- if (rarray == NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5outOfMemory( env, "doubleToByte" );
- return NULL;
- } /* end if */
-
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5JNIFatalError( env, "doubleToByte: getByte failed?");
- return NULL;
- } /* end if */
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, blen)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "doubleToByte: byte array not pinned");
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; ij < sizeof(jdouble); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jdouble); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, rarray ? 0 : JNI_ABORT);
+ if (darr)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, ddata, darr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D */
-
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J
- (JNIEnv *env, jclass clss, jint start, jint len, jlongArray idata) /* IN: array of long */
+ (JNIEnv *env, jclass clss, jint start, jint len, jlongArray ldata) /* IN: array of long */
{
- jlong *ip;
- jlong *iarr;
- int ilen;
- jbyteArray rarray;
- int blen;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ii;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jlong *ip = NULL;
+ jlong *larr = NULL;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
jlong ival;
char bytes[8];
} u;
- if (idata == NULL) {
- h5nullArgument( env, "longToByte: idata is NULL?");
- return NULL;
- } /* end if */
- iarr = ENVPTR->GetLongArrayElements(ENVPAR idata,&bb);
- if (iarr == NULL) {
- h5JNIFatalError( env, "longToByte: getLong failed?");
- return NULL;
- } /* end if */
-
- ilen = ENVPTR->GetArrayLength(ENVPAR idata);
- if ((start < 0) || (((start + len)) > ilen)) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5badArgument( env, "longToByte: start or len is out of bounds?\n");
- return NULL;
- } /* end if */
+ UNUSED(clss);
- ip = iarr + start;
+ if (NULL == ldata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "longToByte: long array is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, ldata, larr, &bb, "longToByte: long array not pinned");
+
+ if ((ilen = ENVPTR->GetArrayLength(ENVONLY, ldata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "longToByte: ldata length < 0");
+ }
+
+ if ((start < 0) || (((start + len)) > ilen))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "longToByte: start < 0 or len exceeded buffer length");
+
+ ip = larr + start;
blen = ilen * (int)sizeof(jlong);
- rarray = ENVPTR->NewByteArray(ENVPAR blen);
- if (rarray == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5outOfMemory( env, "longToByte" );
- return NULL;
- } /* end if */
-
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5JNIFatalError( env, "longToByte: getByte failed?");
- return NULL;
- } /* end if */
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, blen)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "longToByte: byte array not pinned");
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; ij < sizeof(jlong); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jlong); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, rarray ? 0 : JNI_ABORT);
+ if (larr)
+ UNPIN_LONG_ARRAY(ENVONLY, ldata, larr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J */
-
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_intToByte__I
(JNIEnv *env, jclass clss, jint idata) /* IN: int */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- int ij;
- jboolean bb;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
int ival;
char bytes[sizeof(int)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jint));
- if (rarray == NULL) {
- h5outOfMemory( env, "intToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jint))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "intToByte: getByte failed?");
- return NULL;
- } /* end if */
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "intToByte: byte array not pinned");
bap = barray;
u.ival = idata;
- for (ij = 0; ij < sizeof(jint); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jint); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_intToByte__I */
@@ -1014,38 +909,35 @@ Java_hdf_hdf5lib_HDFNativeData_intToByte__I
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_floatToByte__F
- (JNIEnv *env, jclass clss, jfloat idata) /* IN: int */
+ (JNIEnv *env, jclass clss, jfloat fdata) /* IN: float */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
float ival;
char bytes[sizeof(float)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jfloat));
- if (rarray == NULL) {
- h5outOfMemory( env, "floatToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "floatToByte: getByte failed?");
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jfloat))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "floatToByte: byte array not pinned");
bap = barray;
- u.ival = idata;
- for (ij = 0; ij < sizeof(jfloat); ij++) {
+ u.ival = fdata;
+ for (ij = 0; (size_t) ij < sizeof(jfloat); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_floatToByte__F */
@@ -1053,118 +945,107 @@ Java_hdf_hdf5lib_HDFNativeData_floatToByte__F
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_shortToByte__S
- (JNIEnv *env, jclass clss, jshort idata) /* IN: short */
+ (JNIEnv *env, jclass clss, jshort sdata) /* IN: short */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
short ival;
char bytes[sizeof(short)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jshort));
- if (rarray == NULL) {
- h5outOfMemory( env, "shortToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "shortToByte: getShort failed?");
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jshort))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "shortToByte: byte array not pinned");
bap = barray;
- u.ival = idata;
- for (ij = 0; ij < sizeof(jshort); ij++) {
+ u.ival = sdata;
+ for (ij = 0; (size_t) ij < sizeof(jshort); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_shortToByte__S */
-
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D
- (JNIEnv *env, jclass clss, jdouble idata) /* IN: double */
+ (JNIEnv *env, jclass clss, jdouble ddata) /* IN: double */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
double ival;
char bytes[sizeof(double)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jdouble));
- if (rarray == NULL) {
- h5outOfMemory( env, "doubleToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jdouble))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "doubleToByte: getDouble failed?");
- return NULL;
- } /* end if */
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "doubleToByte: byte array not pinned");
bap = barray;
- u.ival = idata;
- for (ij = 0; ij < sizeof(jdouble); ij++) {
+ u.ival = ddata;
+ for (ij = 0; (size_t) ij < sizeof(jdouble); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D */
-
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_longToByte__J
- (JNIEnv *env, jclass clss, jlong idata) /* IN: array of long */
+ (JNIEnv *env, jclass clss, jlong ldata) /* IN: long */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
jlong ival;
char bytes[sizeof(jlong)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jlong));
- if (rarray == NULL) {
- h5outOfMemory( env, "longToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "longToByte: getLong failed?");
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jlong))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "longToByte: byte array not pinned");
bap = barray;
- u.ival = idata;
- for (ij = 0; ij < sizeof(jlong); ij++) {
+ u.ival = ldata;
+ for (ij = 0; (size_t) ij < sizeof(jlong); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_longToByte__J */
@@ -1172,38 +1053,35 @@ Java_hdf_hdf5lib_HDFNativeData_longToByte__J
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToByte__B
- (JNIEnv *env, jclass clss, jbyte idata) /* IN: array of long */
+ (JNIEnv *env, jclass clss, jbyte bdata) /* IN: byte */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ij;
+ jbyteArray rarray = NULL;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
jbyte ival;
char bytes[sizeof(jbyte)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jbyte));
- if (rarray == NULL) {
- h5outOfMemory( env, "byteToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "byteToByte: getByte failed?");
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jbyte))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "byteToByte: byte array not pinned");
bap = barray;
- u.ival = idata;
- for (ij = 0; ij < sizeof(jbyte); ij++) {
+ u.ival = bdata;
+ for (ij = 0; (size_t) ij < sizeof(jbyte); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToByte__B */
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt
index 8912b3f..b97ad26 100644
--- a/java/test/CMakeLists.txt
+++ b/java/test/CMakeLists.txt
@@ -1,128 +1,224 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_JAVA_TEST Java)
+cmake_minimum_required (VERSION 3.12)
+project (HDF5_JAVA_TEST Java)
set (CMAKE_VERBOSE_MAKEFILE 1)
-INCLUDE_DIRECTORIES (
- ${HDF5_JAVA_JNI_BINARY_DIR}
- ${HDF5_JAVA_HDF5_LIB_DIR}
-)
+set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${HDF5_JAVA_JNI_BINARY_DIR};${HDF5_JAVA_HDF5_LIB_DIR}")
set (HDF5_JAVA_TEST_SOURCES
- TestH5.java
- TestH5E.java
- TestH5Edefault.java
- TestH5Eregister.java
- TestH5Fparams.java
- TestH5Fbasic.java
- TestH5F.java
- TestH5Fswmr.java
- TestH5Gbasic.java
- TestH5G.java
- TestH5Giterate.java
- TestH5Sbasic.java
- TestH5S.java
- TestH5Tparams.java
- TestH5Tbasic.java
- TestH5T.java
- TestH5Dparams.java
- TestH5D.java
- TestH5Dplist.java
- TestH5Lparams.java
- TestH5Lbasic.java
- TestH5Lcreate.java
- TestH5R.java
- TestH5P.java
- TestH5PData.java
- TestH5Pfapl.java
- TestH5Pvirtual.java
- TestH5Plist.java
- TestH5A.java
- TestH5Oparams.java
- TestH5Obasic.java
- TestH5Ocreate.java
- TestH5Ocopy.java
- TestH5PL.java
- TestH5Z.java
- TestAll.java
+ TestH5
+ TestH5Eparams
+ TestH5Eregister
+ TestH5Fparams
+ TestH5Fbasic
+ TestH5F
+ TestH5Fswmr
+ TestH5Gbasic
+ TestH5G
+ TestH5Sbasic
+ TestH5S
+ TestH5Tparams
+ TestH5Tbasic
+ TestH5T
+ TestH5Dparams
+ TestH5D
+ TestH5Dplist
+ TestH5Lparams
+ TestH5Lbasic
+ TestH5Lcreate
+ TestH5R
+ TestH5P
+ TestH5PData
+ TestH5Pfapl
+ TestH5Pvirtual
+ TestH5Plist
+ TestH5A
+ TestH5Oparams
+ TestH5Obasic
+ TestH5Ocreate
+ TestH5Ocopy
+ TestH5PL
+ TestH5VL
+ TestH5Z
)
-file (WRITE ${PROJECT_BINARY_DIR}/Manifest.txt
-"Main-Class: test.TestAll
-"
-)
+if (NOT HDF5_ENABLE_DEBUG_APIS)
+ set (HDF5_JAVA_TEST_SOURCES
+ ${HDF5_JAVA_TEST_SOURCES}
+ TestH5E
+ TestH5Edefault
+ TestH5Giterate
+ )
+endif ()
+
+if (HDF5_ENABLE_ROS3_VFD)
+ set (HDF5_JAVA_TEST_SOURCES
+ ${HDF5_JAVA_TEST_SOURCES}
+ TestH5Pfapls3
+ )
+endif ()
+
+if (HDF5_ENABLE_HDFS)
+ set (HDF5_JAVA_TEST_SOURCES
+ ${HDF5_JAVA_TEST_SOURCES}
+ TestH5Pfaplhdfs
+ )
+endif ()
set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_LIB_DIR}/junit.jar;${HDF5_JAVA_LIB_DIR}/hamcrest-core.jar;${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_SIMPLE_JAR}")
-add_jar (${HDF5_JAVA_TEST_LIB_TARGET} MANIFEST ${PROJECT_BINARY_DIR}/Manifest.txt ${HDF5_JAVA_TEST_SOURCES})
+foreach (test_file ${HDF5_JAVA_TEST_SOURCES})
-get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE ${HDF5_JAVA_TEST_LIB_TARGET} JAR_FILE)
-#install_jar (${HDF5_JAVA_TEST_LIB_TARGET} ${HJAVA_INSTALL_DATA_DIR}/tests tests)
-#get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_CLASSPATH ${HDF5_JAVA_TEST_LIB_TARGET} CLASSDIR)
+ file (WRITE ${PROJECT_BINARY_DIR}/${test_file}Manifest.txt
+ "Main-Class: test.${test_file}
+"
+ )
-add_dependencies (${HDF5_JAVA_TEST_LIB_TARGET} ${HDF5_JAVA_HDF5_LIB_TARGET})
-set_target_properties (${HDF5_JAVA_TEST_LIB_TARGET} PROPERTIES FOLDER test/java)
+ add_jar (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} MANIFEST ${PROJECT_BINARY_DIR}/${test_file}Manifest.txt ${test_file}.java)
-set (HDF_JAVA_TEST_FILES
- JUnit-interface.txt
- JUnit-interface.ert
-)
+ get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file}_JAR_FILE ${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} JAR_FILE)
+ #install_jar (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} ${HJAVA_INSTALL_DATA_DIR}/tests tests)
+ #get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file}_CLASSPATH ${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} CLASSDIR)
-foreach (h5_file ${HDF_JAVA_TEST_FILES})
- HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+ add_dependencies (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} ${HDF5_JAVA_HDF5_LIB_TARGET})
+ set_target_properties (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} PROPERTIES FOLDER test/java)
+endforeach ()
+
+foreach (h5_file ${HDF5_JAVA_TEST_SOURCES})
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/JUnit-${h5_file}.txt" "${PROJECT_BINARY_DIR}/JUnit-${h5_file}.txt" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
endforeach ()
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterate.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateL1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+
add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_files_list})
-if (WIN32)
+if (WIN32 OR MINGW)
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
else ()
set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
endif ()
-set (CMAKE_JAVA_CLASSPATH ".")
-foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH})
- set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}")
-endforeach ()
-set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE}")
-set (testfilter "OK (598 tests)")
-
-if (CMAKE_BUILD_TYPE MATCHES Debug)
- if (WIN32)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
- else ()
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME)
+set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>;")
+
+if (HDF5_TEST_JAVA AND HDF5_TEST_SERIAL)
+ foreach (test_file ${HDF5_JAVA_TEST_SOURCES})
+ set (CMAKE_JAVA_CLASSPATH ".")
+ foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH})
+ set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}")
+ endforeach ()
+ set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_${test_file}_JAR_FILE}")
+
+ add_test (
+ NAME JUnit-${test_file}-clearall-objects
+ COMMAND ${CMAKE_COMMAND} -E remove
+ JUnit-${test_file}.out
+ JUnit-${test_file}.out.err
+ )
+ add_test (
+ NAME JUnit-${test_file}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
+ -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}"
+ -D "TEST_ARGS:STRING=${CMD_ARGS}-ea;org.junit.runner.JUnitCore"
+ -D "TEST_PROGRAM=test.${test_file}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
+ -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test"
+ -D "TEST_OUTPUT=JUnit-${test_file}.out"
+# -D "TEST_LOG_LEVEL=trace"
+ -D "TEST_EXPECT=0"
+ -D "SKIP_APPEND=1"
+ -D "TEST_MASK_ERROR=TRUE"
+# -D "TEST_FILTER:STRING=${testfilter}"
+ -D "TEST_REFERENCE=JUnit-${test_file}.txt"
+ -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
+ )
+ set_tests_properties (JUnit-${test_file} PROPERTIES
+ ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2"
+ DEPENDS "JUnit-${test_file}-clearall-objects"
+ )
+ endforeach ()
+
+
+ ##############################################################################
+ ##############################################################################
+ ### V O L T E S T S ###
+ ##############################################################################
+ ##############################################################################
+
+ macro (DO_VOL_TEST voltest volname volinfo volclasspath)
+ #message(STATUS "${voltest}-${volname} with ${volinfo}")
+ add_test (
+ NAME JUnit-VOL-${volname}-${voltest}-clearall-objects
+ COMMAND ${CMAKE_COMMAND} -E remove
+ JUnit-VOL-${volname}-${voltest}.out
+ JUnit-VOL-${volname}-${voltest}.out.err
+ WORKING_DIRECTORY ${HDF5_BINARY_DIR}/java/test/${volname}
+ )
+ add_test (NAME JUnit-VOL-${volname}-${voltest}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
+ -D "TEST_CLASSPATH:STRING=${volclasspath}"
+ -D "TEST_ARGS:STRING=${CMD_ARGS}-ea;org.junit.runner.JUnitCore"
+ -D "TEST_PROGRAM=test.${voltest}"
+ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
+ -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test/${volname}"
+ -D "TEST_VOL:STRING=${volinfo}"
+ -D "TEST_OUTPUT=JUnit-VOL-${volname}-${voltest}.out"
+# -D "TEST_LOG_LEVEL=trace"
+ -D "TEST_EXPECT=0"
+ -D "SKIP_APPEND=1"
+ -D "TEST_MASK_ERROR=TRUE"
+# -D "TEST_FILTER:STRING=${testfilter}"
+ -D "TEST_REFERENCE=JUnit-${volname}-${voltest}.txt"
+ -P "${HDF_RESOURCES_DIR}/jvolTest.cmake"
+ )
+ set_tests_properties (JUnit-VOL-${volname}-${voltest} PROPERTIES
+ ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2"
+ DEPENDS "JUnit-VOL-${volname}-${voltest}-clearall-objects"
+ WORKING_DIRECTORY ${HDF5_BINARY_DIR}/java/test/${volname}
+ )
+ endmacro ()
+
+ if (HDF5_TEST_PASSTHROUGH_VOL)
+ set (VOL_LIST
+ vol_native
+ vol_pass_through1
+ vol_pass_through2
+ )
+
+ set (vol_native native)
+ set (vol_pass_through1 "pass_through under_vol=0\;under_info={}")
+ set (vol_pass_through2 "pass_through under_vol=505\;under_info={under_vol=0\;under_info={}}")
+
+ foreach (voltest ${VOL_LIST})
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${voltest}")
+ foreach (h5_file ${HDF5_JAVA_TEST_SOURCES})
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/JUnit-${h5_file}.txt" "${PROJECT_BINARY_DIR}/${voltest}/JUnit-${h5_file}.txt" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
+ endforeach ()
+
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterate.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateL1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/${voltest}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files")
+
+ add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_${voltest}_files_list})
+
+ foreach (volinfo IN LISTS ${voltest})
+ foreach (h5_file ${HDF5_JAVA_TEST_SOURCES})
+ set (CMAKE_JAVA_CLASSPATH ".")
+ foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH})
+ set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}")
+ endforeach ()
+ set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_${h5_file}_JAR_FILE}")
+ DO_VOL_TEST (${h5_file} ${voltest} "${volinfo}" ${CMAKE_JAVA_CLASSPATH})
+ endforeach ()
+ endforeach ()
+ endforeach ()
endif ()
endif ()
-
-add_test (
- NAME JUnit-interface-clearall-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- JUnit-interface.out
- JUnit-interface.out.err
-)
-
-add_test (
- NAME JUnit-interface
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
- -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}"
- -D "TEST_ARGS:STRING=${CMD_ARGS}-ea;org.junit.runner.JUnitCore"
- -D "TEST_PROGRAM=test.TestAll"
- -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
- -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test"
- -D "TEST_OUTPUT=JUnit-interface.out"
-# -D "TEST_LOG_LEVEL=trace"
- -D "TEST_EXPECT=0"
- -D "SKIP_APPEND=1"
- -D "TEST_MASK_ERROR=TRUE"
- -D "TEST_FILTER:STRING=${testfilter}"
- -D "TEST_REFERENCE=JUnit-interface.txt"
- -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
-)
-set_tests_properties (JUnit-interface PROPERTIES
- ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2"
- DEPENDS "JUnit-interface-clearall-objects"
-)
diff --git a/java/test/JUnit-interface.ert b/java/test/JUnit-interface.ert
deleted file mode 100644
index 5771a4f..0000000
--- a/java/test/JUnit-interface.ert
+++ /dev/null
@@ -1,2 +0,0 @@
-[main] INFO hdf.hdf5lib.H5 - HDF5 library: hdf5_java
-[main] INFO hdf.hdf5lib.H5 - successfully loaded from java.library.path
diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt
deleted file mode 100644
index ab2f3b1..0000000
--- a/java/test/JUnit-interface.txt
+++ /dev/null
@@ -1,664 +0,0 @@
-JUnit version 4.11
-.testJ2C
-.testIsSerializable
-.testH5garbage_collect
-.testH5error_off
-.serializeToDisk
-.testH5open
-.testH5check_version
-.testH5get_libversion
-.testH5set_free_list_limits
-.testH5Eregister_class_lib_name_null
-.testH5Eregister_class_version_null
-.testH5Eunregister_class_invalid_classid
-.testH5Eregister_class
-.testH5Eregister_class_cls_name_null
-.testH5EprintInt
-.testH5Eset_current_stack_invalid_stkid
-.testH5Eset_current_stack
-.testH5Eget_num
-.testH5Eclear
-.testH5Eprint
-.testH5Epush_null_name
-.testH5Eget_num_with_msg
-.testH5Eclear2_with_msg
-.testH5Epush_invalid_stkid
-.testH5Eget_current_stack
-.testH5Ecreate_stack
-.testH5Eget_msg_invalid_msgid
-.testH5Eauto_is_v2
-.testH5EclearInt
-.testH5Eauto_is_v2_invalid_stkid
-.testH5Eclose_msg_invalid_errid
-.testH5Eclose_stack_invalid_stackid
-.testH5Eget_class_name_invalid_classname
-.testH5Eget_num_invalid_stkid
-.testH5EprintInt_invalid_classid
-.testH5Epop
-.testH5Epop_invalid_stkid
-.testH5Eget_current_stack_pop
-.testH5Eget_class_name_invalid_classid
-.testH5Ecreate_msg_invalid_errid
-.testH5Eclear2_invalid_stkid
-.testH5Eprint2_invalid_classid
-.testH5EprintInt
-.testH5Eget_msg_major
-.testH5Eget_msg_minor
-.testH5Eget_msg
-.testH5Eget_num
-.testH5Epush
-.testH5Ewalk
-.testH5Eget_class_name
-.testH5Eget_num_with_msg
-.testH5Eclear2
-.testH5Eprint2
-.testH5Ecreate_msg_major
-.testH5Ecreate_msg_minor
-.testH5Ecreate_stack
-.testH5Ecreate_msg_name_null
-.testH5Eauto_is_v2
-.testH5EclearInt
-.testH5Epop
-.testH5Fcreate_null
-.testH5Fflush_local
-.testH5Fget_info
-.testH5Fmount_null
-.testH5Fcreate
-.testH5Fflush_global
-.testH5Funmount_null
-.testH5Fclose_negative
-.testH5Fopen_null
-.testH5Fis_hdf5_null
-.testH5Fis_hdf5_text
-.testH5Fget_mdc_size
-.testH5Fget_mdc_hit_rate
-.testH5Fis_hdf5
-.testH5Fget_freespace
-.testH5Fclose
-.testH5Fget_filesize
-.testH5Fcreate_EXCL
-.testH5Freopen_closed
-.testH5Freset_mdc_hit_rate_stats
-.testH5Fget_name
-.testH5Fcreate
-.testH5Fclear_elink_file_cache
-.testH5Fclose_twice
-.testH5Freopen
-.testH5Fopen_read_only
-.testH5Fget_access_plist
-.testH5Fget_obj_ids
-.testH5Fget_intent_rdwr
-.testH5Fget_access_plist_closed
-.testH5Fget_create_plist_closed
-.testH5Fget_intent_rdonly
-.testH5Fget_create_plist
-.testH5Fget_obj_count
-.testH5Fstart_swmr_write
-.testH5Fswmr_read_attempts
-.testH5Gget_info_by_name_not_exists
-.testH5Gget_info_by_idx_not_exists
-.testH5Gget_info_by_name
-.testH5Gget_create_plist
-.testH5Gopen
-.testH5Gget_info_by_idx_null
-.testH5Gopen_not_exists
-.testH5Gclose
-.testH5Gcreate_anon
-.testH5Gcreate_null
-.testH5Gget_info_by_idx_fileid
-.testH5Gclose_invalid
-.testH5Gflush_invalid
-.testH5Gopen_invalid
-.testH5Grefresh_invalid
-.testH5Gget_info_invalid
-.testH5Gcreate_invalid
-.testH5Gcreate_exists
-.testH5Gget_info_by_name_null
-.testH5Gget_info_by_name_invalid
-.testH5Gget_create_plist_invalid
-.testH5Gcreate
-.testH5Gget_info_by_name_fileid
-.testH5Gget_info_by_idx_invalid
-.testH5Gopen_null
-.testH5Gget_info_by_idx
-.testH5Gget_info
-.testH5Gget_info_by_name
-.testH5Gget_create_plist
-.testH5Gopen
-.testH5Gget_obj_info_all_gid2
-.testH5Gget_obj_info_all_byIndexType
-.testH5Gget_obj_info_max_limit
-.testH5Gget_obj_info_all
-.testH5Gget_obj_info_max
-.testH5Gget_obj_info_all_gid
-.testH5Gget_info_by_idx
-.testH5Gget_info
-.testH5Gget_obj_info_all
-.testH5Sclose_invalid
-.testH5Screate_simple_max_default
-.testH5Screate_simple_dims_null
-.testH5Sdecode_null
-.testH5Screate_simple_dims_exceed
-.testH5Screate_simple_unlimted_1d
-.testH5Screate_simple_dims_invalid
-.testH5Screate_scalar
-.testH5Screate_simple
-.testH5Screate_simple_rank_invalid
-.testH5Sget_simple_extent_type_invalid
-.testH5Sencode_invalid
-.testH5Screate_null
-.testH5Screate_simple_extent
-.testH5Screate_invalid
-.testH5Screate_simple_unlimted
-.testH5Sget_select_npoints
-.testH5Sget_select_type
-.testH5Sset_extent_simple
-.testH5Sget_select_hyper
-.testH5Sget_select_valid
-.testH5Sget_select_elem_pointlist
-.testH5Sset_extent_none
-.testH5Sencode_decode_scalar_dataspace
-.testH5Soffset_simple
-.testH5Scopy
-.testH5Sget_simple_extent_ndims
-.testH5Sextent_equal
-.testH5Sget_simple_extent_dims
-.testH5Sget_simple_extent_type
-.testH5Shyper_regular
-.testH5Sget_select_bounds
-.testH5Sget_select_elem_pointlist_invalid
-.testH5Sget_simple_extent_npoints
-.testH5Sextent_copy
-.testH5Sencode_decode_null_dataspace
-.testH5Sis_simple
-.testH5Sget_simple_extent_dims_null
-.testH5Sselect_none
-.testH5Tget_member_type_invalid
-.testH5Tenum_insert_null
-.testH5Tget_offset_invalid
-.testH5Tset_precision_invalid
-.testH5Tget_inpad_invalid
-.testH5Tenum_nameof_invalid
-.testH5Tget_member_value_invalid
-.testH5Tenum_nameof_value_null
-.testH5Tcreate_invalid
-.testH5Tget_strpad_invalid
-.testH5Tenum_valueof_invalid
-.testH5Tget_fields_null
-.testH5Topen_null
-.testH5Tpack_invalid
-.testH5Tcommit_null
-.testH5Tinsert_invalid
-.testH5Tenum_valueof_null
-.testH5Tset_norm_invalid
-.testH5Tlock_invalid
-.testH5Tarray_create_invalid
-.testH5Tget_member_value_null
-.testH5Tset_offset_invalid
-.testH5Tget_fields_invalid
-.testH5Tequal_invalid
-.testH5Tget_ebias_long_invalid
-.testH5Tget_cset_invalid
-.testH5Tget_size_invalid
-.testH5Tset_strpad_invalid
-.testH5Tset_ebias_invalid
-.testH5Tget_sign_invalid
-.testH5Tget_member_index_invalid
-.testH5Tget_precision_invalid
-.testH5Tset_fields_invalid
-.testH5Tcopy_invalid
-.testH5Tget_pad_invalid
-.testH5Tset_order_invalid
-.testH5Tget_member_class_invalid
-.testH5Tget_super_invalid
-.testH5Tget_class_invalid
-.testH5Topen_invalid
-.testH5Tget_precision_long_invalid
-.testH5Tget_ebias_invalid
-.testH5Tget_native_type_invalid
-.testH5Tget_fields_length_invalid
-.testH5Tget_norm_invalid
-.testH5Tenum_nameof_invalid_size
-.testH5Tset_pad_invalid
-.testH5Tget_pad_null
-.testH5Tset_tag_null
-.testH5Tget_order_invalid
-.testH5Tcommit_invalid
-.testH5Tget_array_ndims_invalid
-.testH5Tset_tag_invalid
-.testH5Tvlen_create_invalid
-.testH5Tenum_create_invalid
-.testH5Tinsert_null
-.testH5Tset_inpad_invalid
-.testH5Tenum_valueof_name_null
-.testH5Tset_cset_invalid
-.testH5Tclose_invalid
-.testH5Tget_nmembers_invalid
-.testH5Tarray_create_value_null
-.testH5Tset_size_invalid
-.testH5Tflush_invalid
-.testH5Tenum_insert_invalid
-.testH5Tget_array_dims_null
-.testH5Tget_member_index_null
-.testH5Trefresh_invalid
-.testH5Tset_sign_invalid
-.testH5Tenum_insert_name_null
-.testH5Tequal_not
-.testH5Tcopy
-.testH5Tequal
-.testH5Torder_size
-.testH5Tconvert
-.testH5Tvlen_create
-.testH5Tenum_create_functions
-.testH5Tenum_functions
-.testH5Tget_class
-.testH5Tget_array_ndims
-.testH5Tequal_type_error
-.testH5Tget_array_dims
-.testH5Tset_size
-.testH5Tis_variable_str
-.testH5Tcompound_functions
-.testH5Tget_size
-.testH5Tarray_create
-.testH5Topaque_functions
-.testH5Dget_space_status_invalid
-.testH5Dget_access_plist_invalid
-.testH5Dget_type_invalid
-.testH5Dget_create_plist_invalid
-.testH5Dget_offset_invalid
-.testH5Dvlen_get_buf_size_invalid
-.testH5Dcreate_null
-.testH5Dset_extent_status_null
-.testH5Dvlen_reclaim_null
-.testH5Dcreate_invalid
-.testH5Dcreate_anon_invalid
-.testH5Dset_extent_status_invalid
-.testH5Dvlen_reclaim_invalid
-.testH5Dopen_invalid
-.testH5Dclose_invalid
-.testH5Dflush_invalid
-.testH5Drefresh_invalid
-.testH5Dget_storage_size_invalid
-.testH5Dget_space_invalid
-.testH5Dopen_null
-.testH5Dget_storage_size
-.testH5Diterate_write
-.testH5Dcreate
-.testH5Dget_offset
-.testH5Dget_type
-.testH5Dfill
-.testH5Dopen
-.testH5Dcreate_anon
-.testH5Dfill_null
-.testH5Dget_storage_size_empty
-.testH5Diterate
-.testH5Dget_access_plist
-.testH5Dvlen_read_invalid_buffer
-.testH5Dvlen_get_buf_size
-.testH5Dget_space_closed
-.testH5Dget_space_status
-.testH5Dvlen_write_read
-.testH5Dget_space
-.testH5Dget_type_closed
-.testH5Dset_extent
-.testH5Lcopy_invalid
-.testH5Lget_value_by_idx_null
-.testH5Lcreate_external_invalid
-.testH5Lexists_null
-.testH5Lget_info_invalid
-.testH5Lget_name_by_idx_invalid
-.testH5Lmove_null_current
-.testH5Literate_by_name_nullname
-.testH5Lvisit_by_name_nullname
-.testH5Lvisit_null
-.testH5Lget_name_by_idx_null
-.testH5Lcreate_hard_null_dest
-.testH5Lget_value_null
-.testH5Lcreate_external_null_dest
-.testH5Lcreate_external_null_file
-.testH5Lcreate_external_null_current
-.testH5Ldelete_null
-.testH5Lexists_invalid
-.testH5Lmove_invalid
-.testH5Lcreate_hard_invalid
-.testH5Lcopy_null_dest
-.testH5Lcreate_soft_null_current
-.testH5Lcopy_null_current
-.testH5Lget_info_by_idx_null
-.testH5Literate_null
-.testH5Ldelete_invalid
-.testH5Lvisit_by_name_null
-.testH5Ldelete_by_idx_invalid
-.testH5Lget_info_by_idx_invalid
-.testH5Ldelete_by_idx_null
-.testH5Lcreate_soft_invalid
-.testH5Lcreate_hard_null_current
-.testH5Lget_value_by_idx_invalid
-.testH5Lmove_null_dest
-.testH5Lget_info_null
-.testH5Literate_by_name_null
-.testH5Lcreate_soft_null_dest
-.testH5Lget_value_invalid
-.testH5Lget_info_by_idx_not_exist_name
-.testH5Lget_name_by_idx_not_exist
-.testH5Lvisit
-.testH5Lget_name_by_idx_n0
-.testH5Lget_name_by_idx_n3
-.testH5Lvisit_by_name
-.testH5Literate_by_name
-.testH5Lget_info_hardlink
-.testH5Literate
-.testH5Lget_info_by_idx_n0
-.testH5Lget_info_by_idx_n3
-.testH5Lget_info_by_idx_name_not_exist_create
-.testH5Lexists
-.testH5Lget_info_by_idx_name_not_exist_name
-.testH5Lget_info_by_idx_not_exist_create
-.testH5Lget_info_not_exist
-.testH5Lget_info_dataset
-.testH5Lget_info_by_idx_n0_create
-.testH5Ldelete_soft_link_dangle
-.testH5Lget_value_by_idx_external_create
-.testH5Ldelete_by_idx_not_exist_create
-.testH5Lvisit_create
-.testH5Lmove_dst_link_exists
-.testH5Lcreate_soft_dangle
-.testH5Literate_create
-.testH5Lcopy_cur_not_exists
-.testH5Lcopy
-.testH5Lmove
-.testH5Lget_value_by_idx_n2_create
-.testH5Lget_value_soft
-.testH5Ldelete_by_idx_n2_name
-.testH5Lget_info_by_idx_n1_create
-.testH5Lcreate_external
-.testH5Lget_value_dangle
-.testH5Lcreate_hard_dst_link_exists
-.testH5Lget_value_by_idx_n2_name
-.testH5Lcreate_soft_dst_link_exists
-.testH5Lcreate_hard
-.testH5Lcreate_soft
-.testH5Lmove_cur_not_exists
-.testH5Lcreate_hard_cur_not_exists
-.testH5Lget_info_softlink_dangle
-.testH5Ldelete_by_idx_n2_create
-.testH5Ldelete_soft_link
-.testH5Lget_info_externallink
-.testH5Lcopy_dst_link_exists
-.testH5Lget_value_by_idx_external_name
-.testH5Ldelete_by_idx_not_exist_name
-.testH5Lget_info_softlink
-.testH5Lget_value_external
-.testH5Lget_value_by_idx_not_exist_create
-.testH5Lget_value_by_idx_not_exist_name
-.testH5Ldelete_hard_link
-.testH5Rgetregion_Nullreference
-.testH5Rget_obj_type2_Invalidreftype
-.testH5Rdereference
-.testH5Rget_name
-.testH5Rcreate_Invalidreftype
-.testH5Rget_name_NULLreference
-.testH5Rget_region
-.testH5Rdereference_Nullreference
-.testH5Rcreate_refobj
-.testH5Rcreate_Invalidspace_id
-.testH5Rdereference_Invalidreference
-.testH5Rgetregion_Badreferencetype
-.testH5Rcreate_regionrefobj
-.testH5Rget_name_Invalidreftype
-.testH5Rgetregion_Invalidreftype
-.testH5Rget_obj_type2
-.testH5Rcreate_InvalidObjectName
-.testH5Pset_nbit
-.testH5Pset_shared_mesg_index_InvalidFlag
-.testH5Pset_shared_mesg_phase_change
-.testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue
-.testH5P_layout
-.testH5Pget_link_creation_order
-.testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes
-.testH5P_file_space_page_size
-.testH5Pget_shared_mesg_index_Invalid_indexnum
-.testH5Pset_data_transform_NullExpression
-.testH5Pset_elink_prefix_null
-.testH5Pget_elink_prefix
-.testH5Pget_nlinks
-.testH5Pset_libver_bounds_invalidhigh
-.testH5Pget_char_encoding
-.testH5P_istore_k
-.testH5Pget_link_phase_change
-.testH5Pset_link_phase_change_max_compactLESSTHANmin_dense
-.testH5Pget_shared_mesg_phase_change_EqualsSET
-.testH5Pset_scaleoffset_Invalidscale_type
-.testH5Pget_istore_k_null
-.testH5Pset_libver_bounds_invalidlow
-.testH5Pset_est_link_info
-.testH5Pget_link_phase_change_Null
-.testH5P_fill_time
-.testH5Pget_userblock_null
-.testH5Pset_link_creation_order_tracked
-.testH5Pset_shared_mesg_index
-.testH5Pset_copy_object
-.testH5Pset_link_creation_order_trackedPLUSindexed
-.testH5P_file_space_strategy
-.testH5Pset_copy_object_invalidobject
-.testH5Pset_est_link_info_InvalidValues
-.testH5Pset_local_heap_size_hint
-.testH5Pget_est_link_info
-.testH5Pset_scaleoffset
-.testH5Pset_create_intermediate_group_invalidobject
-.testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue
-.testH5Pset_create_intermediate_group
-.testH5P_alloc_time
-.testH5Pset_elink_acc_flags
-.testH5Pset_link_phase_change_Highmax_Compact
-.testH5P_chunk
-.testH5P_sizes
-.testH5Pset_link_creation_order_invalidvalue
-.testH5P_sym_k
-.testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist
-.testH5Pget_version_null
-.testH5Pset_scaleoffset_Invalidscale_factor
-.testH5Pget_elink_prefix_null
-.testH5Pget_data_transform_IllegalSize
-.testH5Pget_create_intermediate_group
-.testH5Pset_shared_mesg_nindexes
-.testH5Pset_attr_creation_order_trackedPLUSindexed
-.testH5Pget_sym_k_null
-.testH5Pset_nlinks
-.testH5P_obj_track_times
-.testH5P_userblock
-.testH5Pget_local_heap_size_hint
-.testH5Pset_shared_mesg_index_Invalid_indexnum
-.testH5Pset_data_transform_InvalidExpression1
-.testH5Pset_data_transform_InvalidExpression2
-.testH5Pget_attr_phase_change
-.testH5Pget_data_transform
-.testH5Pget_create_intermediate_group_notcreated
-.testH5Pset_elink_prefix
-.testH5Pget_attr_creation_order
-.testH5Pset_attr_creation_order_invalidvalue
-.testH5Pget_shared_mesg_phase_change
-.testH5Pget_shared_mesg_index
-.testH5Pset_link_phase_change
-.testH5Pget_shared_mesg_nindexes
-.testH5Pget_version
-.testH5Pset_elink_acc_flags_InvalidFlag1
-.testH5Pset_elink_acc_flags_InvalidFlag2
-.testH5Pget_link_phase_change_EqualsSet
-.testH5Pget_elink_acc_flags
-.testH5Pget_data_transform_ExpressionNotSet
-.testH5P_fill_value
-.testH5Pget_sizes_null
-.testH5Pset_data_transform
-.testH5Pset_attr_creation_order_tracked
-.testH5P_buffer
-.testH5Pdata_transform
-.testH5P_elink_fapl
-.testH5P_fapl_direct
-.testH5P_alignment
-.testH5P_fapl_family
-.testH5P_chunk_cache
-.testH5P_meta_block_size
-.testH5Fmdc_logging
-.testH5Pget_elink_fapl
-.testH5Pset_mdc_config
-.testH5P_small_data_block_size
-.testH5Pset_fapl_log
-.testH5Pset_libver_bounds
-.testH5P_sieve_buf_size
-.testH5P_elink_file_cache_size
-.testH5P_cache
-.testH5Pget_mdc_config
-.testH5P_fapl_muti_defaults
-.testH5Pget_libver_bounds
-.testH5P_btree_ratios
-.testH5P_fapl_muti_nulls
-.testH5Pset_fapl_sec2
-.testH5Pmulti_transform
-.testH5Pset_elink_fapl_NegativeID
-.testH5Pset_fapl_stdio
-.testH5P_edc_check
-.testH5Pset_elink_fapl
-.testH5P_hyper_vector_size
-.testH5P_gc_references
-.testH5P_family_offset
-.testH5P_fapl_core
-.testH5P_fapl_muti
-.testH5P_fapl_split
-.testH5Pset_fapl_windows
-.testH5P_fclose_degree
-.testH5Pget_source_datasetname
-.testH5Pvirtual_storage
-.testH5Pget_selection_source_dataset
-.testH5Pget_source_filename
-.testH5Pset_get_virtual_printf_gap
-.testH5Pget_virtual_count
-.testH5Pset_get_virtual_view
-.testH5Pget_mapping_parameters
-.testH5P_genprop_basic_class
-.testH5P_genprop_class_iter
-.testH5P_genprop_basic_class_prop
-.testH5P_genprop_basic_list_prop
-.testH5Acreate2_nullname
-.testH5Acreate_by_name
-.testH5Aget_name_by_idx
-.testH5Aget_storage_size
-.testH5Aiterate
-.testH5Aopen_by_idx
-.testH5Aopen_invalidname
-.testH5Aopen
-.testH5Aget_info_by_name
-.testH5Aget_create_plist
-.testH5Adelete_by_name
-.testH5Aopen_by_name
-.testH5Aget_info
-.testH5Aget_name
-.testH5Aexists
-.testH5Aget_info_by_idx
-.testH5Arename
-.testH5Adelete_by_idx_name1
-.testH5Adelete_by_idx_name2
-.testH5Adelete_by_idx_order
-.testH5Arename_by_name
-.testH5Acreate2_invalidobject
-.testH5Acreate2
-.testH5Aiterate_by_name
-.testH5Adelete_by_idx_null
-.testH5Adelete_by_idx_invalidobject
-.testH5Awrite_readVL
-.testH5Aget_info1
-.testH5Oget_comment_by_name_null
-.testH5Ovisit_by_name_nullname
-.testH5Oget_info_invalid
-.testH5Ovisit_by_name_null
-.testH5Oget_comment_invalid
-.testH5Oset_comment_by_name_invalid
-.testH5Oopen_null
-.testH5Oclose_invalid
-.testH5Oflush_invalid
-.testH5Oget_comment_by_name_invalid
-.testH5Orefresh_invalid
-.testH5Ocopy_null_dest
-.testH5Olink_invalid
-.testH5Oget_info_by_idx_invalid
-.testH5Oget_info_by_idx_null
-.testH5Olink_null_dest
-.testH5Oget_info_by_name_invalid
-.testH5Oget_info_by_name_null
-.testH5Ocopy_invalid
-.testH5Oset_comment_by_name_null
-.testH5Ocopy_null_current
-.testH5Oset_comment_invalid
-.testH5Oopen_invalid
-.testH5Ovisit_null
-.testH5Oexists_by_name
-.testH5Oget_info_by_idx_n0
-.testH5Oget_info_by_idx_n3
-.testH5Oget_info_by_name_not_exist_name
-.testH5Ovisit_by_name
-.testH5Oget_info_by_idx_name_not_exist_name
-.testH5Oget_info_datatype
-.testH5Oget_info_by_idx_not_exist_name
-.testH5Oopen_by_idx_n0
-.testH5Oopen_by_idx_n3
-.testH5Oopen_not_exists
-.testH5Ovisit
-.testH5Oget_info_by_idx_not_exist_create
-.testH5Oget_info_by_name_hardlink
-.testH5Oget_info_by_name_group
-.testH5Oopen_by_addr
-.testH5Oget_info_by_name_not_exists
-.testH5Oget_info_by_name_dataset
-.testH5Oget_info_group
-.testH5Oget_info_by_name_datatype
-.testH5Oget_info_hardlink
-.testH5Oget_info_by_idx_name_not_exist_create
-.testH5Oget_info_dataset
-.testH5OcopyRefsDatasettosameFile
-.testH5OcopyRefsDatasettodiffFile
-.testH5OcopyRefsAttr
-.testH5Oget_info_by_idx_n0_create
-.testH5Oget_info_softlink_dangle
-.testH5Oget_info_softlink
-.testH5Oget_info_externallink
-.testH5Ocopy
-.testH5Olink
-.testH5Ocomment_by_name
-.testH5Oget_info_by_idx_n1_create
-.testH5Ocomment
-.testH5Oinc_dec_count
-.testH5Ocomment_by_name_clear
-.testH5Ovisit_create
-.testH5Ocopy_dst_link_exists
-.testH5Ocomment_clear
-.testH5Ocopy_cur_not_exists
-.TestH5PLplugins
-.TestH5PLpaths
-.testH5Zfilter_avail
-.testH5Zunregister_predefined
-.testH5Zget_filter_info
-
-Time: XXXX
-
-OK (638 tests)
-
-HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists
- major: File accessibilty
- minor: Can't set value
- #001: (file name) line (number) in H5P_verify_apl_and_dxpl(): not the required access property list
- major: Property lists
- minor: Inappropriate type
- #002: (file name) line (number) in H5P_isa_class(): not a property list
- major: Invalid arguments to routine
- minor: Inappropriate type
-HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists
- major: File accessibilty
- minor: Can't set value
- #001: (file name) line (number) in H5P_verify_apl_and_dxpl(): not the required access property list
- major: Property lists
- minor: Inappropriate type
- #002: (file name) line (number) in H5P_isa_class(): not a property list
- major: Invalid arguments to routine
- minor: Inappropriate type
diff --git a/java/test/Makefile.am b/java/test/Makefile.am
index b7409cf..46e6a7e 100644
--- a/java/test/Makefile.am
+++ b/java/test/Makefile.am
@@ -28,15 +28,17 @@ classes:
pkgpath = test
hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
+CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/junit.jar:$(top_srcdir)/java/lib/hamcrest-core.jar:$(top_srcdir)/java/lib/slf4j-api-1.7.25.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.25.jar:$$CLASSPATH
+
jarfile = jar$(PACKAGE_TARNAME)test.jar
-CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/junit.jar:$(top_srcdir)/java/lib/hamcrest-core.jar:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation
+TESTPACKAGE =
+
noinst_JAVA = \
TestH5.java \
- TestH5E.java \
- TestH5Edefault.java \
+ TestH5Eparams.java \
TestH5Eregister.java \
TestH5Fparams.java \
TestH5Fbasic.java \
@@ -44,7 +46,6 @@ noinst_JAVA = \
TestH5Fswmr.java \
TestH5Gbasic.java \
TestH5G.java \
- TestH5Giterate.java \
TestH5Sbasic.java \
TestH5S.java \
TestH5Tparams.java \
@@ -60,6 +61,8 @@ noinst_JAVA = \
TestH5P.java \
TestH5PData.java \
TestH5Pfapl.java \
+ TestH5Pfaplhdfs.java \
+ TestH5Pfapls3.java \
TestH5Pvirtual.java \
TestH5Plist.java \
TestH5A.java \
@@ -68,8 +71,11 @@ noinst_JAVA = \
TestH5Ocreate.java \
TestH5Ocopy.java \
TestH5PL.java \
+ TestH5VL.java \
TestH5Z.java \
- TestAll.java
+ TestH5E.java \
+ TestH5Edefault.java \
+ TestH5Giterate.java
$(jarfile): classnoinst.stamp classes
$(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath)
@@ -78,22 +84,16 @@ noinst_DATA = $(jarfile)
.PHONY: classes
+# Test with just the native connector, with a single pass-through connector
+# and with a doubly-stacked pass-through.
+VOL_LIST = native "pass_through under_vol=0;under_info={}" \
+ "pass_through under_vol=505;under_info={under_vol=0;under_info={}}"
+
check_SCRIPTS = junit.sh
TEST_SCRIPT = $(check_SCRIPTS)
CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class junit.sh
-#JAVA_JUNIT = $(JAVA_SRCS)
-#noinst_JAVA = @JAVA_JUNIT@
-#EXTRA_JAVA = $(JAVA_JUNIT)
-TESTS_JUNIT = AllJunitTests
-#EXTRA_TEST = $(TESTS_JUNIT)
-
-AllJunitTests :
- echo "#! /bin/sh" > $@
- echo "exec @JUNIT@ test.TestAll" >> $@
- chmod +x $@
-
clean:
rm -rf $(JAVAROOT)/*
rm -f $(jarfile)
diff --git a/java/test/TestAll.java b/java/test/TestAll.java
index de5d333..c7c206c 100644
--- a/java/test/TestAll.java
+++ b/java/test/TestAll.java
@@ -18,9 +18,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses( { TestH5.class,
- TestH5Eregister.class,
- TestH5Edefault.class,
- TestH5E.class,
+ TestH5Eparams.class, TestH5Eregister.class, TestH5Edefault.class, TestH5E.class,
TestH5Fparams.class, TestH5Fbasic.class, TestH5F.class, TestH5Fswmr.class,
TestH5Gbasic.class, TestH5G.class, TestH5Giterate.class,
TestH5Sbasic.class, TestH5S.class,
@@ -29,6 +27,7 @@ import org.junit.runners.Suite;
TestH5Lparams.class, TestH5Lbasic.class, TestH5Lcreate.class,
TestH5R.class,
TestH5P.class, TestH5PData.class, TestH5Pfapl.class, TestH5Pvirtual.class, TestH5Plist.class,
+ TestH5Pfapls3.class, TestH5Pfaplhdfs.class,
TestH5A.class,
TestH5Oparams.class, TestH5Obasic.class, TestH5Ocopy.class, TestH5Ocreate.class,
TestH5PL.class, TestH5Z.class
diff --git a/java/test/TestH5.java b/java/test/TestH5.java
index 413e58d..9b2a1d3 100644
--- a/java/test/TestH5.java
+++ b/java/test/TestH5.java
@@ -22,12 +22,17 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.Reader;
+import java.io.StreamTokenizer;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
import org.junit.After;
import org.junit.Before;
@@ -50,12 +55,87 @@ public class TestH5 {
public void nextTestName() {
System.out.println();
}
+ private static final String H5_FILE = "testData.h5";
+ private static final String EXPORT_FILE = "testExport.txt";
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ private static final int RANK = 2;
+ long H5fid = -1;
+ long H5dsid = -1;
+ long H5did = -1;
+ long[] H5dims = { DIM_X, DIM_Y };
+
+ private final void _deleteFile(String filename) {
+ File file = null;
+ try {
+ file = new File(filename);
+ }
+ catch (Throwable err) {}
+
+ if (file.exists()) {
+ try {file.delete();} catch (SecurityException e) {}
+ }
+ }
+
+ private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ long did = -1;
+ try {
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32LE, dsid,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Dcreate: " + err);
+ }
+ assertTrue("TestH5._createDataset: ", did > 0);
+
+ return did;
+ }
+
+ private final void _createH5File() {
+ try {
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5dsid = H5.H5Screate_simple(2, H5dims, null);
+ H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Pfapl.createH5file: " + err);
+ }
+ assertTrue("TestH5.createH5file: H5.H5Fcreate: ", H5fid > 0);
+ assertTrue("TestH5.createH5file: H5.H5Screate_simple: ", H5dsid > 0);
+ assertTrue("TestH5.createH5file: _createDataset: ", H5did > 0);
+
+ try {
+ H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ }
+ }
+
+ public final void _closeH5File() throws HDF5LibraryException {
+ if (H5did >= 0)
+ try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ if (H5dsid > 0)
+ try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ if (H5fid > 0)
+ try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ H5fid = -1;
+ H5dsid = -1;
+ H5did = -1;
+ }
+
+ public final void _deleteH5file() {
+ _deleteFile(H5_FILE);
+ }
/**
* Test method for {@link hdf.hdf5lib.H5#J2C(int)}.
* NOTE:
- * H5F_ACC_DEBUG no longer prints any special debug info. The symbol is
- * being retained and will be listed as deprecated in HDF5 1.10.0.
+ * H5F_ACC_DEBUG no longer prints any special debug info. Even though the symbol is
+ * being retained hdf java does not access the symbol.
*/
@Test
public void testJ2C() {
@@ -63,7 +143,6 @@ public class TestH5 {
int H5F_ACC_RDWR = 0x0001;
int H5F_ACC_TRUNC = 0x0002;
int H5F_ACC_EXCL = 0x0004;
- int H5F_ACC_DEBUG = 0x0000; // HDFFV-1074 was 0x0008;
int H5F_ACC_CREAT = 0x0010;
int H5F_OBJ_FILE = 0x0001;
int H5F_OBJ_DATASET = 0x0002;
@@ -75,13 +154,13 @@ public class TestH5 {
int H5F_OBJ_LOCAL = 0x0020;
int definedValues[] = { H5F_ACC_RDONLY, H5F_ACC_RDWR, H5F_ACC_TRUNC,
- H5F_ACC_EXCL, H5F_ACC_DEBUG, H5F_ACC_CREAT, H5F_OBJ_FILE,
+ H5F_ACC_EXCL, H5F_ACC_CREAT, H5F_OBJ_FILE,
H5F_OBJ_DATASET, H5F_OBJ_GROUP, H5F_OBJ_DATATYPE, H5F_OBJ_ATTR,
H5F_OBJ_ALL, H5F_OBJ_LOCAL };
int j2cValues[] = { HDF5Constants.H5F_ACC_RDONLY,
HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5F_ACC_TRUNC,
- HDF5Constants.H5F_ACC_EXCL, H5F_ACC_DEBUG,
+ HDF5Constants.H5F_ACC_EXCL,
HDF5Constants.H5F_ACC_CREAT, HDF5Constants.H5F_OBJ_FILE,
HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP,
HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR,
@@ -162,7 +241,7 @@ public class TestH5 {
*/
@Test
public void testH5get_libversion() {
- int libversion[] = { 1, 11, 0 };
+ int libversion[] = { 1, 13, 0 };
try {
H5.H5get_libversion(libversion);
@@ -179,12 +258,29 @@ public class TestH5 {
}
/**
+ * Test method for {@link hdf.hdf5lib.H5#H5get_libversion(int[])}
+ * to ensure a null libversion parameter causes the function to
+ * fail.
+ */
+ @Test
+ public void testH5get_libversion_null_param() {
+ try {
+ H5.H5get_libversion(null);
+ }
+ catch (Throwable err) {
+ return;
+ }
+
+ fail("H5.H5get_libversion: succeeded with a null libversion parameter!");
+ }
+
+ /**
* Test method for
* {@link hdf.hdf5lib.H5#H5check_version(int, int, int)}.
*/
@Test
public void testH5check_version() {
- int majnum = 1, minnum = 11, relnum = 0;
+ int majnum = 1, minnum = 13, relnum = 0;
try {
H5.H5check_version(majnum, minnum, relnum);
@@ -252,4 +348,67 @@ public class TestH5 {
fail("Exception thrown during test: " + ex.toString());
}
}
+
+ @Test
+ public void testH5export_dataset() {
+ int[][] dset_data = new int[DIM_X][DIM_Y];
+ int[][] dset_indata = new int[DIM_X][DIM_Y];
+ int FILLVAL = 99;
+
+ _createH5File();
+
+ // Initialize the dataset.
+ for (int indx = 0; indx < DIM_X; indx++)
+ for (int jndx = 0; jndx < DIM_Y; jndx++)
+ dset_data[indx][jndx] = FILLVAL;
+
+ try {
+ if (H5did >= 0)
+ H5.H5Dwrite(H5did, HDF5Constants.H5T_STD_I32LE,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ _closeH5File();
+
+ try {
+ H5.H5export_dataset(EXPORT_FILE, H5_FILE, "/dset", 99);
+ }
+ catch (HDF5LibraryException err) {
+ err.printStackTrace();
+ fail("H5export_dataset failed: " + err);
+ }
+
+ File file = new File(EXPORT_FILE);
+
+ try {
+ Reader reader = new FileReader(EXPORT_FILE);
+ StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
+ int indx = 0;
+ int jndx = 0;
+ while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
+ if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
+ dset_indata[indx][jndx] = (int)streamTokenizer.nval;
+ jndx++;
+ if (jndx >= DIM_Y) {
+ jndx = 0;
+ indx++;
+ }
+ }
+ }
+ reader.close();
+ }
+ catch (IOException err) {
+ err.printStackTrace();
+ fail("read file failed: " + err);
+ }
+ for(int row = 0; row < DIM_X; row++)
+ for(int col = 0; col < DIM_Y; col++) {
+ assertTrue("H5export_dataset: <"+row+","+col+">"+dset_indata[row][col]+"=99", dset_indata[row][col]==99);
+ }
+ _deleteH5file();
+ }
}
diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java
index 5e1e3f6..7d336e1 100644
--- a/java/test/TestH5A.java
+++ b/java/test/TestH5A.java
@@ -40,7 +40,7 @@ import org.junit.rules.TestName;
public class TestH5A {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "test.h5";
+ private static final String H5_FILE = "testA.h5";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
long H5fid = -1;
@@ -50,6 +50,7 @@ public class TestH5A {
long type_id = -1;
long space_id = -1;
long lapl_id = -1;
+ long aapl_id = -1;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -90,8 +91,10 @@ public class TestH5A {
assertTrue("TestH5A.createH5file: _createDataset: ", H5did > 0);
space_id = H5.H5Screate(HDF5Constants.H5S_NULL);
assertTrue(space_id > 0);
- lapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS);
+ lapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS);
assertTrue(lapl_id > 0);
+ aapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS);
+ assertTrue(aapl_id > 0);
type_id = H5.H5Tenum_create(HDF5Constants.H5T_STD_I32LE);
assertTrue(type_id > 0);
int status = H5.H5Tenum_insert(type_id, "test", 1);
@@ -122,6 +125,8 @@ public class TestH5A {
try {H5.H5Sclose(space_id);} catch (Exception ex) {}
if (lapl_id > 0)
try {H5.H5Pclose(lapl_id);} catch (Exception ex) {}
+ if (aapl_id > 0)
+ try {H5.H5Pclose(aapl_id);} catch (Exception ex) {}
System.out.println();
}
@@ -194,7 +199,6 @@ public class TestH5A {
long n = 0;
long attr_id = -1;
long attribute_id = -1;
- long aapl_id = HDF5Constants.H5P_DEFAULT;
try {
attr_id = H5.H5Acreate(H5did, "file", type_id, space_id,
@@ -203,7 +207,7 @@ public class TestH5A {
// Opening the existing attribute, obj_name(Created by H5ACreate2)
// by index, attached to an object identifier.
attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC,
- 0, HDF5Constants.H5P_DEFAULT, lapl_id);
+ 0, aapl_id, lapl_id);
assertTrue("testH5Aopen_by_idx: H5Aopen_by_idx", attribute_id >= 0);
@@ -258,7 +262,7 @@ public class TestH5A {
try {
attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
+ aapl_id, lapl_id);
assertTrue("testH5Acreate_by_name: H5Acreate_by_name",
attribute_id >= 0);
@@ -289,7 +293,7 @@ public class TestH5A {
boolean bool_val = false;
try {
- attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, lapl_id);
+ attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id);
ret_val = H5.H5Arename(loc_id, old_attr_name, new_attr_name);
@@ -328,7 +332,7 @@ public class TestH5A {
try {
attr_id = H5.H5Acreate_by_name(loc_id, obj_name, old_attr_name,
- type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id);
+ type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id);
ret_val = H5.H5Arename_by_name(loc_id, obj_name, old_attr_name,
new_attr_name, lapl_id);
@@ -369,7 +373,7 @@ public class TestH5A {
try {
attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
type_id, space_id, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT, lapl_id);
+ aapl_id, lapl_id);
assertTrue("testH5Aget_name: H5Acreate_by_name ", attribute_id > 0);
ret_name = H5.H5Aget_name(attribute_id);
assertEquals(ret_name, attr_name);
diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java
index 372fdba..5d0e405 100644
--- a/java/test/TestH5D.java
+++ b/java/test/TestH5D.java
@@ -35,7 +35,7 @@ import org.junit.rules.TestName;
public class TestH5D {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "test.h5";
+ private static final String H5_FILE = "testD.h5";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
private static final int RANK = 2;
diff --git a/java/test/TestH5Dparams.java b/java/test/TestH5Dparams.java
index a3618f2..621c000 100644
--- a/java/test/TestH5Dparams.java
+++ b/java/test/TestH5Dparams.java
@@ -113,17 +113,6 @@ public class TestH5Dparams {
H5.H5Dvlen_get_buf_size(-1, -1, -1);
}
- @Test(expected = HDF5LibraryException.class)
- public void testH5Dvlen_reclaim_invalid() throws Throwable {
- byte[] buf = new byte[2];
- H5.H5Dvlen_reclaim(-1, -1, -1, buf);
- }
-
- @Test(expected = NullPointerException.class)
- public void testH5Dvlen_reclaim_null() throws Throwable {
- H5.H5Dvlen_reclaim(-1, -1, -1, null);
- }
-
@Test(expected = IllegalArgumentException.class)
public void testH5Dget_storage_size_invalid() throws Throwable {
H5.H5Dget_storage_size(-1);
diff --git a/java/test/TestH5Dplist.java b/java/test/TestH5Dplist.java
index 6feaa23..1b5acfa 100644
--- a/java/test/TestH5Dplist.java
+++ b/java/test/TestH5Dplist.java
@@ -13,6 +13,7 @@
package test;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -31,7 +32,7 @@ import org.junit.rules.TestName;
public class TestH5Dplist {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "test.h5";
+ private static final String H5_FILE = "testDp.h5";
private static final int DIM_X = 4;
private static final int DIM_Y = 7;
private static final int EDIM_X = 6;
@@ -211,4 +212,23 @@ public class TestH5Dplist {
assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[4][8] == 99);
}
+ @Test
+ public void testH5P_dset_no_attrs_hint() {
+ boolean ret_val_id = true;
+
+ _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE);
+
+ try {
+ ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id);
+ assertFalse("H5P_dset_no_attrs_hint", ret_val_id);
+ H5.H5Pset_dset_no_attrs_hint(H5dcpl_id, true);
+ ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id);
+ assertTrue("H5P_dset_no_attrs_hint", ret_val_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5P_dset_no_attrs_hint: " + err);
+ }
+ }
+
}
diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java
index 9a36365..ac641c3 100644
--- a/java/test/TestH5E.java
+++ b/java/test/TestH5E.java
@@ -37,6 +37,7 @@ import org.junit.rules.TestName;
public class TestH5E {
@Rule public TestName testname = new TestName();
+
long hdf_java_classid = -1;
long current_stackid = -1;
@@ -47,8 +48,7 @@ public class TestH5E {
hdf_java_classid = -1;
try {
- hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error",
- "hdf-java", "2.5");
+ hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", "hdf-java", "2.5");
current_stackid = H5.H5Eget_current_stack();
}
catch (Throwable err) {
@@ -73,180 +73,83 @@ public class TestH5E {
}
@Test
- public void testH5Eget_class_name() {
- try {
- String class_name = H5.H5Eget_class_name(hdf_java_classid);
- assertNotNull("H5.H5Eget_class_name: " + class_name, class_name);
- assertEquals("H5.H5Eget_class_name: ", "HDF-Java-Error", class_name);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eget_class_name: " + err);
- }
- }
-
- @Test
- public void testH5Eprint2() {
- try {
- assertFalse(current_stackid < 0);
- H5.H5Eprint2(current_stackid, null);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eprint2: " + err);
- }
- }
-
- @Ignore("Tested with create_msg_major[minor]")
- public void testH5Eclose_msg() {
- fail("Not yet implemented");
- }
-
- @Test(expected = NullPointerException.class)
- public void testH5Ecreate_msg_name_null() throws Throwable {
- H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, null);
- }
-
- @Test
- public void testH5Ecreate_msg_major() {
- try {
- long err_id = H5.H5Ecreate_msg(hdf_java_classid,
- HDF5Constants.H5E_MAJOR, "Error in Test");
- assertFalse("H5.H5Ecreate_msg_major: " + err_id, err_id < 0);
- H5.H5Eclose_msg(err_id);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Ecreate_msg_major: " + err);
- }
- }
-
- @Test
- public void testH5Ecreate_msg_minor() {
- try {
- long err_id = H5.H5Ecreate_msg(hdf_java_classid,
- HDF5Constants.H5E_MINOR, "Error in Test Function");
- assertFalse("H5.H5Ecreate_msg_minor: " + err_id, err_id < 0);
- H5.H5Eclose_msg(err_id);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Ecreate_msg_minor: " + err);
- }
- }
-
- @Test
- public void testH5Eget_msg() {
- int[] error_msg_type = { HDF5Constants.H5E_MINOR };
- long err_id = -1;
- String msg = null;
- try {
- err_id = H5.H5Ecreate_msg(hdf_java_classid,
- HDF5Constants.H5E_MAJOR, "Error in Test");
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eget_msg: " + err);
- }
- assertFalse("H5.H5Eget_msg: H5Ecreate_msg - " + err_id, err_id < 0);
- try {
- msg = H5.H5Eget_msg(err_id, error_msg_type);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eget_msg: " + err);
- }
- assertNotNull("H5.H5Eget_msg: " + msg, msg);
- assertEquals("H5.H5Eget_msg: ", "Error in Test", msg);
- assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR,
- error_msg_type[0]);
- try {
- H5.H5Eclose_msg(err_id);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eget_msg: " + err);
- }
- }
-
- @Test
public void testH5Eget_msg_major() {
-
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (HDF5LibraryException hdferr) {
+ long errnum = hdferr.getMajorErrorNumber();
int[] error_msg_type = { HDF5Constants.H5E_MAJOR };
String msg = null;
+
try {
- msg = H5.H5Eget_msg(hdferr.getMajorErrorNumber(),
- error_msg_type);
+ msg = H5.H5Eget_msg(errnum, error_msg_type);
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5.H5Eget_msg: " + err);
+ fail("H5.H5Eget_msg(Throwable): " + err);
}
assertNotNull("H5.H5Eget_msg: " + msg, msg);
- assertEquals("H5.H5Eget_msg: ", "Invalid arguments to routine",
- msg);
- assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR,
- error_msg_type[0]);
+ assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, error_msg_type[0]);
+
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error string might be different.
+ * Only check for the specific error message if the native
+ * connector is being used.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null)
+ assertTrue("H5.H5Eget_msg: ", msg.contains("File accessibility"));
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5.H5Eget_msg: " + err);
+ fail("H5.H5Eget_msg(Other): " + err);
}
}
@Test
public void testH5Eget_msg_minor() {
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (HDF5LibraryException hdferr) {
+ long errnum = hdferr.getMinorErrorNumber();
int[] error_msg_type = { HDF5Constants.H5E_MINOR };
String msg = null;
+
try {
- msg = H5.H5Eget_msg(hdferr.getMinorErrorNumber(),
- error_msg_type);
+ msg = H5.H5Eget_msg(errnum, error_msg_type);
}
catch (Throwable err) {
err.printStackTrace();
fail("H5.H5Eget_msg: " + err);
}
assertNotNull("H5.H5Eget_msg: " + msg, msg);
- assertEquals("H5.H5Eget_msg: ", "Inappropriate type", msg);
- assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR,
- error_msg_type[0]);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eget_msg: " + err);
- }
- }
+ assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR, error_msg_type[0]);
- @Test
- public void testH5Ecreate_stack() {
- long stk_id = -1;
- try {
- stk_id = H5.H5Ecreate_stack();
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error string might be different.
+ * Only check for the specific error message if the native
+ * connector is being used.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null)
+ assertTrue("H5.H5Eget_msg: ", msg.contains("Unable to open file"));
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5.H5Ecreate_stack: " + err);
- }
- assertFalse("H5.H5Ecreate_stack: " + stk_id, stk_id < 0);
- try {
- H5.H5Eclose_stack(stk_id);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Ecreate_stack: " + err);
+ fail("H5.H5Eget_msg: " + err);
}
}
@Test
public void testH5Epop() {
+
+ long num_msg = -1;
+ long saved_num_msg = -1;
+
try {
H5.H5Eset_current_stack(current_stackid);
}
@@ -256,12 +159,12 @@ public class TestH5E {
}
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
}
- // save current stack contents
+ // Save current stack contents
try {
current_stackid = H5.H5Eget_current_stack();
}
@@ -270,7 +173,6 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
- long num_msg = -1;
try {
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
}
@@ -289,8 +191,9 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop #:" + num_msg, num_msg == 3);
+ assertTrue("H5.H5Epop #:" + num_msg, num_msg > 0);
+ saved_num_msg = num_msg;
try {
H5.H5Epop(current_stackid, 1);
}
@@ -307,7 +210,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop", num_msg == 2);
+ assertTrue("H5.H5Epop", num_msg == saved_num_msg - 1);
}
@Test
@@ -381,101 +284,6 @@ public class TestH5E {
} /* end test_create() */
@Test
- public void testH5EprintInt() {
- assertFalse(current_stackid < 0);
- try {
- H5.H5Eprint2(current_stackid, null);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5EprintInt: " + err);
- }
- }
-
- @Test
- public void testH5EclearInt() {
- try {
- H5.H5Eclear(current_stackid);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5EclearInt: " + err);
- }
- }
-
- @Test
- public void testH5Eclear2() {
- try {
- H5.H5Eclear2(current_stackid);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eclear2: " + err);
- }
- }
-
- @Test
- public void testH5Eauto_is_v2() {
- boolean is_v2 = false;
- try {
- is_v2 = H5.H5Eauto_is_v2(current_stackid);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eauto_is_v2: " + err);
- }
- assertTrue("H5.H5Eauto_is_v2: ", is_v2);
- }
-
- @Test
- public void testH5Eget_num() {
- long num_msg = -1;
- try {
- num_msg = H5.H5Eget_num(current_stackid);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eget_num: " + err);
- }
- assertTrue("H5.H5Eget_num", num_msg == 0);
- }
-
- @Test
- public void testH5Eget_num_with_msg() {
- try {
- H5.H5Eset_current_stack(current_stackid);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Epop: " + err);
- }
- try {
- H5.H5Fopen("test", 0, 1);
- }
- catch (Throwable err) {
- }
-
- // save current stack contents
- try {
- current_stackid = H5.H5Eget_current_stack();
- }
- catch (HDF5LibraryException err) {
- err.printStackTrace();
- fail("H5.H5Epop: " + err);
- }
-
- long num_msg = -1;
- try {
- num_msg = H5.H5Eget_num(current_stackid);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Epop: " + err);
- }
- assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0);
- }
-
- @Test
public void testH5Ewalk() {
class wdata {
public String err_desc = null;
@@ -509,12 +317,12 @@ public class TestH5E {
fail("testH5Ewalk:H5Eset_current_stack " + err);
}
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
}
- // save current stack contents
+ // Save current stack contents
try {
current_stackid = H5.H5Eget_current_stack();
}
@@ -530,7 +338,7 @@ public class TestH5E {
err.printStackTrace();
fail("testH5Ewalk:H5Eget_num " + err);
}
- assertTrue("testH5Ewalk #:" + num_msg, num_msg == 3);
+ assertTrue("testH5Ewalk #:" + num_msg, num_msg > 0);
try {
H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data);
@@ -540,12 +348,8 @@ public class TestH5E {
fail("testH5Ewalk:H5Ewalk2 " + err);
}
assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty());
- assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==3);
- assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).line,((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).line==3765);
- assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).line,((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).line==5504);
- assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).func_name,((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).func_name.compareToIgnoreCase("H5P_verify_apl_and_dxpl")==0);
- assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).err_desc,((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).err_desc.compareToIgnoreCase("not a property list")==0);
- assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).err_desc,((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).err_desc.compareToIgnoreCase("not the required access property list")==0);
+ assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size() > 0);
}
}
+
diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java
index 835ccba..0e55bcc 100644
--- a/java/test/TestH5Edefault.java
+++ b/java/test/TestH5Edefault.java
@@ -24,11 +24,14 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.junit.Ignore;
import org.junit.rules.TestName;
public class TestH5Edefault {
@Rule public TestName testname = new TestName();
+ public static final int ERRSTACK_CNT = 6;
+
@Before
public void H5Eset_default_stack() {
assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
@@ -53,37 +56,47 @@ public class TestH5Edefault {
H5.H5Eprint2(-1, null);
}
- @Test
+ @Ignore
public void testH5Eprint() {
- try {
- H5.H5Fopen("test", 0, 1);
- }
- catch (Throwable err) {
- }
- try {
- H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5Eprint: " + err);
- }
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error stack might be different.
+ * Only check for the specific error stack if the native
+ * connector is being used.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null) {
+ try {
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ }
+ try {
+ H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eprint: " + err);
+ }
+ }
}
@Test
public void testH5Eget_current_stack() {
long num_msg = -1;
long num_msg_default = -1;
+ long saved_num_msg = -1;
long stack_id = -1;
long stack_id_default = HDF5Constants.H5E_DEFAULT;
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
//default stack id will be different after exception
stack_id_default = HDF5Constants.H5E_DEFAULT;
//err.printStackTrace(); //This will clear the error stack
}
- // Verify we have the correct number of messages
+ // Verify we have messages on the error stack
try {
num_msg_default = H5.H5Eget_num(stack_id_default);
}
@@ -91,10 +104,10 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default,
- num_msg_default == 3);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0);
+ saved_num_msg = num_msg_default;
- //Save a copy of the current stack and clears the current stack
+ // Save a copy of the current stack and clear the current stack
try {
stack_id = H5.H5Eget_current_stack();
}
@@ -102,12 +115,10 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertFalse("H5.H5Eget_current_stack: get_current_stack - "
- + stack_id, stack_id < 0);
- assertFalse("H5.H5Eget_current_stack: get_current_stack - "
- + stack_id, stack_id == stack_id_default);
+ assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id < 0);
+ assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id == stack_id_default);
- // Verify we have the correct number of messages
+ // Verify the default stack is empty
try {
num_msg_default = H5.H5Eget_num(stack_id_default);
}
@@ -115,10 +126,9 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default,
- num_msg_default == 0);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0);
- //Verify the copy has the correct number of messages
+ // Verify the copy has the same number of messages as the original
try {
num_msg = H5.H5Eget_num(stack_id);
}
@@ -126,8 +136,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg,
- num_msg == 3);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg);
try {
H5.H5Eclose_stack(stack_id);
@@ -142,15 +151,16 @@ public class TestH5Edefault {
public void testH5Eget_current_stack_pop() {
long num_msg = -1;
long num_msg_default = -1;
+ long saved_num_msg = -1;
long stack_id = -1;
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
//err.printStackTrace(); //This will clear the error stack
}
- // Verify we have the correct number of messages
+ // Verify there are error messages on the stack and save it
try {
num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
}
@@ -158,10 +168,10 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default,
- num_msg_default == 3);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0);
+ saved_num_msg = num_msg_default;
- //Save a copy of the current stack and clears the current stack
+ // Save a copy of the current stack and clear the current stack
try {
stack_id = H5.H5Eget_current_stack();
}
@@ -169,12 +179,10 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertFalse("H5.H5Eget_current_stack: get_current_stack - "
- + stack_id, stack_id < 0);
- assertFalse("H5.H5Eget_current_stack: get_current_stack - "
- + stack_id, stack_id == HDF5Constants.H5E_DEFAULT);
+ assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id < 0);
+ assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT);
- // Verify we have the correct number of messages
+ // Verify the stack is empty
try {
num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
}
@@ -182,10 +190,9 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default,
- num_msg_default == 0);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0);
- //Verify the copy has the correct number of messages
+ // Verify the copy has the correct number of messages
try {
num_msg = H5.H5Eget_num(stack_id);
}
@@ -193,18 +200,17 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg,
- num_msg == 3);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg);
- //Generate errors on default stack
+ // Generate errors on default stack
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
//err.printStackTrace(); //This will clear the error stack
}
- // Verify we have the correct number of messages
+ // Verify we have a nonzero number of messages and save it
try {
num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
}
@@ -212,10 +218,10 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default,
- num_msg_default == 3);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0);
+ saved_num_msg = num_msg;
- //Remove one message from the current stack
+ // Remove one message from the current stack
try {
H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1);
num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -224,10 +230,9 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default,
- num_msg_default == 2);
+ assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == saved_num_msg - 1);
- //Verify the copy still has the correct number of messages
+ // Verify the copy still has the old number of messages
try {
num_msg = H5.H5Eget_num(stack_id);
}
@@ -235,8 +240,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg,
- num_msg == 3);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg);
}
@Test(expected = IllegalArgumentException.class)
@@ -249,7 +253,7 @@ public class TestH5Edefault {
H5.H5Eget_class_name(-1);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = HDF5LibraryException.class)
public void testH5Eget_class_name_invalid_classname() throws Throwable {
H5.H5Eget_class_name(HDF5Constants.H5E_DEFAULT);
}
@@ -291,14 +295,17 @@ public class TestH5Edefault {
public void testH5Eset_current_stack() {
long num_msg = -1;
long stack_id = -1;
+ long saved_num_msg = -1;
+
+ // Generate errors on the default stack
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
//err.printStackTrace(); //This will clear the error stack
}
- // Verify we have the correct number of messages
+ // Verify we have a nonzero number of messages and save it
try {
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
}
@@ -306,10 +313,10 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg,
- num_msg == 3);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg > 0);
+ saved_num_msg = num_msg;
- //Save a copy of the current stack
+ // Save a copy of the current stack
try {
stack_id = H5.H5Eget_current_stack();
}
@@ -317,12 +324,10 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertFalse("H5.H5Eset_current_stack: get_current_stack - "
- + stack_id, stack_id < 0);
- assertFalse("H5.H5Eset_current_stack: get_current_stack - "
- + stack_id, stack_id == HDF5Constants.H5E_DEFAULT);
+ assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id < 0);
+ assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT);
- //Verify the copy has the correct number of messages
+ // Verify the copy has the same number of messages as the original stack
try {
num_msg = H5.H5Eget_num(stack_id);
}
@@ -330,18 +335,17 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg,
- num_msg == 3);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg);
- //Generate errors on default stack
+ // Generate errors on default stack (again, in the same way)
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
//err.printStackTrace(); //This will clear the error stack
}
- // Verify we have the correct number of messages
+ // Verify we have the same number of messages as before
try {
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
}
@@ -349,10 +353,9 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg,
- num_msg == 3);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg);
- //Remove one message from the current stack
+ // Remove one message from the current stack
try {
H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1);
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -361,10 +364,9 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg,
- num_msg == 2);
+ assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == saved_num_msg - 1);
- //Verify the copy still has the correct number of messages
+ // Verify the copy still has the correct number of messages
try {
num_msg = H5.H5Eget_num(stack_id);
}
@@ -372,9 +374,9 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg,
- num_msg == 3);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg);
+ // Set the current stack to be the default and try that again
try {
H5.H5Eset_current_stack(stack_id);
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -383,8 +385,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg,
- num_msg == 3);
+ assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == saved_num_msg);
}
@Test(expected = IllegalArgumentException.class)
@@ -395,8 +396,9 @@ public class TestH5Edefault {
@Test
public void testH5Epop() throws Throwable {
long num_msg = -1;
+ long saved_num_msg = -1;
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
}
@@ -407,7 +409,8 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop before #:" + num_msg, num_msg == 3);
+ assertTrue("H5.H5Epop before #:" + num_msg, num_msg > 0);
+ saved_num_msg = num_msg;
try {
H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1);
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -416,7 +419,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop after #:" + num_msg, num_msg == 2);
+ assertTrue("H5.H5Epop after #:" + num_msg, num_msg == saved_num_msg - 1);
}
@Test(expected = IllegalArgumentException.class)
@@ -434,20 +437,29 @@ public class TestH5Edefault {
H5.H5Eprint2(-1, null);
}
- @Test
+ @Ignore
public void testH5EprintInt() {
- try {
- H5.H5Fopen("test", 0, 1);
- }
- catch (Throwable err) {
- }
- try {
- H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5.H5EprintInt: " + err);
- }
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error stack might be different.
+ * Only check for the specific error stack if the native
+ * connector is being used.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null) {
+ try {
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ }
+ try {
+ H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5EprintInt: " + err);
+ }
+ }
}
@Test
@@ -481,7 +493,7 @@ public class TestH5Edefault {
public void testH5Eclear2_with_msg() {
long num_msg = -1;
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
}
@@ -492,8 +504,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eclear2_with_msg: " + err);
}
- assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg,
- num_msg == 3);
+ assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg > 0);
try {
H5.H5Eclear2(HDF5Constants.H5E_DEFAULT);
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -502,7 +513,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eclear2_with_msg: " + err);
}
- assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == 0);
+ assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == 0);
}
@Test(expected = IllegalArgumentException.class)
@@ -545,7 +556,7 @@ public class TestH5Edefault {
public void testH5Eget_num_with_msg() {
long num_msg = -1;
try {
- H5.H5Fopen("test", 0, 1);
+ H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
}
@@ -560,3 +571,4 @@ public class TestH5Edefault {
}
}
+
diff --git a/java/test/TestH5Eparams.java b/java/test/TestH5Eparams.java
new file mode 100644
index 0000000..0c55577
--- /dev/null
+++ b/java/test/TestH5Eparams.java
@@ -0,0 +1,282 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+
+import hdf.hdf5lib.H5;
+import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
+import hdf.hdf5lib.callbacks.H5E_walk_cb;
+import hdf.hdf5lib.callbacks.H5E_walk_t;
+import hdf.hdf5lib.structs.H5E_error2_t;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+public class TestH5Eparams {
+ @Rule public TestName testname = new TestName();
+ long hdf_java_classid = -1;
+ long current_stackid = -1;
+
+ @Before
+ public void H5Eget_stack_class() {
+ assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ System.out.print(testname.getMethodName());
+
+ hdf_java_classid = -1;
+ try {
+ hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", "hdf-java", "2.5");
+ current_stackid = H5.H5Eget_current_stack();
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eget_stack_class: " + err);
+ }
+ }
+
+ @After
+ public void H5Erestore_stack_class() {
+ try {
+ H5.H5Eunregister_class(hdf_java_classid);
+ hdf_java_classid = -1;
+ H5.H5Eclose_stack(current_stackid);
+ current_stackid = -1;
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Erestore_stack_class: " + err);
+ }
+ System.out.println();
+ }
+
+ @Test
+ public void testH5Eget_class_name() {
+ try {
+ String class_name = H5.H5Eget_class_name(hdf_java_classid);
+ assertNotNull("H5.H5Eget_class_name: " + class_name, class_name);
+ assertEquals("H5.H5Eget_class_name: ", "HDF-Java-Error", class_name);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eget_class_name: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Eprint2() {
+ try {
+ assertFalse(current_stackid < 0);
+ H5.H5Eprint2(current_stackid, null);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eprint2: " + err);
+ }
+ }
+
+ @Ignore("Tested with create_msg_major[minor]")
+ public void testH5Eclose_msg() {
+ fail("Not yet implemented");
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Ecreate_msg_name_null() throws Throwable {
+ H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, null);
+ }
+
+ @Test
+ public void testH5Ecreate_msg_major() {
+ try {
+ long err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, "Error in Test");
+ assertFalse("H5.H5Ecreate_msg_major: " + err_id, err_id < 0);
+ H5.H5Eclose_msg(err_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Ecreate_msg_major: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Ecreate_msg_minor() {
+ try {
+ long err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MINOR, "Error in Test Function");
+ assertFalse("H5.H5Ecreate_msg_minor: " + err_id, err_id < 0);
+ H5.H5Eclose_msg(err_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Ecreate_msg_minor: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Eget_msg() {
+ int[] error_msg_type = { HDF5Constants.H5E_MINOR };
+ long err_id = -1;
+ String msg = null;
+ try {
+ err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, "Error in Test");
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eget_msg: " + err);
+ }
+ assertFalse("H5.H5Eget_msg: H5Ecreate_msg - " + err_id, err_id < 0);
+ try {
+ msg = H5.H5Eget_msg(err_id, error_msg_type);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eget_msg: " + err);
+ }
+ assertNotNull("H5.H5Eget_msg: " + msg, msg);
+ assertEquals("H5.H5Eget_msg: ", "Error in Test", msg);
+ assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, error_msg_type[0]);
+ try {
+ H5.H5Eclose_msg(err_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eget_msg: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Ecreate_stack() {
+ long stk_id = -1;
+ try {
+ stk_id = H5.H5Ecreate_stack();
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Ecreate_stack: " + err);
+ }
+ assertFalse("H5.H5Ecreate_stack: " + stk_id, stk_id < 0);
+ try {
+ H5.H5Eclose_stack(stk_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Ecreate_stack: " + err);
+ }
+ }
+
+ @Test
+ public void testH5EprintInt() {
+ assertFalse(current_stackid < 0);
+ try {
+ H5.H5Eprint2(current_stackid, null);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5EprintInt: " + err);
+ }
+ }
+
+ @Test
+ public void testH5EclearInt() {
+ try {
+ H5.H5Eclear(current_stackid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5EclearInt: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Eclear2() {
+ try {
+ H5.H5Eclear2(current_stackid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eclear2: " + err);
+ }
+ }
+
+ @Test
+ public void testH5Eauto_is_v2() {
+ boolean is_v2 = false;
+ try {
+ is_v2 = H5.H5Eauto_is_v2(current_stackid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eauto_is_v2: " + err);
+ }
+ assertTrue("H5.H5Eauto_is_v2: ", is_v2);
+ }
+
+ @Test
+ public void testH5Eget_num() {
+ long num_msg = -1;
+ try {
+ num_msg = H5.H5Eget_num(current_stackid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Eget_num: " + err);
+ }
+ assertTrue("H5.H5Eget_num", num_msg == 0);
+ }
+
+ @Test
+ public void testH5Eget_num_with_msg() {
+ try {
+ H5.H5Eset_current_stack(current_stackid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Epop: " + err);
+ }
+ try {
+ H5.H5Fopen("test", 0, 1);
+ }
+ catch (Throwable err) {
+ }
+
+ // save current stack contents
+ try {
+ current_stackid = H5.H5Eget_current_stack();
+ }
+ catch (HDF5LibraryException err) {
+ err.printStackTrace();
+ fail("H5.H5Epop: " + err);
+ }
+
+ long num_msg = -1;
+ try {
+ num_msg = H5.H5Eget_num(current_stackid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Epop: " + err);
+ }
+ assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0);
+ }
+
+}
diff --git a/java/test/TestH5Eregister.java b/java/test/TestH5Eregister.java
index 742b47f..1b87699 100644
--- a/java/test/TestH5Eregister.java
+++ b/java/test/TestH5Eregister.java
@@ -60,8 +60,7 @@ public class TestH5Eregister {
public void testH5Eregister_class() {
long hdf_java_classid = -1;
try {
- hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error",
- "hdf-java", "2.5");
+ hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", "hdf-java", "2.5");
}
catch (Throwable err) {
fail("H5.H5Eregister_class: " + err);
diff --git a/java/test/TestH5F.java b/java/test/TestH5F.java
index ac2f70d..869b45c 100644
--- a/java/test/TestH5F.java
+++ b/java/test/TestH5F.java
@@ -14,6 +14,7 @@
package test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -31,7 +32,8 @@ import org.junit.rules.TestName;
public class TestH5F {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "test.h5";
+ private static final String H5_FILE = "testF.h5";
+ private static final String H5_FILE2 = "testF2.h5";
private static final int COUNT_OBJ_FILE = 1;
private static final int COUNT_OBJ_DATASET = 0;
@@ -94,28 +96,12 @@ public class TestH5F {
@Test(expected = HDF5LibraryException.class)
public void testH5Fget_create_plist_closed() throws Throwable {
- long fid = -1;
-
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
- }
-
- try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- fail("H5.H5Fopen: " + err);
- }
- try {
- H5.H5Fclose(fid);
- }
- catch (Exception ex) {
}
// it should fail because the file was closed.
- H5.H5Fget_create_plist(fid);
+ H5.H5Fget_create_plist(H5fid);
}
@Test
@@ -134,34 +120,17 @@ public class TestH5F {
@Test(expected = HDF5LibraryException.class)
public void testH5Fget_access_plist_closed() throws Throwable {
- long fid = -1;
-
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
- }
-
- try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
- HDF5Constants.H5P_DEFAULT);
- }
- catch (Throwable err) {
- fail("H5.H5Fopen: " + err);
- }
- try {
- H5.H5Fclose(fid);
- }
- catch (Exception ex) {
}
// it should fail because the file was closed.
- H5.H5Fget_access_plist(fid);
+ H5.H5Fget_access_plist(H5fid);
}
@Test
public void testH5Fget_intent_rdwr() {
int intent = 0;
- long fid = -1;
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
@@ -169,31 +138,24 @@ public class TestH5F {
}
try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
}
try {
- intent = H5.H5Fget_intent(fid);
+ intent = H5.H5Fget_intent(H5fid);
}
catch (Throwable err) {
fail("H5.H5Fget_intent: " + err);
}
assertEquals(HDF5Constants.H5F_ACC_RDWR, intent);
-
- try {
- H5.H5Fclose(fid);
- }
- catch (Exception ex) {
- }
}
@Test
public void testH5Fget_intent_rdonly() {
int intent = 0;
- long fid = -1;
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
@@ -201,24 +163,76 @@ public class TestH5F {
}
try {
- fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY,
+ H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY,
HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
}
try {
- intent = H5.H5Fget_intent(fid);
+ intent = H5.H5Fget_intent(H5fid);
}
catch (Throwable err) {
fail("H5.H5Fget_intent: " + err);
}
assertEquals(HDF5Constants.H5F_ACC_RDONLY, intent);
+ }
+
+ @Test
+ public void testH5Fget_fileno_same() {
+ long fileno1 = 0;
+ long fileno2 = 0;
+ long fid1 = -1;
+ long fid2 = -1;
try {
- H5.H5Fclose(fid);
+ fid1 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5.H5Fflush(fid1, HDF5Constants.H5F_SCOPE_LOCAL);
+ assertTrue("H5Fcreate failed", fid1 > 0);
+ fid2 = H5.H5Fopen(H5_FILE2, HDF5Constants.H5F_ACC_RDWR,
+ HDF5Constants.H5P_DEFAULT);
+ assertTrue("H5Fopen failed", fid2 > 0);
+ fileno1 = H5.H5Fget_fileno(fid1);
+ assertTrue("H5Fget_fileno1="+fileno1, fileno1 > 0);
+ fileno2 = H5.H5Fget_fileno(fid2);
+ assertTrue("H5Fget_fileno2="+fileno2, fileno2 > 0);
+
+ assertEquals("fileno1["+fileno1+"]!=fileno2["+fileno2+"]", fileno1, fileno2);
+ }
+ catch (Throwable err) {
+ fail("testH5Fget_fileno_same: " + err);
+ }
+ finally {
+ H5.H5Fclose(fid1);
+ H5.H5Fclose(fid2);
+ }
+ }
+
+ @Test
+ public void testH5Fget_fileno_diff() {
+ long fileno1 = 0;
+ long fileno2 = 0;
+ long fid2 = -1;
+
+ try {
+ fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5.H5Fflush(fid2, HDF5Constants.H5F_SCOPE_LOCAL);
+ assertTrue("H5Fcreate failed", fid2 > 0);
+
+ fileno1 = H5.H5Fget_fileno(H5fid);
+ assertTrue("H5Fget_fileno1="+fileno1, fileno1 > 0);
+ fileno2 = H5.H5Fget_fileno(fid2);
+ assertTrue("H5Fget_fileno2="+fileno2, fileno2 > 0);
+
+ assertNotEquals("fileno1["+fileno1+"]==fileno2["+fileno2+"]", fileno1, fileno2);
+ }
+ catch (Throwable err) {
+ fail("testH5Fget_fileno_diff: " + err);
}
- catch (Exception ex) {
+ finally {
+ H5.H5Fclose(fid2);
}
}
diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java
index faf0bf7..72a3c23 100644
--- a/java/test/TestH5Fbasic.java
+++ b/java/test/TestH5Fbasic.java
@@ -14,6 +14,7 @@
package test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -32,8 +33,8 @@ import org.junit.rules.TestName;
public class TestH5Fbasic {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "test.h5";
- private static final String TXT_FILE = "test.txt";
+ private static final String H5_FILE = "testFb.h5";
+ private static final String TXT_FILE = "testFb.txt";
long H5fid = -1;
private final void _deleteFile(String filename) {
@@ -69,14 +70,14 @@ public class TestH5Fbasic {
}
@Test
- public void testH5Fis_hdf5() {
+ public void testH5Fis_accessible() {
boolean isH5 = false;
try {
- isH5 = H5.H5Fis_hdf5(H5_FILE);
+ isH5 = H5.H5Fis_accessible(H5_FILE, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- fail("H5.H5Fis_hdf5 failed on " + H5_FILE + ": " + err);
+ fail("H5.H5Fis_accessible failed on " + H5_FILE + ": " + err);
}
assertTrue(isH5 == true);
}
@@ -315,4 +316,20 @@ public class TestH5Fbasic {
fail("H5.H5Freset_mdc_hit_rate_stats: " + err);
}
}
+
+ @Test
+ public void testH5F_dset_no_attrs_hint() {
+ boolean ret_val_id = true;
+ try {
+ ret_val_id = H5.H5Fget_dset_no_attrs_hint(H5fid);
+ assertFalse("H5F_dset_no_attrs_hint", ret_val_id);
+ H5.H5Fset_dset_no_attrs_hint(H5fid, true);
+ ret_val_id = H5.H5Fget_dset_no_attrs_hint(H5fid);
+ assertTrue("H5F_dset_no_attrs_hint", ret_val_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5F_dset_no_attrs_hint: " + err);
+ }
+ }
}
diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java
index fffded1..6b541c6 100644
--- a/java/test/TestH5Fparams.java
+++ b/java/test/TestH5Fparams.java
@@ -22,10 +22,12 @@ import java.io.File;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
import hdf.hdf5lib.structs.H5F_info2_t;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@@ -55,8 +57,8 @@ public class TestH5Fparams {
}
@Test(expected = NullPointerException.class)
- public void testH5Fis_hdf5_null() throws Throwable {
- H5.H5Fis_hdf5(null);
+ public void testH5Fis_accessible_null() throws Throwable {
+ H5.H5Fis_accessible(null, -1);
}
@Test(expected = NullPointerException.class)
@@ -69,7 +71,7 @@ public class TestH5Fparams {
H5.H5Funmount(-1, null);
}
- @Test
+ @Ignore
public void testH5Fis_hdf5_text() {
File txtFile = null;
boolean isH5 = false;
@@ -190,7 +192,7 @@ public class TestH5Fparams {
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- fail("H5.H5Fopen: " + err);
+ fail("H5.H5Fcreate: " + err);
}
try {
@@ -210,4 +212,42 @@ public class TestH5Fparams {
try {H5.H5Fclose(fid);} catch (Exception ex) {}
}
}
+
+ @Ignore//(expected = HDF5FunctionArgumentException.class)
+ public void testH5Fset_libver_bounds_invalidlow() throws Throwable {
+ long fid = -1;
+
+ try {
+ try {
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ fail("H5.H5Fcreate: " + err);
+ }
+ H5.H5Fset_libver_bounds(fid, 5, HDF5Constants.H5F_LIBVER_LATEST);
+ }
+ finally {
+ try {H5.H5Fclose(fid);} catch (Exception ex) {}
+ }
+ }
+
+ @Ignore//(expected = HDF5FunctionArgumentException.class)
+ public void testH5Fset_libver_bounds_invalidhigh() throws Throwable {
+ long fid = -1;
+
+ try {
+ try {
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ fail("H5.H5Fcreate: " + err);
+ }
+ H5.H5Fset_libver_bounds(fid, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST+1);
+ }
+ finally {
+ try {H5.H5Fclose(fid);} catch (Exception ex) {}
+ }
+ }
}
diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java
index 1a67990..4b6d470 100644
--- a/java/test/TestH5G.java
+++ b/java/test/TestH5G.java
@@ -24,6 +24,7 @@ import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5G_info_t;
+import hdf.hdf5lib.structs.H5O_token_t;
import org.junit.After;
import org.junit.Before;
@@ -33,8 +34,8 @@ import org.junit.rules.TestName;
public class TestH5G {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "test.h5";
- private static final String H5_FILE2 = "test2.h5";
+ private static final String H5_FILE = "testG.h5";
+ private static final String H5_FILE2 = "testG2.h5";
private static final String[] GROUPS = { "/G1", "/G1/G11", "/G1/G12",
"/G1/G11/G111", "/G1/G11/G112", "/G1/G11/G113", "/G1/G11/G114" };
private static final String[] GROUPS2 = { "/G1", "/G1/G14", "/G1/G12", "/G1/G13", "/G1/G11"};
@@ -286,12 +287,12 @@ public class TestH5G {
String objNames[] = new String[(int) info.nlinks];
int objTypes[] = new int[(int) info.nlinks];
int lnkTypes[] = new int[(int) info.nlinks];
- long objRefs[] = new long[(int) info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_all(H5fid, GROUPS[0], objNames,
- objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME);
+ objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
@@ -317,14 +318,14 @@ public class TestH5G {
assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: ", info);
assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number of links is empty", info.nlinks > 0);
String objNames[] = new String[(int) info.nlinks];
- long objRefs[] = new long[(int) info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
int lnkTypes[] = new int[(int) info.nlinks];
int objTypes[] = new int[(int) info.nlinks];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes,
- objRefs, HDF5Constants.H5_INDEX_NAME);
+ objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
@@ -358,14 +359,14 @@ public class TestH5G {
assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: ", info);
assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number of links is empty", info.nlinks > 0);
String objNames[] = new String[(int) info.nlinks];
- long objRefs[] = new long[(int) info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
int lnkTypes[] = new int[(int) info.nlinks];
int objTypes[] = new int[(int) info.nlinks];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes,
- objRefs, HDF5Constants.H5_INDEX_NAME);
+ objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
@@ -395,12 +396,12 @@ public class TestH5G {
String objNames[] = new String[(int)groups_max_size];
int objTypes[] = new int[(int)groups_max_size];
int lnkTypes[] = new int[(int)groups_max_size];
- long objRefs[] = new long[(int)groups_max_size];
+ H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes,
- objRefs, groups_max_size);
+ objTokens, groups_max_size);
}
catch (Throwable err) {
err.printStackTrace();
@@ -426,12 +427,12 @@ public class TestH5G {
String objNames[] = new String[(int)groups_max_size];
int objTypes[] = new int[(int)groups_max_size];
int lnkTypes[] = new int[(int)groups_max_size];
- long objRefs[] = new long[(int)groups_max_size];
+ H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes,
- objRefs, groups_max_size);
+ objTokens, groups_max_size);
}
catch (Throwable err) {
err.printStackTrace();
@@ -471,11 +472,11 @@ public class TestH5G {
String objNames[] = new String[(int) info.nlinks];
int objTypes[] = new int[(int) info.nlinks];
int lnkTypes[] = new int[(int) info.nlinks];
- long objRefs[] = new long[(int) info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
try {
H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames,
- objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_CRT_ORDER);
+ objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_CRT_ORDER);
}
catch (Throwable err) {
err.printStackTrace();
@@ -488,7 +489,7 @@ public class TestH5G {
try {
H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames,
- objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME);
+ objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/TestH5Gbasic.java b/java/test/TestH5Gbasic.java
index 6ff7d03..202f6ff 100644
--- a/java/test/TestH5Gbasic.java
+++ b/java/test/TestH5Gbasic.java
@@ -32,7 +32,7 @@ import org.junit.rules.TestName;
public class TestH5Gbasic {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "test.h5";
+ private static final String H5_FILE = "testGb.h5";
long H5fid = -1;
private final long _createGroup(long fid, String name) {
diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java
index 06c59e7..9514837 100644
--- a/java/test/TestH5Giterate.java
+++ b/java/test/TestH5Giterate.java
@@ -20,6 +20,7 @@ import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5G_info_t;
+import hdf.hdf5lib.structs.H5O_token_t;
import org.junit.After;
import org.junit.Before;
@@ -93,12 +94,12 @@ public class TestH5Giterate {
String objNames[] = new String[(int) info.nlinks];
int objTypes[] = new int[(int) info.nlinks];
int lnkTypes[] = new int[(int) info.nlinks];
- long objRefs[] = new long[(int) info.nlinks];
+ H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks];
int names_found = 0;
try {
names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames,
- objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME);
+ objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME);
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java
index 9e832f3..3bea1ee 100644
--- a/java/test/TestH5Lbasic.java
+++ b/java/test/TestH5Lbasic.java
@@ -21,8 +21,8 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5L_iterate_cb;
import hdf.hdf5lib.callbacks.H5L_iterate_t;
+import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5L_info_t;
@@ -34,7 +34,7 @@ import org.junit.rules.TestName;
public class TestH5Lbasic {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "h5ex_g_iterate.hdf";
+ private static final String H5_FILE = "h5ex_g_iterateL1.hdf";
long H5fid = -1;
@Before
@@ -119,9 +119,8 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info ",link_info==null);
+ assertFalse("H5Lget_info",link_info==null);
assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD);
- assertTrue("Link Address ",link_info.address_val_size>0);
}
@Test(expected = HDF5LibraryException.class)
@@ -155,7 +154,7 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("H5Lget_info_by_idx ",link_info==null);
+ assertFalse("H5Lget_info_by_idx",link_info==null);
assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD);
try {
link_info2 = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
@@ -164,7 +163,7 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size);
+ assertTrue("Link Value Size", link_info.val_size == link_info2.val_size);
}
@Test
@@ -178,7 +177,7 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info_by_idx: " + err);
}
- assertFalse("H5Lget_info_by_idx ",link_info==null);
+ assertFalse("H5Lget_info_by_idx",link_info==null);
assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD);
try {
link_info2 = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
@@ -187,7 +186,7 @@ public class TestH5Lbasic {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size);
+ assertTrue("Link Value Size", link_info.val_size == link_info2.val_size);
}
@Test(expected = HDF5LibraryException.class)
@@ -233,18 +232,18 @@ public class TestH5Lbasic {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data);
}
@@ -271,18 +270,18 @@ public class TestH5Lbasic {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Lvisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
}
@@ -305,18 +304,18 @@ public class TestH5Lbasic {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data);
}
@@ -342,18 +341,18 @@ public class TestH5Lbasic {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Literate_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
}
diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java
index dcb076d..c8f2348 100644
--- a/java/test/TestH5Lcreate.java
+++ b/java/test/TestH5Lcreate.java
@@ -22,8 +22,8 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5L_iterate_cb;
import hdf.hdf5lib.callbacks.H5L_iterate_t;
+import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5L_info_t;
@@ -37,8 +37,8 @@ import org.junit.rules.TestName;
public class TestH5Lcreate {
@Rule public TestName testname = new TestName();
- private static final String H5_EXTFILE = "h5ex_g_iterate.hdf";
- private static final String H5_FILE = "test.h5";
+ private static final String H5_EXTFILE = "h5ex_g_iterateL2.hdf";
+ private static final String H5_FILE = "testL.h5";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
long H5fcpl = -1;
@@ -147,6 +147,13 @@ public class TestH5Lcreate {
H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED);
H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
H5fcpl, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5L.createH5file: " + err);
+ }
+ assertTrue("TestH5L.createH5file: H5.H5Fcreate: ",H5fid > 0);
+ try {
H5dsid = H5.H5Screate_simple(2, H5dims, null);
H5did1 = _createDataset(H5fid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT);
H5gid = _createGroup(H5fid, "/G1");
@@ -154,9 +161,8 @@ public class TestH5Lcreate {
}
catch (Throwable err) {
err.printStackTrace();
- fail("TestH5L.createH5file: " + err);
+ fail("TestH5L.createH5objs: " + err);
}
- assertTrue("TestH5L.createH5file: H5.H5Fcreate: ",H5fid > 0);
assertTrue("TestH5L.createH5file: H5.H5Screate_simple: ",H5dsid > 0);
assertTrue("TestH5L.createH5file: H5.H5Gcreate: ",H5gid > 0);
@@ -314,9 +320,9 @@ public class TestH5Lcreate {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info ", link_info==null);
+ assertFalse("H5Lget_info", link_info==null);
assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT);
- assertTrue("Link Address ", link_info.address_val_size>0);
+ assertTrue("Link Value Size", link_info.val_size > 0);
}
@Test
@@ -377,9 +383,9 @@ public class TestH5Lcreate {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info ", link_info==null);
+ assertFalse("H5Lget_info", link_info==null);
assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT);
- assertTrue("Link Address ", link_info.address_val_size>0);
+ assertTrue("Link Value Size", link_info.val_size > 0);
}
@Test
@@ -425,9 +431,9 @@ public class TestH5Lcreate {
err.printStackTrace();
fail("H5.H5Lget_info: " + err);
}
- assertFalse("H5Lget_info ", link_info==null);
+ assertFalse("H5Lget_info", link_info==null);
assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL);
- assertTrue("Link Address ", link_info.address_val_size>0);
+ assertTrue("Link Value Size", link_info.val_size > 0);
}
@Test
@@ -734,18 +740,18 @@ public class TestH5Lcreate {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data);
}
@@ -786,18 +792,18 @@ public class TestH5Lcreate {
this.link_type = type;
}
}
- class H5L_iter_data implements H5L_iterate_t {
+ class H5L_iter_data implements H5L_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5L_iterate_t iter_data = new H5L_iter_data();
- class H5L_iter_callback implements H5L_iterate_cb {
- public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) {
+ H5L_iterate_opdata_t iter_data = new H5L_iter_data();
+ class H5L_iter_callback implements H5L_iterate_t {
+ public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5L_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5L_iterate_cb iter_cb = new H5L_iter_callback();
+ H5L_iterate_t iter_cb = new H5L_iter_callback();
try {
H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, iter_cb, iter_data);
}
diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java
index 923d2b1..20ffc41 100644
--- a/java/test/TestH5Obasic.java
+++ b/java/test/TestH5Obasic.java
@@ -21,10 +21,14 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5O_iterate_cb;
import hdf.hdf5lib.callbacks.H5O_iterate_t;
+import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5O_info_t;
+import hdf.hdf5lib.structs.H5O_native_info_t;
+import hdf.hdf5lib.structs.H5O_token_t;
+import hdf.hdf5lib.structs.H5O_hdr_info_t;
+import hdf.hdf5lib.structs.H5_ih_info_t;
import org.junit.After;
import org.junit.Before;
@@ -34,11 +38,9 @@ import org.junit.rules.TestName;
public class TestH5Obasic {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "h5ex_g_iterate.hdf";
- private static long H5la_ds1 = -1;
- private static long H5la_l1 = -1;
- private static long H5la_dt1 = -1;
- private static long H5la_g1 = -1;
+ private static final String H5_FILE = "h5ex_g_iterateO1.hdf";
+ private static H5O_token_t H5la_ds1 = null;
+ private static H5O_token_t H5la_l1 = null;
long H5fid = -1;
@Before
@@ -242,7 +244,7 @@ public class TestH5Obasic {
err.printStackTrace();
fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info: " + err);
}
- H5la_ds1 = obj_info.addr;
+ H5la_ds1 = obj_info.token;
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
@@ -253,7 +255,7 @@ public class TestH5Obasic {
}
assertFalse("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx ",obj_info==null);
assertTrue("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("testH5Oget_info_by_idx_n0:Link Address ",obj_info.addr==H5la_ds1);
+ assertTrue("testH5Oget_info_by_idx_n0:Link Object token", obj_info.token.equals(H5la_ds1));
}
@Test
@@ -268,7 +270,7 @@ public class TestH5Obasic {
err.printStackTrace();
fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info: " + err);
}
- H5la_l1 = obj_info.addr;
+ H5la_l1 = obj_info.token;
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
@@ -279,7 +281,263 @@ public class TestH5Obasic {
}
assertFalse("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx ",obj_info==null);
assertTrue("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("testH5Oget_info_by_idx_n3:Link Address ",obj_info.addr==H5la_l1);
+ assertTrue("testH5Oget_info_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1));
+ }
+
+ @Test
+ public void testH5Oget_native_info_dataset() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info: " + err);
+ }
+ assertFalse("H5Oget_native_info ", native_info == null);
+ assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info ", native_info.attr_info == null);
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ }
+
+ @Test
+ public void testH5Oget_native_info_hardlink() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info: " + err);
+ }
+ assertFalse("H5Oget_native_info ", native_info == null);
+ assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info ", native_info.attr_info == null);
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ }
+
+ @Test
+ public void testH5Oget_native_info_group() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info: " + err);
+ }
+ assertFalse("H5Oget_native_info ", native_info == null);
+ assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info ", native_info.attr_info == null);
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ }
+
+ @Test
+ public void testH5Oget_native_info_datatype() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info: " + err);
+ }
+ assertFalse("H5Oget_native_info ", native_info == null);
+ assertFalse("H5Oget_native_info ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info ", native_info.attr_info == null);
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_name_not_exist_name() throws Throwable {
+ H5.H5Oget_native_info_by_name(H5fid, "None", HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_name_not_exists() throws Throwable {
+ H5.H5Oget_native_info_by_name(H5fid, "Bogus", HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_name_dataset() {
+ H5O_native_info_t native_info = null;
+
+ try {
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info_by_name: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_name ", native_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null);
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_name_hardlink() {
+ H5O_native_info_t native_info = null;
+
+ try {
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info_by_name: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_name ", native_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null);
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_name_group() {
+ H5O_native_info_t native_info = null;
+
+ try {
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info_by_name: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_name ", native_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null);
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_name_datatype() {
+ H5O_native_info_t native_info = null;
+
+ try {
+ native_info = H5.H5Oget_native_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Oget_native_info_by_name: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_name ", native_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_name ", native_info.attr_info == null);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_idx_name_not_exist_name() throws Throwable {
+ H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_idx_name_not_exist_create() throws Throwable {
+ H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_idx_not_exist_name() throws Throwable {
+ H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_idx_not_exist_create() throws Throwable {
+ H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_idx_n0() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+ H5O_hdr_info_t ohdr;
+ H5_ih_info_t oinfo;
+ H5_ih_info_t ainfo;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Oget_native_info_by_idx_n0:H5.H5Oget_native_info: " + err);
+ }
+
+ ohdr = native_info.hdr_info;
+ oinfo = native_info.obj_info;
+ ainfo = native_info.attr_info;
+
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+
+ try {
+ native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Oget_native_info_by_idx_n0:H5.H5Oget_native_info_by_idx: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_idx ", native_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.attr_info == null);
+ assertTrue("testH5Oget_native_info_by_idx_n0:Object Header Info", native_info.hdr_info.equals(ohdr));
+ assertTrue("testH5Oget_native_info_by_idx_n0:Object Info", native_info.obj_info.equals(oinfo));
+ assertTrue("testH5Oget_native_info_by_idx_n0:Attribute Info", native_info.attr_info.equals(ainfo));
+ }
+
+ @Test
+ public void testH5Oget_native_info_by_idx_n3() {
+ long oid = -1;
+ H5O_native_info_t native_info = null;
+ H5O_hdr_info_t ohdr;
+ H5_ih_info_t oinfo;
+ H5_ih_info_t ainfo;
+
+ try {
+ oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
+ native_info = H5.H5Oget_native_info(oid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Oget_native_info_by_idx_n3:H5.H5Oget_native_info: " + err);
+ }
+
+ ohdr = native_info.hdr_info;
+ oinfo = native_info.obj_info;
+ ainfo = native_info.attr_info;
+
+ try {H5.H5Oclose(oid);} catch (Exception ex) {}
+
+ try {
+ native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Oget_native_info_by_idx_n3:H5.H5Oget_native_info_by_idx: " + err);
+ }
+ assertFalse("H5Oget_native_info_by_idx ", native_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.hdr_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.obj_info == null);
+ assertFalse("H5Oget_native_info_by_idx ", native_info.attr_info == null);
+ assertTrue("testH5Oget_native_info_by_idx_n3:Object Header Info", native_info.hdr_info.equals(ohdr));
+ assertTrue("testH5Oget_native_info_by_idx_n3:Object Info", native_info.obj_info.equals(oinfo));
+ assertTrue("testH5Oget_native_info_by_idx_n3:Attribute Info", native_info.attr_info.equals(ainfo));
}
@Test
@@ -292,18 +550,18 @@ public class TestH5Obasic {
this.link_type = type;
}
}
- class H5O_iter_data implements H5O_iterate_t {
+ class H5O_iter_data implements H5O_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5O_iterate_t iter_data = new H5O_iter_data();
- class H5O_iter_callback implements H5O_iterate_cb {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) {
+ H5O_iterate_opdata_t iter_data = new H5O_iter_data();
+ class H5O_iter_callback implements H5O_iterate_t {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5O_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5O_iterate_cb iter_cb = new H5O_iter_callback();
+ H5O_iterate_t iter_cb = new H5O_iter_callback();
try {
H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data);
}
@@ -331,18 +589,18 @@ public class TestH5Obasic {
this.link_type = type;
}
}
- class H5O_iter_data implements H5O_iterate_t {
+ class H5O_iter_data implements H5O_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5O_iterate_t iter_data = new H5O_iter_data();
- class H5O_iter_callback implements H5O_iterate_cb {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) {
+ H5O_iterate_opdata_t iter_data = new H5O_iter_data();
+ class H5O_iter_callback implements H5O_iterate_t {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5O_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5O_iterate_cb iter_cb = new H5O_iter_callback();
+ H5O_iterate_t iter_cb = new H5O_iter_callback();
try {
H5.H5Ovisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT);
}
@@ -371,7 +629,7 @@ public class TestH5Obasic {
}
@Test
- public void testH5Oopen_by_addr() {
+ public void testH5Oopen_by_token() {
long oid = -1;
H5O_info_t obj_info = null;
try {
@@ -381,32 +639,32 @@ public class TestH5Obasic {
}
catch (Throwable err) {
err.printStackTrace();
- fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err);
+ fail("testH5Oopen_by_token: H5.H5Oget_info: " + err);
}
- H5la_ds1 = obj_info.addr;
+ H5la_ds1 = obj_info.token;
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
- oid = H5.H5Oopen_by_addr(H5fid, H5la_ds1);
+ oid = H5.H5Oopen_by_token(H5fid, H5la_ds1);
}
catch (Throwable err) {
err.printStackTrace();
- fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err);
+ fail("testH5Oopen_by_token: H5.H5Oopen_by_token: " + err);
}
try {
obj_info = H5.H5Oget_info(oid);
}
catch (Throwable err) {
err.printStackTrace();
- fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err);
+ fail("testH5Oopen_by_token: H5.H5Oget_info: " + err);
}
- assertFalse("testH5Oopen_by_addr: H5Oget_info ",obj_info==null);
- assertTrue("testH5Oopen_by_addr: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("testH5Oopen_by_addr: Link Address ",obj_info.addr==H5la_ds1);
+ assertFalse("testH5Oopen_by_token: H5Oget_info ",obj_info==null);
+ assertTrue("testH5Oopen_by_token: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
+ assertTrue("testH5Oopen_by_token: Link Object Token", obj_info.token.equals(H5la_ds1));
}
finally {
try{H5.H5Oclose(oid);} catch (Exception ex) {}
}
- }
+ }
@Test
public void testH5Oopen_by_idx_n0() {
@@ -421,14 +679,14 @@ public class TestH5Obasic {
err.printStackTrace();
fail("testH5Oopen_by_idx_n0: H5.H5Oget_info: " + err);
}
- H5la_ds1 = obj_info.addr;
+ H5la_ds1 = obj_info.token;
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
- fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err);
+ fail("testH5Oopen_by_idx_n0: H5.H5Oopen_by_idx: " + err);
}
try {
obj_info = H5.H5Oget_info(oid);
@@ -439,7 +697,7 @@ public class TestH5Obasic {
}
assertFalse("testH5Oopen_by_idx_n0: H5Oget_info_by_idx ",obj_info==null);
assertTrue("testH5Oopen_by_idx_n0: H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("testH5Oopen_by_idx_n0: Link Address ",obj_info.addr==H5la_ds1);
+ assertTrue("testH5Oopen_by_idx_n0: Link Object Token", obj_info.token.equals(H5la_ds1));
}
finally {
try{H5.H5Oclose(oid);} catch (Exception ex) {}
@@ -459,14 +717,14 @@ public class TestH5Obasic {
err.printStackTrace();
fail("testH5Oopen_by_idx_n3:H5.H5Oget_info: " + err);
}
- H5la_l1 = obj_info.addr;
+ H5la_l1 = obj_info.token;
try {H5.H5Oclose(oid);} catch (Exception ex) {}
try {
oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
- fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err);
+ fail("testH5Oopen_by_idx_n3: H5.H5Oopen_by_idx: " + err);
}
try {
obj_info = H5.H5Oget_info(oid);
@@ -477,7 +735,7 @@ public class TestH5Obasic {
}
assertFalse("testH5Oopen_by_idx_n3:H5Oget_info_by_idx ",obj_info==null);
assertTrue("testH5Oopen_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("testH5Oopen_by_idx_n3:Link Address ",obj_info.addr==H5la_l1);
+ assertTrue("testH5Oopen_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1));
}
finally {
try{H5.H5Oclose(oid);} catch (Exception ex) {}
diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java
index 559e12b..5e9fdf2 100644
--- a/java/test/TestH5Ocreate.java
+++ b/java/test/TestH5Ocreate.java
@@ -22,8 +22,8 @@ import java.util.ArrayList;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
-import hdf.hdf5lib.callbacks.H5O_iterate_cb;
import hdf.hdf5lib.callbacks.H5O_iterate_t;
+import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import hdf.hdf5lib.structs.H5O_info_t;
@@ -37,8 +37,8 @@ import org.junit.rules.TestName;
public class TestH5Ocreate {
@Rule public TestName testname = new TestName();
- private static final String H5_EXTFILE = "h5ex_g_iterate.hdf";
- private static final String H5_FILE = "test.h5";
+ private static final String H5_EXTFILE = "h5ex_g_iterateO2.hdf";
+ private static final String H5_FILE = "testO.h5";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
long H5fcpl = -1;
@@ -264,9 +264,9 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ", obj_info==null);
+ assertFalse("H5Oget_info", obj_info==null);
assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET);
- assertTrue("Link Address ", obj_info.addr>0);
+ assertTrue("Link Object Token", obj_info.token != null);
}
@Test(expected = HDF5LibraryException.class)
@@ -286,9 +286,9 @@ public class TestH5Ocreate {
err.printStackTrace();
fail("H5.H5Oget_info: " + err);
}
- assertFalse("H5Oget_info ", obj_info==null);
+ assertFalse("H5Oget_info", obj_info==null);
assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE);
- assertTrue("Link Address ", obj_info.addr>0);
+ assertTrue("Link Object Token", obj_info.token != null);
}
@Test
@@ -351,18 +351,18 @@ public class TestH5Ocreate {
this.link_type = type;
}
}
- class H5O_iter_data implements H5O_iterate_t {
+ class H5O_iter_data implements H5O_iterate_opdata_t {
public ArrayList<idata> iterdata = new ArrayList<idata>();
}
- H5O_iterate_t iter_data = new H5O_iter_data();
- class H5O_iter_callback implements H5O_iterate_cb {
- public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) {
+ H5O_iterate_opdata_t iter_data = new H5O_iter_data();
+ class H5O_iter_callback implements H5O_iterate_t {
+ public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) {
idata id = new idata(name, info.type);
((H5O_iter_data)op_data).iterdata.add(id);
return 0;
}
}
- H5O_iterate_cb iter_cb = new H5O_iter_callback();
+ H5O_iterate_t iter_cb = new H5O_iter_callback();
try {
H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data);
}
@@ -557,4 +557,57 @@ public class TestH5Ocreate {
}
}
+ @Test
+ public void testH5Ocork() {
+ boolean corked = false;
+
+ // Check cork status of the group: not corked
+ try {
+ corked = H5.H5Oare_mdc_flushes_disabled(H5gid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Ocork: H5.H5Oare_mdc_flushes_disabled: " + err);
+ }
+ assertFalse("H5Oare_mdc_flushes_disabled: ", corked);
+
+ // Cork the group: an object
+ try {
+ H5.H5Odisable_mdc_flushes(H5gid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Ocork: H5.H5Odisable_mdc_flushes: " + err);
+ }
+
+ // Check cork status of the group: corked
+ try {
+ corked = H5.H5Oare_mdc_flushes_disabled(H5gid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Ocork: H5.H5Oare_mdc_flushes_disabled: " + err);
+ }
+ assertTrue("H5Oare_mdc_flushes_disabled: ", corked);
+
+ // Unork the group: an object
+ try {
+ H5.H5Oenable_mdc_flushes(H5gid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Ocork: H5.H5Oenable_mdc_flushes: " + err);
+ }
+
+ // Check cork status of the group: corked
+ try {
+ corked = H5.H5Oare_mdc_flushes_disabled(H5gid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Ocork: H5.H5Oare_mdc_flushes_disabled: " + err);
+ }
+ assertFalse("H5Oare_mdc_flushes_disabled: ", corked);
+ }
+
}
diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java
index 2af190f..1f379d3 100644
--- a/java/test/TestH5Oparams.java
+++ b/java/test/TestH5Oparams.java
@@ -71,27 +71,52 @@ public class TestH5Oparams {
@Test(expected = HDF5LibraryException.class)
public void testH5Oget_info_invalid() throws Throwable {
- H5.H5Oget_info(-1);
+ H5.H5Oget_info(-1, 0);
}
@Test(expected = NullPointerException.class)
public void testH5Oget_info_by_name_null() throws Throwable {
- H5.H5Oget_info_by_name(-1, null, HDF5Constants.H5P_DEFAULT);
+ H5.H5Oget_info_by_name(-1, null, 0, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Oget_info_by_name_invalid() throws Throwable {
- H5.H5Oget_info_by_name(-1, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT);
+ H5.H5Oget_info_by_name(-1, "/testH5Gcreate", 0, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = HDF5LibraryException.class)
public void testH5Oget_info_by_idx_invalid() throws Throwable {
- H5.H5Oget_info_by_idx(-1, "Bogus", -1, -1, -1L, -1);
+ H5.H5Oget_info_by_idx(-1, "Bogus", -1, -1, -1L, 0, -1);
}
@Test(expected = NullPointerException.class)
public void testH5Oget_info_by_idx_null() throws Throwable {
- H5.H5Oget_info_by_idx(-1, null, 0, 0, 0L, 0);
+ H5.H5Oget_info_by_idx(-1, null, 0, 0, 0L, 0, 0);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_invalid() throws Throwable {
+ H5.H5Oget_native_info(-1, 0);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Oget_native_info_by_name_null() throws Throwable {
+ H5.H5Oget_native_info_by_name(-1, null, 0, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_name_invalid() throws Throwable {
+ H5.H5Oget_native_info_by_name(-1, "/testH5Gcreate", 0, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oget_native_info_by_idx_invalid() throws Throwable {
+ H5.H5Oget_native_info_by_idx(-1, "Bogus", -1, -1, -1L, 0, -1);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Oget_native_info_by_idx_null() throws Throwable {
+ H5.H5Oget_native_info_by_idx(-1, null, 0, 0, 0L, 0, 0);
}
@Test(expected = HDF5LibraryException.class)
@@ -106,17 +131,17 @@ public class TestH5Oparams {
@Test(expected = NullPointerException.class)
public void testH5Ovisit_null() throws Throwable {
- H5.H5Ovisit(-1, -1, -1, null, null);
+ H5.H5Ovisit(-1, -1, -1, null, null, 0);
}
@Test(expected = NullPointerException.class)
public void testH5Ovisit_by_name_nullname() throws Throwable {
- H5.H5Ovisit_by_name(-1, null, -1, -1, null, null, -1);
+ H5.H5Ovisit_by_name(-1, null, -1, -1, null, null, 0, -1);
}
@Test(expected = NullPointerException.class)
public void testH5Ovisit_by_name_null() throws Throwable {
- H5.H5Ovisit_by_name(-1, "Bogus", -1, -1, null, null, -1);
+ H5.H5Ovisit_by_name(-1, "Bogus", -1, -1, null, null, 0, -1);
}
@Test(expected = HDF5LibraryException.class)
@@ -124,7 +149,7 @@ public class TestH5Oparams {
H5.H5Oset_comment(-1, "Bogus");
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = HDF5LibraryException.class)
public void testH5Oget_comment_invalid() throws Throwable {
H5.H5Oget_comment(-1);
}
@@ -139,7 +164,7 @@ public class TestH5Oparams {
H5.H5Oset_comment_by_name(-1, null, null, -1);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = HDF5LibraryException.class)
public void testH5Oget_comment_by_name_invalid() throws Throwable {
H5.H5Oget_comment_by_name(-1, "Bogus", -1);
}
@@ -159,4 +184,19 @@ public class TestH5Oparams {
H5.H5Orefresh(-1);
}
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Odisable_mdc_flushes() throws Throwable {
+ H5.H5Odisable_mdc_flushes(-1);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oenable_mdc_flushes() throws Throwable {
+ H5.H5Oenable_mdc_flushes(-1);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Oare_mdc_flushes_disabled() throws Throwable {
+ H5.H5Oare_mdc_flushes_disabled(-1);
+ }
+
}
diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java
index 5aafb5b..b1c29b2 100644
--- a/java/test/TestH5P.java
+++ b/java/test/TestH5P.java
@@ -25,9 +25,11 @@ import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
+import hdf.hdf5lib.structs.H5F_info2_t;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@@ -35,7 +37,7 @@ import org.junit.rules.TestName;
public class TestH5P {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "test.h5";
+ private static final String H5_FILE = "testP.h5";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
long[] H5dims = { DIM_X, DIM_Y };
@@ -205,14 +207,14 @@ public class TestH5P {
assertEquals(nlinks, 20L);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = HDF5FunctionArgumentException.class)
public void testH5Pset_libver_bounds_invalidlow() throws Throwable {
- H5.H5Pset_libver_bounds(fapl_id, 5, HDF5Constants.H5F_LIBVER_LATEST);
+ H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST+1, HDF5Constants.H5F_LIBVER_LATEST);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = HDF5FunctionArgumentException.class)
public void testH5Pset_libver_bounds_invalidhigh() throws Throwable {
- H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, 5);
+ H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST+1);
}
@Test
@@ -852,7 +854,7 @@ public class TestH5P {
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5Pset_est_link_info: " + err);
+ fail("H5Pset_elink_prefix: " + err);
}
assertTrue("H5Pset_elink_prefix", ret_val >= 0);
}
@@ -886,37 +888,12 @@ public class TestH5P {
}
@Test(expected = NullPointerException.class)
- public void testH5Pget_version_null() throws Throwable {
- H5.H5Pget_version(fcpl_id, null);
- }
-
- @Test
- public void testH5Pget_version() {
- int[] version_info = {255,255,255,255};
-
- try {
- _createH5File(fcpl_id, fapl_id);
- H5.H5Pget_version(fcpl_id, version_info);
- deleteH5file();
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5Pget_version: " + err);
- }
- assertTrue("super block version: "+version_info[0], version_info[0] == 0);
- assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
- assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
- assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
- }
-
- @Test(expected = NullPointerException.class)
public void testH5Pget_userblock_null() throws Throwable {
H5.H5Pget_userblock(fcpl_id, null);
}
@Test
public void testH5P_userblock() {
- int[] version_info = {255,255,255,255};
long[] size = {0};
try {
@@ -930,7 +907,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
- H5.H5Pget_version(fcpl_id, version_info);
+ H5F_info2_t finfo = H5.H5Fget_info(H5fid);
+ assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
+ assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_userblock(fcpl_id, size);
deleteH5file();
}
@@ -938,10 +918,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_userblock: " + err);
}
- assertTrue("super block version: "+version_info[0], version_info[0] == 0);
- assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
- assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
- assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("user block size: "+size[0], size[0] == 1024);
}
@@ -952,7 +928,6 @@ public class TestH5P {
@Test
public void testH5P_sizes() {
- int[] version_info = {255,255,255,255};
long[] size = {0,0};
try {
@@ -966,7 +941,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
- H5.H5Pget_version(fcpl_id, version_info);
+ H5F_info2_t finfo = H5.H5Fget_info(H5fid);
+ assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
+ assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_sizes(fcpl_id, size);
deleteH5file();
}
@@ -974,10 +952,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sizes: " + err);
}
- assertTrue("super block version: "+version_info[0], version_info[0] == 0);
- assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
- assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
- assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("sizeof_addr size: "+size[0], size[0] == 4);
assertTrue("sizeof_size size: "+size[1], size[1] == 8);
}
@@ -989,7 +963,6 @@ public class TestH5P {
@Test
public void testH5P_sym_k() {
- int[] version_info = {255,255,255,255};
int[] size = {0,0};
try {
@@ -1003,7 +976,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
- H5.H5Pget_version(fcpl_id, version_info);
+ H5F_info2_t finfo = H5.H5Fget_info(H5fid);
+ assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
+ assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_sym_k(fcpl_id, size);
deleteH5file();
}
@@ -1011,10 +987,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sym_k: " + err);
}
- assertTrue("super block version: "+version_info[0], version_info[0] == 0);
- assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
- assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
- assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("symbol table tree rank: "+size[0], size[0] == 32);
assertTrue("symbol table node size: "+size[1], size[1] == 8);
}
@@ -1026,7 +998,6 @@ public class TestH5P {
@Test
public void testH5P_istore_k() {
- int[] version_info = {255,255,255,255};
int[] size = {0};
try {
@@ -1040,7 +1011,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
- H5.H5Pget_version(fcpl_id, version_info);
+ H5F_info2_t finfo = H5.H5Fget_info(H5fid);
+ assertTrue("super block version: "+finfo.super_version, finfo.super_version == 1);
+ assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_istore_k(fcpl_id, size);
deleteH5file();
}
@@ -1048,10 +1022,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sym_k: " + err);
}
- assertTrue("super block version: "+version_info[0], version_info[0] == 1);
- assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
- assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
- assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("chunked storage b-tree 1/2-rank: "+size[0], size[0] == 64);
}
@@ -1232,4 +1202,54 @@ public class TestH5P {
fail("testH5P_file_space_page_size: " + err);
}
}
+
+ @Test
+ public void testH5Pset_efile_prefix() {
+ String prefix = "tmp";
+ try {
+ H5.H5Pset_efile_prefix(lapl_id, prefix);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5Pset_efile_prefix: " + err);
+ }
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Pset_efile_prefix_null() throws Throwable{
+ H5.H5Pset_efile_prefix(lapl_id, null);
+ }
+
+ @Test
+ public void testH5Pget_efile_prefix() {
+ String prefix = "tmp";
+ String pre = "";
+
+ try {
+ H5.H5Pset_efile_prefix(lapl_id, prefix);
+ pre = H5.H5Pget_efile_prefix(lapl_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5Pget_efile_prefix: " + err);
+ }
+ assertTrue("The prefix: ", prefix.equals(pre));
+ }
+
+ @Ignore
+ public void testH5P_chunk_opts() {
+ int chunk_opts = -1;
+
+ try {
+ chunk_opts = H5.H5Pget_chunk_opts(ocpl_id);
+ assertTrue("chunk_opts: "+chunk_opts, chunk_opts == 0);
+ H5.H5Pset_chunk_opts(ocpl_id, HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS);
+ chunk_opts = H5.H5Pget_chunk_opts(ocpl_id);
+ assertTrue("chunk_opts: "+chunk_opts, chunk_opts == HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5Pget_lchunk_opts: " + err);
+ }
+ }
}
diff --git a/java/test/TestH5PData.java b/java/test/TestH5PData.java
index c414d67..dfd8e87 100644
--- a/java/test/TestH5PData.java
+++ b/java/test/TestH5PData.java
@@ -34,7 +34,7 @@ import org.junit.rules.TestName;
public class TestH5PData {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "test.h5";
+ private static final String H5_FILE = "testPD.h5";
private static final int DIM_X = 12;
private static final int DIM_Y = 18;
long H5fid = -1;
diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java
index d4a2231..10a79dd 100644
--- a/java/test/TestH5Pfapl.java
+++ b/java/test/TestH5Pfapl.java
@@ -26,6 +26,7 @@ import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
+import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException;
import hdf.hdf5lib.structs.H5AC_cache_config_t;
import org.junit.After;
@@ -37,10 +38,10 @@ import org.junit.rules.TestName;
public class TestH5Pfapl {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "test.h5";
- private static final String H5_LOG_FILE = "test.log";
- private static final String H5_FAMILY_FILE = "test%05d";
- private static final String H5_MULTI_FILE = "testmulti";
+ private static final String H5_FILE = "testPf.h5";
+ private static final String H5_LOG_FILE = "testPf.log";
+ private static final String H5_FAMILY_FILE = "testPf%05d";
+ private static final String H5_MULTI_FILE = "testPfmulti";
private static char MULTI_LETTERS[] = {'X','s','b','r','g','l','o'};
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
@@ -1376,4 +1377,25 @@ public class TestH5Pfapl {
deleteH5file();
_deleteLogFile();
}
+
+ @Test
+ public void testH5P_evict_on_close() {
+ boolean ret_val_id = false;
+ try {
+ H5.H5Pset_evict_on_close(fapl_id, true);
+ ret_val_id = H5.H5Pget_evict_on_close(fapl_id);
+ assertTrue("H5P_evict_on_close", ret_val_id);
+ }
+ catch (HDF5PropertyListInterfaceException err) {
+ // parallel is not supported
+ if (err.getMinorErrorNumber() != HDF5Constants.H5E_UNSUPPORTED) {
+ err.printStackTrace();
+ fail("H5P_evict_on_close: " + err);
+ }
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5P_evict_on_close: " + err);
+ }
+ }
}
diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java
new file mode 100644
index 0000000..b0d42d8
--- /dev/null
+++ b/java/test/TestH5Pfaplhdfs.java
@@ -0,0 +1,138 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import hdf.hdf5lib.H5;
+import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5Exception;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
+import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+public class TestH5Pfaplhdfs {
+ @Rule public TestName testname = new TestName();
+
+ long fapl_id = -1;
+ long plapl_id = -1;
+ long dapl_id = -1;
+ long plist_id = -1;
+ long btplist_id = -1;
+
+ @Before
+ public void createFileAccess() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
+ System.out.print(testname.getMethodName());
+
+ try {
+ fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Pfapl.createFileAccess: " + err);
+ }
+ assertTrue(fapl_id > 0);
+ try {
+ plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Pfapl.createFileAccess: " + err);
+ }
+ assertTrue(plapl_id > 0);
+ try {
+ plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
+ btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
+ dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Pfapl.createFileAccess: " + err);
+ }
+ assertTrue(plist_id > 0);
+ assertTrue(btplist_id > 0);
+ assertTrue(dapl_id > 0);
+ }
+
+ @After
+ public void deleteFileAccess() throws HDF5LibraryException
+ {
+ if (fapl_id > 0)
+ try {H5.H5Pclose(fapl_id);} catch (Exception ex) {}
+ if (plapl_id > 0)
+ try {H5.H5Pclose(plapl_id);} catch (Exception ex) {}
+ if (dapl_id > 0)
+ try {H5.H5Pclose(dapl_id);} catch (Exception ex) {}
+ if (plist_id > 0)
+ try {H5.H5Pclose(plist_id);} catch (Exception ex) {}
+ if (btplist_id > 0)
+ try {H5.H5Pclose(btplist_id);} catch (Exception ex) {}
+ System.out.println();
+ }
+
+ @Test
+ public void testHDFS_fapl() throws Exception
+ {
+ if (HDF5Constants.H5FD_HDFS < 0)
+ throw new HDF5LibraryException("skip");
+
+ String nodename = "blues";
+ int nodeport = 12345;
+ String username = "sparticus";
+ String kerbcache = "/dev/null";
+ int streamsize = 1024;
+
+ final H5FD_hdfs_fapl_t config = new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize);
+ assertTrue("setting fapl should succeed", -1 < H5.H5Pset_fapl_hdfs(fapl_id, config));
+
+ assertEquals("driver types should match", HDF5Constants.H5FD_HDFS, H5.H5Pget_driver(fapl_id));
+
+ H5FD_hdfs_fapl_t copy = H5.H5Pget_fapl_hdfs(fapl_id);
+ assertEquals("fapl contents should match", new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize), copy);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Pget_fapl_hdfs_invalid_fapl_id() throws Exception
+ {
+ if (HDF5Constants.H5FD_HDFS < 0)
+ throw new HDF5LibraryException("skip");
+ H5FD_hdfs_fapl_t fails = H5.H5Pget_fapl_hdfs(-1);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Pget_fapl_hdfs_fapl_id_of_wrong_driver_type() throws Exception
+ {
+ if (HDF5Constants.H5FD_HDFS < 0)
+ throw new HDF5LibraryException("skip");
+ if (HDF5Constants.H5FD_SEC2 < 0 )
+ throw new HDF5LibraryException("skip");
+ /* TODO: for now, test against a sec2 fapl only */
+
+ H5.H5Pset_fapl_sec2(fapl_id);
+ assertEquals("fapl_id was not set properly", HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id));
+ H5FD_hdfs_fapl_t fails = H5.H5Pget_fapl_hdfs(fapl_id);
+ }
+
+}
diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java
new file mode 100644
index 0000000..ba10524
--- /dev/null
+++ b/java/test/TestH5Pfapls3.java
@@ -0,0 +1,159 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import hdf.hdf5lib.H5;
+import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5Exception;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
+import hdf.hdf5lib.structs.H5FD_ros3_fapl_t;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+public class TestH5Pfapls3 {
+ @Rule public TestName testname = new TestName();
+
+ long fapl_id = -1;
+ long plapl_id = -1;
+ long dapl_id = -1;
+ long plist_id = -1;
+ long btplist_id = -1;
+
+ @Before
+ public void createFileAccess() throws NullPointerException, HDF5Exception
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
+ System.out.print(testname.getMethodName());
+
+ try {
+ fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Pfapl.createFileAccess: " + err);
+ }
+ assertTrue(fapl_id > 0);
+ try {
+ plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Pfapl.createFileAccess: " + err);
+ }
+ assertTrue(plapl_id > 0);
+ try {
+ plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
+ btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER);
+ dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Pfapl.createFileAccess: " + err);
+ }
+ assertTrue(plist_id > 0);
+ assertTrue(btplist_id > 0);
+ assertTrue(dapl_id > 0);
+ }
+
+ @After
+ public void deleteFileAccess() throws HDF5LibraryException
+ {
+ if (fapl_id > 0)
+ try {H5.H5Pclose(fapl_id);} catch (Exception ex) {}
+ if (plapl_id > 0)
+ try {H5.H5Pclose(plapl_id);} catch (Exception ex) {}
+ if (dapl_id > 0)
+ try {H5.H5Pclose(dapl_id);} catch (Exception ex) {}
+ if (plist_id > 0)
+ try {H5.H5Pclose(plist_id);} catch (Exception ex) {}
+ if (btplist_id > 0)
+ try {H5.H5Pclose(btplist_id);} catch (Exception ex) {}
+ System.out.println();
+ }
+
+ @Test
+ public void testH5Pset_fapl_ros3() throws Exception
+ {
+ if (HDF5Constants.H5FD_ROS3 < 0)
+ return;
+
+ final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t();
+ assertEquals("Default fapl has unexpected contents",
+ new H5FD_ros3_fapl_t("", "", ""), config);
+
+ H5.H5Pset_fapl_ros3(fapl_id, config);
+
+ assertEquals("driver types don't match",
+ HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id));
+
+ /* get_fapl_ros3 can throw exception in error cases */
+ H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id);
+ assertEquals("contents of fapl set and get don't match",
+ new H5FD_ros3_fapl_t("", "", ""), copy);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Pget_fapl_ros3_invalid_fapl_id() throws Exception
+ {
+ if (HDF5Constants.H5FD_ROS3 < 0)
+ throw new HDF5LibraryException("skip");
+ H5FD_ros3_fapl_t fails = H5.H5Pget_fapl_ros3(-1);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5Pget_fapl_ros3_fapl_id_of_wrong_driver_type() throws Exception
+ {
+ if (HDF5Constants.H5FD_ROS3 < 0)
+ throw new HDF5LibraryException("skip");
+ if (HDF5Constants.H5FD_SEC2 < 0 )
+ throw new HDF5LibraryException("skip");
+ /* TODO: for now, test against a sec2 fapl only */
+
+ H5.H5Pset_fapl_sec2(fapl_id);
+ assertEquals("fapl_id was not set properly",
+ HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id));
+ H5FD_ros3_fapl_t fails = H5.H5Pget_fapl_ros3(fapl_id);
+ }
+
+ @Test
+ public void testH5Pset_fapl_ros3_specified() throws Exception
+ {
+ if (HDF5Constants.H5FD_ROS3 < 0)
+ return;
+
+ String region = "us-east-1";
+ String acc_id = "my_access_id";
+ String acc_key = "my_access_key";
+
+ final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t(region, acc_id, acc_key);
+ H5.H5Pset_fapl_ros3(fapl_id, config);
+ assertEquals("driver types don't match",
+ HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id));
+
+ H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id);
+ assertEquals("contents of fapl set and get don't match",
+ new H5FD_ros3_fapl_t(region, acc_id, acc_key), copy);
+ }
+
+}
diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java
index 40cfbac..ff2e4dc 100644
--- a/java/test/TestH5Pvirtual.java
+++ b/java/test/TestH5Pvirtual.java
@@ -429,4 +429,37 @@ public class TestH5Pvirtual {
try {H5.H5Dclose(H5did);} catch (Exception ex) {}
}
}
+
+ @Test
+ public void testH5Pset_virtual_prefix() {
+ String prefix = "tmp";
+ try {
+ H5.H5Pset_virtual_prefix(H5dapl_id, prefix);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5Pset_virtual_prefix: " + err);
+ }
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Pset_virtual_prefix_null() throws Throwable{
+ H5.H5Pset_virtual_prefix(H5dapl_id, null);
+ }
+
+ @Test
+ public void testH5Pget_virtual_prefix() {
+ String prefix = "tmp";
+ String pre = "";
+
+ try {
+ H5.H5Pset_virtual_prefix(H5dapl_id, prefix);
+ pre = H5.H5Pget_virtual_prefix(H5dapl_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5Pget_virtual_prefix: " + err);
+ }
+ assertTrue("The prefix: ", prefix.equals(pre));
+ }
}
diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java
index 5349855..7b9f538 100644
--- a/java/test/TestH5R.java
+++ b/java/test/TestH5R.java
@@ -14,6 +14,7 @@
package test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -24,9 +25,11 @@ import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
+import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@@ -42,6 +45,8 @@ public class TestH5R {
long H5gid = -1;
long H5did2 = -1;
long[] H5dims = { DIM_X, DIM_Y };
+ int[][] dset_data = new int[DIM_X][DIM_Y];
+ int FILLVAL = 99;
private final void _deleteFile(String filename) {
File file = null;
@@ -51,8 +56,9 @@ public class TestH5R {
catch (Throwable err) {}
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {file.delete();} catch (SecurityException e) {e.printStackTrace();}
}
+ assertFalse("TestH5R._deleteFile file still exists ", file.exists());
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
@@ -66,7 +72,7 @@ public class TestH5R {
err.printStackTrace();
fail("H5.H5Dcreate: " + err);
}
- assertTrue("TestH5R._createDataset: ",did > 0);
+ assertTrue("TestH5R._createDataset: ", did > 0);
return did;
}
@@ -100,6 +106,21 @@ public class TestH5R {
H5did2 = _createDataset(H5gid, H5dsid, "dset2", HDF5Constants.H5P_DEFAULT);
H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
+ // Initialize the dataset.
+ for (int indx = 0; indx < DIM_X; indx++)
+ for (int jndx = 0; jndx < DIM_Y; jndx++)
+ dset_data[indx][jndx] = FILLVAL;
+
+ try {
+ if (H5did >= 0)
+ H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data[0]);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
}
catch (Throwable err) {
err.printStackTrace();
@@ -129,205 +150,438 @@ public class TestH5R {
System.out.println();
}
+ // Test v1.8 APIs params
+ /*
+ * @Ignore public void testH5Rget_name() { long loc_id = H5fid; int ref_type =
+ * HDF5Constants.H5R_OBJECT; long ret_val = -1; byte[] ref = null; String[] name = {""}; String
+ * objName = "/dset";
+ *
+ * try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch (Throwable err) {
+ * err.printStackTrace(); fail("H5.H5Rget_name:H5Rcreate " + err); }
+ *
+ * try { ret_val = H5.H5Rget_name(loc_id, ref_type, ref, name, 16); } catch (Throwable err) {
+ * err.printStackTrace(); fail("H5.H5Rget_name: " + err); }
+ *
+ * assertTrue("testH5Rget_name: H5Rget_name", ret_val>0); assertTrue("The name of the object: ",
+ * objName.equals(name[0])); }
+ *
+ * @Ignore public void testH5Rget_obj_type2() { int ref_type=HDF5Constants.H5R_OBJECT; byte[]
+ * ref=null;
+ *
+ * String objName = "/dset"; int obj_type = -1;
+ *
+ * try { ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); } catch(Throwable err) {
+ * err.printStackTrace(); }
+ *
+ * try { obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, ref); } catch (Throwable
+ * err) { err.printStackTrace(); fail("H5.H5Rget_obj_type2: " + err); } assertEquals(obj_type,
+ * HDF5Constants.H5O_TYPE_DATASET); }
+ *
+ * @Ignore public void testH5Rcreate_refobj() { byte[] ref = null;
+ *
+ * try { ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); } catch (Throwable err) {
+ * err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); }
+ *
+ * @Ignore public void testH5Rcreate_regionrefobj() { byte[] ref = null; try { ref =
+ * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); } catch (Throwable err) {
+ * err.printStackTrace(); fail("H5.H5Rcreate: " + err); } assertNotNull(ref); }
+ *
+ * @Ignore public void testH5Rdereference() { byte[] ref1 = null; byte[] ref2 = null; long
+ * dataset_id = -1; long group_id = -1; try { //Create reference on dataset ref1 =
+ * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); dataset_id=
+ * H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1);
+ *
+ * //Create reference on group ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1);
+ * group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2);
+ * assertNotNull(ref1); assertNotNull(ref2); assertTrue(dataset_id >= 0); assertTrue(group_id >= 0);
+ * } catch (Throwable err) { err.printStackTrace(); fail("TestH5Rdereference " + err); } finally {
+ * try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} try {H5.H5Gclose(group_id);} catch
+ * (Exception ex) {} } }
+ *
+ * @Ignore public void testH5Rget_region() { byte[] ref = null; long dsid = -1; try { ref =
+ * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); dsid =
+ * H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); assertNotNull(ref);
+ * assertTrue(dsid >= 0); } catch (Throwable err) { err.printStackTrace();
+ * fail("TestH5Rget_region: " + err); } finally { try {H5.H5Sclose(dsid);} catch (Exception ex) {} }
+ * }
+ *
+ * @Ignore//(expected = IllegalArgumentException.class) public void testH5Rget_name_Invalidreftype()
+ * throws Throwable { byte[] ref = null; String[] name = {""}; ref = H5.H5Rcreate(H5fid, "/dset",
+ * HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name,
+ * 16); }
+ *
+ * @Ignore//(expected = NullPointerException.class) public void testH5Rget_name_NULLreference()
+ * throws Throwable { byte[] ref = null; String[] name = {""}; H5.H5Rget_name(H5fid,
+ * HDF5Constants.H5R_OBJECT, ref, name, 16); }
+ *
+ * @Ignore//(expected = HDF5LibraryException.class) public void
+ * testH5Rget_obj_type2_Invalidreftype() throws Throwable { byte[] ref = null; ref =
+ * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); H5.H5Rget_obj_type(H5fid,
+ * HDF5Constants.H5R_DATASET_REGION, ref); }
+ *
+ * @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_InvalidObjectName()
+ * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/GROUPS", HDF5Constants.H5R_OBJECT, -1); }
+ *
+ * @Ignore//(expected = HDF5LibraryException.class) public void testH5Rcreate_Invalidspace_id()
+ * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, -1);
+ * }
+ *
+ * @Ignore//(expected = IllegalArgumentException.class) public void testH5Rcreate_Invalidreftype()
+ * throws Throwable { byte[] ref=H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_BADTYPE, -1); }
+ *
+ * @Ignore//(expected = IllegalArgumentException.class) public void
+ * testH5Rgetregion_Invalidreftype() throws Throwable { byte[] ref = null; ref = H5.H5Rcreate(H5fid,
+ * "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid,
+ * HDF5Constants.H5R_DATASET_REGION, ref); }
+ *
+ * @Ignore//(expected = IllegalArgumentException.class) public void
+ * testH5Rgetregion_Badreferencetype() throws Throwable { byte[] ref = null; ref =
+ * H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); H5.H5Rget_region(H5fid,
+ * HDF5Constants.H5R_OBJECT, ref); }
+ *
+ * @Ignore//(expected = NullPointerException.class) public void testH5Rgetregion_Nullreference()
+ * throws Throwable { byte[] ref = null; H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION,
+ * ref); }
+ *
+ * @Ignore//(expected = NullPointerException.class) public void testH5Rdereference_Nullreference()
+ * throws Throwable { byte[] ref = null; H5.H5Rdereference(H5did2, HDF5Constants.H5P_DEFAULT,
+ * HDF5Constants.H5R_OBJECT, ref); }
+ *
+ * @Ignore//(expected = IllegalArgumentException.class) public void
+ * testH5Rdereference_Invalidreference() throws Throwable { byte[] ref1 = null; byte[] ref2 = null;
+ * ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); ref2 =
+ * H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); H5.H5Rdereference(H5gid,
+ * HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1); }
+ */
+ // Test v1.12 APIs params
+
@Test
- public void testH5Rget_name() {
- long loc_id=H5fid;
- int ref_type=HDF5Constants.H5R_OBJECT;
- long ret_val=-1;
- byte[] ref=null;
- String[] name= {""};
+ public void testH5Rget_object() {
+ int ref_type = HDF5Constants.H5R_OBJECT2;
+ long ret_val = -1;
+ byte[] ref = null;
+ String name = "";
String objName = "/dset";
try {
- ref = H5.H5Rcreate(H5fid, objName, ref_type, -1);
+ ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5.H5Rget_name:H5Rcreate " + err);
+ fail("testH5Rget_object: H5Rcreate_object " + err);
}
try {
- ret_val = H5.H5Rget_name(loc_id, ref_type, ref, name, 16);
+ ret_val = H5.H5Rget_type(ref);
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5.H5Rget_name: " + err);
+ fail("testH5Rget_object: H5Rget_type: " + err);
}
-
- assertTrue("testH5Rget_name: H5Rget_name", ret_val>0);
- assertTrue("The name of the object: ", objName.equals(name[0]));
- }
-
- @Test
- public void testH5Rget_obj_type2() {
- int ref_type=HDF5Constants.H5R_OBJECT;
- byte[] ref=null;
-
- String objName = "/dset";
- int obj_type = -1;;
+ assertTrue("testH5Rget_object: H5Rget_type", ret_val == ref_type);
try {
- ref = H5.H5Rcreate(H5fid, objName, ref_type, -1);
+ name = H5.H5Rget_file_name(ref);
}
- catch(Throwable err) {
+ catch (Throwable err) {
err.printStackTrace();
+ fail("testH5Rget_object: H5Rget_file_name: " + err);
}
+ assertTrue("testH5Rget_object: H5Rget_file_name", H5_FILE.equals(name));
try {
- obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, ref);
+ name = H5.H5Rget_obj_name(ref, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5.H5Rget_obj_type2: " + err);
+ fail("testH5Rget_object: H5Rget_obj_name: " + err);
}
- assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET);
+ assertTrue("The name of the object: ", objName.equals(name));
+ H5.H5Rdestroy(ref);
}
@Test
- public void testH5Rcreate_refobj() {
+ public void testH5Rget_obj_type3() {
+ int obj_type = -1;
byte[] ref = null;
+ String objName = "/dset";
try {
- ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1);
+ ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5.H5Rcreate: " + err);
+ fail("testH5Rget_obj_type3: H5Rcreate_object " + err);
}
- assertNotNull(ref);
- }
- @Test
- public void testH5Rcreate_regionrefobj() {
- byte[] ref = null;
try {
- ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid);
+ obj_type = H5.H5Rget_obj_type3(ref, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
- fail("H5.H5Rcreate: " + err);
+ fail("testH5Rget_obj_type3: H5.H5Rget_obj_type3: " + err);
}
- assertNotNull(ref);
+ assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET);
+ H5.H5Rdestroy(ref);
}
@Test
- public void testH5Rdereference() {
- byte[] ref1 = null;
- byte[] ref2 = null;
- long dataset_id = -1;
- long group_id = -1;
+ public void testH5Rcreate_regionref_object() {
+ byte[] ref = null;
+ String objName = "/dset";
+ long start[] = {2,2}; // Starting location of hyperslab
+ long stride[] = {1,1}; // Stride of hyperslab
+ long count[] = {1,1}; // Element count of hyperslab
+ long block[] = {3,3}; // Block size of hyperslab
+
+ // Select 3x3 hyperslab for reference
try {
- //Create reference on dataset
- ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid);
- dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1);
-
- //Create reference on group
- ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1);
- group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2);
- assertNotNull(ref1);
- assertNotNull(ref2);
- assertTrue(dataset_id>=0);
- assertTrue(group_id>=0);
+ H5.H5Sselect_hyperslab(H5dsid, HDF5Constants.H5S_SELECT_SET, start, stride, count, block);
}
catch (Throwable err) {
err.printStackTrace();
- fail("TestH5Rdereference " + err);
- }
- finally {
- try {H5.H5Dclose(dataset_id);} catch (Exception ex) {}
- try {H5.H5Gclose(group_id);} catch (Exception ex) {}
+ fail("testH5Rget_object: H5Sselect_hyperslab " + err);
}
- }
-
- @Test
- public void testH5Rget_region() {
- byte[] ref = null;
- long dsid = -1;
try {
- ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid);
- dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
- assertNotNull(ref);
- assertTrue(dsid>=0);
+ ref = H5.H5Rcreate_region(H5fid, objName, H5dsid, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
- fail("TestH5Rget_region: " + err);
- }
- finally {
- try {H5.H5Sclose(dsid);} catch (Exception ex) {}
+ fail("testH5Rget_object: H5Rcreate_region " + err);
}
+ assertNotNull(ref);
+ H5.H5Rdestroy(ref);
}
- @Test(expected = IllegalArgumentException.class)
- public void testH5Rget_name_Invalidreftype() throws Throwable {
- byte[] ref = null;
- String[] name= {""};
- ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1);
- H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name, 16);
+// These tests need to be updated with new APIs
+// @Test//
+// public void testH5Rget_group() {
+// long loc_id = H5fid;
+// int ref_type = HDF5Constants.H5R_OBJECT2;
+// long ret_val = -1;
+// byte[] ref = null;
+// String name = "";
+// String objName = "/dset";
+//
+// try {
+// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("testH5Rget_object: H5Rcreate_object " + err);
+// }
+// try {
+// dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1);
+//
+// //Create reference on group
+// ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1);
+// group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2);
+// assertNotNull(ref1);
+// assertNotNull(ref2);
+// assertTrue(dataset_id >= 0);
+// assertTrue(group_id >= 0);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("TestH5Rdereference " + err);
+// }
+// finally {
+// try {H5.H5Dclose(dataset_id);} catch (Exception ex) {}
+// try {H5.H5Gclose(group_id);} catch (Exception ex) {}
+// }
+// }
+
+// @Test//
+// public void testH5Rget_region_dataset() {
+// long loc_id = H5fid;
+// int ref_type = HDF5Constants.H5R_OBJECT2;
+// long ret_val = -1;
+// byte[] ref = null;
+// String name = "";
+// String objName = "/dset";
+//
+// try {
+// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("testH5Rget_object: H5Rcreate_object " + err);
+// }
+// try {
+// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
+// assertNotNull(ref);
+// assertTrue(dsid >= 0);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("TestH5Rget_region: " + err);
+// }
+// finally {
+// try {H5.H5Sclose(dsid);} catch (Exception ex) {}
+// }
+// }
+
+// @Test//
+// public void testH5Rget_attr() {
+// long loc_id = H5fid;
+// int ref_type = HDF5Constants.H5R_OBJECT2;
+// long ret_val = -1;
+// byte[] ref = null;
+// String name = "";
+// String objName = "/dset";
+//
+// try {
+// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("testH5Rget_object: H5Rcreate_object " + err);
+// }
+// try {
+// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
+// assertNotNull(ref);
+// assertTrue(dsid >= 0);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("TestH5Rget_region: " + err);
+// }
+// finally {
+// try {H5.H5Sclose(dsid);} catch (Exception ex) {}
+// }
+// }
+
+ // Test parameters to H5Rcreate_object
+ @Test(expected = NullPointerException.class)
+ public void testH5Rcreate_object_Nullname() throws Throwable {
+ String name = null;
+ H5.H5Rcreate_object(H5fid, name, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5FunctionArgumentException.class)
+ public void testH5Rget_name_Invalidloc() throws Throwable {
+ String name= "";
+ H5.H5Rcreate_object(-1, name, HDF5Constants.H5P_DEFAULT);
}
+ // Test parameters to H5Rcreate_region
@Test(expected = NullPointerException.class)
- public void testH5Rget_name_NULLreference() throws Throwable {
+ public void testH5Rcreate_region_Nullname() throws Throwable {
+ String name = null;
+ H5.H5Rcreate_region(H5fid, name, -1, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5FunctionArgumentException.class)
+ public void testH5Rcreate_region_Invalidloc() throws Throwable {
+ String name= "";
+ H5.H5Rcreate_region(-1, name, -1, HDF5Constants.H5P_DEFAULT);
+ }
+
+ // Test parameters to H5Rcreate_attr
+ @Test(expected = NullPointerException.class)
+ public void testH5Rcreate_attr_Nullname() throws Throwable {
+ String name = null;
+ String attrname = "";
+ H5.H5Rcreate_attr(H5fid, name, attrname, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Rcreate_attr_Nullattrname() throws Throwable {
+ String name = "";
+ String attrname = null;
+ H5.H5Rcreate_attr(H5fid, name, attrname, HDF5Constants.H5P_DEFAULT);
+ }
+
+ @Test(expected = HDF5FunctionArgumentException.class)
+ public void testH5Rcreate_attr_Invalidloc() throws Throwable {
+ String name= "";
+ String attrname= "";
+ H5.H5Rcreate_attr(-1, name, attrname, HDF5Constants.H5P_DEFAULT);
+ }
+
+ // Test parameters to H5Rdestroy
+ @Test(expected = NullPointerException.class)
+ public void testH5Rdestroy_Nullref() throws Throwable {
byte[] ref = null;
- String[] name= {""};
- H5.H5Rget_name(H5fid, HDF5Constants.H5R_OBJECT, ref, name, 16);
+ H5.H5Rdestroy(ref);
}
- @Test(expected = HDF5LibraryException.class)
- public void testH5Rget_obj_type2_Invalidreftype() throws Throwable {
+ // Test parameters to H5Rget_type
+ @Test(expected = NullPointerException.class)
+ public void testH5Rget_type_Nullref() throws Throwable {
byte[] ref = null;
- ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1);
- H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
+ H5.H5Rget_type(ref);
+ }
+
+ // Test parameters to H5Requal
+ @Test(expected = NullPointerException.class)
+ public void testH5Requal_Nullref1() throws Throwable {
+ byte[] ref1 = null;
+ byte[] ref2 = {0,0,0,0};
+ H5.H5Requal(ref1, ref2);
}
- @Test(expected = HDF5LibraryException.class)
- public void testH5Rcreate_InvalidObjectName() throws Throwable {
- H5.H5Rcreate(H5fid, "/GROUPS", HDF5Constants.H5R_OBJECT, -1);
+ @Test(expected = NullPointerException.class)
+ public void testH5Requal_Nullref2() throws Throwable {
+ byte[] ref1 = {0,0,0,0};
+ byte[] ref2 = null;
+ H5.H5Requal(ref1, ref2);
}
- @Test(expected = HDF5LibraryException.class)
- public void testH5Rcreate_Invalidspace_id() throws Throwable {
- H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, -1);
+ // Test parameters to H5Rcopy
+ @Test(expected = NullPointerException.class)
+ public void testH5Rcopy_Nullref1() throws Throwable {
+ byte[] ref1 = null;
+ byte[] ref2 = H5.H5Rcopy(ref1);
}
- @Test(expected = IllegalArgumentException.class)
- public void testH5Rcreate_Invalidreftype() throws Throwable {
- H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_BADTYPE, -1);
+ // Test parameters to H5Ropen_object
+ @Test(expected = NullPointerException.class)
+ public void testH5Ropen_object_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Ropen_object(ref, -1, -1);
}
- @Test(expected = IllegalArgumentException.class)
- public void testH5Rgetregion_Invalidreftype() throws Throwable {
+ // Test parameters to H5Ropen_region
+ @Test(expected = NullPointerException.class)
+ public void testH5Ropen_region_Nullref() throws Throwable {
byte[] ref = null;
- ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid);
- H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
+ H5.H5Ropen_region(ref, -1, -1);
}
- @Test(expected = IllegalArgumentException.class)
- public void testH5Rgetregion_Badreferencetype() throws Throwable {
+ // Test parameters to H5Ropen_attr
+ @Test(expected = NullPointerException.class)
+ public void testH5Ropen_attr_Nullref() throws Throwable {
byte[] ref = null;
- ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid);
- H5.H5Rget_region(H5fid, HDF5Constants.H5R_OBJECT, ref);
+ H5.H5Ropen_attr(ref, -1, -1);
}
+ // Test parameters to H5Rget_obj_type3
@Test(expected = NullPointerException.class)
- public void testH5Rgetregion_Nullreference() throws Throwable {
+ public void testH5Rget_obj_type3_Nullref() throws Throwable {
byte[] ref = null;
- H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
+ H5.H5Rget_obj_type3(ref, -1);
}
+ // Test parameters to H5Rget_file_name
@Test(expected = NullPointerException.class)
- public void testH5Rdereference_Nullreference() throws Throwable {
+ public void testH5Rget_file_name_Nullref() throws Throwable {
byte[] ref = null;
- H5.H5Rdereference(H5did2, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref);
+ H5.H5Rget_file_name(ref);
}
- @Test(expected = IllegalArgumentException.class)
- public void testH5Rdereference_Invalidreference() throws Throwable {
- byte[] ref1 = null;
- byte[] ref2 = null;
- ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid);
- ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1);
- H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1);
+ // Test parameters to H5Rget_obj_name
+ @Test(expected = NullPointerException.class)
+ public void testH5Rget_obj_name_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Rget_obj_name(ref, -1);
+ }
+
+ // Test parameters to H5Rget_attr_name
+ @Test(expected = NullPointerException.class)
+ public void testH5Rget_attr_name_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Rget_attr_name(ref);
}
}
diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java
index 3007495..2173647 100644
--- a/java/test/TestH5Sbasic.java
+++ b/java/test/TestH5Sbasic.java
@@ -49,7 +49,7 @@ public class TestH5Sbasic {
H5.H5Screate(-1);
}
- @Test(expected = HDF5LibraryException.class)
+ @Test(expected = IllegalArgumentException.class)
public void testH5Sget_simple_extent_type_invalid() throws Throwable {
H5.H5Sget_simple_extent_type(-1);
}
diff --git a/java/test/TestH5T.java b/java/test/TestH5T.java
index 0c68d2e..1a7e58b 100644
--- a/java/test/TestH5T.java
+++ b/java/test/TestH5T.java
@@ -32,7 +32,7 @@ import org.junit.rules.TestName;
public class TestH5T {
@Rule public TestName testname = new TestName();
- private static final String H5_FILE = "test.h5";
+ private static final String H5_FILE = "testT.h5";
long H5fid = -1;
long H5strdid = -1;
diff --git a/java/test/TestH5Tparams.java b/java/test/TestH5Tparams.java
index 53d3a37..f2b5ab5 100644
--- a/java/test/TestH5Tparams.java
+++ b/java/test/TestH5Tparams.java
@@ -276,6 +276,17 @@ public class TestH5Tparams {
}
@Test(expected = HDF5LibraryException.class)
+ public void testH5Treclaim_invalid() throws Throwable {
+ byte[] buf = new byte[2];
+ H5.H5Treclaim(-1, -1, -1, buf);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Treclaim_null() throws Throwable {
+ H5.H5Treclaim(-1, -1, -1, null);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
public void testH5Tvlen_create_invalid() throws Throwable {
H5.H5Tvlen_create(-1);
}
diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java
new file mode 100644
index 0000000..bd660d3
--- /dev/null
+++ b/java/test/TestH5VL.java
@@ -0,0 +1,173 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import hdf.hdf5lib.H5;
+import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+public class TestH5VL {
+ @Rule public TestName testname = new TestName();
+
+ private final void _deleteFile(String filename) {
+ File file = new File(filename);
+
+ if (file.exists()) {
+ try {file.delete();} catch (SecurityException e) {}
+ }
+ }
+
+ @Before
+ public void checkOpenIDs() {
+ assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ System.out.print(testname.getMethodName());
+ }
+ @After
+ public void nextTestName() {
+ System.out.println();
+ }
+
+ @Test
+ public void testH5VLnative_init() {
+ try {
+ boolean is_registered;
+
+ is_registered = H5.H5VLis_connector_registered_by_name(HDF5Constants.H5VL_NATIVE_NAME);
+ assertTrue("H5.H5VLis_connector_registered_by_name H5VL_NATIVE_NAME", is_registered);
+
+ is_registered = H5.H5VLis_connector_registered_by_name("FAKE_VOL_NAME");
+ assertFalse("H5.H5VLis_connector_registered_by_name FAKE_VOL_NAME", is_registered);
+
+ is_registered = H5.H5VLis_connector_registered_by_value(HDF5Constants.H5VL_NATIVE_VALUE);
+ assertTrue("H5.H5VLis_connector_registered_by_value H5VL_NATIVE_VALUE", is_registered);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5VLnative_init(): " + err);
+ }
+ }
+
+ @Test
+ public void testH5VLget_connector_id() {
+ String H5_FILE = "testFvl.h5";
+
+ long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+
+ try {
+ long native_id = H5.H5VLget_connector_id(H5fid);
+ assertTrue("H5.H5VLget_connector_id", native_id >= 0);
+
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector. Only check for the native connector
+ * if this isn't set.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null)
+ assertEquals(HDF5Constants.H5VL_NATIVE, native_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5VLget_connector_id " + err);
+ }
+ finally {
+ if (H5fid > 0) {
+ try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ }
+ _deleteFile(H5_FILE);
+ }
+ }
+
+ @Test
+ public void testH5VLget_connector_id_by_name() {
+ try {
+ long native_id = H5.H5VLget_connector_id_by_name(HDF5Constants.H5VL_NATIVE_NAME);
+ assertTrue("H5.H5VLget_connector_id_by_name H5VL_NATIVE_NAME", native_id >= 0);
+ assertEquals(HDF5Constants.H5VL_NATIVE, native_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5VLget_connector_id_by_name " + err);
+ }
+ }
+
+ @Test
+ public void testH5VLget_connector_id_by_value() {
+ try {
+ long native_id = H5.H5VLget_connector_id_by_value(HDF5Constants.H5VL_NATIVE_VALUE);
+ assertTrue("H5.H5VLget_connector_id_by_value H5VL_NATIVE_VALUE", native_id >= 0);
+ assertEquals(HDF5Constants.H5VL_NATIVE, native_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5VLget_connector_id_by_value " + err);
+ }
+ }
+
+ @Test
+ public void testH5VLget_connector_name() {
+ String H5_FILE = "testFvl.h5";
+
+ long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
+
+ try {
+ String native_name = H5.H5VLget_connector_name(H5fid);
+
+ /*
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector. Only check for the native connector
+ * if this isn't set.
+ */
+ String connector = System.getenv("HDF5_VOL_CONNECTOR");
+ if (connector == null)
+ assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5VLget_connector_name " + err);
+ }
+ finally {
+ if (H5fid > 0) {
+ try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ }
+ _deleteFile(H5_FILE);
+ }
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5VLclose_NegativeID() throws Throwable {
+ H5.H5VLclose(-1);
+ }
+
+ @Test(expected = HDF5LibraryException.class)
+ public void testH5VLunregister_connector_NegativeID() throws Throwable {
+ H5.H5VLunregister_connector(-1);
+ }
+}
+
diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java
index 31adf22..27bda6f 100644
--- a/java/test/TestH5Z.java
+++ b/java/test/TestH5Z.java
@@ -41,8 +41,8 @@ public class TestH5Z {
@Test
public void testH5Zfilter_avail() {
try {
- int filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE);
- assertTrue("H5.H5Zfilter_avail_DEFLATE", filter_found > 0);
+ int filter_found;
+
filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_FLETCHER32);
assertTrue("H5.H5Zfilter_avail_FLETCHER32", filter_found > 0);
filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_NBIT);
@@ -51,8 +51,12 @@ public class TestH5Z {
assertTrue("H5.H5Zfilter_avail_SCALEOFFSET", filter_found > 0);
filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE);
assertTrue("H5.H5Zfilter_avail_SHUFFLE", filter_found > 0);
-// filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP);
-// assertTrue("H5.H5Zfilter_avail_SZIP", filter_found > 0);
+
+ // Just make sure H5Zfilter_avail() doesn't fail with szip/zlib
+ // since there is no way for us to determine if they should be present
+ // or not.
+ filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE);
+ filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP);
}
catch (Throwable err) {
err.printStackTrace();
@@ -63,9 +67,8 @@ public class TestH5Z {
@Test
public void testH5Zget_filter_info() {
try {
- int filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE);
- assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
- assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
+ int filter_flag;
+
filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32);
assertTrue("H5.H5Zget_filter_info_FLETCHER32_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
assertTrue("H5.H5Zget_filter_info_FLETCHER32_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
@@ -78,9 +81,19 @@ public class TestH5Z {
filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE);
assertTrue("H5.H5Zget_filter_info_DECODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
assertTrue("H5.H5Zget_filter_info_ENCODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
-// filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP);
-// assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
-// assertTrue("H5.H5Zget_filter_info_ENCODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
+
+ if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE)) {
+ filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE);
+ assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
+ assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0);
+ }
+
+ if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP)) {
+ filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP);
+ // Decode should always be available, but we have no way of determining
+ // if encode is so don't assert on that.
+ assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0);
+ }
}
catch (Throwable err) {
err.printStackTrace();
diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in
index 32b0832..598b3d2 100644
--- a/java/test/junit.sh.in
+++ b/java/test/junit.sh.in
@@ -15,6 +15,12 @@
top_builddir=@top_builddir@
top_srcdir=@top_srcdir@
srcdir=@srcdir@
+prefix=@prefix@
+
+USE_FILTER_SZIP="@USE_FILTER_SZIP@"
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+USE_ROS3_VFD="@HAVE_ROS3_VFD@"
+USE_HDFS_VFD="@HAVE_LIBHDFS@"
TESTNAME=JUnitInterface
EXIT_SUCCESS=0
@@ -37,7 +43,7 @@ myos=`uname -s`
# where the libs exist
HDFLIB_HOME="$top_srcdir/java/lib"
-BLDLIBDIR="$top_builddir/hdf5/lib"
+BLDLIBDIR="$prefix/lib"
BLDDIR="."
HDFTEST_HOME="$top_srcdir/java/test"
JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar
@@ -56,27 +62,62 @@ LIST_LIBRARY_FILES="
$top_builddir/src/.libs/libhdf5.*
$top_builddir/java/src/jni/.libs/libhdf5_java.*
"
-LIST_JAR_FILES="
+LIST_JAR_TESTFILES="
$HDFLIB_HOME/hamcrest-core.jar
$HDFLIB_HOME/junit.jar
-$HDFLIB_HOME/slf4j-api-1.7.5.jar
-$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar
+$HDFLIB_HOME/slf4j-api-1.7.25.jar
+$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
+"
+LIST_JAR_FILES="
$top_builddir/java/src/$JARFILE
"
LIST_DATA_FILES="
-$HDFTEST_HOME/JUnit-interface.txt
-$HDFTEST_HOME/JUnit-interface.ert
+$HDFTEST_HOME/testfiles/JUnit-TestH5.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Eparams.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Eregister.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Fparams.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Fbasic.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5F.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Fswmr.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Gbasic.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5G.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Sbasic.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5S.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Tparams.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Tbasic.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5T.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Dparams.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5D.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Dplist.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Lparams.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Lbasic.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Lcreate.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5R.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5P.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5PData.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Pfapl.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Pfapls3.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Pfaplhdfs.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Pvirtual.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Plist.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5A.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Oparams.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Obasic.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Ocreate.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Ocopy.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5PL.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5VL.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Z.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5E.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Edefault.txt
+$HDFTEST_HOME/testfiles/JUnit-TestH5Giterate.txt
"
-expect="JUnit-interface.txt"
-actual="JUnit-interface.out"
-actual_err="JUnit-interface.err"
-actual_ext="JUnit-interface.ext"
-
#
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARTESTFILES="$LIST_JAR_TESTFILES"
COPY_JARFILES="$LIST_JAR_FILES"
COPY_LIBFILES_TO_BLDLIBDIR()
@@ -106,6 +147,29 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
done
# copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARTESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
for tstfile in $COPY_JARFILES
do
# ignore '#' comment
@@ -140,7 +204,10 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDLIBDIR
+ for tstfile in $COPY_JARTESTFILES
+ do
+ $RM $BLDLIBDIR/tstfile
+ done
fi
}
@@ -173,14 +240,18 @@ COPY_DATAFILES_TO_BLDDIR()
fi
done
$CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterate.hdf
+ $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateL1.hdf
+ $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateL2.hdf
+ $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO1.hdf
+ $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO2.hdf
}
CLEAN_DATAFILES_AND_BLDDIR()
{
- $RM $BLDDIR/h5ex_g_iterate.hdf
- $RM $BLDDIR/JUnit-interface.out
- $RM $BLDDIR/JUnit-interface.err
- $RM $BLDDIR/JUnit-interface.ext
+ $RM $BLDDIR/h5ex_g_iterate*.hdf
+ $RM $BLDDIR/JUnit-*.out
+ $RM $BLDDIR/JUnit-*.ext
+ $RM $BLDDIR/JUnit-*.err
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
@@ -188,9 +259,9 @@ CLEAN_DATAFILES_AND_BLDDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDDIR/JUnit-interface.ert
- $RM $BLDDIR/JUnit-interface.txt
- fi
+ $RM $BLDDIR/JUnit-*.ert
+ $RM $BLDDIR/JUnit-*.txt
+ fi
}
# Print a line-line message left justified in a field of 70 characters
@@ -213,7 +284,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
-CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/junit.jar:"$BLDLIBDIR"/hamcrest-core.jar:"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE""
+CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/junit.jar:"$BLDLIBDIR"/hamcrest-core.jar:"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
TEST=/usr/bin/test
if [ ! -x /usr/bin/test ]
@@ -245,11 +316,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then
fi
case $os_name in
- Darwin)
- DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH
- LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
- ;;
*)
LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH
;;
@@ -257,28 +323,826 @@ esac
export LD_LIBRARY_PATH
-echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestAll"
-($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestAll 1>$actual_ext 2>$actual_err)
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5"
+TESTING JUnit-TestH5
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5 > JUnit-TestH5.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5.ext > JUnit-TestH5.out
+
+if diff JUnit-TestH5.out JUnit-TestH5.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5"
+else
+ echo "**FAILED** JUnit-TestH5"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5.txt JUnit-TestH5.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eparams"
+TESTING JUnit-TestH5Eparams
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eparams > JUnit-TestH5Eparams.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Eparams.ext > JUnit-TestH5Eparams.out
+
+if diff JUnit-TestH5Eparams.out JUnit-TestH5Eparams.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Eparams"
+else
+ echo "**FAILED** JUnit-TestH5Eparams"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Eparams.txt JUnit-TestH5Eparams.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eregister"
+TESTING JUnit-TestH5Eregister
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Eregister > JUnit-TestH5Eregister.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Eregister.ext > JUnit-TestH5Eregister.out
+
+if diff JUnit-TestH5Eregister.out JUnit-TestH5Eregister.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Eregister"
+else
+ echo "**FAILED** JUnit-TestH5Eregister"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Eregister.txt JUnit-TestH5Eregister.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fparams"
+TESTING JUnit-TestH5Fparams
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fparams > JUnit-TestH5Fparams.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Fparams.ext > JUnit-TestH5Fparams.out
+
+if diff JUnit-TestH5Fparams.out JUnit-TestH5Fparams.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Fparams"
+else
+ echo "**FAILED** JUnit-TestH5Fparams"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Fparams.txt JUnit-TestH5Fparams.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fbasic"
+TESTING JUnit-TestH5Fbasic
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fbasic > JUnit-TestH5Fbasic.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Fbasic.ext > JUnit-TestH5Fbasic.out
+
+if diff JUnit-TestH5Fbasic.out JUnit-TestH5Fbasic.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Fbasic"
+else
+ echo "**FAILED** JUnit-TestH5Fbasic"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Fbasic.txt JUnit-TestH5Fbasic.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5F"
+TESTING JUnit-TestH5F
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5F > JUnit-TestH5F.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5F.ext > JUnit-TestH5F.out
+
+if diff JUnit-TestH5F.out JUnit-TestH5F.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5F"
+else
+ echo "**FAILED** JUnit-TestH5F"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5F.txt JUnit-TestH5F.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fswmr"
+TESTING JUnit-TestH5Fswmr
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Fswmr > JUnit-TestH5Fswmr.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Fswmr.ext > JUnit-TestH5Fswmr.out
+
+if diff JUnit-TestH5Fswmr.out JUnit-TestH5Fswmr.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Fswmr"
+else
+ echo "**FAILED** JUnit-TestH5Fswmr"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Fswmr.txt JUnit-TestH5Fswmr.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Gbasic"
+TESTING JUnit-TestH5Gbasic
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Gbasic > JUnit-TestH5Gbasic.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Gbasic.ext > JUnit-TestH5Gbasic.out
+
+if diff JUnit-TestH5Gbasic.out JUnit-TestH5Gbasic.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Gbasic"
+else
+ echo "**FAILED** JUnit-TestH5Gbasic"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Gbasic.txt JUnit-TestH5Gbasic.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5G"
+TESTING JUnit-TestH5G
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5G > JUnit-TestH5G.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5G.ext > JUnit-TestH5G.out
+
+if diff JUnit-TestH5G.out JUnit-TestH5G.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5G"
+else
+ echo "**FAILED** JUnit-TestH5G"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5G.txt JUnit-TestH5G.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Sbasic"
+TESTING JUnit-TestH5Sbasic
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Sbasic > JUnit-TestH5Sbasic.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Sbasic.ext > JUnit-TestH5Sbasic.out
+
+if diff JUnit-TestH5Sbasic.out JUnit-TestH5Sbasic.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Sbasic"
+else
+ echo "**FAILED** JUnit-TestH5Sbasic"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Sbasic.txt JUnit-TestH5Sbasic.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5S"
+TESTING JUnit-TestH5S
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5S > JUnit-TestH5S.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5S.ext > JUnit-TestH5S.out
+
+if diff JUnit-TestH5S.out JUnit-TestH5S.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5S"
+else
+ echo "**FAILED** JUnit-TestH5S"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5S.txt JUnit-TestH5S.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tparams"
+TESTING JUnit-TestH5Tparams
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tparams > JUnit-TestH5Tparams.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Tparams.ext > JUnit-TestH5Tparams.out
+
+if diff JUnit-TestH5Tparams.out JUnit-TestH5Tparams.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Tparams"
+else
+ echo "**FAILED** JUnit-TestH5Tparams"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Tparams.txt JUnit-TestH5Tparams.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tbasic"
+TESTING JUnit-TestH5Tbasic
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Tbasic > JUnit-TestH5Tbasic.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Tbasic.ext > JUnit-TestH5Tbasic.out
+
+if diff JUnit-TestH5Tbasic.out JUnit-TestH5Tbasic.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Tbasic"
+else
+ echo "**FAILED** JUnit-TestH5Tbasic"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Tbasic.txt JUnit-TestH5Tbasic.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5T"
+TESTING JUnit-TestH5T
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5T > JUnit-TestH5T.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5T.ext > JUnit-TestH5T.out
+
+if diff JUnit-TestH5T.out JUnit-TestH5T.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5T"
+else
+ echo "**FAILED** JUnit-TestH5T"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5T.txt JUnit-TestH5T.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dparams"
+TESTING JUnit-TestH5Dparams
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dparams > JUnit-TestH5Dparams.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Dparams.ext > JUnit-TestH5Dparams.out
+
+if diff JUnit-TestH5Dparams.out JUnit-TestH5Dparams.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Dparams"
+else
+ echo "**FAILED** JUnit-TestH5Dparams"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Dparams.txt JUnit-TestH5Dparams.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5D"
+TESTING JUnit-TestH5D
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5D > JUnit-TestH5D.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5D.ext > JUnit-TestH5D.out
+
+if diff JUnit-TestH5D.out JUnit-TestH5D.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5D"
+else
+ echo "**FAILED** JUnit-TestH5D"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5D.txt JUnit-TestH5D.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist"
+TESTING JUnit-TestH5Dplist
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Dplist > JUnit-TestH5Dplist.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Dplist.ext > JUnit-TestH5Dplist.out
+
+if diff JUnit-TestH5Dplist.out JUnit-TestH5Dplist.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Dplist"
+else
+ echo "**FAILED** JUnit-TestH5Dplist"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Dplist.txt JUnit-TestH5Dplist.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lparams"
+TESTING JUnit-TestH5Lparams
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lparams > JUnit-TestH5Lparams.ext)
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
- $actual_ext > $actual
+ JUnit-TestH5Lparams.ext > JUnit-TestH5Lparams.out
-# SunOS does not support this. Skip it.
-if [ $myos = SunOS ]; then
- echo " SKIPPED"
+if diff JUnit-TestH5Lparams.out JUnit-TestH5Lparams.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Lparams"
else
- if $CMP $expect $actual; then
- echo " PASSED"
+ echo "**FAILED** JUnit-TestH5Lparams"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Lparams.txt JUnit-TestH5Lparams.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lbasic"
+TESTING JUnit-TestH5Lbasic
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lbasic > JUnit-TestH5Lbasic.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Lbasic.ext > JUnit-TestH5Lbasic.out
+
+if diff JUnit-TestH5Lbasic.out JUnit-TestH5Lbasic.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Lbasic"
+else
+ echo "**FAILED** JUnit-TestH5Lbasic"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Lbasic.txt JUnit-TestH5Lbasic.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lcreate"
+TESTING JUnit-TestH5Lcreate
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Lcreate > JUnit-TestH5Lcreate.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Lcreate.ext > JUnit-TestH5Lcreate.out
+
+if diff JUnit-TestH5Lcreate.out JUnit-TestH5Lcreate.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Lcreate"
+else
+ echo "**FAILED** JUnit-TestH5Lcreate"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Lcreate.txt JUnit-TestH5Lcreate.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5R"
+TESTING JUnit-TestH5R
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5R > JUnit-TestH5R.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5R.ext > JUnit-TestH5R.out
+
+if diff JUnit-TestH5R.out JUnit-TestH5R.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5R"
+else
+ echo "**FAILED** JUnit-TestH5R"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5R.txt JUnit-TestH5R.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P"
+TESTING JUnit-TestH5P
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5P > JUnit-TestH5P.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5P.ext > JUnit-TestH5P.out
+
+if diff JUnit-TestH5P.out JUnit-TestH5P.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5P"
+else
+ echo "**FAILED** JUnit-TestH5P"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5P.txt JUnit-TestH5P.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PData"
+TESTING JUnit-TestH5PData
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PData > JUnit-TestH5PData.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5PData.ext > JUnit-TestH5PData.out
+
+if diff JUnit-TestH5PData.out JUnit-TestH5PData.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5PData"
+else
+ echo "**FAILED** JUnit-TestH5PData"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5PData.txt JUnit-TestH5PData.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapl"
+TESTING JUnit-TestH5Pfapl
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapl > JUnit-TestH5Pfapl.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Pfapl.ext > JUnit-TestH5Pfapl.out
+
+if diff JUnit-TestH5Pfapl.out JUnit-TestH5Pfapl.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Pfapl"
+else
+ echo "**FAILED** JUnit-TestH5Pfapl"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Pfapl.txt JUnit-TestH5Pfapl.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pvirtual"
+TESTING JUnit-TestH5Pvirtual
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pvirtual > JUnit-TestH5Pvirtual.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Pvirtual.ext > JUnit-TestH5Pvirtual.out
+
+if diff JUnit-TestH5Pvirtual.out JUnit-TestH5Pvirtual.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Pvirtual"
+else
+ echo "**FAILED** JUnit-TestH5Pvirtual"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Pvirtual.txt JUnit-TestH5Pvirtual.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Plist"
+TESTING JUnit-TestH5Plist
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Plist > JUnit-TestH5Plist.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Plist.ext > JUnit-TestH5Plist.out
+
+if diff JUnit-TestH5Plist.out JUnit-TestH5Plist.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Plist"
+else
+ echo "**FAILED** JUnit-TestH5Plist"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Plist.txt JUnit-TestH5Plist.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5A"
+TESTING JUnit-TestH5A
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5A > JUnit-TestH5A.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5A.ext > JUnit-TestH5A.out
+
+if diff JUnit-TestH5A.out JUnit-TestH5A.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5A"
+else
+ echo "**FAILED** JUnit-TestH5A"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5A.txt JUnit-TestH5A.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams"
+TESTING JUnit-TestH5Oparams
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Oparams > JUnit-TestH5Oparams.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Oparams.ext > JUnit-TestH5Oparams.out
+
+if diff JUnit-TestH5Oparams.out JUnit-TestH5Oparams.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Oparams"
+else
+ echo "**FAILED** JUnit-TestH5Oparams"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Oparams.txt JUnit-TestH5Oparams.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Obasic"
+TESTING JUnit-TestH5Obasic
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Obasic > JUnit-TestH5Obasic.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Obasic.ext > JUnit-TestH5Obasic.out
+
+if diff JUnit-TestH5Obasic.out JUnit-TestH5Obasic.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Obasic"
+else
+ echo "**FAILED** JUnit-TestH5Obasic"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Obasic.txt JUnit-TestH5Obasic.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocreate"
+TESTING JUnit-TestH5Ocreate
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocreate > JUnit-TestH5Ocreate.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Ocreate.ext > JUnit-TestH5Ocreate.out
+
+if diff JUnit-TestH5Ocreate.out JUnit-TestH5Ocreate.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Ocreate"
+else
+ echo "**FAILED** JUnit-TestH5Ocreate"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Ocreate.txt JUnit-TestH5Ocreate.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy"
+TESTING JUnit-TestH5Ocopy
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Ocopy > JUnit-TestH5Ocopy.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Ocopy.ext > JUnit-TestH5Ocopy.out
+
+if diff JUnit-TestH5Ocopy.out JUnit-TestH5Ocopy.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Ocopy"
+else
+ echo "**FAILED** JUnit-TestH5Ocopy"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Ocopy.txt JUnit-TestH5Ocopy.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PL"
+TESTING JUnit-TestH5PL
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5PL > JUnit-TestH5PL.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5PL.ext > JUnit-TestH5PL.out
+
+if diff JUnit-TestH5PL.out JUnit-TestH5PL.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5PL"
+else
+ echo "**FAILED** JUnit-TestH5PL"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5PL.txt JUnit-TestH5PL.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5VL"
+TESTING JUnit-TestH5VL
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5VL > JUnit-TestH5VL.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5VL.ext > JUnit-TestH5VL.out
+
+if diff JUnit-TestH5VL.out JUnit-TestH5VL.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5VL"
+else
+ echo "**FAILED** JUnit-TestH5VL"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5VL.txt JUnit-TestH5VL.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z"
+TESTING JUnit-TestH5Z
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Z > JUnit-TestH5Z.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Z.ext > JUnit-TestH5Z.out
+
+if diff JUnit-TestH5Z.out JUnit-TestH5Z.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Z"
+else
+ echo "**FAILED** JUnit-TestH5Z"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Z.txt JUnit-TestH5Z.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E"
+TESTING JUnit-TestH5E
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5E.ext > JUnit-TestH5E.out
+
+if diff JUnit-TestH5E.out JUnit-TestH5E.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5E"
+else
+ echo "**FAILED** JUnit-TestH5E"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5E.txt JUnit-TestH5E.out |sed 's/^/ /'
+fi
+
+echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault"
+TESTING JUnit-TestH5Edefault
+($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext)
+
+# Extract file name, line number, version and thread IDs because they may be different
+sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out
+
+if diff JUnit-TestH5Edefault.out JUnit-TestH5Edefault.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Edefault"
+else
+ echo "**FAILED** JUnit-TestH5Edefault"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Edefault.txt JUnit-TestH5Edefault.out |sed 's/^/ /'
+fi
+
+if test $USE_FILTER_SZIP = "yes"; then
+ echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate"
+ TESTING JUnit-TestH5Giterate
+ ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate > JUnit-TestH5Giterate.ext)
+
+ # Extract file name, line number, version and thread IDs because they may be different
+ sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*[\.,[0-9]*]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Giterate.ext > JUnit-TestH5Giterate.out
+
+ if diff JUnit-TestH5Giterate.out JUnit-TestH5Giterate.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Giterate"
+ else
+ echo "**FAILED** JUnit-TestH5Giterate"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Giterate.txt JUnit-TestH5Giterate.out |sed 's/^/ /'
+ fi
+fi
+if test "X$ROS3_VFD" = "Xyes"; then
+ echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapls3"
+ TESTING JUnit-TestH5Pfapls3
+ ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapls3 > JUnit-TestH5Pfapls3.ext)
+
+ # Extract file name, line number, version and thread IDs because they may be different
+ sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*\.,[0-9]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Pfapls3.ext > JUnit-TestH5Pfapls3.out
+
+ if diff JUnit-TestH5Pfapls3.out JUnit-TestH5Pfapls3.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Pfapls3"
+ else
+ echo "**FAILED** JUnit-TestH5Pfapls3"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF JUnit-TestH5Pfapls3.txt JUnit-TestH5Pfapls3.out |sed 's/^/ /'
+ fi
+fi
+if test "X$HAVE_LIBHDFS" = "Xyes"; then
+ echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfaplhdfs"
+ TESTING JUnit-TestH5Pfaplhdfs
+ ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfaplhdfs > JUnit-TestH5Pfaplhdfs.ext)
+
+ # Extract file name, line number, version and thread IDs because they may be different
+ sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/Time: [0-9]*\.,[0-9]*/Time: XXXX/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ JUnit-TestH5Pfaplhdfs.ext > JUnit-TestH5Pfaplhdfs.out
+
+ if diff JUnit-TestH5Pfaplhdfs.out JUnit-TestH5Pfaplhdfs.txt > /dev/null; then
+ echo " PASSED JUnit-TestH5Pfaplhdfs"
else
- echo "*FAILED*"
+ echo "**FAILED** JUnit-TestH5Pfaplhdfs"
echo " Expected result differs from actual result"
nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ test yes = "$verbose" && $DIFF JUnit-TestH5Pfaplhdfs.txt JUnit-TestH5Pfaplhdfs.out |sed 's/^/ /'
fi
fi
diff --git a/java/test/testfiles/JUnit-TestH5.txt b/java/test/testfiles/JUnit-TestH5.txt
new file mode 100644
index 0000000..4bab633
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5.txt
@@ -0,0 +1,17 @@
+JUnit version 4.11
+.testH5get_libversion_null_param
+.testJ2C
+.testH5export_dataset
+.testIsSerializable
+.testH5garbage_collect
+.testH5error_off
+.serializeToDisk
+.testH5open
+.testH5check_version
+.testH5get_libversion
+.testH5set_free_list_limits
+
+Time: XXXX
+
+OK (11 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5A.txt b/java/test/testfiles/JUnit-TestH5A.txt
new file mode 100644
index 0000000..2026d21
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5A.txt
@@ -0,0 +1,34 @@
+JUnit version 4.11
+.testH5Acreate2_nullname
+.testH5Acreate_by_name
+.testH5Aget_name_by_idx
+.testH5Aget_storage_size
+.testH5Aiterate
+.testH5Aopen_by_idx
+.testH5Aopen_invalidname
+.testH5Aopen
+.testH5Aget_info_by_name
+.testH5Aget_create_plist
+.testH5Adelete_by_name
+.testH5Aopen_by_name
+.testH5Aget_info
+.testH5Aget_name
+.testH5Aexists
+.testH5Aget_info_by_idx
+.testH5Arename
+.testH5Adelete_by_idx_name1
+.testH5Adelete_by_idx_name2
+.testH5Adelete_by_idx_order
+.testH5Arename_by_name
+.testH5Acreate2_invalidobject
+.testH5Acreate2
+.testH5Aiterate_by_name
+.testH5Adelete_by_idx_null
+.testH5Adelete_by_idx_invalidobject
+.testH5Awrite_readVL
+.testH5Aget_info1
+
+Time: XXXX
+
+OK (28 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5D.txt b/java/test/testfiles/JUnit-TestH5D.txt
new file mode 100644
index 0000000..987655b
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5D.txt
@@ -0,0 +1,25 @@
+JUnit version 4.11
+.testH5Dget_storage_size
+.testH5Diterate_write
+.testH5Dcreate
+.testH5Dget_offset
+.testH5Dget_type
+.testH5Dfill
+.testH5Dopen
+.testH5Dcreate_anon
+.testH5Dfill_null
+.testH5Dget_storage_size_empty
+.testH5Diterate
+.testH5Dget_access_plist
+.testH5Dvlen_read_invalid_buffer
+.testH5Dvlen_get_buf_size
+.testH5Dget_space_closed
+.testH5Dget_space_status
+.testH5Dvlen_write_read
+.testH5Dget_space
+.testH5Dget_type_closed
+
+Time: XXXX
+
+OK (19 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Dparams.txt b/java/test/testfiles/JUnit-TestH5Dparams.txt
new file mode 100644
index 0000000..9acedd7
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Dparams.txt
@@ -0,0 +1,24 @@
+JUnit version 4.11
+.testH5Dget_space_status_invalid
+.testH5Dget_access_plist_invalid
+.testH5Dget_type_invalid
+.testH5Dget_create_plist_invalid
+.testH5Dget_offset_invalid
+.testH5Dvlen_get_buf_size_invalid
+.testH5Dcreate_null
+.testH5Dset_extent_status_null
+.testH5Dcreate_invalid
+.testH5Dcreate_anon_invalid
+.testH5Dset_extent_status_invalid
+.testH5Dopen_invalid
+.testH5Dclose_invalid
+.testH5Dflush_invalid
+.testH5Drefresh_invalid
+.testH5Dget_storage_size_invalid
+.testH5Dget_space_invalid
+.testH5Dopen_null
+
+Time: XXXX
+
+OK (18 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Dplist.txt b/java/test/testfiles/JUnit-TestH5Dplist.txt
new file mode 100644
index 0000000..64e924a
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Dplist.txt
@@ -0,0 +1,8 @@
+JUnit version 4.11
+.testH5P_dset_no_attrs_hint
+.testH5Dset_extent
+
+Time: XXXX
+
+OK (2 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5E.txt b/java/test/testfiles/JUnit-TestH5E.txt
new file mode 100644
index 0000000..8c5e5e4
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5E.txt
@@ -0,0 +1,11 @@
+JUnit version 4.11
+.testH5Eget_msg_major
+.testH5Eget_msg_minor
+.testH5Epush
+.testH5Ewalk
+.testH5Epop
+
+Time: XXXX
+
+OK (5 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt
new file mode 100644
index 0000000..bb43c64
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Edefault.txt
@@ -0,0 +1,32 @@
+JUnit version 4.11
+.testH5Eset_current_stack_invalid_stkid
+.testH5Eset_current_stack
+.testH5Eget_num
+.testH5Eclear
+.testH5Epush_null_name
+.testH5Eget_num_with_msg
+.testH5Eclear2_with_msg
+.testH5Epush_invalid_stkid
+.testH5Eget_current_stack
+.testH5Ecreate_stack
+.testH5Eget_msg_invalid_msgid
+.testH5Eauto_is_v2
+.testH5EclearInt
+.testH5Eauto_is_v2_invalid_stkid
+.testH5Eclose_msg_invalid_errid
+.testH5Eclose_stack_invalid_stackid
+.testH5Eget_class_name_invalid_classname
+.testH5Eget_num_invalid_stkid
+.testH5EprintInt_invalid_classid
+.testH5Epop
+.testH5Epop_invalid_stkid
+.testH5Eget_current_stack_pop
+.testH5Eget_class_name_invalid_classid
+.testH5Ecreate_msg_invalid_errid
+.testH5Eclear2_invalid_stkid
+.testH5Eprint2_invalid_classid
+
+Time: XXXX
+
+OK (26 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Eparams.txt b/java/test/testfiles/JUnit-TestH5Eparams.txt
new file mode 100644
index 0000000..92f8068
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Eparams.txt
@@ -0,0 +1,19 @@
+JUnit version 4.11
+.testH5EprintInt
+.testH5Eget_msg
+.testH5Eget_num
+.testH5Eget_class_name
+.testH5Eget_num_with_msg
+.testH5Eclear2
+.testH5Eprint2
+.testH5Ecreate_msg_major
+.testH5Ecreate_msg_minor
+.testH5Ecreate_stack
+.testH5Ecreate_msg_name_null
+.testH5Eauto_is_v2
+.testH5EclearInt
+
+Time: XXXX
+
+OK (13 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Eregister.txt b/java/test/testfiles/JUnit-TestH5Eregister.txt
new file mode 100644
index 0000000..132e123
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Eregister.txt
@@ -0,0 +1,11 @@
+JUnit version 4.11
+.testH5Eregister_class_lib_name_null
+.testH5Eregister_class_version_null
+.testH5Eunregister_class_invalid_classid
+.testH5Eregister_class
+.testH5Eregister_class_cls_name_null
+
+Time: XXXX
+
+OK (5 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5F.txt b/java/test/testfiles/JUnit-TestH5F.txt
new file mode 100644
index 0000000..f79ac40
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5F.txt
@@ -0,0 +1,16 @@
+JUnit version 4.11
+.testH5Fget_access_plist
+.testH5Fget_fileno_diff
+.testH5Fget_fileno_same
+.testH5Fget_obj_ids
+.testH5Fget_intent_rdwr
+.testH5Fget_access_plist_closed
+.testH5Fget_create_plist_closed
+.testH5Fget_intent_rdonly
+.testH5Fget_create_plist
+.testH5Fget_obj_count
+
+Time: XXXX
+
+OK (10 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Fbasic.txt b/java/test/testfiles/JUnit-TestH5Fbasic.txt
new file mode 100644
index 0000000..cd4e282
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Fbasic.txt
@@ -0,0 +1,22 @@
+JUnit version 4.11
+.testH5Fget_mdc_size
+.testH5Fget_mdc_hit_rate
+.testH5F_dset_no_attrs_hint
+.testH5Fget_freespace
+.testH5Fclose
+.testH5Fget_filesize
+.testH5Fcreate_EXCL
+.testH5Freopen_closed
+.testH5Freset_mdc_hit_rate_stats
+.testH5Fget_name
+.testH5Fis_accessible
+.testH5Fcreate
+.testH5Fclear_elink_file_cache
+.testH5Fclose_twice
+.testH5Freopen
+.testH5Fopen_read_only
+
+Time: XXXX
+
+OK (16 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Fparams.txt b/java/test/testfiles/JUnit-TestH5Fparams.txt
new file mode 100644
index 0000000..91a8435
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Fparams.txt
@@ -0,0 +1,16 @@
+JUnit version 4.11
+.testH5Fis_accessible_null
+.testH5Fcreate_null
+.testH5Fflush_local
+.testH5Fget_info
+.testH5Fmount_null
+.testH5Fcreate
+.testH5Fflush_global
+.testH5Funmount_null
+.testH5Fclose_negative
+.testH5Fopen_null
+
+Time: XXXX
+
+OK (10 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Fswmr.txt b/java/test/testfiles/JUnit-TestH5Fswmr.txt
new file mode 100644
index 0000000..f943892
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Fswmr.txt
@@ -0,0 +1,8 @@
+JUnit version 4.11
+.testH5Fstart_swmr_write
+.testH5Fswmr_read_attempts
+
+Time: XXXX
+
+OK (2 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5G.txt b/java/test/testfiles/JUnit-TestH5G.txt
new file mode 100644
index 0000000..cbcea1d
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5G.txt
@@ -0,0 +1,17 @@
+JUnit version 4.11
+.testH5Gget_info_by_name
+.testH5Gget_create_plist
+.testH5Gopen
+.testH5Gget_obj_info_all_gid2
+.testH5Gget_obj_info_all_byIndexType
+.testH5Gget_obj_info_max_limit
+.testH5Gget_obj_info_all
+.testH5Gget_obj_info_max
+.testH5Gget_obj_info_all_gid
+.testH5Gget_info_by_idx
+.testH5Gget_info
+
+Time: XXXX
+
+OK (11 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Gbasic.txt b/java/test/testfiles/JUnit-TestH5Gbasic.txt
new file mode 100644
index 0000000..3521696
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Gbasic.txt
@@ -0,0 +1,33 @@
+JUnit version 4.11
+.testH5Gget_info_by_name_not_exists
+.testH5Gget_info_by_idx_not_exists
+.testH5Gget_info_by_name
+.testH5Gget_create_plist
+.testH5Gopen
+.testH5Gget_info_by_idx_null
+.testH5Gopen_not_exists
+.testH5Gclose
+.testH5Gcreate_anon
+.testH5Gcreate_null
+.testH5Gget_info_by_idx_fileid
+.testH5Gclose_invalid
+.testH5Gflush_invalid
+.testH5Gopen_invalid
+.testH5Grefresh_invalid
+.testH5Gget_info_invalid
+.testH5Gcreate_invalid
+.testH5Gcreate_exists
+.testH5Gget_info_by_name_null
+.testH5Gget_info_by_name_invalid
+.testH5Gget_create_plist_invalid
+.testH5Gcreate
+.testH5Gget_info_by_name_fileid
+.testH5Gget_info_by_idx_invalid
+.testH5Gopen_null
+.testH5Gget_info_by_idx
+.testH5Gget_info
+
+Time: XXXX
+
+OK (27 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Giterate.txt b/java/test/testfiles/JUnit-TestH5Giterate.txt
new file mode 100644
index 0000000..38402af
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Giterate.txt
@@ -0,0 +1,7 @@
+JUnit version 4.11
+.testH5Gget_obj_info_all
+
+Time: XXXX
+
+OK (1 test)
+
diff --git a/java/test/testfiles/JUnit-TestH5Lbasic.txt b/java/test/testfiles/JUnit-TestH5Lbasic.txt
new file mode 100644
index 0000000..b9b580c
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Lbasic.txt
@@ -0,0 +1,23 @@
+JUnit version 4.11
+.testH5Lget_info_by_idx_not_exist_name
+.testH5Lget_name_by_idx_not_exist
+.testH5Lvisit
+.testH5Lget_name_by_idx_n0
+.testH5Lget_name_by_idx_n3
+.testH5Lvisit_by_name
+.testH5Literate_by_name
+.testH5Lget_info_hardlink
+.testH5Literate
+.testH5Lget_info_by_idx_n0
+.testH5Lget_info_by_idx_n3
+.testH5Lget_info_by_idx_name_not_exist_create
+.testH5Lexists
+.testH5Lget_info_by_idx_name_not_exist_name
+.testH5Lget_info_by_idx_not_exist_create
+.testH5Lget_info_not_exist
+.testH5Lget_info_dataset
+
+Time: XXXX
+
+OK (17 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Lcreate.txt b/java/test/testfiles/JUnit-TestH5Lcreate.txt
new file mode 100644
index 0000000..cbd5d36
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Lcreate.txt
@@ -0,0 +1,42 @@
+JUnit version 4.11
+.testH5Lget_info_by_idx_n0_create
+.testH5Ldelete_soft_link_dangle
+.testH5Lget_value_by_idx_external_create
+.testH5Ldelete_by_idx_not_exist_create
+.testH5Lvisit_create
+.testH5Lmove_dst_link_exists
+.testH5Lcreate_soft_dangle
+.testH5Literate_create
+.testH5Lcopy_cur_not_exists
+.testH5Lcopy
+.testH5Lmove
+.testH5Lget_value_by_idx_n2_create
+.testH5Lget_value_soft
+.testH5Ldelete_by_idx_n2_name
+.testH5Lget_info_by_idx_n1_create
+.testH5Lcreate_external
+.testH5Lget_value_dangle
+.testH5Lcreate_hard_dst_link_exists
+.testH5Lget_value_by_idx_n2_name
+.testH5Lcreate_soft_dst_link_exists
+.testH5Lcreate_hard
+.testH5Lcreate_soft
+.testH5Lmove_cur_not_exists
+.testH5Lcreate_hard_cur_not_exists
+.testH5Lget_info_softlink_dangle
+.testH5Ldelete_by_idx_n2_create
+.testH5Ldelete_soft_link
+.testH5Lget_info_externallink
+.testH5Lcopy_dst_link_exists
+.testH5Lget_value_by_idx_external_name
+.testH5Ldelete_by_idx_not_exist_name
+.testH5Lget_info_softlink
+.testH5Lget_value_external
+.testH5Lget_value_by_idx_not_exist_create
+.testH5Lget_value_by_idx_not_exist_name
+.testH5Ldelete_hard_link
+
+Time: XXXX
+
+OK (36 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Lparams.txt b/java/test/testfiles/JUnit-TestH5Lparams.txt
new file mode 100644
index 0000000..a22741c
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Lparams.txt
@@ -0,0 +1,44 @@
+JUnit version 4.11
+.testH5Lcopy_invalid
+.testH5Lget_value_by_idx_null
+.testH5Lcreate_external_invalid
+.testH5Lexists_null
+.testH5Lget_info_invalid
+.testH5Lget_name_by_idx_invalid
+.testH5Lmove_null_current
+.testH5Literate_by_name_nullname
+.testH5Lvisit_by_name_nullname
+.testH5Lvisit_null
+.testH5Lget_name_by_idx_null
+.testH5Lcreate_hard_null_dest
+.testH5Lget_value_null
+.testH5Lcreate_external_null_dest
+.testH5Lcreate_external_null_file
+.testH5Lcreate_external_null_current
+.testH5Ldelete_null
+.testH5Lexists_invalid
+.testH5Lmove_invalid
+.testH5Lcreate_hard_invalid
+.testH5Lcopy_null_dest
+.testH5Lcreate_soft_null_current
+.testH5Lcopy_null_current
+.testH5Lget_info_by_idx_null
+.testH5Literate_null
+.testH5Ldelete_invalid
+.testH5Lvisit_by_name_null
+.testH5Ldelete_by_idx_invalid
+.testH5Lget_info_by_idx_invalid
+.testH5Ldelete_by_idx_null
+.testH5Lcreate_soft_invalid
+.testH5Lcreate_hard_null_current
+.testH5Lget_value_by_idx_invalid
+.testH5Lmove_null_dest
+.testH5Lget_info_null
+.testH5Literate_by_name_null
+.testH5Lcreate_soft_null_dest
+.testH5Lget_value_invalid
+
+Time: XXXX
+
+OK (38 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Obasic.txt b/java/test/testfiles/JUnit-TestH5Obasic.txt
new file mode 100644
index 0000000..c39c01d
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Obasic.txt
@@ -0,0 +1,45 @@
+JUnit version 4.11
+.testH5Oexists_by_name
+.testH5Oget_native_info_dataset
+.testH5Oopen_by_token
+.testH5Oget_info_by_idx_n0
+.testH5Oget_info_by_idx_n3
+.testH5Oget_native_info_datatype
+.testH5Oget_info_by_name_not_exist_name
+.testH5Ovisit_by_name
+.testH5Oget_native_info_by_name_datatype
+.testH5Oget_info_by_idx_name_not_exist_name
+.testH5Oget_info_datatype
+.testH5Oget_info_by_idx_not_exist_name
+.testH5Oopen_by_idx_n0
+.testH5Oopen_by_idx_n3
+.testH5Oget_native_info_by_name_not_exist_name
+.testH5Oopen_not_exists
+.testH5Ovisit
+.testH5Oget_info_by_idx_not_exist_create
+.testH5Oget_native_info_by_idx_not_exist_name
+.testH5Oget_info_by_name_hardlink
+.testH5Oget_info_by_name_group
+.testH5Oget_info_by_name_not_exists
+.testH5Oget_native_info_by_idx_not_exist_create
+.testH5Oget_info_by_name_dataset
+.testH5Oget_info_group
+.testH5Oget_native_info_hardlink
+.testH5Oget_native_info_by_name_hardlink
+.testH5Oget_native_info_by_idx_name_not_exist_name
+.testH5Oget_info_by_name_datatype
+.testH5Oget_info_hardlink
+.testH5Oget_native_info_group
+.testH5Oget_native_info_by_name_not_exists
+.testH5Oget_native_info_by_name_dataset
+.testH5Oget_info_by_idx_name_not_exist_create
+.testH5Oget_native_info_by_idx_n0
+.testH5Oget_native_info_by_idx_n3
+.testH5Oget_info_dataset
+.testH5Oget_native_info_by_name_group
+.testH5Oget_native_info_by_idx_name_not_exist_create
+
+Time: XXXX
+
+OK (39 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Ocopy.txt b/java/test/testfiles/JUnit-TestH5Ocopy.txt
new file mode 100644
index 0000000..32dfde7
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Ocopy.txt
@@ -0,0 +1,9 @@
+JUnit version 4.11
+.testH5OcopyRefsDatasettosameFile
+.testH5OcopyRefsDatasettodiffFile
+.testH5OcopyRefsAttr
+
+Time: XXXX
+
+OK (3 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Ocreate.txt b/java/test/testfiles/JUnit-TestH5Ocreate.txt
new file mode 100644
index 0000000..5bc9e07
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Ocreate.txt
@@ -0,0 +1,22 @@
+JUnit version 4.11
+.testH5Oget_info_by_idx_n0_create
+.testH5Oget_info_softlink_dangle
+.testH5Oget_info_softlink
+.testH5Oget_info_externallink
+.testH5Ocopy
+.testH5Ocork
+.testH5Olink
+.testH5Ocomment_by_name
+.testH5Oget_info_by_idx_n1_create
+.testH5Ocomment
+.testH5Oinc_dec_count
+.testH5Ocomment_by_name_clear
+.testH5Ovisit_create
+.testH5Ocopy_dst_link_exists
+.testH5Ocomment_clear
+.testH5Ocopy_cur_not_exists
+
+Time: XXXX
+
+OK (16 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Oparams.txt b/java/test/testfiles/JUnit-TestH5Oparams.txt
new file mode 100644
index 0000000..b756bcf
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Oparams.txt
@@ -0,0 +1,38 @@
+JUnit version 4.11
+.testH5Oget_comment_by_name_null
+.testH5Oget_native_info_by_name_invalid
+.testH5Ovisit_by_name_nullname
+.testH5Oget_info_invalid
+.testH5Ovisit_by_name_null
+.testH5Odisable_mdc_flushes
+.testH5Oget_comment_invalid
+.testH5Oget_native_info_invalid
+.testH5Oset_comment_by_name_invalid
+.testH5Oare_mdc_flushes_disabled
+.testH5Oopen_null
+.testH5Oclose_invalid
+.testH5Oflush_invalid
+.testH5Oget_native_info_by_name_null
+.testH5Oget_comment_by_name_invalid
+.testH5Orefresh_invalid
+.testH5Ocopy_null_dest
+.testH5Oget_native_info_by_idx_null
+.testH5Olink_invalid
+.testH5Oget_info_by_idx_invalid
+.testH5Oget_info_by_idx_null
+.testH5Olink_null_dest
+.testH5Oget_native_info_by_idx_invalid
+.testH5Oget_info_by_name_invalid
+.testH5Oget_info_by_name_null
+.testH5Ocopy_invalid
+.testH5Oset_comment_by_name_null
+.testH5Ocopy_null_current
+.testH5Oset_comment_invalid
+.testH5Oopen_invalid
+.testH5Oenable_mdc_flushes
+.testH5Ovisit_null
+
+Time: XXXX
+
+OK (32 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5P.txt b/java/test/testfiles/JUnit-TestH5P.txt
new file mode 100644
index 0000000..01acadd
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5P.txt
@@ -0,0 +1,89 @@
+JUnit version 4.11
+.testH5Pset_nbit
+.testH5Pset_shared_mesg_index_InvalidFlag
+.testH5Pset_shared_mesg_phase_change
+.testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue
+.testH5P_layout
+.testH5Pget_link_creation_order
+.testH5Pget_efile_prefix
+.testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes
+.testH5P_file_space_page_size
+.testH5Pget_shared_mesg_index_Invalid_indexnum
+.testH5Pset_data_transform_NullExpression
+.testH5Pset_elink_prefix_null
+.testH5Pget_elink_prefix
+.testH5Pget_nlinks
+.testH5Pset_libver_bounds_invalidhigh
+.testH5Pget_char_encoding
+.testH5P_istore_k
+.testH5Pget_link_phase_change
+.testH5Pset_link_phase_change_max_compactLESSTHANmin_dense
+.testH5Pget_shared_mesg_phase_change_EqualsSET
+.testH5Pset_scaleoffset_Invalidscale_type
+.testH5Pget_istore_k_null
+.testH5Pset_libver_bounds_invalidlow
+.testH5Pset_est_link_info
+.testH5Pget_link_phase_change_Null
+.testH5P_fill_time
+.testH5Pget_userblock_null
+.testH5Pset_link_creation_order_tracked
+.testH5Pset_shared_mesg_index
+.testH5Pset_copy_object
+.testH5Pset_link_creation_order_trackedPLUSindexed
+.testH5P_file_space_strategy
+.testH5Pset_copy_object_invalidobject
+.testH5Pset_est_link_info_InvalidValues
+.testH5Pset_local_heap_size_hint
+.testH5Pget_est_link_info
+.testH5Pset_efile_prefix_null
+.testH5Pset_scaleoffset
+.testH5Pset_create_intermediate_group_invalidobject
+.testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue
+.testH5Pset_create_intermediate_group
+.testH5P_alloc_time
+.testH5Pset_elink_acc_flags
+.testH5Pset_link_phase_change_Highmax_Compact
+.testH5P_chunk
+.testH5P_sizes
+.testH5Pset_link_creation_order_invalidvalue
+.testH5P_sym_k
+.testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist
+.testH5Pset_scaleoffset_Invalidscale_factor
+.testH5Pget_elink_prefix_null
+.testH5Pget_data_transform_IllegalSize
+.testH5Pget_create_intermediate_group
+.testH5Pset_shared_mesg_nindexes
+.testH5Pset_attr_creation_order_trackedPLUSindexed
+.testH5Pget_sym_k_null
+.testH5Pset_nlinks
+.testH5P_obj_track_times
+.testH5Pset_efile_prefix
+.testH5P_userblock
+.testH5Pget_local_heap_size_hint
+.testH5Pset_shared_mesg_index_Invalid_indexnum
+.testH5Pset_data_transform_InvalidExpression1
+.testH5Pset_data_transform_InvalidExpression2
+.testH5Pget_attr_phase_change
+.testH5Pget_data_transform
+.testH5Pget_create_intermediate_group_notcreated
+.testH5Pset_elink_prefix
+.testH5Pget_attr_creation_order
+.testH5Pset_attr_creation_order_invalidvalue
+.testH5Pget_shared_mesg_phase_change
+.testH5Pget_shared_mesg_index
+.testH5Pset_link_phase_change
+.testH5Pget_shared_mesg_nindexes
+.testH5Pset_elink_acc_flags_InvalidFlag1
+.testH5Pset_elink_acc_flags_InvalidFlag2
+.testH5Pget_link_phase_change_EqualsSet
+.testH5Pget_elink_acc_flags
+.testH5Pget_data_transform_ExpressionNotSet
+.testH5P_fill_value
+.testH5Pget_sizes_null
+.testH5Pset_data_transform
+.testH5Pset_attr_creation_order_tracked
+
+Time: XXXX
+
+OK (83 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5PData.txt b/java/test/testfiles/JUnit-TestH5PData.txt
new file mode 100644
index 0000000..6356d69
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5PData.txt
@@ -0,0 +1,8 @@
+JUnit version 4.11
+.testH5P_buffer
+.testH5Pdata_transform
+
+Time: XXXX
+
+OK (2 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5PL.txt b/java/test/testfiles/JUnit-TestH5PL.txt
new file mode 100644
index 0000000..fb78bb5
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5PL.txt
@@ -0,0 +1,8 @@
+JUnit version 4.11
+.TestH5PLplugins
+.TestH5PLpaths
+
+Time: XXXX
+
+OK (2 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Pfapl.txt b/java/test/testfiles/JUnit-TestH5Pfapl.txt
new file mode 100644
index 0000000..c4f37d0
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Pfapl.txt
@@ -0,0 +1,41 @@
+JUnit version 4.11
+.testH5P_elink_fapl
+.testH5P_fapl_direct
+.testH5P_alignment
+.testH5P_fapl_family
+.testH5P_chunk_cache
+.testH5P_meta_block_size
+.testH5Fmdc_logging
+.testH5Pget_elink_fapl
+.testH5Pset_mdc_config
+.testH5P_small_data_block_size
+.testH5Pset_fapl_log
+.testH5P_evict_on_close
+.testH5Pset_libver_bounds
+.testH5P_sieve_buf_size
+.testH5P_elink_file_cache_size
+.testH5P_cache
+.testH5Pget_mdc_config
+.testH5P_fapl_muti_defaults
+.testH5Pget_libver_bounds
+.testH5P_btree_ratios
+.testH5P_fapl_muti_nulls
+.testH5Pset_fapl_sec2
+.testH5Pmulti_transform
+.testH5Pset_elink_fapl_NegativeID
+.testH5Pset_fapl_stdio
+.testH5P_edc_check
+.testH5Pset_elink_fapl
+.testH5P_hyper_vector_size
+.testH5P_gc_references
+.testH5P_family_offset
+.testH5P_fapl_core
+.testH5P_fapl_muti
+.testH5P_fapl_split
+.testH5Pset_fapl_windows
+.testH5P_fclose_degree
+
+Time: XXXX
+
+OK (35 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt b/java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt
new file mode 100644
index 0000000..47a00a4
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt
@@ -0,0 +1,9 @@
+JUnit version 4.11
+.testH5Pget_fapl_hdfs_invalid_fapl_id
+.testH5Pget_fapl_hdfs_fapl_id_of_wrong_driver_type
+.testHDFS_fapl
+
+Time: XXXX
+
+OK (3 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Pfapls3.txt b/java/test/testfiles/JUnit-TestH5Pfapls3.txt
new file mode 100644
index 0000000..3f46342
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Pfapls3.txt
@@ -0,0 +1,10 @@
+JUnit version 4.11
+.testH5Pset_fapl_ros3_specified
+.testH5Pset_fapl_ros3
+.testH5Pget_fapl_ros3_invalid_fapl_id
+.testH5Pget_fapl_ros3_fapl_id_of_wrong_driver_type
+
+Time: XXXX
+
+OK (4 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Plist.txt b/java/test/testfiles/JUnit-TestH5Plist.txt
new file mode 100644
index 0000000..ed9843a
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Plist.txt
@@ -0,0 +1,10 @@
+JUnit version 4.11
+.testH5P_genprop_basic_class
+.testH5P_genprop_class_iter
+.testH5P_genprop_basic_class_prop
+.testH5P_genprop_basic_list_prop
+
+Time: XXXX
+
+OK (4 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Pvirtual.txt b/java/test/testfiles/JUnit-TestH5Pvirtual.txt
new file mode 100644
index 0000000..e57f683
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Pvirtual.txt
@@ -0,0 +1,17 @@
+JUnit version 4.11
+.testH5Pget_source_datasetname
+.testH5Pvirtual_storage
+.testH5Pget_selection_source_dataset
+.testH5Pget_virtual_prefix
+.testH5Pget_source_filename
+.testH5Pset_get_virtual_printf_gap
+.testH5Pget_virtual_count
+.testH5Pset_virtual_prefix
+.testH5Pset_get_virtual_view
+.testH5Pget_mapping_parameters
+.testH5Pset_virtual_prefix_null
+
+Time: XXXX
+
+OK (11 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5R.txt b/java/test/testfiles/JUnit-TestH5R.txt
new file mode 100644
index 0000000..a96fbb4
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5R.txt
@@ -0,0 +1,28 @@
+JUnit version 4.11
+.testH5Ropen_attr_Nullref
+.testH5Rget_attr_name_Nullref
+.testH5Ropen_region_Nullref
+.testH5Requal_Nullref1
+.testH5Requal_Nullref2
+.testH5Rget_object
+.testH5Rget_obj_type3_Nullref
+.testH5Ropen_object_Nullref
+.testH5Rdestroy_Nullref
+.testH5Rcreate_object_Nullname
+.testH5Rget_obj_type3
+.testH5Rget_name_Invalidloc
+.testH5Rcopy_Nullref1
+.testH5Rcreate_attr_Invalidloc
+.testH5Rget_file_name_Nullref
+.testH5Rget_obj_name_Nullref
+.testH5Rcreate_region_Nullname
+.testH5Rcreate_regionref_object
+.testH5Rcreate_attr_Nullattrname
+.testH5Rcreate_region_Invalidloc
+.testH5Rget_type_Nullref
+.testH5Rcreate_attr_Nullname
+
+Time: XXXX
+
+OK (22 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5S.txt b/java/test/testfiles/JUnit-TestH5S.txt
new file mode 100644
index 0000000..6bde487
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5S.txt
@@ -0,0 +1,29 @@
+JUnit version 4.11
+.testH5Sget_select_npoints
+.testH5Sget_select_type
+.testH5Sset_extent_simple
+.testH5Sget_select_hyper
+.testH5Sget_select_valid
+.testH5Sget_select_elem_pointlist
+.testH5Sset_extent_none
+.testH5Sencode_decode_scalar_dataspace
+.testH5Soffset_simple
+.testH5Scopy
+.testH5Sget_simple_extent_ndims
+.testH5Sextent_equal
+.testH5Sget_simple_extent_dims
+.testH5Sget_simple_extent_type
+.testH5Shyper_regular
+.testH5Sget_select_bounds
+.testH5Sget_select_elem_pointlist_invalid
+.testH5Sget_simple_extent_npoints
+.testH5Sextent_copy
+.testH5Sencode_decode_null_dataspace
+.testH5Sis_simple
+.testH5Sget_simple_extent_dims_null
+.testH5Sselect_none
+
+Time: XXXX
+
+OK (23 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Sbasic.txt b/java/test/testfiles/JUnit-TestH5Sbasic.txt
new file mode 100644
index 0000000..707878e
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Sbasic.txt
@@ -0,0 +1,22 @@
+JUnit version 4.11
+.testH5Sclose_invalid
+.testH5Screate_simple_max_default
+.testH5Screate_simple_dims_null
+.testH5Sdecode_null
+.testH5Screate_simple_dims_exceed
+.testH5Screate_simple_unlimted_1d
+.testH5Screate_simple_dims_invalid
+.testH5Screate_scalar
+.testH5Screate_simple
+.testH5Screate_simple_rank_invalid
+.testH5Sget_simple_extent_type_invalid
+.testH5Sencode_invalid
+.testH5Screate_null
+.testH5Screate_simple_extent
+.testH5Screate_invalid
+.testH5Screate_simple_unlimted
+
+Time: XXXX
+
+OK (16 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5T.txt b/java/test/testfiles/JUnit-TestH5T.txt
new file mode 100644
index 0000000..446adcb
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5T.txt
@@ -0,0 +1,19 @@
+JUnit version 4.11
+.testH5Tvlen_create
+.testH5Tenum_create_functions
+.testH5Tenum_functions
+.testH5Tget_class
+.testH5Tget_array_ndims
+.testH5Tequal_type_error
+.testH5Tget_array_dims
+.testH5Tset_size
+.testH5Tis_variable_str
+.testH5Tcompound_functions
+.testH5Tget_size
+.testH5Tarray_create
+.testH5Topaque_functions
+
+Time: XXXX
+
+OK (13 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Tbasic.txt b/java/test/testfiles/JUnit-TestH5Tbasic.txt
new file mode 100644
index 0000000..131c4f5
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Tbasic.txt
@@ -0,0 +1,11 @@
+JUnit version 4.11
+.testH5Tequal_not
+.testH5Tcopy
+.testH5Tequal
+.testH5Torder_size
+.testH5Tconvert
+
+Time: XXXX
+
+OK (5 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Tparams.txt b/java/test/testfiles/JUnit-TestH5Tparams.txt
new file mode 100644
index 0000000..9f725ac
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Tparams.txt
@@ -0,0 +1,78 @@
+JUnit version 4.11
+.testH5Tget_member_type_invalid
+.testH5Treclaim_invalid
+.testH5Tenum_insert_null
+.testH5Tget_offset_invalid
+.testH5Tset_precision_invalid
+.testH5Tget_inpad_invalid
+.testH5Tenum_nameof_invalid
+.testH5Tget_member_value_invalid
+.testH5Tenum_nameof_value_null
+.testH5Tcreate_invalid
+.testH5Tget_strpad_invalid
+.testH5Tenum_valueof_invalid
+.testH5Tget_fields_null
+.testH5Topen_null
+.testH5Tpack_invalid
+.testH5Tcommit_null
+.testH5Tinsert_invalid
+.testH5Tenum_valueof_null
+.testH5Tset_norm_invalid
+.testH5Tlock_invalid
+.testH5Tarray_create_invalid
+.testH5Tget_member_value_null
+.testH5Tset_offset_invalid
+.testH5Tget_fields_invalid
+.testH5Tequal_invalid
+.testH5Tget_ebias_long_invalid
+.testH5Tget_cset_invalid
+.testH5Tget_size_invalid
+.testH5Tset_strpad_invalid
+.testH5Tset_ebias_invalid
+.testH5Tget_sign_invalid
+.testH5Tget_member_index_invalid
+.testH5Tget_precision_invalid
+.testH5Tset_fields_invalid
+.testH5Tcopy_invalid
+.testH5Tget_pad_invalid
+.testH5Tset_order_invalid
+.testH5Tget_member_class_invalid
+.testH5Tget_super_invalid
+.testH5Tget_class_invalid
+.testH5Topen_invalid
+.testH5Tget_precision_long_invalid
+.testH5Tget_ebias_invalid
+.testH5Tget_native_type_invalid
+.testH5Tget_fields_length_invalid
+.testH5Tget_norm_invalid
+.testH5Tenum_nameof_invalid_size
+.testH5Tset_pad_invalid
+.testH5Tget_pad_null
+.testH5Tset_tag_null
+.testH5Tget_order_invalid
+.testH5Tcommit_invalid
+.testH5Tget_array_ndims_invalid
+.testH5Tset_tag_invalid
+.testH5Tvlen_create_invalid
+.testH5Tenum_create_invalid
+.testH5Tinsert_null
+.testH5Tset_inpad_invalid
+.testH5Tenum_valueof_name_null
+.testH5Tset_cset_invalid
+.testH5Tclose_invalid
+.testH5Tget_nmembers_invalid
+.testH5Tarray_create_value_null
+.testH5Tset_size_invalid
+.testH5Tflush_invalid
+.testH5Tenum_insert_invalid
+.testH5Tget_array_dims_null
+.testH5Tget_member_index_null
+.testH5Trefresh_invalid
+.testH5Tset_sign_invalid
+.testH5Treclaim_null
+.testH5Tenum_insert_name_null
+
+Time: XXXX
+
+OK (72 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5VL.txt b/java/test/testfiles/JUnit-TestH5VL.txt
new file mode 100644
index 0000000..ff94969
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5VL.txt
@@ -0,0 +1,13 @@
+JUnit version 4.11
+.testH5VLget_connector_id_by_name
+.testH5VLget_connector_id_by_value
+.testH5VLget_connector_id
+.testH5VLnative_init
+.testH5VLget_connector_name
+.testH5VLclose_NegativeID
+.testH5VLunregister_connector_NegativeID
+
+Time: XXXX
+
+OK (7 tests)
+
diff --git a/java/test/testfiles/JUnit-TestH5Z.txt b/java/test/testfiles/JUnit-TestH5Z.txt
new file mode 100644
index 0000000..63fc227
--- /dev/null
+++ b/java/test/testfiles/JUnit-TestH5Z.txt
@@ -0,0 +1,9 @@
+JUnit version 4.11
+.testH5Zfilter_avail
+.testH5Zunregister_predefined
+.testH5Zget_filter_info
+
+Time: XXXX
+
+OK (3 tests)
+