Re-write of Java JNI error handling

This commit is contained in:
Jordan Henderson 2019-02-11 10:58:58 -06:00
parent 4300ca6234
commit cc6a61215e
56 changed files with 17976 additions and 15906 deletions

View File

@ -14,6 +14,19 @@ 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
@ -36,6 +49,19 @@ 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

View File

@ -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 h5vlImp.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)

View File

@ -33,21 +33,14 @@ extern "C" {
#include "h5jni.h"
#include "exceptionImp.h"
extern H5E_auto2_t efunc;
extern void *edata;
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
@ -73,29 +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) { \
printf("THROWEXCEPTION FATAL ERROR: GetMethodID failed\n"); \
return JNI_FALSE; \
} \
ex = ENVPTR->NewObjectA (ENVPAR jc, jm, (jvalue*)(args)); \
if (ex == NULL) { \
printf("THROWEXCEPTION FATAL ERROR: %s: Creation failed\n", (className)); \
return JNI_FALSE; \
} \
if (ENVPTR->Throw(ENVPAR (jthrowable)ex) < 0) { \
printf("THROWEXCEPTION 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); \
} \
}
/********************/
@ -112,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 */
@ -130,8 +125,15 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5error_1off
(JNIEnv *env, jclass clss)
{
H5Eget_auto2(H5E_DEFAULT, &efunc, &edata);
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() */
@ -145,10 +147,12 @@ 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
* Method: printStackTrace0
@ -163,18 +167,25 @@ 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() */
/*
@ -189,10 +200,15 @@ 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__1getMajorErrorNumber() */
@ -209,27 +225,42 @@ 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__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() */
/*
@ -316,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() */
@ -336,51 +367,76 @@ jboolean
h5libraryError
(JNIEnv *env)
{
char *args[2];
const char *exception = NULL;
char *msg_str = NULL;
int num_errs = 0;
H5E_type_t error_msg_type;
H5E_num_t exceptionNumbers;
jstring str = NULL;
ssize_t msg_size = 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;
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_JNI_FATAL_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() */
THROWEXCEPTION(exception, args);
retVal = JNI_TRUE;
done:
if (msg_str)
HDfree(msg_str);
return retVal;
} /* end h5libraryError() */
/*
* defineHDF5LibraryException() returns the name of the sub-class

View File

@ -1260,7 +1260,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5VL_1CAP_1FLAG_1THREADSAFE(JNIEnv *env, jclass c
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(ENVPAR H5VL_NATIVE_NAME); }
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

View File

@ -35,7 +35,10 @@ extern "C" {
#include "h5jni.h"
#include "h5Imp.h"
extern JavaVM *jvm;
/*
* Pointer to the JNI's Virtual Machine; used for callback functions.
*/
/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@ -46,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 */
@ -62,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 */
@ -78,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 */
@ -94,29 +109,25 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5get_1libversion
(JNIEnv *env, jclass clss, jintArray libversion)
{
unsigned *theArray = NULL;
herr_t status = -1;
jboolean isCopy;
jboolean libversionArrayIsCopy;
int *libversionArray = NULL;
herr_t status = FAIL;
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]));
UNUSED(clss);
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 */
return (jint)status;
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 */
/*
@ -128,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 */
@ -141,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 */
@ -158,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 */
@ -176,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 */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -39,6 +39,9 @@ extern "C" {
#include "h5jni.h"
#include "h5eImp.h"
/*
* Pointer to the JNI's Virtual Machine; used for callback functions.
*/
extern JavaVM *jvm;
typedef struct _cb_wrapper {
@ -46,20 +49,6 @@ typedef struct _cb_wrapper {
jobject op_data;
} cb_wrapper;
#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 */
/********************/
/* Local Prototypes */
/********************/
@ -77,12 +66,15 @@ Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2
{
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(cls);
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 */
@ -95,20 +87,27 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Eregister_1class
(JNIEnv *env, jclass cls, 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;
const char* the_cls_name = NULL;
const char* the_lib_name = NULL;
const char* the_version = NULL;
hid_t ret_val = H5I_INVALID_HID;
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);
UNUSED(cls);
UNPIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version);
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 < 0)
h5libraryError(env);
}
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 */
@ -122,11 +121,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eunregister_1class
(JNIEnv *env, jclass cls, 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(cls);
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 */
/*
@ -138,11 +142,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclose_1msg
(JNIEnv *env, jclass cls, 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(cls);
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 */
/*
@ -154,24 +163,23 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Ecreate_1msg
(JNIEnv *env, jclass cls, 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(cls);
UNPIN_JAVA_STRING(err_msg, the_err_msg);
if (err_id < 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ecreate_msg: invalid error class ID");
if (ret_val < 0)
h5libraryError(env);
}
} /* end else */
PIN_JAVA_STRING(ENVONLY, err_msg, the_err_msg, NULL, "H5Ecreate_msg: error message string not pinned");
if ((ret_val = H5Ecreate_msg((hid_t)err_id, error_msg_type, the_err_msg)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
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 */
@ -185,12 +193,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Ecreate_1stack
(JNIEnv *env, jclass cls)
{
hid_t ret_val = -1;
hid_t ret_val = H5I_INVALID_HID;
ret_val = H5Ecreate_stack();
if (ret_val < 0)
h5libraryError(env);
UNUSED(cls);
if ((ret_val = H5Ecreate_stack()) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Ecreate_1stack */
@ -203,12 +213,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1current_1stack
(JNIEnv *env, jclass cls)
{
hid_t ret_val = -1;
hid_t ret_val = H5I_INVALID_HID;
ret_val = H5Eget_current_stack();
if (ret_val < 0)
h5libraryError(env);
UNUSED(cls);
if ((ret_val = H5Eget_current_stack()) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Eget_1current_1stack */
@ -221,11 +233,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclose_1stack
(JNIEnv *env, jclass cls, 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(cls);
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 */
/*
@ -237,20 +254,24 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eprint2
(JNIEnv *env, jclass cls, 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(cls);
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 = H5Eprint2((hid_t)stk_id, (FILE *)stream_obj)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
}
if (ret_val < 0)
h5libraryError(env);
} /* end else */
done:
return;
} /* end Java_hdf_hdf5lib_H5_H5Eprint2 */
/*
@ -262,43 +283,36 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1class_1name
(JNIEnv *env, jclass cls, jlong cls_id)
{
char *namePtr;
jstring str = NULL;
ssize_t buf_size;
jstring str = NULL;
ssize_t buf_size;
char *namePtr = NULL;
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);
UNUSED(cls);
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 (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_JNI_FATAL_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 (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 */
@ -311,11 +325,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eset_1current_1stack
(JNIEnv *env, jclass cls, 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(cls);
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 */
/*
@ -327,11 +346,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Epop
(JNIEnv *env, jclass cls, 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(cls);
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 */
/*
@ -344,35 +368,37 @@ Java_hdf_hdf5lib_H5_H5Epush2
(JNIEnv *env, jclass cls, 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;
const char *fName = NULL;
const char *fncName = NULL;
const char *errMsg = NULL;
herr_t ret_val = FAIL;
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);
UNUSED(cls);
UNPIN_JAVA_STRING_THREE(filename, fName, funcname, fncName, err_desc, errMsg);
if (stk_id < 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush: invalid error stack ID");
if (class_id < 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush: invalid error class ID");
if (major_id < 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush: invalid major error class ID");
if (minor_id < 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush: invalid minor error class ID");
if (ret_val < 0)
h5libraryError(env);
}
} /* end else */
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 */
/*
@ -384,11 +410,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclear2
(JNIEnv *env, jclass cls, 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(cls);
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 */
/*
@ -400,57 +431,45 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1msg
(JNIEnv *env, jclass cls, 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;
H5E_type_t error_msg_type;
jstring str = NULL;
ssize_t buf_size;
jint *theArray = NULL;
char *namePtr = NULL;
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);
UNUSED(cls);
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 (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");
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);
/* Get the length of the name */
if ((buf_size = H5Eget_msg((hid_t)msg_id, NULL, NULL, 0)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
str = ENVPTR->NewStringUTF(ENVPAR namePtr);
HDfree(namePtr);
} /* end else */
} /* end else */
} /* end else */
} /* end else */
} /* end else */
if (!buf_size)
H5_JNI_FATAL_ERROR(ENVONLY, "H5Eget_msg: invalid message");
if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_JNI_FATAL_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 */
@ -466,14 +485,15 @@ Java_hdf_hdf5lib_H5_H5Eget_1num
{
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(cls);
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 */
@ -481,52 +501,67 @@ static herr_t
H5E_walk_cb
(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;
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
void *op_data = (void *)wrapper->op_data;
jobject visit_callback = wrapper->visit_callback;
jmethodID constructor;
jmethodID mid;
jobject visit_callback = wrapper->visit_callback;
jstring str1, str2, str3;
jobject cb_info_t = NULL;
jvalue args[7];
JNIEnv *cbenv = NULL;
jclass cls;
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 == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "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;
/* Get a reference to your class if you don't have it already */
if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5E_error2_t")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
/* get a reference to the constructor; the name is <init> */
if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(JJJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V")))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
if (NULL == (cb_info_t = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args)))
CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
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);
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);
if (cb_info_t == NULL) {
printf("FATAL ERROR: hdf/hdf5lib/structs/H5E_error2_t: Creation failed\n");
}
else {
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);
return (herr_t)status;
} /* end H5E_walk_cb */
@ -539,15 +574,23 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Ewalk2
(JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data)
{
cb_wrapper wrapper = {callback_op, op_data};
cb_wrapper wrapper = { callback_op, op_data };
ENVPTR->GetJavaVM(ENVPAR &jvm);
UNUSED(cls);
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*)&wrapper) < 0)
h5libraryError(env);
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

View File

@ -28,7 +28,10 @@ extern "C" {
#include "h5fImp.h"
#include "h5util.h"
extern JavaVM *jvm;
/*
* Pointer to the JNI's Virtual Machine; used for callback functions.
*/
/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@ -39,18 +42,19 @@ 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);
PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fopen: file name not pinned");
if (status < 0)
h5libraryError(env);
}
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 */
@ -64,18 +68,19 @@ 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);
PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fcreate: file name not pinned");
if (status < 0)
h5libraryError(env);
}
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 */
@ -89,12 +94,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;
retVal = H5Fflush((hid_t)object_id, (H5F_scope_t)scope );
if (retVal < 0)
h5libraryError(env);
UNUSED(clss);
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 */
@ -107,34 +114,29 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1name
(JNIEnv *env, jclass cls, jlong file_id)
{
char *namePtr;
jstring str = NULL;
ssize_t buf_size;
jstring str = NULL;
ssize_t buf_size;
char *namePtr = NULL;
/* get the length of the name */
buf_size = H5Fget_name((hid_t)file_id, NULL, 0);
UNUSED(cls);
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 */
/* 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_JNI_FATAL_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 */
@ -148,24 +150,26 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fis_1hdf5
(JNIEnv *env, jclass clss, jstring name)
{
const char *fileName = NULL;
htri_t bval = JNI_FALSE;
UNUSED(clss);
#ifdef H5_NO_DEPRECATED_SYMBOLS
h5unimplemented(env, "H5Fis_hdf5: not implemented");
#else
const char *fileName;
PIN_JAVA_STRING(name, fileName);
if (fileName != NULL) {
bval = H5Fis_hdf5(fileName);
UNPIN_JAVA_STRING(name, fileName);
if (bval > 0)
bval = JNI_TRUE;
else if (bval < 0)
h5libraryError(env);
}
H5_UNIMPLEMENTED(ENVONLY, "H5Fis_hdf5: not implemented");
#endif
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;
done:
if (fileName)
UNPIN_JAVA_STRING(ENVONLY, name, fileName);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */
@ -178,20 +182,21 @@ 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;
const char *fileName;
PIN_JAVA_STRING(name, fileName);
if (fileName != NULL) {
bval = H5Fis_accessible(fileName, (hid_t)file_id);
UNUSED(clss);
UNPIN_JAVA_STRING(name, fileName);
PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fis_accessible: file name not pinned");
if (bval > 0)
bval = JNI_TRUE;
else if (bval < 0)
h5libraryError(env);
}
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 */
@ -205,12 +210,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;
retVal = H5Fget_create_plist((hid_t)file_id);
if (retVal < 0)
h5libraryError(env);
UNUSED(clss);
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 */
@ -223,12 +230,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 */
@ -243,9 +252,12 @@ Java_hdf_hdf5lib_H5_H5Fget_1intent
{
unsigned intent = 0;
if (H5Fget_intent((hid_t)file_id, &intent) < 0)
h5libraryError(env);
UNUSED(cls);
if (H5Fget_intent((hid_t)file_id, &intent) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
return (jint)intent;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1intent */
@ -258,14 +270,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 */
@ -278,18 +290,19 @@ 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);
PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fmount: file name not pinned");
if (status < 0)
h5libraryError(env);
}
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 */
@ -303,18 +316,19 @@ 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);
PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Funmount: file name not pinned");
if (status < 0)
h5libraryError(env);
}
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 */
@ -328,11 +342,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1freespace
(JNIEnv *env, jclass cls, 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(cls);
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 */
@ -345,12 +362,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;
retVal = H5Freopen((hid_t)file_id);
if (retVal < 0)
h5libraryError(env);
UNUSED(clss);
if ((retVal = H5Freopen((hid_t)file_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Freopen */
@ -364,47 +383,40 @@ Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids
(JNIEnv *env, jclass cls, 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;
jboolean isCopy;
ssize_t ret_val = -1;
size_t i;
jsize rank;
jlong *obj_id_listP = NULL;
hid_t *id_list = NULL;
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);
UNUSED(cls);
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 (NULL == obj_id_list)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_obj_ids: obj_id_list is NULL");
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 */
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_JNI_FATAL_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 */
@ -418,11 +430,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1obj_1count
(JNIEnv *env, jclass cls, 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(cls);
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 */
@ -437,9 +452,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 */
@ -454,9 +472,12 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate
{
double rate = 0.0;
if (H5Fget_mdc_hit_rate((hid_t)file_id, &rate) < 0)
h5libraryError(env);
UNUSED(cls);
if (H5Fget_mdc_hit_rate((hid_t)file_id, &rate) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
return (jdouble)rate;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate */
@ -469,33 +490,37 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size
(JNIEnv *env, jclass cls, 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;
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;
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 */
UNUSED(cls);
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 */
@ -509,31 +534,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;
UNUSED(clss);
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 */
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 */
@ -546,8 +576,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats
(JNIEnv *env, jclass cls, jlong file_id)
{
UNUSED(cls);
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 */
/*
@ -559,8 +594,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache
(JNIEnv *env, jclass cls, jlong file_id)
{
UNUSED(cls);
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 */
/*
@ -572,8 +612,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write
(JNIEnv *env, jclass cls, jlong file_id)
{
UNUSED(cls);
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 */
/*
@ -585,8 +630,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging
(JNIEnv *env, jclass cls, jlong file_id)
{
UNUSED(cls);
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 */
/*
@ -598,8 +648,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging
(JNIEnv *env, jclass cls, jlong file_id)
{
UNUSED(cls);
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 */
/*
@ -611,32 +666,38 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
(JNIEnv *env, jclass cls, 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;
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 */
UNUSED(cls);
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 */
/*
@ -648,17 +709,18 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint
(JNIEnv *env, jclass clss, jlong file_id, jboolean minimize)
{
herr_t retVal = -1;
hbool_t minimize_val;
hbool_t minimize_val;
herr_t retVal = FAIL;
if (minimize == JNI_TRUE)
minimize_val = TRUE;
else
minimize_val = FALSE;
UNUSED(clss);
retVal = H5Fset_dset_no_attrs_hint((hid_t)file_id, (hbool_t)minimize_val);
if (retVal < 0)
h5libraryError(env);
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;
}
/*
@ -670,17 +732,18 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
(JNIEnv *env, jclass clss, jlong file_id)
{
hbool_t minimize = FALSE;
jboolean bval = JNI_FALSE;
jboolean bval = JNI_FALSE;
hbool_t minimize = FALSE;
if (H5Fget_dset_no_attrs_hint((hid_t)file_id, (hbool_t *)&minimize) < 0) {
h5libraryError(env);
}
else {
if (minimize == TRUE)
bval = JNI_TRUE;
} /* end else */
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;
}
@ -693,11 +756,15 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
(JNIEnv *env, jclass clss, jlong file_id, jint low, jint high)
{
herr_t retVal = -1;
herr_t retVal = FAIL;
retVal = H5Fset_libver_bounds((hid_t)file_id, (H5F_libver_t)low, (H5F_libver_t)high);
if(retVal < 0)
h5libraryError(env);
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 */

View File

@ -72,7 +72,7 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5
* Signature: (Ljava/lang/String;J)Z
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fis_1ccessible
Java_hdf_hdf5lib_H5_H5Fis_1accessible
(JNIEnv*, jclass, jstring, jlong);
/*

View File

@ -29,7 +29,10 @@ extern "C" {
#include "h5util.h"
#include "h5gImp.h"
extern JavaVM *jvm;
/*
* Pointer to the JNI's Virtual Machine; used for callback functions.
*/
/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@ -40,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 */
@ -63,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;
if (NULL == (cls = ENVPTR->FindClass(ENVONLY, "hdf/hdf5lib/structs/H5G_info_t")))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
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 == (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 */
@ -103,17 +121,19 @@ 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);
}
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 */
@ -127,12 +147,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Gcreate_1anon
(JNIEnv *env, jclass cls, jlong loc_id, jlong gcpl_id, jlong gapl_id)
{
hid_t group_id = -1;
hid_t group_id = H5I_INVALID_HID;
group_id = H5Gcreate_anon((hid_t)loc_id, (hid_t)gcpl_id, (hid_t)gapl_id);
if (group_id < 0)
h5libraryError(env);
UNUSED(cls);
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 */
@ -145,18 +167,19 @@ 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);
PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gopen2: group name not pinned");
if (group_id < 0)
h5libraryError(env);
}
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 */
@ -171,11 +194,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1create_1plist
(JNIEnv *env, jclass cls, 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(cls);
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 */
@ -188,14 +214,18 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info
(JNIEnv *env, jclass cls, jlong loc_id)
{
jobject obj = NULL;
H5G_info_t group_info;
jobject obj = NULL;
UNUSED(cls);
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 */
@ -208,23 +238,27 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name
(JNIEnv *env, jclass cls, 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;
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);
UNUSED(cls);
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 */
@ -238,26 +272,30 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx
(JNIEnv *env, jclass cls, 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;
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;
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);
UNUSED(cls);
UNPIN_JAVA_STRING(name, gName);
PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gget_info_by_idx: 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_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 */
@ -270,8 +308,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 */
/*
@ -283,8 +326,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 */

View File

@ -27,7 +27,10 @@ extern "C" {
#include "h5jni.h"
#include "h5iImp.h"
extern JavaVM *jvm;
/*
* Pointer to the JNI's Virtual Machine; used for callback functions.
*/
/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@ -40,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 */
@ -56,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;
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_JNI_FATAL_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);
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);
}
}
return (jlong)size;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1name */
@ -95,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;
ssize_t buf_size = -1;
char *aName = NULL;
/* get the length of the name */
buf_size = H5Iget_name((hid_t)obj_id, NULL, 0);
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_JNI_FATAL_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);
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);
}
}
return str;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1name */
@ -134,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;
retVal = H5Iget_ref((hid_t)obj_id);
if (retVal < 0)
h5libraryError(env);
UNUSED(clss);
if ((retVal = H5Iget_ref((hid_t)obj_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1ref */
@ -152,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;
retVal = H5Iinc_ref((hid_t)obj_id);
if (retVal < 0)
h5libraryError(env);
UNUSED(clss);
if ((retVal = H5Iinc_ref((hid_t)obj_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iinc_1ref */
@ -170,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 */
@ -189,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;
file_id = H5Iget_file_id((hid_t)obj_id);
if (file_id < 0)
h5libraryError(env);
UNUSED(clss);
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 */
@ -207,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 */
@ -225,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;
retVal = H5Idec_type_ref((H5I_type_t)type);
if (retVal < 0)
h5libraryError(env);
UNUSED(clss);
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 */
@ -243,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 */
@ -261,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 */
@ -280,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 */
/*
@ -299,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 */
@ -317,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 */
/*
@ -330,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

View File

@ -27,147 +27,299 @@
#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
/* 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(env, classname, classsig, args, ret_obj) \
{ \
jmethodID constructor; \
jclass cls; \
\
if (NULL == (cls = ENVPTR->FindClass(env, (classname)))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, "JNI error: GetObjectClass"); \
} \
if (NULL == (constructor = ENVPTR->GetMethodID(ENVONLY, cls, "<init>", (classsig)))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, "JNI error: GetMethodID failed"); \
} \
if (NULL == (ret_obj = ENVPTR->NewObjectA(ENVONLY, cls, constructor, (args)))) { \
CHECK_JNI_EXCEPTION(env, JNI_FALSE); \
} \
}
/*
* Macros for pinning/unpinning objects.
*/
#define PIN_BYTE_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = ENVPTR->GetByteArrayElements(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define PIN_BYTE_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = (jbyte *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define UNPIN_BYTE_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
{ \
ENVPTR->ReleaseByteArrayElements(env, pinnedArray, (jbyte *) bufToRelease, freeMode); \
}
#define PIN_SHORT_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = ENVPTR->GetShortArrayElements(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define PIN_SHORT_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = (jshort *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define UNPIN_SHORT_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
{ \
ENVPTR->ReleaseShortArrayElements(env, pinnedArray, (jshort *) bufToRelease, freeMode); \
}
#define PIN_INT_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = ENVPTR->GetIntArrayElements(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define PIN_INT_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = (jint *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define UNPIN_INT_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
{ \
ENVPTR->ReleaseIntArrayElements(env, pinnedArray, (jint *) bufToRelease, freeMode); \
}
#define PIN_LONG_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = ENVPTR->GetLongArrayElements(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define PIN_LONG_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = (jlong *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define UNPIN_LONG_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
{ \
ENVPTR->ReleaseLongArrayElements(env, pinnedArray, (jlong *) bufToRelease, freeMode); \
}
#define PIN_FLOAT_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = ENVPTR->GetFloatArrayElements(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define PIN_FLOAT_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = (jfloat *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define UNPIN_FLOAT_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
{ \
ENVPTR->ReleaseFloatArrayElements(env, pinnedArray, (jfloat *) bufToRelease, freeMode); \
}
#define PIN_DOUBLE_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = ENVPTR->GetDoubleArrayElements(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define PIN_DOUBLE_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = (jdouble *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define UNPIN_DOUBLE_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
{ \
ENVPTR->ReleaseDoubleArrayElements(env, pinnedArray, (jdouble *) bufToRelease, freeMode); \
}
#define PIN_BOOL_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = ENVPTR->GetBooleanArrayElements(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define PIN_BOOL_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
{ \
if (NULL == (outBuf = (jboolean *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define UNPIN_BOOL_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
{ \
ENVPTR->ReleaseBooleanArrayElements(env, pinnedArray, (jboolean *) bufToRelease, freeMode); \
}
#define UNPIN_ARRAY_CRITICAL(env, pinnedArray, bufToRelease, freeMode) \
{ \
ENVPTR->ReleasePrimitiveArrayCritical(env, pinnedArray, bufToRelease, freeMode); \
}
/* 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 PIN_JAVA_STRING(env, stringToPin, outString, isCopy, failErrMsg) \
{ \
if (NULL == (outString = ENVPTR->GetStringUTFChars(env, stringToPin, isCopy))) { \
CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
H5_JNI_FATAL_ERROR(env, failErrMsg); \
} \
}
#define UNPIN_JAVA_STRING(javastr,localstr) { \
ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
#define UNPIN_JAVA_STRING(env, pinnedString, stringToRelease) \
{ \
ENVPTR->ReleaseStringUTFChars(env, pinnedString, stringToRelease); \
}
#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)); \
/*
* 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(env, clearException) \
{ \
if (JNI_TRUE == (*env)->ExceptionCheck(env)) { \
if (JNI_TRUE == clearException) \
(*env)->ExceptionClear(env); \
else \
goto done; \
} \
}
#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) \
{ \
h5JNIFatalError(env, message); \
goto done; \
}
#define H5_NULL_ARGUMENT_ERROR(env, message) \
{ \
h5nullArgument(env, message); \
goto done; \
}
#define H5_BAD_ARGUMENT_ERROR(env, message) \
{ \
h5badArgument(env, message); \
goto done; \
}
#define H5_OUT_OF_MEMORY_ERROR(env, message) \
{ \
h5outOfMemory(env, message); \
goto done; \
}
#define H5_LIBRARY_ERROR(env) \
{ \
h5libraryError(env); \
goto done; \
}
#define H5_RAISE_EXCEPTION(env, message, exception) \
{ \
h5raiseException(env, message, exception); \
goto done; \
}
#define H5_UNIMPLEMENTED(env, message) \
{ \
h5unimplemented(env, message); \
goto done; \
}
/* 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,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

36
java/src/jni/h5pACPLImp.c Normal file
View File

@ -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 */

27
java/src/jni/h5pACPLImp.h Normal file
View File

@ -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 */

322
java/src/jni/h5pDAPLImp.c Normal file
View File

@ -0,0 +1,322 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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);
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_JNI_FATAL_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_JNI_FATAL_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 */

112
java/src/jni/h5pDAPLImp.h Normal file
View File

@ -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 */

1404
java/src/jni/h5pDCPLImp.c Normal file

File diff suppressed because it is too large Load Diff

396
java/src/jni/h5pDCPLImp.h Normal file
View File

@ -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 */

502
java/src/jni/h5pDXPLImp.c Normal file
View File

@ -0,0 +1,502 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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);
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_JNI_FATAL_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_JNI_FATAL_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 */

209
java/src/jni/h5pDXPLImp.h Normal file
View File

@ -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 */

1624
java/src/jni/h5pFAPLImp.c Normal file

File diff suppressed because it is too large Load Diff

501
java/src/jni/h5pFAPLImp.h Normal file
View File

@ -0,0 +1,501 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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: 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: 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 */

572
java/src/jni/h5pFCPLImp.c Normal file
View File

@ -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_LONG_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 */

207
java/src/jni/h5pFCPLImp.h Normal file
View File

@ -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 */

36
java/src/jni/h5pGAPLImp.c Normal file
View File

@ -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 */

27
java/src/jni/h5pGAPLImp.h Normal file
View File

@ -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 */

227
java/src/jni/h5pGCPLImp.c Normal file
View File

@ -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 */

99
java/src/jni/h5pGCPLImp.h Normal file
View File

@ -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 */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

237
java/src/jni/h5pLAPLImp.c Normal file
View File

@ -0,0 +1,237 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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);
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_JNI_FATAL_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_JNI_FATAL_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 */

107
java/src/jni/h5pLAPLImp.h Normal file
View File

@ -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 */

36
java/src/jni/h5pLCPLImp.c Normal file
View File

@ -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 */

27
java/src/jni/h5pLCPLImp.h Normal file
View File

@ -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 */

211
java/src/jni/h5pOCPLImp.c Normal file
View File

@ -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 */

99
java/src/jni/h5pOCPLImp.h Normal file
View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -26,7 +26,10 @@ extern "C" {
#include "h5jni.h"
#include "h5plImp.h"
extern JavaVM *jvm;
/*
* Pointer to the JNI's Virtual Machine; used for callback functions.
*/
/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@ -37,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 */
/*
@ -52,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 */
@ -67,18 +78,19 @@ 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;
PIN_JAVA_STRING(plugin_path, aName);
if (aName != NULL) {
retVal = H5PLappend(aName);
UNUSED(clss);
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
@ -89,18 +101,19 @@ 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;
PIN_JAVA_STRING(plugin_path, aName);
if (aName != NULL) {
retVal = H5PLprepend(aName);
UNUSED(clss);
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 */
/*
@ -112,18 +125,22 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLreplace
(JNIEnv *env, jclass clss, jobjectArray plugin_path, jint index)
{
const char *aName;
herr_t retVal = -1;
const char *newPath = NULL;
herr_t retVal = FAIL;
PIN_JAVA_STRING(plugin_path, aName);
if (aName != NULL) {
retVal = H5PLreplace(aName, index);
UNUSED(clss);
UNPIN_JAVA_STRING(plugin_path, aName);
if (index < 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) index)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
if (newPath)
UNPIN_JAVA_STRING(ENVONLY, plugin_path, newPath);
} /* end Java_hdf_hdf5lib_H5_H5PLreplace */
/*
@ -135,18 +152,22 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLinsert
(JNIEnv *env, jclass clss, jobjectArray plugin_path, jint index)
{
const char *aName;
herr_t retVal = -1;
const char *newPath = NULL;
herr_t retVal = FAIL;
PIN_JAVA_STRING(plugin_path, aName);
if (aName != NULL) {
retVal = H5PLinsert(aName, index);
UNUSED(clss);
UNPIN_JAVA_STRING(plugin_path, aName);
if (index < 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) index)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
if (newPath)
UNPIN_JAVA_STRING(ENVONLY, plugin_path, newPath);
} /* end Java_hdf_hdf5lib_H5_H5PLinsert */
/*
@ -158,8 +179,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLremove
(JNIEnv *env, jclass clss, jint index)
{
if (H5PLremove(index) < 0)
h5libraryError(env);
UNUSED(clss);
if (index < 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLremove: index < 0");
if (H5PLremove((unsigned) index) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
return;
} /* end Java_hdf_hdf5lib_H5_H5PLremove */
/*
@ -171,33 +200,33 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5PLget
(JNIEnv *env, jclass clss, jint index)
{
char *aName;
jstring str = NULL;
ssize_t buf_size;
char *aName = NULL;
/* get the length of the name */
buf_size = H5PLget(index, NULL, 0);
UNUSED(clss);
if (index < 0)
H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLget: index < 0");
/* Get the length of the name */
if ((buf_size = H5PLget((unsigned) index, NULL, 0)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_JNI_FATAL_ERROR(ENVONLY, "H5PLget: failed to allocate plugin name buffer");
if ((H5PLget((unsigned) index, 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);
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 */
@ -211,9 +240,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 */

View File

@ -26,8 +26,10 @@ extern "C" {
#include "h5jni.h"
#include "h5rImp.h"
extern JavaVM *jvm;
/*
* Pointer to the JNI's Virtual Machine; used for callback functions.
*/
/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@ -38,47 +40,42 @@ 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;
const char *refName = NULL;
jboolean isCopy;
jbyte *refBuf = NULL;
jsize refBufLen;
herr_t status = FAIL;
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);
UNUSED(clss);
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);
if (NULL == ref)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: reference 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 */
@ -91,33 +88,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;
jboolean isCopy;
jbyte *refBuf = NULL;
jsize refBufLen;
hid_t retVal = H5I_INVALID_HID;
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);
UNUSED(clss);
ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
if (NULL == ref)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: reference buffer is NULL");
if (retVal < 0)
h5libraryError(env);
} /* end else */
} /* end else */
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 */
@ -131,33 +131,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;
jboolean isCopy;
jbyte *refBuf = NULL;
jsize refBufLen;
hid_t retVal = H5I_INVALID_HID;
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);
UNUSED(clss);
ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
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 (retVal < 0)
h5libraryError(env);
} /* end else */
} /* end else */
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 */
@ -171,31 +172,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;
H5O_type_t object_info;
jboolean isCopy;
jbyte *refBuf = NULL;
int retVal = -1;
UNUSED(clss);
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;
if (NULL == ref)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_type: reference buffer is NULL");
ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_type: reference buffer not pinned");
if (retVal < 0)
h5libraryError(env);
} /* end else */
} /* end else */
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 */
@ -209,46 +206,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;
int retVal = -1;
jint status;
jboolean isCopy;
jbyte *refP;
jint *ref_objP;
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");
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];
PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_type: reference buffer not pinned");
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 */
@ -262,57 +246,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;
jboolean isCopy;
jstring str;
jsize refBufLen;
jbyte *refBuf = NULL;
char *aName = NULL;
jlong ret_val = -1;
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) ;
UNUSED(clss);
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);
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");
HDfree(aName);
} /* end else */
} /* end else */
} /* end else */
} /* end else */
} /* end else */
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 = (char *) HDmalloc(sizeof(char) * (size_t)size + 1)))
H5_JNI_FATAL_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 */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -35,18 +35,29 @@ 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_vlsprintf(h5str_t *str, hid_t container, hid_t tid, hvl_t *buf, int expand_data);
extern size_t h5str_sprintf(h5str_t *str, hid_t container, hid_t tid, void *buf, int ptrlen, int expand_data);
extern size_t h5str_vlsconvert(char *str, hid_t container, hid_t tid, hvl_t *buf, int expand_data);
extern size_t h5str_convert(char **str, hid_t container, hid_t tid, hvl_t *buf, int ptroffset, 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 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);
extern htri_t H5Tdetect_variable_str(hid_t tid);
/*
* Symbols used to format the output of h5str_sprintf and
* to interpret the input to h5str_convert.
*/
#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

