diff options
Diffstat (limited to 'java/src/jni/h5dImp.c')
-rw-r--r-- | java/src/jni/h5dImp.c | 649 |
1 files changed, 329 insertions, 320 deletions
diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index 5b53460..6a587b5 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -44,28 +44,30 @@ typedef struct _cb_wrapper { /* Local Prototypes */ /********************/ -static herr_t H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); -static herr_t H5DreadVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); -static herr_t H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); -static herr_t H5DwriteVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); +static herr_t H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, + hid_t xfer_plist_id, jobjectArray buf); +static herr_t H5DreadVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, + hid_t xfer_plist_id, jobjectArray buf); +static herr_t H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, + hid_t xfer_plist_id, jobjectArray buf); +static herr_t H5DwriteVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, + hid_t xfer_plist_id, jobjectArray buf); /********************/ /* Local Macros */ /********************/ - /* * Class: hdf_hdf5lib_H5 * Method: _H5Dcreate * Signature: (JLjava/lang/String;JJJ)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Dcreate - (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, - jlong space_id, jlong create_plist_id) +Java_hdf_hdf5lib_H5__1H5Dcreate(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, + jlong space_id, jlong create_plist_id) { const char *dsetName = NULL; - hid_t dset_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; UNUSED(clss); @@ -74,7 +76,8 @@ Java_hdf_hdf5lib_H5__1H5Dcreate PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dcreate: dataset name not pinned"); - if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, H5P_DEFAULT, (hid_t)create_plist_id, H5P_DEFAULT)) < 0) + if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, H5P_DEFAULT, + (hid_t)create_plist_id, H5P_DEFAULT)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -90,11 +93,10 @@ done: * Signature: (JLjava/lang/String;)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Dopen - (JNIEnv *env, jclass clss, jlong loc_id, jstring name) +Java_hdf_hdf5lib_H5__1H5Dopen(JNIEnv *env, jclass clss, jlong loc_id, jstring name) { const char *dsetName = NULL; - hid_t dset_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; UNUSED(clss); @@ -119,8 +121,7 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Dget_1space - (JNIEnv *env, jclass clss, jlong dataset_id) +Java_hdf_hdf5lib_H5__1H5Dget_1space(JNIEnv *env, jclass clss, jlong dataset_id) { hid_t retVal = H5I_INVALID_HID; @@ -139,8 +140,7 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Dget_1type - (JNIEnv *env, jclass clss, jlong dataset_id) +Java_hdf_hdf5lib_H5__1H5Dget_1type(JNIEnv *env, jclass clss, jlong dataset_id) { hid_t retVal = H5I_INVALID_HID; @@ -159,8 +159,7 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist - (JNIEnv *env, jclass clss, jlong dataset_id) +Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist(JNIEnv *env, jclass clss, jlong dataset_id) { hid_t retVal = H5I_INVALID_HID; @@ -179,14 +178,14 @@ done: * Signature: (JJJJJ[BZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dread - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dread(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, + jboolean isCriticalPinning) { - jboolean readBufIsCopy; - htri_t data_class; - jbyte *readBuf = NULL; - herr_t status = FAIL; + jboolean readBufIsCopy; + htri_t data_class; + jbyte * readBuf = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -207,14 +206,15 @@ Java_hdf_hdf5lib_H5_H5Dread H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread: variable length type not supported"); if (isCriticalPinning) { - PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread: read buffer not critically pinned"); + PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, + "H5Dread: read buffer not critically pinned"); } else { PIN_BYTE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread: read buffer not pinned"); } - if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0) + if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -236,14 +236,14 @@ done: * Signature: (JJJJJ[BZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dwrite - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dwrite(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, + jboolean isCriticalPinning) { - jboolean writeBufIsCopy; - htri_t data_class; - jbyte *writeBuf = NULL; - herr_t status = FAIL; + jboolean writeBufIsCopy; + htri_t data_class; + jbyte * writeBuf = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -264,14 +264,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite: variable length type not supported"); if (isCriticalPinning) { - PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite: write buffer not critically pinned"); + PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, + "H5Dwrite: write buffer not critically pinned"); } else { PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite: write buffer not pinned"); } - if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0) + if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, writeBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -293,8 +294,7 @@ done: * Signature: (J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5__1H5Dclose - (JNIEnv *env, jclass clss, jlong dataset_id) +Java_hdf_hdf5lib_H5__1H5Dclose(JNIEnv *env, jclass clss, jlong dataset_id) { herr_t retVal = FAIL; @@ -313,8 +313,7 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Dget_1storage_1size - (JNIEnv *env, jclass clss, jlong dataset_id) +Java_hdf_hdf5lib_H5_H5Dget_1storage_1size(JNIEnv *env, jclass clss, jlong dataset_id) { hsize_t retVal = 0; @@ -336,13 +335,12 @@ done: * Signature: (JJJ[B)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim - (JNIEnv *env, jclass clss, jlong type_id, jlong space_id, - jlong xfer_plist_id, jbyteArray buf) +Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim(JNIEnv *env, jclass clss, jlong type_id, jlong space_id, + jlong xfer_plist_id, jbyteArray buf) { - jboolean vlenBufIsCopy; - jbyte *vlenBuf = NULL; - herr_t status = FAIL; + jboolean vlenBufIsCopy; + jbyte * vlenBuf = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -367,14 +365,14 @@ done: * Signature: (JJJJJ[SZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dread_1short - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dread_1short(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jshortArray buf, jboolean isCriticalPinning) { - jboolean readBufIsCopy; - jshort *readBuf = NULL; - htri_t data_class; - herr_t status = FAIL; + jboolean readBufIsCopy; + jshort * readBuf = NULL; + htri_t data_class; + herr_t status = FAIL; UNUSED(clss); @@ -395,14 +393,15 @@ Java_hdf_hdf5lib_H5_H5Dread_1short H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_short: variable length type not supported"); if (isCriticalPinning) { - PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_short: read buffer not critically pinned"); + PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, + "H5Dread_short: read buffer not critically pinned"); } else { PIN_SHORT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_short: read buffer not pinned"); } - if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0) + if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -424,14 +423,14 @@ done: * Signature: (JJJJJ[SZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dwrite_1short - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dwrite_1short(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jshortArray buf, jboolean isCriticalPinning) { - jboolean writeBufIsCopy; - jshort *writeBuf = NULL; - htri_t data_class; - herr_t status = FAIL; + jboolean writeBufIsCopy; + jshort * writeBuf = NULL; + htri_t data_class; + herr_t status = FAIL; UNUSED(clss); @@ -452,14 +451,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1short H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_short: variable length type not supported"); if (isCriticalPinning) { - PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_short: write buffer not critically pinned"); + PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, + "H5Dwrite_short: write buffer not critically pinned"); } else { PIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_short: write buffer not pinned"); } - if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0) + if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, writeBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -481,14 +481,14 @@ done: * Signature: (JJJJJ[IZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dread_1int - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dread_1int(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jintArray buf, + jboolean isCriticalPinning) { - jboolean readBufIsCopy; - htri_t data_class; - jint *readBuf = NULL; - herr_t status = FAIL; + jboolean readBufIsCopy; + htri_t data_class; + jint * readBuf = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -509,14 +509,15 @@ Java_hdf_hdf5lib_H5_H5Dread_1int H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_int: variable length type not supported"); if (isCriticalPinning) { - PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_int: read buffer not critically pinned"); + PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, + "H5Dread_int: read buffer not critically pinned"); } else { PIN_INT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_int: read buffer not pinned"); } - if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0) + if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -538,14 +539,14 @@ done: * Signature: (JJJJJ[IZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dwrite_1int - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dwrite_1int(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jintArray buf, + jboolean isCriticalPinning) { - jboolean writeBufIsCopy; - htri_t data_class; - jint *writeBuf = NULL; - herr_t status = FAIL; + jboolean writeBufIsCopy; + htri_t data_class; + jint * writeBuf = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -566,14 +567,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1int H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_int: variable length type not supported"); if (isCriticalPinning) { - PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_int: write buffer not critically pinned"); + PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, + "H5Dwrite_int: write buffer not critically pinned"); } else { PIN_INT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_int: write buffer not pinned"); } - if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0) + if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, writeBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -595,14 +597,14 @@ done: * Signature: (JJJJJ[JZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dread_1long - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dread_1long(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jlongArray buf, jboolean isCriticalPinning) { - jboolean readBufIsCopy; - htri_t data_class; - jlong *readBuf = NULL; - herr_t status = FAIL; + jboolean readBufIsCopy; + htri_t data_class; + jlong * readBuf = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -623,14 +625,15 @@ Java_hdf_hdf5lib_H5_H5Dread_1long H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_long: variable length type not supported"); if (isCriticalPinning) { - PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_long: read buffer not critically pinned"); + PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, + "H5Dread_long: read buffer not critically pinned"); } else { PIN_LONG_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_long: read buffer not pinned"); } - if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0) + if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -652,14 +655,14 @@ done: * Signature: (JJJJJ[JZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dwrite_1long - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dwrite_1long(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jlongArray buf, jboolean isCriticalPinning) { - jboolean writeBufIsCopy; - htri_t data_class; - jlong *writeBuf = NULL; - herr_t status = FAIL; + jboolean writeBufIsCopy; + htri_t data_class; + jlong * writeBuf = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -680,14 +683,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1long H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_long: variable length type not supported"); if (isCriticalPinning) { - PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_long: write buffer not critically pinned"); + PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, + "H5Dwrite_long: write buffer not critically pinned"); } else { PIN_LONG_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_long: write buffer not pinned"); } - if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0) + if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, writeBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -709,14 +713,14 @@ done: * Signature: (JJJJJ[FZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dread_1float - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dread_1float(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jfloatArray buf, jboolean isCriticalPinning) { - jboolean readBufIsCopy; - htri_t data_class; - jfloat *readBuf = NULL; - herr_t status = FAIL; + jboolean readBufIsCopy; + htri_t data_class; + jfloat * readBuf = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -737,14 +741,15 @@ Java_hdf_hdf5lib_H5_H5Dread_1float H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_float: variable length type not supported"); if (isCriticalPinning) { - PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_float: read buffer not critically pinned"); + PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, + "H5Dread_float: read buffer not critically pinned"); } else { PIN_FLOAT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_float: read buffer not pinned"); } - if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0) + if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -766,14 +771,14 @@ done: * Signature: (JJJJJ[FZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dwrite_1float - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dwrite_1float(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jfloatArray buf, jboolean isCriticalPinning) { - jboolean writeBufIsCopy; - htri_t data_class; - jfloat *writeBuf = NULL; - herr_t status = FAIL; + jboolean writeBufIsCopy; + htri_t data_class; + jfloat * writeBuf = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -794,14 +799,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1float H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_float: variable length type not supported"); if (isCriticalPinning) { - PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_float: write buffer not critically pinned"); + PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, + "H5Dwrite_float: write buffer not critically pinned"); } else { PIN_FLOAT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_float: write buffer not pinned"); } - if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0) + if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, writeBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -823,14 +829,14 @@ done: * Signature: (JJJJJ[DZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dread_1double - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dread_1double(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jdoubleArray buf, jboolean isCriticalPinning) { - jboolean readBufIsCopy; - jdouble *readBuf = NULL; - htri_t data_class; - herr_t status = FAIL; + jboolean readBufIsCopy; + jdouble *readBuf = NULL; + htri_t data_class; + herr_t status = FAIL; UNUSED(clss); @@ -851,14 +857,15 @@ Java_hdf_hdf5lib_H5_H5Dread_1double H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_double: variable length type not supported"); if (isCriticalPinning) { - PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_double: read buffer not critically pinned"); + PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, + "H5Dread_double: read buffer not critically pinned"); } else { PIN_DOUBLE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_double: read buffer not pinned"); } - if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0) + if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, readBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -880,14 +887,14 @@ done: * Signature: (JJJJJ[DZ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dwrite_1double - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning) +Java_hdf_hdf5lib_H5_H5Dwrite_1double(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jdoubleArray buf, jboolean isCriticalPinning) { - jboolean writeBufIsCopy; - jdouble *writeBuf = NULL; - htri_t data_class; - herr_t status = FAIL; + jboolean writeBufIsCopy; + jdouble *writeBuf = NULL; + htri_t data_class; + herr_t status = FAIL; UNUSED(clss); @@ -908,14 +915,15 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1double H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_double: variable length type not supported"); if (isCriticalPinning) { - PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_double: write buffer not critically pinned"); + PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, + "H5Dwrite_double: write buffer not critically pinned"); } else { PIN_DOUBLE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_double: write buffer not pinned"); } - if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0) + if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, writeBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -937,17 +945,17 @@ done: * Signature: (JJJJJ[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dread_1string - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf) +Java_hdf_hdf5lib_H5_H5Dread_1string(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jobjectArray j_buf) { - jstring jstr; - size_t str_len; - size_t pos; - jsize i, n; - char *c_buf = NULL; - char *cstr = NULL; - herr_t status = FAIL; + jstring jstr; + size_t str_len; + size_t pos; + jsize i, n; + char * c_buf = NULL; + char * cstr = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -962,23 +970,24 @@ Java_hdf_hdf5lib_H5_H5Dread_1string if (!(str_len = H5Tget_size((hid_t)mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (cstr = (char *) HDmalloc(str_len + 1))) + if (NULL == (cstr = (char *)HDmalloc(str_len + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: memory allocation failed"); - if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len))) + if (NULL == (c_buf = (char *)HDmalloc((size_t)n * str_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: memory allocation failed"); - if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf)) < 0) + if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, c_buf)) < 0) H5_LIBRARY_ERROR(ENVONLY); for (i = 0, pos = 0; i < n; i++) { - HDmemcpy(cstr, c_buf+pos, str_len); + HDmemcpy(cstr, c_buf + pos, str_len); cstr[str_len] = '\0'; if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, cstr))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_string: out of memory - unable to construct string from UTF characters"); + H5_OUT_OF_MEMORY_ERROR( + ENVONLY, "H5Dread_string: out of memory - unable to construct string from UTF characters"); } ENVPTR->SetObjectArrayElement(ENVONLY, j_buf, i, jstr); @@ -1004,15 +1013,15 @@ done: * Signature: (JJJJJ[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dwrite_1string - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf) +Java_hdf_hdf5lib_H5_H5Dwrite_1string(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jobjectArray j_buf) { const char *utf8 = NULL; jstring obj; size_t i, str_len; jsize n; - char *c_buf = NULL; + char * c_buf = NULL; herr_t status = FAIL; UNUSED(clss); @@ -1028,11 +1037,11 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string if (!(str_len = H5Tget_size((hid_t)mem_type_id))) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len))) + if (NULL == (c_buf = (char *)HDmalloc((size_t)n * str_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dwrite_string: memory allocation failed"); - for (i = 0; i < (size_t) n; i++) { - if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize) i))) { + for (i = 0; i < (size_t)n; i++) { + if (NULL == (obj = (jstring)ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize)i))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); /* @@ -1057,8 +1066,8 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string ENVPTR->DeleteLocalRef(ENVONLY, obj); } /* end for */ - if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, - (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf)) < 0) + if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, c_buf)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -1076,17 +1085,16 @@ done: * Signature: (JJJJJ[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5DreadVL - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +Java_hdf_hdf5lib_H5_H5DreadVL(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) { H5T_class_t type_class; - htri_t isStr = 0; - htri_t isVlenStr = 0; - htri_t isComplex = 0; + htri_t isStr = 0; + htri_t isVlenStr = 0; + htri_t isComplex = 0; htri_t isComplex2 = 0; hid_t nested_tid = H5I_INVALID_HID; - herr_t status = FAIL; + herr_t status = FAIL; UNUSED(clss); @@ -1106,7 +1114,7 @@ Java_hdf_hdf5lib_H5_H5DreadVL if ((num_members = H5Tget_nmembers(mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - for (i = 0; i < (unsigned) num_members; i++) { + for (i = 0; i < (unsigned)num_members; i++) { if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1128,13 +1136,13 @@ Java_hdf_hdf5lib_H5_H5DreadVL } if (!isStr || isComplex || isVlenStr) { - if ((status = H5DreadVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id, - (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) + if ((status = H5DreadVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } else if (isStr) { - if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, - (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) + if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } @@ -1151,21 +1159,22 @@ done: * buffer in turn. */ static herr_t -H5DreadVL_str - (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf) +H5DreadVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, + jobjectArray buf) { - jstring jstr; - jsize i, n; - char **strs = NULL; - herr_t status = FAIL; + jstring jstr; + jsize i, n; + char ** strs = NULL; + herr_t status = FAIL; if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DreadVL_str: buf length < 0"); } - if (NULL == (strs = (char **) HDcalloc((size_t)n, sizeof(char *)))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DreadVL_str: failed to allocate variable length string read buffer"); + if (NULL == (strs = (char **)HDcalloc((size_t)n, sizeof(char *)))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, + "H5DreadVL_str: failed to allocate variable length string read buffer"); if ((status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, strs)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1209,19 +1218,19 @@ done: * in the output buffer in turn. */ static herr_t -H5DreadVL_asstr - (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf) +H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, + jobjectArray buf) { - H5T_class_t tclass; - jstring jstr; - h5str_t h5str; - hbool_t close_mem_space = FALSE; - size_t typeSize; - size_t i; - hid_t mem_space = mem_sid; - jsize n; - void *readBuf = NULL; - herr_t status = FAIL; + H5T_class_t tclass; + jstring jstr; + h5str_t h5str; + hbool_t close_mem_space = FALSE; + size_t typeSize; + size_t i; + hid_t mem_space = mem_sid; + jsize n; + void * readBuf = NULL; + herr_t status = FAIL; HDmemset(&h5str, 0, sizeof(h5str_t)); @@ -1266,16 +1275,16 @@ H5DreadVL_asstr H5_LIBRARY_ERROR(ENVONLY); /* Convert each element to a char string */ - for (i = 0; i < (size_t) n; i++) { + for (i = 0; i < (size_t)n; i++) { h5str.s[0] = '\0'; - if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *) readBuf)[i * typeSize]), typeSize, 0)) + if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *)readBuf)[i * typeSize]), typeSize, 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize) i, jstr); + ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize)i, jstr); CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); ENVPTR->DeleteLocalRef(ENVONLY, jstr); @@ -1307,12 +1316,12 @@ done: * Signature: (JJJJJ[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dread_1VLStrings - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +Java_hdf_hdf5lib_H5_H5Dread_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jobjectArray buf) { htri_t isVlenStr = 0; - herr_t status = FAIL; + herr_t status = FAIL; UNUSED(clss); @@ -1323,8 +1332,8 @@ Java_hdf_hdf5lib_H5_H5Dread_1VLStrings H5_LIBRARY_ERROR(ENVONLY); if (isVlenStr) { - if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, - (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) + if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) H5_LIBRARY_ERROR(ENVONLY); } else @@ -1340,17 +1349,16 @@ done: * Signature: (JJJJJ[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5DwriteVL - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +Java_hdf_hdf5lib_H5_H5DwriteVL(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) { H5T_class_t type_class; - htri_t isStr = 0; - htri_t isVlenStr = 0; - htri_t isComplex = 0; + htri_t isStr = 0; + htri_t isVlenStr = 0; + htri_t isComplex = 0; htri_t isComplex2 = 0; hid_t nested_tid = H5I_INVALID_HID; - herr_t status = FAIL; + herr_t status = FAIL; UNUSED(clss); @@ -1370,7 +1378,7 @@ Java_hdf_hdf5lib_H5_H5DwriteVL if ((num_members = H5Tget_nmembers(mem_type_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); - for (i = 0; i < (unsigned) num_members; i++) { + for (i = 0; i < (unsigned)num_members; i++) { if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1392,13 +1400,13 @@ Java_hdf_hdf5lib_H5_H5DwriteVL } if (!isStr || isComplex || isVlenStr) { - if ((status = H5DwriteVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id, - (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) + if ((status = H5DwriteVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } else if (isStr) { - if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, - (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) + if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); } @@ -1414,28 +1422,29 @@ done: * The buffer of C-strings is then written to the HDF5 dataset specified. */ static herr_t -H5DwriteVL_str - (JNIEnv *env, hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, jobjectArray buf) +H5DwriteVL_str(JNIEnv *env, hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, + hid_t xfer_plist_id, jobjectArray buf) { - const char *utf8 = NULL; - jstring obj; - jsize size; - jsize i; - char **writeBuf = NULL; - herr_t status = FAIL; - - if ((size = ENVPTR->GetArrayLength(ENVONLY, (jarray) buf)) < 0) { + const char *utf8 = NULL; + jstring obj; + jsize size; + jsize i; + char ** writeBuf = NULL; + herr_t status = FAIL; + + if ((size = ENVPTR->GetArrayLength(ENVONLY, (jarray)buf)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL_str: buf length < 0"); } - if (NULL == (writeBuf = (char **) HDcalloc((size_t)size + 1, sizeof(char *)))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate variable length string write buffer"); + if (NULL == (writeBuf = (char **)HDcalloc((size_t)size + 1, sizeof(char *)))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, + "H5DwriteVL_str: failed to allocate variable length string write buffer"); for (i = 0; i < size; ++i) { jsize length; - if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, i))) { + if (NULL == (obj = (jstring)ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, i))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); /* @@ -1450,7 +1459,7 @@ H5DwriteVL_str PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5DwriteVL_str: string not pinned"); - if (NULL == (writeBuf[i] = (char *) HDmalloc((size_t)length + 1))) + if (NULL == (writeBuf[i] = (char *)HDmalloc((size_t)length + 1))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate string buffer"); HDstrncpy(writeBuf[i], utf8, (size_t)length + 1); @@ -1462,7 +1471,8 @@ H5DwriteVL_str ENVPTR->DeleteLocalRef(ENVONLY, obj); } /* end for (i = 0; i < size; ++i) */ - if ((status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, writeBuf)) < 0) + if ((status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, writeBuf)) < + 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -1486,18 +1496,18 @@ done: * elements is then written to the HDF5 dataset. */ static herr_t -H5DwriteVL_asstr - (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf) +H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, + jobjectArray buf) { - const char *utf8 = NULL; - jstring obj = NULL; + const char *utf8 = NULL; + jstring obj = NULL; hbool_t close_mem_space = FALSE; size_t typeSize; size_t i; hid_t mem_space = mem_sid; jsize n; - void *writeBuf = NULL; - herr_t status = FAIL; + void * writeBuf = NULL; + herr_t status = FAIL; if (mem_space == H5S_ALL) { mem_space = file_sid; @@ -1526,14 +1536,14 @@ H5DwriteVL_asstr if (NULL == (writeBuf = HDcalloc((size_t)n, typeSize))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer"); - for (i = 0; i < (size_t) n; ++i) { - if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize) i))) { + for (i = 0; i < (size_t)n; ++i) { + if (NULL == (obj = (jstring)ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize)i))) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); /* * If the string object was NULL, skip it. */ - HDmemset(&(((char *) writeBuf)[i * typeSize]), 0, typeSize); + HDmemset(&(((char *)writeBuf)[i * typeSize]), 0, typeSize); continue; } @@ -1549,7 +1559,7 @@ H5DwriteVL_asstr * one before destroying it with h5str_convert. */ - if (!h5str_convert(ENVONLY, (char **) &utf8, did, tid, &(((char *) writeBuf)[i * typeSize]), 0)) + if (!h5str_convert(ENVONLY, (char **)&utf8, did, tid, &(((char *)writeBuf)[i * typeSize]), 0)) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); UNPIN_JAVA_STRING(ENVONLY, obj, utf8); @@ -1580,12 +1590,12 @@ done: * Signature: (JJJJJ[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings - (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jobjectArray buf) { - htri_t isVlenStr = 0; - herr_t status = FAIL; + htri_t isVlenStr = 0; + herr_t status = FAIL; UNUSED(clss); @@ -1596,8 +1606,8 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings H5_LIBRARY_ERROR(ENVONLY); if (isVlenStr) { - if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, - (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) + if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0) H5_LIBRARY_ERROR(ENVONLY); } /* end if */ else @@ -1613,10 +1623,9 @@ done: * Signature: (JJJJJ[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref - (JNIEnv *env, jclass clss, - jlong dataset_id, jlong mem_type_id, jlong mem_space_id, - jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, + jlong mem_space_id, jlong file_space_id, jlong xfer_plist_id, + jobjectArray buf) { hdset_reg_ref_t *ref_data = NULL; h5str_t h5str; @@ -1633,10 +1642,11 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_reg_ref: buf length < 0"); } - if (NULL == (ref_data = (hdset_reg_ref_t *) HDcalloc(1, (size_t)n * sizeof(hdset_reg_ref_t)))) + if (NULL == (ref_data = (hdset_reg_ref_t *)HDcalloc(1, (size_t)n * sizeof(hdset_reg_ref_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate read buffer"); - if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, xfer_plist_id, ref_data)) < 0) + if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, + xfer_plist_id, ref_data)) < 0) H5_LIBRARY_ERROR(ENVONLY); h5str_new(&h5str, 1024); @@ -1674,12 +1684,12 @@ done: * Signature: (JLjava/lang/String;JJJJJ)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Dcreate2 - (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, - jlong space_id, jlong link_plist_id, jlong create_plist_id, jlong access_plist_id) +Java_hdf_hdf5lib_H5__1H5Dcreate2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, + jlong space_id, jlong link_plist_id, jlong create_plist_id, + jlong access_plist_id) { const char *dsetName = NULL; - hid_t dset_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; UNUSED(clss); @@ -1688,7 +1698,8 @@ Java_hdf_hdf5lib_H5__1H5Dcreate2 PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dcreate2: dataset name not pinned"); - if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0) + if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, (hid_t)link_plist_id, + (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -1704,11 +1715,10 @@ done: * Signature: (JLjava/lang/String;J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Dopen2 - (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist) +Java_hdf_hdf5lib_H5__1H5Dopen2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist) { const char *dsetName = NULL; - hid_t dset_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; UNUSED(clss); @@ -1733,14 +1743,15 @@ done: * Signature: (JJJJJ)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Dcreate_1anon - (JNIEnv *env, jclass clss, jlong loc_id, jlong type_id, jlong space_id, jlong dcpl_id, jlong dapl_id) +Java_hdf_hdf5lib_H5__1H5Dcreate_1anon(JNIEnv *env, jclass clss, jlong loc_id, jlong type_id, jlong space_id, + jlong dcpl_id, jlong dapl_id) { hid_t dset_id = H5I_INVALID_HID; UNUSED(clss); - if ((dset_id = H5Dcreate_anon((hid_t)loc_id, (hid_t)type_id, (hid_t)space_id, (hid_t)dcpl_id, (hid_t)dapl_id)) < 0) + if ((dset_id = H5Dcreate_anon((hid_t)loc_id, (hid_t)type_id, (hid_t)space_id, (hid_t)dcpl_id, + (hid_t)dapl_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -1753,8 +1764,7 @@ done: * Signature: (J)I; */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Dget_1space_1status - (JNIEnv *env, jclass clss, jlong loc_id) +Java_hdf_hdf5lib_H5_H5Dget_1space_1status(JNIEnv *env, jclass clss, jlong loc_id) { H5D_space_status_t space_status = H5D_SPACE_STATUS_ERROR; @@ -1773,8 +1783,7 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Dget_1access_1plist - (JNIEnv *env, jclass clss, jlong loc_id) +Java_hdf_hdf5lib_H5_H5Dget_1access_1plist(JNIEnv *env, jclass clss, jlong loc_id) { hid_t retVal = H5I_INVALID_HID; @@ -1793,8 +1802,7 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Dget_1offset - (JNIEnv *env, jclass clss, jlong loc_id) +Java_hdf_hdf5lib_H5_H5Dget_1offset(JNIEnv *env, jclass clss, jlong loc_id) { haddr_t offset = HADDR_UNDEF; @@ -1813,8 +1821,8 @@ done: * Signature: (JJJ)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size - (JNIEnv *env, jclass clss, jlong dataset_id, jlong type_id, jlong space_id) +Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size(JNIEnv *env, jclass clss, jlong dataset_id, jlong type_id, + jlong space_id) { hsize_t sz = 0; @@ -1833,14 +1841,14 @@ done: * Signature: ([BJ[BJJ)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Dfill - (JNIEnv *env, jclass clss, jbyteArray fill, jlong fill_type_id, jbyteArray buf, jlong buf_type_id, jlong space_id) +Java_hdf_hdf5lib_H5_H5Dfill(JNIEnv *env, jclass clss, jbyteArray fill, jlong fill_type_id, jbyteArray buf, + jlong buf_type_id, jlong space_id) { - jboolean isCopy1; - jboolean isCopy2; - herr_t status = FAIL; - jbyte *fillP = NULL; - jbyte *buffP = NULL; + jboolean isCopy1; + jboolean isCopy2; + herr_t status = FAIL; + jbyte * fillP = NULL; + jbyte * buffP = NULL; UNUSED(clss); @@ -1853,7 +1861,8 @@ Java_hdf_hdf5lib_H5_H5Dfill PIN_BYTE_ARRAY(ENVONLY, fill, fillP, &isCopy1, "H5Dfill: fill buffer not pinned"); } - if ((status = H5Dfill((const void *)fillP, (hid_t)fill_type_id, (void *)buffP, (hid_t)buf_type_id, (hid_t)space_id)) < 0) + if ((status = H5Dfill((const void *)fillP, (hid_t)fill_type_id, (void *)buffP, (hid_t)buf_type_id, + (hid_t)space_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); if (fillP) { @@ -1874,15 +1883,14 @@ done: * Signature: (J[J)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Dset_1extent - (JNIEnv *env, jclass clss, jlong loc_id, jlongArray buf) +Java_hdf_hdf5lib_H5_H5Dset_1extent(JNIEnv *env, jclass clss, jlong loc_id, jlongArray buf) { - jboolean isCopy; - hsize_t *dims = NULL; - herr_t status; - jsize rank; - jlong *dimsBuf = NULL; - int i = 0; + jboolean isCopy; + hsize_t *dims = NULL; + herr_t status; + jsize rank; + jlong * dimsBuf = NULL; + int i = 0; UNUSED(clss); @@ -1896,7 +1904,7 @@ Java_hdf_hdf5lib_H5_H5Dset_1extent PIN_LONG_ARRAY(ENVONLY, buf, dimsBuf, &isCopy, "H5Dset_extent: buffer not pinned"); - if (NULL == (dims = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (dims = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Dset_extent: failed to allocate dataset dimension buffer"); for (i = 0; i < rank; i++) @@ -1913,18 +1921,18 @@ done: } /* end Java_hdf_hdf5lib_H5_H5Dset_1extent */ static herr_t -H5D_iterate_cb - (void *elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data) { +H5D_iterate_cb(void *elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data) +{ cb_wrapper *wrapper = (cb_wrapper *)cb_data; jbyteArray elemArray; jlongArray pointArray; jmethodID mid; jobject visit_callback = wrapper->visit_callback; jclass cls; - JNIEnv *cbenv = NULL; + JNIEnv * cbenv = NULL; jint status = FAIL; jsize size; - void *op_data = (void *)wrapper->op_data; + void * op_data = (void *)wrapper->op_data; if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) { CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE); @@ -1934,7 +1942,8 @@ H5D_iterate_cb if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "([BJI[JLhdf/hdf5lib/callbacks/H5D_iterate_t;)I"))) + if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", + "([BJI[JLhdf/hdf5lib/callbacks/H5D_iterate_t;)I"))) CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); if (NULL == elem) @@ -1957,7 +1966,8 @@ H5D_iterate_cb CBENVPTR->SetLongArrayRegion(CBENVONLY, pointArray, 0, 2, (const jlong *)point); CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); - status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, (void *)elemArray, elem_id, ndim, pointArray, op_data); + status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, (void *)elemArray, elem_id, ndim, + pointArray, op_data); CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE); CBENVPTR->GetByteArrayRegion(CBENVONLY, elemArray, 0, size, (jbyte *)elem); @@ -1976,14 +1986,13 @@ done: * Signature: ([BJJLjava/lang/Object;Ljava/lang/Object;)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Diterate - (JNIEnv *env, jclass clss, jbyteArray buf, jlong buf_type, jlong space, - jobject callback_op, jobject op_data) +Java_hdf_hdf5lib_H5_H5Diterate(JNIEnv *env, jclass clss, jbyteArray buf, jlong buf_type, jlong space, + jobject callback_op, jobject op_data) { - cb_wrapper wrapper = { callback_op, op_data }; - jboolean isCopy; - jbyte *iterBuf = NULL; - herr_t status = FAIL; + cb_wrapper wrapper = {callback_op, op_data}; + jboolean isCopy; + jbyte * iterBuf = NULL; + herr_t status = FAIL; UNUSED(clss); @@ -1999,12 +2008,14 @@ Java_hdf_hdf5lib_H5_H5Diterate PIN_BYTE_ARRAY(ENVONLY, buf, iterBuf, &isCopy, "H5Diterate: buffer not pinned"); - if ((status = H5Diterate((void *)iterBuf, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void *)&wrapper)) < 0) + if ((status = H5Diterate((void *)iterBuf, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, + (void *)&wrapper)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: if (iterBuf) - UNPIN_BYTE_ARRAY(ENVONLY, buf, iterBuf, (status < 0) ? (JNI_ABORT) : ((isCopy == JNI_TRUE) ? 0 : JNI_ABORT)); + UNPIN_BYTE_ARRAY(ENVONLY, buf, iterBuf, + (status < 0) ? (JNI_ABORT) : ((isCopy == JNI_TRUE) ? 0 : JNI_ABORT)); return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Diterate */ @@ -2015,8 +2026,7 @@ done: * Signature: (J)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Dflush - (JNIEnv *env, jclass clss, jlong loc_id) +Java_hdf_hdf5lib_H5_H5Dflush(JNIEnv *env, jclass clss, jlong loc_id) { UNUSED(clss); @@ -2033,8 +2043,7 @@ done: * Signature: (J)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Drefresh - (JNIEnv *env, jclass clss, jlong loc_id) +Java_hdf_hdf5lib_H5_H5Drefresh(JNIEnv *env, jclass clss, jlong loc_id) { UNUSED(clss); |