diff options
Diffstat (limited to 'java/src/jni/h5sImp.c')
-rw-r--r-- | java/src/jni/h5sImp.c | 458 |
1 files changed, 224 insertions, 234 deletions
diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c index 3498392..2a9cff5 100644 --- a/java/src/jni/h5sImp.c +++ b/java/src/jni/h5sImp.c @@ -37,14 +37,13 @@ extern "C" { * Signature: (I)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Screate - (JNIEnv *env, jclass clss, jint type) +Java_hdf_hdf5lib_H5__1H5Screate(JNIEnv *env, jclass clss, jint type) { hid_t retVal = H5I_INVALID_HID; UNUSED(clss); - if ((retVal = H5Screate((H5S_class_t) type)) < 0) + if ((retVal = H5Screate((H5S_class_t)type)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -57,18 +56,18 @@ done: * Signature: (I[J[J)G */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Screate_1simple - (JNIEnv *env, jclass clss, jint rank, jlongArray dims, jlongArray maxdims) +Java_hdf_hdf5lib_H5__1H5Screate_1simple(JNIEnv *env, jclass clss, jint rank, jlongArray dims, + jlongArray maxdims) { - jboolean isCopy; - hsize_t *sa = NULL; - hsize_t *msa = NULL; - hsize_t *lp = NULL; - jlong *dimsP = NULL, *maxdimsP = NULL; - jlong *jlp = NULL; - jsize drank = 0, mrank = 0; - int i; - hid_t retVal = H5I_INVALID_HID; + jboolean isCopy; + hsize_t *sa = NULL; + hsize_t *msa = NULL; + hsize_t *lp = NULL; + jlong * dimsP = NULL, *maxdimsP = NULL; + jlong * jlp = NULL; + jsize drank = 0, mrank = 0; + int i; + hid_t retVal = H5I_INVALID_HID; UNUSED(clss); @@ -97,29 +96,29 @@ Java_hdf_hdf5lib_H5__1H5Screate_1simple PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Screate_simple: dims not pinned"); - if (NULL == (sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (sa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Screate_simple: failed to allocate dims buffer"); - jlp = (jlong *) dimsP; + jlp = (jlong *)dimsP; for (i = 0; i < rank; i++) { - *lp = (hsize_t) *jlp; + *lp = (hsize_t)*jlp; lp++; jlp++; } /* end for */ if (NULL == maxdims) { maxdimsP = NULL; - msa = (hsize_t *)maxdimsP; + msa = (hsize_t *)maxdimsP; } else { PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Screate_simple: maxdims not pinned"); - if (NULL == (msa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Screate_simple: failed to allocate maxdims buffer"); - jlp = (jlong *) maxdimsP; + jlp = (jlong *)maxdimsP; for (i = 0; i < mrank; i++) { - *lp = (hsize_t) *jlp; + *lp = (hsize_t)*jlp; lp++; jlp++; } /* end for */ @@ -147,8 +146,7 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5__1H5Scopy - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5__1H5Scopy(JNIEnv *env, jclass clss, jlong space_id) { hid_t retVal = H5I_INVALID_HID; @@ -177,12 +175,12 @@ done: * Signature: (JII[J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sselect_1elements - (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jlongArray coords) +Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, + jlongArray coords) { jboolean isCopy; hssize_t *sa = NULL; - jlong *P = NULL; + jlong * P = NULL; jint i; int rank; herr_t status = FAIL; @@ -194,7 +192,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements PIN_LONG_ARRAY(ENVONLY, coords, P, &isCopy, "H5Sselect_elements: coords not pinned"); - if (NULL == (sa = (hssize_t *) HDmalloc( (size_t)num_elemn * 2 * sizeof(hssize_t)))) + if (NULL == (sa = (hssize_t *)HDmalloc((size_t)num_elemn * 2 * sizeof(hssize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer"); for (i = 0; i < (num_elemn * 2); i++) { @@ -220,18 +218,18 @@ done: * Signature: (JII[B)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sselect_1elements - (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jbyteArray coords) +Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, + jbyteArray coords) { - jboolean isCopy; - hsize_t *lp = NULL; - hsize_t *llp = NULL; - jlong *jlp = NULL; - jbyte *P = NULL; - jsize size; - int ii; - int nlongs; - herr_t status = FAIL; + jboolean isCopy; + hsize_t *lp = NULL; + hsize_t *llp = NULL; + jlong * jlp = NULL; + jbyte * P = NULL; + jsize size; + int ii; + int nlongs; + herr_t status = FAIL; UNUSED(clss); @@ -247,18 +245,19 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements nlongs = (int)((size_t)size / sizeof(jlong)); - if (NULL == (lp = (hsize_t *) HDmalloc((size_t)nlongs * sizeof(hsize_t)))) + if (NULL == (lp = (hsize_t *)HDmalloc((size_t)nlongs * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer"); - jlp = (jlong *) P; + jlp = (jlong *)P; llp = lp; for (ii = 0; ii < nlongs; ii++) { - *lp = (hsize_t) *jlp; + *lp = (hsize_t)*jlp; lp++; jlp++; } /* end for */ - if ((status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, (const hsize_t *)llp)) < 0) + if ((status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, (const hsize_t *)llp)) < + 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -276,8 +275,7 @@ done: * Signature: (J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sselect_1all - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5_H5Sselect_1all(JNIEnv *env, jclass clss, jlong space_id) { herr_t retVal = FAIL; @@ -287,7 +285,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1all H5_LIBRARY_ERROR(ENVONLY); done: - return (jint) retVal; + return (jint)retVal; } /* end Java_hdf_hdf5lib_H5_H5Sselect_1all */ /* @@ -296,8 +294,7 @@ done: * Signature: (J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sselect_1none - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5_H5Sselect_1none(JNIEnv *env, jclass clss, jlong space_id) { herr_t retVal = FAIL; @@ -307,7 +304,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1none H5_LIBRARY_ERROR(ENVONLY); done: - return (jint) retVal; + return (jint)retVal; } /* end Java_hdf_hdf5lib_H5_H5Sselect_1none */ /* @@ -316,8 +313,7 @@ done: * Signature: (J)Z */ JNIEXPORT jboolean JNICALL -Java_hdf_hdf5lib_H5_H5Sselect_1valid - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5_H5Sselect_1valid(JNIEnv *env, jclass clss, jlong space_id) { htri_t bval = JNI_FALSE; @@ -338,8 +334,7 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints(JNIEnv *env, jclass clss, jlong space_id) { hssize_t retVal = -1; @@ -349,7 +344,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints H5_LIBRARY_ERROR(ENVONLY); done: - return (jlong) retVal; + return (jlong)retVal; } /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints */ /* @@ -358,8 +353,7 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints(JNIEnv *env, jclass clss, jlong space_id) { hssize_t retVal = -1; @@ -369,7 +363,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints H5_LIBRARY_ERROR(ENVONLY); done: - return (jlong) retVal; + return (jlong)retVal; } /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints */ /* @@ -378,8 +372,7 @@ done: * Signature: (J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1select_1type - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5_H5Sget_1select_1type(JNIEnv *env, jclass clss, jlong space_id) { int retVal = -1; @@ -389,7 +382,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1type H5_LIBRARY_ERROR(ENVONLY); done: - return (jint) retVal; + return (jint)retVal; } /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1type */ /* @@ -398,8 +391,7 @@ done: * Signature: (J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims(JNIEnv *env, jclass clss, jlong space_id) { int retVal = -1; @@ -409,7 +401,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims H5_LIBRARY_ERROR(ENVONLY); done: - return (jint) retVal; + return (jint)retVal; } /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims */ /* @@ -418,23 +410,23 @@ done: * Signature: (J[J[J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims - (JNIEnv *env, jclass clss, jlong space_id, jlongArray dims, jlongArray maxdims) +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims(JNIEnv *env, jclass clss, jlong space_id, jlongArray dims, + jlongArray maxdims) { - jboolean isCopy; - hsize_t *sa = NULL; - hsize_t *msa = NULL; - jlong *dimsP = NULL, *maxdimsP = NULL; - int i; - int rank = -1; - int mrank; - int status = -1; + jboolean isCopy; + hsize_t *sa = NULL; + hsize_t *msa = NULL; + jlong * dimsP = NULL, *maxdimsP = NULL; + int i; + int rank = -1; + int mrank; + int status = -1; UNUSED(clss); if (NULL == dims) { dimsP = NULL; - sa = (hsize_t *) dimsP; + sa = (hsize_t *)dimsP; } else { PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Sget_simple_extent_dims: dims not pinned"); @@ -444,18 +436,18 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: dims array length < 0"); } - if (NULL == (sa = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (sa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate dimension buffer"); } if (NULL == maxdims) { maxdimsP = NULL; - msa = (hsize_t *) maxdimsP; + msa = (hsize_t *)maxdimsP; } else { PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Sget_simple_extent_dims: maxdims not pinned"); - if ((mrank = (int) ENVPTR->GetArrayLength(ENVONLY, maxdims)) < 0) { + if ((mrank = (int)ENVPTR->GetArrayLength(ENVONLY, maxdims)) < 0) { CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims array length < 0"); } @@ -465,8 +457,9 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims else if (mrank != rank) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims rank not same as dims"); - if (NULL == (msa = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate maximum dimension buffer"); + if (NULL == (msa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, + "H5Sget_simple_extent_dims: failed to allocate maximum dimension buffer"); } if ((status = H5Sget_simple_extent_dims(space_id, (hsize_t *)sa, (hsize_t *)msa)) < 0) @@ -503,8 +496,7 @@ done: * Signature: (J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type(JNIEnv *env, jclass clss, jlong space_id) { H5S_class_t retVal = H5S_NO_CLASS; @@ -526,18 +518,18 @@ done: * Signature: (JI[J[J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple - (JNIEnv *env, jclass clss, jlong space_id, jint rank, jlongArray dims, jlongArray maxdims) +Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple(JNIEnv *env, jclass clss, jlong space_id, jint rank, + jlongArray dims, jlongArray maxdims) { - jboolean isCopy; - hsize_t *sa = NULL; - hsize_t *msa = NULL; - hsize_t *lp = NULL; - jlong *dimsP = NULL, *maxdimsP = NULL; - jlong *jlp = NULL; - jsize drank, mrank; - int i; - herr_t status = FAIL; + jboolean isCopy; + hsize_t *sa = NULL; + hsize_t *msa = NULL; + hsize_t *lp = NULL; + jlong * dimsP = NULL, *maxdimsP = NULL; + jlong * jlp = NULL; + jsize drank, mrank; + int i; + herr_t status = FAIL; UNUSED(clss); @@ -564,35 +556,36 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Sset_extent_simple: dims not pinned"); - if (NULL == (sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (sa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate dimension buffer"); - jlp = (jlong *) dimsP; + jlp = (jlong *)dimsP; for (i = 0; i < rank; i++) { - *lp = (hsize_t) *jlp; + *lp = (hsize_t)*jlp; lp++; jlp++; } /* end for */ if (NULL == maxdims) { maxdimsP = NULL; - msa = (hsize_t *) maxdimsP; + msa = (hsize_t *)maxdimsP; } else { PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Sset_extent_simple: maxdims not pinned"); - if (NULL == (msa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate maximum dimension buffer"); + if (NULL == (msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, + "H5Sset_extent_simple: failed to allocate maximum dimension buffer"); - jlp = (jlong *) maxdimsP; + jlp = (jlong *)maxdimsP; for (i = 0; i < rank; i++) { - *lp = (hsize_t) *jlp; + *lp = (hsize_t)*jlp; lp++; jlp++; } /* end for */ } - if ((status = H5Sset_extent_simple(space_id, rank, (hsize_t *) sa, (hsize_t *) msa)) < 0) + if ((status = H5Sset_extent_simple(space_id, rank, (hsize_t *)sa, (hsize_t *)msa)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -614,8 +607,7 @@ done: * Signature: (J)Z */ JNIEXPORT jboolean JNICALL -Java_hdf_hdf5lib_H5_H5Sis_1simple - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5_H5Sis_1simple(JNIEnv *env, jclass clss, jlong space_id) { htri_t bval = JNI_FALSE; @@ -636,16 +628,15 @@ done: * Signature: (J[B)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Soffset_1simple - (JNIEnv *env, jclass clss, jlong space_id, jbyteArray offset) +Java_hdf_hdf5lib_H5_H5Soffset_1simple(JNIEnv *env, jclass clss, jlong space_id, jbyteArray offset) { jboolean isCopy; hssize_t *sa = NULL; hssize_t *lp = NULL; size_t rank; jsize i; - jbyte *P = NULL; - jlong *jlp = NULL; + jbyte * P = NULL; + jlong * jlp = NULL; herr_t status = FAIL; UNUSED(clss); @@ -658,21 +649,21 @@ Java_hdf_hdf5lib_H5_H5Soffset_1simple H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Soffset_simple: offset array length < 0"); } - rank = (size_t) i / sizeof(jlong); + rank = (size_t)i / sizeof(jlong); - if (NULL == (sa = lp = (hssize_t *) HDmalloc((size_t)rank * sizeof(hssize_t)))) + if (NULL == (sa = lp = (hssize_t *)HDmalloc((size_t)rank * sizeof(hssize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Soffset_simple: failed to allocate offset buffer"); - jlp = (jlong *) P; - for (i = 0; (size_t) i < rank; i++) { - *lp = (hssize_t) *jlp; + jlp = (jlong *)P; + for (i = 0; (size_t)i < rank; i++) { + *lp = (hssize_t)*jlp; lp++; jlp++; } /* end for */ } else { - P = NULL; - sa = (hssize_t *) P; + P = NULL; + sa = (hssize_t *)P; } if ((status = H5Soffset_simple(space_id, sa)) < 0) @@ -693,8 +684,7 @@ done: * Signature: (JJ)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sextent_1copy - (JNIEnv *env, jclass clss, jlong space_id, jlong src_id) +Java_hdf_hdf5lib_H5_H5Sextent_1copy(JNIEnv *env, jclass clss, jlong space_id, jlong src_id) { herr_t retVal = FAIL; @@ -713,8 +703,7 @@ done: * Signature: (JJ)Z */ JNIEXPORT jboolean JNICALL -Java_hdf_hdf5lib_H5_H5Sextent_1equal - (JNIEnv *env, jclass clss, jlong space_id, jlong src_id) +Java_hdf_hdf5lib_H5_H5Sextent_1equal(JNIEnv *env, jclass clss, jlong space_id, jlong src_id) { htri_t bval = JNI_FALSE; @@ -735,8 +724,7 @@ done: * Signature: (J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sset_1extent_1none - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5_H5Sset_1extent_1none(JNIEnv *env, jclass clss, jlong space_id) { herr_t retVal = FAIL; @@ -755,17 +743,17 @@ done: * Signature: (JI[J[J[J[J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab - (JNIEnv *env, jclass clss, jlong space_id, jint op, jlongArray start, jlongArray stride, jlongArray count, jlongArray block) +Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab(JNIEnv *env, jclass clss, jlong space_id, jint op, jlongArray start, + jlongArray stride, jlongArray count, jlongArray block) { - jboolean isCopy; - hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL; - hsize_t *lp = NULL; - jlong *startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL; - jlong *jlp = NULL; - jsize start_rank, stride_rank, count_rank, block_rank; - int i; - herr_t status = FAIL; + jboolean isCopy; + hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL; + hsize_t *lp = NULL; + jlong * startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL; + jlong * jlp = NULL; + jsize start_rank, stride_rank, count_rank, block_rank; + int i; + herr_t status = FAIL; UNUSED(clss); @@ -788,31 +776,31 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sselect_hyperslab: start not pinned"); - if (NULL == (strt = lp = (hsize_t *) HDmalloc((size_t)start_rank * sizeof(hsize_t)))) + if (NULL == (strt = lp = (hsize_t *)HDmalloc((size_t)start_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate start buffer"); - jlp = (jlong *) startP; + jlp = (jlong *)startP; for (i = 0; i < start_rank; i++) { - *lp = (hsize_t) *jlp; + *lp = (hsize_t)*jlp; lp++; jlp++; } /* end if */ PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sselect_hyperslab: count not pinned"); - if (NULL == (cnt = lp = (hsize_t *) HDmalloc((size_t)count_rank * sizeof(hsize_t)))) + if (NULL == (cnt = lp = (hsize_t *)HDmalloc((size_t)count_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate count buffer"); - jlp = (jlong *) countP; + jlp = (jlong *)countP; for (i = 0; i < count_rank; i++) { - *lp = (hsize_t) *jlp; + *lp = (hsize_t)*jlp; lp++; jlp++; } /* end if */ if (NULL == stride) { strideP = NULL; - strd = (hsize_t *) strideP; + strd = (hsize_t *)strideP; } else { if ((stride_rank = ENVPTR->GetArrayLength(ENVONLY, stride)) < 0) { @@ -825,12 +813,12 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sselect_hyperslab: stride not pinned"); - if (NULL == (strd = lp = (hsize_t *) HDmalloc((size_t)stride_rank * sizeof(hsize_t)))) + if (NULL == (strd = lp = (hsize_t *)HDmalloc((size_t)stride_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate stride buffer"); - jlp = (jlong *) strideP; + jlp = (jlong *)strideP; for (i = 0; i < stride_rank; i++) { - *lp = (hsize_t) *jlp; + *lp = (hsize_t)*jlp; lp++; jlp++; } /* end if */ @@ -838,7 +826,7 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab if (NULL == block) { blockP = NULL; - blk = (hsize_t *) blockP; + blk = (hsize_t *)blockP; } else { if ((block_rank = ENVPTR->GetArrayLength(ENVONLY, block)) < 0) { @@ -851,19 +839,19 @@ Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sselect_hyperslab: block not pinned"); - if (NULL == (blk = lp = (hsize_t *) HDmalloc((size_t)block_rank * sizeof(hsize_t)))) + if (NULL == (blk = lp = (hsize_t *)HDmalloc((size_t)block_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate block buffer"); - jlp = (jlong *) blockP; + jlp = (jlong *)blockP; for (i = 0; i < block_rank; i++) { - *lp = (hsize_t) *jlp; + *lp = (hsize_t)*jlp; lp++; jlp++; } /* end for */ } - if ((status = H5Sselect_hyperslab(space_id, (H5S_seloper_t) op, (const hsize_t *) strt, (const hsize_t *) strd, - (const hsize_t *) cnt, (const hsize_t *) blk)) < 0) + if ((status = H5Sselect_hyperslab(space_id, (H5S_seloper_t)op, (const hsize_t *)strt, + (const hsize_t *)strd, (const hsize_t *)cnt, (const hsize_t *)blk)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -893,8 +881,7 @@ done: * Signature: (J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5__1H5Sclose - (JNIEnv *env, jclass clss, jlong space_id) +Java_hdf_hdf5lib_H5__1H5Sclose(JNIEnv *env, jclass clss, jlong space_id) { herr_t retVal = FAIL; @@ -913,14 +900,13 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks - (JNIEnv *env, jclass clss, jlong spaceid) +Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks(JNIEnv *env, jclass clss, jlong spaceid) { hssize_t retVal = -1; UNUSED(clss); - if ((retVal = H5Sget_select_hyper_nblocks((hid_t) spaceid)) < 0) + if ((retVal = H5Sget_select_hyper_nblocks((hid_t)spaceid)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -933,14 +919,13 @@ done: * Signature: (J)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints - (JNIEnv *env, jclass clss, jlong spaceid) +Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints(JNIEnv *env, jclass clss, jlong spaceid) { hssize_t retVal = -1; UNUSED(clss); - if ((retVal = H5Sget_select_elem_npoints((hid_t) spaceid)) < 0) + if ((retVal = H5Sget_select_elem_npoints((hid_t)spaceid)) < 0) H5_LIBRARY_ERROR(ENVONLY); done: @@ -953,16 +938,16 @@ done: * Signature: (JJJ[J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist - (JNIEnv *env, jclass clss, jlong spaceid, jlong startblock, jlong numblocks, jlongArray buf) +Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist(JNIEnv *env, jclass clss, jlong spaceid, + jlong startblock, jlong numblocks, jlongArray buf) { - jboolean isCopy; - hsize_t *ba = NULL; - size_t i, buf_size; - jlong *bufP = NULL; - jsize buflen; - int rank; - herr_t status = FAIL; + jboolean isCopy; + hsize_t *ba = NULL; + size_t i, buf_size; + jlong * bufP = NULL; + jsize buflen; + int rank; + herr_t status = FAIL; UNUSED(clss); @@ -987,15 +972,17 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist PIN_LONG_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sget_select_hyper_blocklist: buffer not pinned"); - buf_size = (size_t) numblocks * (size_t) 2 * (size_t) rank * sizeof(hsize_t); - if (NULL == (ba = (hsize_t *) HDmalloc(buf_size))) - H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: failed to allocate block list buffer"); + buf_size = (size_t)numblocks * (size_t)2 * (size_t)rank * sizeof(hsize_t); + if (NULL == (ba = (hsize_t *)HDmalloc(buf_size))) + H5_OUT_OF_MEMORY_ERROR(ENVONLY, + "H5Sget_select_hyper_blocklist: failed to allocate block list buffer"); - if ((status = H5Sget_select_hyper_blocklist((hid_t)spaceid, (hsize_t) startblock, (hsize_t) numblocks, (hsize_t *)ba)) < 0) + if ((status = H5Sget_select_hyper_blocklist((hid_t)spaceid, (hsize_t)startblock, (hsize_t)numblocks, + (hsize_t *)ba)) < 0) H5_LIBRARY_ERROR(ENVONLY); for (i = 0; i < (buf_size / sizeof(hsize_t)); i++) { - bufP[i] = (jlong) ba[i]; + bufP[i] = (jlong)ba[i]; } /* end for */ done: @@ -1013,15 +1000,15 @@ done: * Signature: (JJJ[J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist - (JNIEnv *env, jclass clss, jlong spaceid, jlong startpoint, jlong numpoints, jlongArray buf) +Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist(JNIEnv *env, jclass clss, jlong spaceid, jlong startpoint, + jlong numpoints, jlongArray buf) { - jboolean isCopy; - hsize_t *ba = NULL; - jlong *bufP = NULL; - jsize buflen; - int i, rank; - herr_t status = FAIL; + jboolean isCopy; + hsize_t *ba = NULL; + jlong * bufP = NULL; + jsize buflen; + int i, rank; + herr_t status = FAIL; UNUSED(clss); @@ -1044,14 +1031,15 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist PIN_LONG_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sget_select_elem_pointlist: buffer not pinned"); - if (NULL == (ba = (hsize_t *) HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t)))) + if (NULL == (ba = (hsize_t *)HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: failed to allocate point list buffer"); - if ((status = H5Sget_select_elem_pointlist((hid_t)spaceid, (hsize_t)startpoint, (hsize_t)numpoints, (hsize_t *)ba)) < 0) + if ((status = H5Sget_select_elem_pointlist((hid_t)spaceid, (hsize_t)startpoint, (hsize_t)numpoints, + (hsize_t *)ba)) < 0) H5_LIBRARY_ERROR(ENVONLY); for (i = 0; i < (numpoints * rank); i++) { - bufP[i] = (jlong) ba[i]; + bufP[i] = (jlong)ba[i]; } /* end for */ done: @@ -1069,16 +1057,16 @@ done: * Signature: (J[J[J)I */ JNIEXPORT jint JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds - (JNIEnv *env, jclass clss, jlong spaceid, jlongArray start, jlongArray end) +Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds(JNIEnv *env, jclass clss, jlong spaceid, jlongArray start, + jlongArray end) { - jboolean isCopy; - hsize_t *strt = NULL; - hsize_t *en = NULL; - size_t i; - jlong *startP = NULL, *endP = NULL; - jsize rank; - herr_t status = FAIL; + jboolean isCopy; + hsize_t *strt = NULL; + hsize_t *en = NULL; + size_t i; + jlong * startP = NULL, *endP = NULL; + jsize rank; + herr_t status = FAIL; UNUSED(clss); @@ -1094,20 +1082,20 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_bounds: start array length < 0"); } - if (NULL == (strt = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate start buffer"); PIN_LONG_ARRAY(ENVONLY, end, endP, &isCopy, "H5Sget_select_bounds: end not pinned"); - if (NULL == (en = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t)))) + if (NULL == (en = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate end buffer"); - if ((status = H5Sget_select_bounds((hid_t) spaceid, (hsize_t *) strt, (hsize_t *) en)) < 0) + if ((status = H5Sget_select_bounds((hid_t)spaceid, (hsize_t *)strt, (hsize_t *)en)) < 0) H5_LIBRARY_ERROR(ENVONLY); - for (i = 0; i < (size_t) rank; i++) { - startP[i] = (jlong) strt[i]; - endP[i] = (jlong) en[i]; + for (i = 0; i < (size_t)rank; i++) { + startP[i] = (jlong)strt[i]; + endP[i] = (jlong)en[i]; } /* end for */ done: @@ -1129,12 +1117,11 @@ done: * Signature: (J)[B */ JNIEXPORT jbyteArray JNICALL -Java_hdf_hdf5lib_H5_H5Sencode - (JNIEnv *env, jclass clss, jlong obj_id) +Java_hdf_hdf5lib_H5_H5Sencode(JNIEnv *env, jclass clss, jlong obj_id) { - unsigned char *bufPtr = NULL; - size_t buf_size = 0; - herr_t status = FAIL; + unsigned char *bufPtr = NULL; + size_t buf_size = 0; + herr_t status = FAIL; jbyteArray returnedArray = NULL; UNUSED(clss); @@ -1148,16 +1135,16 @@ Java_hdf_hdf5lib_H5_H5Sencode if (buf_size == 0) H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: buf_size = 0"); - if (NULL == (bufPtr = (unsigned char *) HDcalloc((size_t) 1, buf_size))) + if (NULL == (bufPtr = (unsigned char *)HDcalloc((size_t)1, buf_size))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sencode: failed to allocate encoding buffer"); - if ((status = H5Sencode2((hid_t) obj_id, bufPtr, &buf_size, H5P_DEFAULT)) < 0) + if ((status = H5Sencode2((hid_t)obj_id, bufPtr, &buf_size, H5P_DEFAULT)) < 0) H5_LIBRARY_ERROR(ENVONLY); - if (NULL == (returnedArray = ENVPTR->NewByteArray(ENVONLY, (jsize) buf_size))) + if (NULL == (returnedArray = ENVPTR->NewByteArray(ENVONLY, (jsize)buf_size))) CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - ENVPTR->SetByteArrayRegion(ENVONLY, returnedArray, 0, (jsize) buf_size, (jbyte *) bufPtr); + ENVPTR->SetByteArrayRegion(ENVONLY, returnedArray, 0, (jsize)buf_size, (jbyte *)bufPtr); CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); done: @@ -1173,12 +1160,11 @@ done: * Signature: ([B)J */ JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_H5_H5Sdecode - (JNIEnv *env, jclass clss, jbyteArray buf) +Java_hdf_hdf5lib_H5_H5Sdecode(JNIEnv *env, jclass clss, jbyteArray buf) { - jboolean isCopy; - jbyte *bufP = NULL; - hid_t sid = H5I_INVALID_HID; + jboolean isCopy; + jbyte * bufP = NULL; + hid_t sid = H5I_INVALID_HID; UNUSED(clss); @@ -1203,8 +1189,7 @@ done: * Signature: (J)Z */ JNIEXPORT jboolean JNICALL -Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab - (JNIEnv *env, jclass clss, jlong obj_id) +Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab(JNIEnv *env, jclass clss, jlong obj_id) { htri_t bval = JNI_FALSE; @@ -1225,15 +1210,15 @@ done: * Signature: (J[J[J[J[J)V */ JNIEXPORT void JNICALL -Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab - (JNIEnv *env, jclass clss, jlong space_id, jlongArray start, jlongArray stride, jlongArray count, jlongArray block) +Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab(JNIEnv *env, jclass clss, jlong space_id, jlongArray start, + jlongArray stride, jlongArray count, jlongArray block) { - jboolean isCopy; - hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL; - jlong *startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL; - jsize start_rank = -1, stride_rank = -1, count_rank = -1, block_rank = -1; - int i, rank = -1; - herr_t status = FAIL; + jboolean isCopy; + hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL; + jlong * startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL; + jsize start_rank = -1, stride_rank = -1, count_rank = -1, block_rank = -1; + int i, rank = -1; + herr_t status = FAIL; UNUSED(clss); @@ -1245,7 +1230,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab if (NULL == start) { startP = NULL; - strt = (hsize_t *) startP; + strt = (hsize_t *)startP; } else { if ((start_rank = ENVPTR->GetArrayLength(ENVONLY, start)) < 0) { @@ -1254,17 +1239,18 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab } if (start_rank != rank) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: start rank doesn't match dataspace rank!"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, + "H5Sget_regular_hyperslab: start rank doesn't match dataspace rank!"); PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sget_regular_hyperslab: start not pinned"); - if (NULL == (strt = (hsize_t *) HDmalloc((size_t)start_rank * sizeof(hsize_t)))) + if (NULL == (strt = (hsize_t *)HDmalloc((size_t)start_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate start buffer"); } if (NULL == stride) { strideP = NULL; - strd = (hsize_t *) strideP; + strd = (hsize_t *)strideP; } else { if ((stride_rank = ENVPTR->GetArrayLength(ENVONLY, stride)) < 0) { @@ -1273,17 +1259,18 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab } if (stride_rank != rank) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: stride rank doesn't match dataspace rank!"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, + "H5Sget_regular_hyperslab: stride rank doesn't match dataspace rank!"); PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sget_regular_hyperslab: stride not pinned"); - if (NULL == (strd = (hsize_t *) HDmalloc((size_t)stride_rank * sizeof(hsize_t)))) + if (NULL == (strd = (hsize_t *)HDmalloc((size_t)stride_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate stride buffer"); } if (NULL == count) { countP = NULL; - cnt = (hsize_t *) countP; + cnt = (hsize_t *)countP; } else { if ((count_rank = ENVPTR->GetArrayLength(ENVONLY, count)) < 0) { @@ -1292,17 +1279,18 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab } if (count_rank != rank) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: count rank doesn't match dataspace rank!"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, + "H5Sget_regular_hyperslab: count rank doesn't match dataspace rank!"); PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sget_regular_hyperslab: count not pinned"); - if (NULL == (cnt = (hsize_t *) HDmalloc((size_t)count_rank * sizeof(hsize_t)))) + if (NULL == (cnt = (hsize_t *)HDmalloc((size_t)count_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate count buffer"); } if (NULL == block) { blockP = NULL; - blk = (hsize_t *) blockP; + blk = (hsize_t *)blockP; } else { if ((block_rank = ENVPTR->GetArrayLength(ENVONLY, block)) < 0) { @@ -1311,22 +1299,24 @@ Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab } if (block_rank != rank) - H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: block rank doesn't match dataspace rank!"); + H5_BAD_ARGUMENT_ERROR(ENVONLY, + "H5Sget_regular_hyperslab: block rank doesn't match dataspace rank!"); PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sget_regular_hyperslab: block not pinned"); - if (NULL == (blk = (hsize_t *) HDmalloc((size_t)block_rank * sizeof(hsize_t)))) + if (NULL == (blk = (hsize_t *)HDmalloc((size_t)block_rank * sizeof(hsize_t)))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate block buffer"); } - if ((status = H5Sget_regular_hyperslab(space_id, (hsize_t *) strt, (hsize_t *) strd, (hsize_t *) cnt, (hsize_t *) blk)) < 0) + if ((status = H5Sget_regular_hyperslab(space_id, (hsize_t *)strt, (hsize_t *)strd, (hsize_t *)cnt, + (hsize_t *)blk)) < 0) H5_LIBRARY_ERROR(ENVONLY); for (i = 0; i < start_rank; i++) { - startP[i] = (jlong) strt[i]; - countP[i] = (jlong) cnt[i]; - strideP[i] = (jlong) strd[i]; - blockP[i] = (jlong) blk[i]; + startP[i] = (jlong)strt[i]; + countP[i] = (jlong)cnt[i]; + strideP[i] = (jlong)strd[i]; + blockP[i] = (jlong)blk[i]; } /* end for */ done: |