View File

@ -21,9 +21,9 @@
extern "C" {
#endif /* __cplusplus */
#include "hdf5.h"
#include <jni.h>
#include <stdlib.h>
#include "hdf5.h"
#include "h5jni.h"
#include "h5vlImp.h"
@ -36,18 +36,19 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1name
(JNIEnv *env, jclass clss, jobject connector_name, jlong vipl_id)
{
hid_t status = -1;
const char *vlName;
const char *volName = NULL;
hid_t status = H5I_INVALID_HID;
PIN_JAVA_STRING(connector_name, vlName);
if (vlName != NULL) {
status = H5VLregister_connector_by_name(vlName, (hid_t)vipl_id);
UNUSED(clss);
UNPIN_JAVA_STRING(connector_name, vlName);
PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLregister_connector_by_name: VOL connector name not pinned");
if (status < 0)
h5libraryError(env);
}
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 */
@ -61,11 +62,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value
(JNIEnv *env, jclass clss, jint connector_value, jlong vipl_id)
{
hid_t status = H5VLregister_connector_by_value((H5VL_class_value_t)connector_value, (hid_t)vipl_id);
hid_t status = H5I_INVALID_HID;
if (status < 0)
h5libraryError(env);
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 */
@ -78,20 +82,21 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered
(JNIEnv *env, jclass clss, jobject connector_name)
{
const char *volName = NULL;
htri_t bval = JNI_FALSE;
const char *vlName;
PIN_JAVA_STRING(connector_name, vlName);
if (vlName != NULL) {
bval = H5VLis_connector_registered(vlName);
UNUSED(clss);
UNPIN_JAVA_STRING(connector_name, vlName);
PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLis_connector_registered: VOL connector name not pinned");
if (bval > 0)
bval = JNI_TRUE;
else if (bval < 0)
h5libraryError(env);
}
if ((bval = H5VLis_connector_registered(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 */
@ -105,18 +110,19 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5VLget_1connector_1id
(JNIEnv *env, jclass clss, jobject connector_name)
{
hid_t status = -1;
const char *vlName;
const char *volName = NULL;
hid_t status = H5I_INVALID_HID;
PIN_JAVA_STRING(connector_name, vlName);
if (vlName != NULL) {
status = H5VLget_connector_id(vlName);
UNUSED(clss);
UNPIN_JAVA_STRING(connector_name, vlName);
PIN_JAVA_STRING(ENVONLY, connector_name, volName, NULL, "H5VLget_connector_id: VOL connector name not pinned");
if (status < 0)
h5libraryError(env);
}
if ((status = H5VLget_connector_id(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 */
@ -131,41 +137,31 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5VLget_1connector_1name
(JNIEnv *env, jclass clss, jlong object_id)
{
char *vlName;
ssize_t buf_size;
ssize_t status;
ssize_t buf_size, status;
char *volName = NULL;
jstring str = NULL;
/* get the length of the comment */
buf_size = H5VLget_connector_name((hid_t)object_id, NULL, 0);
if (buf_size < 0) {
H5Eprint2(H5E_DEFAULT, NULL);
UNUSED(clss);
h5badArgument(env, "H5VLget_connector_name: buf_size < 0");
} /* end if */
else if (buf_size > 0) {
buf_size++; /* add extra space for the null terminator */
vlName = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
if (vlName == NULL) {
/* exception -- out of memory */
h5outOfMemory(env, "H5VLget_connector_name: malloc failed");
} /* end if */
else {
status = H5VLget_connector_name((hid_t)object_id, vlName, (size_t)buf_size);
/* Get the length of the comment */
if ((buf_size = H5VLget_connector_name((hid_t)object_id, NULL, 0)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
if (status < 0) {
h5libraryError(env);
} /* end if */
else {
/* may throw OutOfMemoryError */
str = ENVPTR->NewStringUTF(ENVPAR vlName);
if (str == NULL) {
h5JNIFatalError(env, "H5VLget_connector_name: return string not allocated");
} /* end if */
} /* end else */
HDfree(vlName);
}
} /* end else if */
if (buf_size > 0) {
if (NULL == (volName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
H5_JNI_FATAL_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 */
@ -179,10 +175,15 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5VLclose
(JNIEnv *env, jclass clss, jlong connector_id)
{
herr_t retValue = H5VLclose((hid_t)connector_id);
herr_t retValue = FAIL;
if (retValue < 0)
h5libraryError(env);
UNUSED(clss);
if ((retValue = H5VLclose((hid_t)connector_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
return;
} /* end Java_hdf_hdf5lib_H5_H5VLclose */
/*
@ -194,10 +195,15 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5VLunregister_1connector
(JNIEnv *env, jclass clss, jlong connector_id)
{
herr_t retValue = H5VLunregister_connector((hid_t)connector_id);
herr_t retValue = FAIL;
if (retValue < 0)
h5libraryError(env);
UNUSED(clss);
if ((retValue = H5VLunregister_connector((hid_t)connector_id)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
done:
return;
} /* end Java_hdf_hdf5lib_H5_H5VLunregister_1connector */

View File

@ -44,7 +44,7 @@ Java_hdf_hdf5lib_H5_H5VLregister_1connector_1by_1value
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5VLis_connector_registered
Java_hdf_hdf5lib_H5_H5VLis_1connector_1registered
(JNIEnv *, jclass, jobject);
/*

View File

@ -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;
if (retValue < 0)
h5libraryError(env);
UNUSED(clss);
return (jint)retValue;
if ((retVal = H5Zfilter_avail((H5Z_filter_t)filter)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
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 */

File diff suppressed because it is too large Load Diff

View File

@ -177,6 +177,23 @@ public class TestH5 {
for (int i = 0; i < 2; i++)
assertFalse(libversion[i] == 0);
}
/**
* 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

View File

@ -1,4 +1,5 @@
JUnit version 4.11
.testH5get_libversion_null_param
.testJ2C
.testIsSerializable
.testH5garbage_collect
@ -11,5 +12,5 @@ JUnit version 4.11
Time: XXXX
OK (9 tests)
OK (10 tests)

View File

@ -100,11 +100,11 @@ H5Tget_order(hid_t type_id)
/* Check args */
if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_ORDER_ERROR, "not a datatype")
HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_ORDER_ERROR, "not a datatype")
/* Get order */
if(H5T_ORDER_ERROR == (ret_value = H5T_get_order(dt)))
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "cant't get order for specified datatype")
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "can't get order for specified datatype")
done:
FUNC_LEAVE_API(ret_value)