summaryrefslogtreecommitdiffstats
path: root/java/src/jni/h5sImp.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2022-04-13 21:17:29 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2022-04-13 21:17:29 (GMT)
commitcabc39c3e197e2591449d2604bfee26465fb60e1 (patch)
treed5f39f5f5965584bf9bf49646a2af617adfd3e4e /java/src/jni/h5sImp.c
parent7355f4c505092a7a85474b47f18d5206028e2c95 (diff)
parentab69f5df770ee3cc6cd6c81d905a5317b894a002 (diff)
downloadhdf5-feature/coding_standards.zip
hdf5-feature/coding_standards.tar.gz
hdf5-feature/coding_standards.tar.bz2
Merge branch 'develop' into feature/coding_standardsfeature/coding_standards
Diffstat (limited to 'java/src/jni/h5sImp.c')
-rw-r--r--java/src/jni/h5sImp.c890
1 files changed, 632 insertions, 258 deletions
diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c
index eedd42e..c3a8460 100644
--- a/java/src/jni/h5sImp.c
+++ b/java/src/jni/h5sImp.c
@@ -6,7 +6,7 @@
* 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. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Screate_simple: failed to allocate dims buffer")
+ 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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Screate_simple: failed to allocate maxdims buffer")
+ 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;
@@ -162,9 +160,10 @@ done:
} /* end Java_hdf_hdf5lib_H5__1H5Scopy */
#ifdef notdef
-// 10/28/99 -- added code to copy the array -- this is not used,
-// but serves as a reminder in case we try to implement this in
-// the future....
+/* 10/28/99 -- added code to copy the array -- this is not used,
+ * but serves as a reminder in case we try to implement this in
+ * the future....
+ */
/*
* Note: the argument coord is actually long coord[][], which has been
* flattened by the caller.
@@ -176,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;
@@ -193,8 +192,8 @@ 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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer");
+ if (NULL == (sa = (hssize_t *)HDmalloc((size_t)num_elemn * 2 * sizeof(hssize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer");
for (i = 0; i < (num_elemn * 2); i++) {
sa[i] = P[i];
@@ -219,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);
@@ -246,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer");
+ 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:
@@ -275,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;
@@ -286,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 */
/*
@@ -295,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;
@@ -306,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 */
/*
@@ -315,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;
@@ -337,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;
@@ -348,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 */
/*
@@ -357,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;
@@ -368,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 */
/*
@@ -377,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;
@@ -388,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 */
/*
@@ -397,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;
@@ -408,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 */
/*
@@ -417,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");
@@ -443,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate dimension buffer");
+ 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");
}
@@ -462,10 +455,11 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims
if (rank < 0)
rank = mrank;
else if (mrank != rank)
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims rank not same as dims");
+ 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_JNI_FATAL_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)
@@ -502,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;
@@ -525,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);
@@ -563,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate dimension buffer");
+ 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_JNI_FATAL_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:
@@ -613,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;
@@ -635,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);
@@ -657,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Soffset_simple: failed to allocate offset buffer");
+ 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)
@@ -692,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;
@@ -712,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;
@@ -734,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;
@@ -754,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);
@@ -787,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate start buffer");
+ 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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate count buffer");
+ 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) {
@@ -824,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate stride buffer");
+ 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 */
@@ -837,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) {
@@ -850,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate block buffer");
+ 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:
@@ -892,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;
@@ -912,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:
@@ -932,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:
@@ -952,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);
@@ -986,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_JNI_FATAL_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:
@@ -1012,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);
@@ -1043,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: failed to allocate point list buffer");
+ 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:
@@ -1068,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);
@@ -1093,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate start buffer");
+ if (NULL == (strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate start buffer");
PIN_LONG_ARRAY(ENVONLY, end, endP, &isCopy, "H5Sget_select_bounds: end not pinned");
- if (NULL == (en = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate end buffer");
+ 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:
@@ -1128,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);
@@ -1147,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)))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sencode: failed to allocate encoding buffer");
+ 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:
@@ -1172,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);
@@ -1202,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;
@@ -1224,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);
@@ -1244,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) {
@@ -1253,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate start buffer");
+ 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) {
@@ -1272,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate stride buffer");
+ 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) {
@@ -1291,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate count buffer");
+ 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) {
@@ -1310,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))))
- H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate block buffer");
+ 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:
@@ -1349,6 +1340,389 @@ done:
return;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab */
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Sselect_copy
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Sselect_1copy(JNIEnv *env, jclass clss, jlong dst_id, jlong src_id)
+{
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if ((status = H5Sselect_copy((hid_t)dst_id, (hid_t)src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Sselect_1copy */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Sselect_shape_same
+ * Signature: (JJ)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Sselect_1shape_1same(JNIEnv *env, jclass clss, jlong space1_id, jlong space2_id)
+{
+ htri_t bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if ((bval = H5Sselect_shape_same((hid_t)space1_id, (hid_t)space2_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return (jboolean)bval;
+} /* end Java_hdf_hdf5lib_H5_H5Sselect_1shape_1same */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Sselect_adjust
+ * Signature: (J[J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Sselect_1adjust(JNIEnv *env, jclass clss, jlong space_id, jlongArray offset)
+{
+ jboolean isCopy;
+ hssize_t *offst = NULL;
+ jlong * offsetP = NULL;
+ jsize offset_rank = -1;
+ int i, rank = -1;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (space_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_adjust: invalid dataspace ID");
+
+ if ((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == offset) {
+ offsetP = NULL;
+ offst = (hssize_t *)offsetP;
+ }
+ else {
+ if ((offset_rank = ENVPTR->GetArrayLength(ENVONLY, offset)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_adjust: offset length < 0");
+ }
+
+ if (offset_rank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_adjust: offset rank doesn't match dataspace rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, offset, offsetP, &isCopy, "H5Sselect_adjust: offset not pinned");
+
+ if (NULL == (offst = (hssize_t *)HDmalloc((size_t)offset_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_adjust: failed to allocate offset buffer");
+ }
+
+ if ((status = H5Sselect_adjust(space_id, (hssize_t *)offst)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < offset_rank; i++) {
+ offsetP[i] = (jlong)offst[i];
+ } /* end for */
+
+done:
+ if (offst)
+ HDfree(offst);
+ if (offsetP)
+ UNPIN_LONG_ARRAY(ENVONLY, offset, offsetP, (status < 0) ? JNI_ABORT : 0);
+
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Sselect_1adjust */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Sselect_intersect_block
+ * Signature: (J[J[J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Sselect_1intersect_1block(JNIEnv *env, jclass clss, jlong space_id, jlongArray start,
+ jlongArray end)
+{
+ htri_t bval = JNI_FALSE;
+ jboolean isCopy;
+ hsize_t *strt = NULL, *nd = NULL;
+ jlong * startP = NULL, *endP = NULL;
+ jsize start_rank = -1, end_rank = -1;
+ int i, rank = -1;
+
+ UNUSED(clss);
+
+ if (space_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_intersect_block: invalid dataspace ID");
+
+ if ((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == start) {
+ startP = NULL;
+ strt = (hsize_t *)startP;
+ }
+ else {
+ if ((start_rank = ENVPTR->GetArrayLength(ENVONLY, start)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_intersect_block: start length < 0");
+ }
+
+ if (start_rank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY,
+ "H5Sselect_intersect_block: start rank doesn't match dataspace rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sselect_intersect_block: start not pinned");
+
+ if (NULL == (strt = (hsize_t *)HDmalloc((size_t)start_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_intersect_block: failed to allocate start buffer");
+ }
+
+ if (NULL == end) {
+ endP = NULL;
+ nd = (hsize_t *)endP;
+ }
+ else {
+ if ((end_rank = ENVPTR->GetArrayLength(ENVONLY, end)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_intersect_block: end array length < 0");
+ }
+
+ if (end_rank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY,
+ "H5Sselect_intersect_block: end rank doesn't match dataspace rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, end, endP, &isCopy, "H5Sselect_intersect_block: end not pinned");
+
+ if (NULL == (nd = (hsize_t *)HDmalloc((size_t)end_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Sselect_intersect_block: failed to allocate end buffer");
+ }
+
+ if ((bval = H5Sselect_intersect_block(space_id, (hsize_t *)strt, (hsize_t *)nd)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+ for (i = 0; i < start_rank; i++) {
+ startP[i] = (jlong)strt[i];
+ endP[i] = (jlong)nd[i];
+ } /* end for */
+
+done:
+ if (strt)
+ HDfree(strt);
+ if (startP)
+ UNPIN_LONG_ARRAY(ENVONLY, start, startP, (bval < 0) ? JNI_ABORT : 0);
+ if (nd)
+ HDfree(nd);
+ if (endP)
+ UNPIN_LONG_ARRAY(ENVONLY, end, endP, (bval < 0) ? JNI_ABORT : 0);
+
+ return (jboolean)bval;
+} /* end Java_hdf_hdf5lib_H5_H5Sselect_1intersect_1block */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Sselect_project_intersection
+ * Signature: (JJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Sselect_1project_1intersection(JNIEnv *env, jclass clss, jlong src_space_id,
+ jlong dst_space_id, jlong src_intersect_space_id)
+{
+ hid_t sid = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((sid = H5Sselect_project_intersection(src_space_id, dst_space_id, src_intersect_space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+
+ return (jlong)sid;
+} /* end Java_hdf_hdf5lib_H5_H5Sselect_1project_1intersection */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Scombine_hyperslab
+ * Signature: (JI[J[J[J[J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Scombine_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;
+ hid_t sid = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == start)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Scombine_hyperslab: start is NULL");
+ if (NULL == count)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Scombine_hyperslab: count is NULL");
+
+ if ((start_rank = ENVPTR->GetArrayLength(ENVONLY, start)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Scombine_hyperslab: start array length < 0");
+ }
+ if ((count_rank = ENVPTR->GetArrayLength(ENVONLY, count)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Scombine_hyperslab: count array length < 0");
+ }
+
+ if (start_rank != count_rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Scombine_hyperslab: count and start have different rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Scombine_hyperslab: start not pinned");
+
+ if (NULL == (strt = lp = (hsize_t *)HDmalloc((size_t)start_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Scombine_hyperslab: failed to allocate start buffer");
+
+ jlp = (jlong *)startP;
+ for (i = 0; i < start_rank; i++) {
+ *lp = (hsize_t)*jlp;
+ lp++;
+ jlp++;
+ } /* end if */
+
+ PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Scombine_hyperslab: count not pinned");
+
+ if (NULL == (cnt = lp = (hsize_t *)HDmalloc((size_t)count_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Scombine_hyperslab: failed to allocate count buffer");
+
+ jlp = (jlong *)countP;
+ for (i = 0; i < count_rank; i++) {
+ *lp = (hsize_t)*jlp;
+ lp++;
+ jlp++;
+ } /* end if */
+
+ if (NULL == stride) {
+ strideP = NULL;
+ strd = (hsize_t *)strideP;
+ }
+ else {
+ if ((stride_rank = ENVPTR->GetArrayLength(ENVONLY, stride)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Scombine_hyperslab: stride array length < 0");
+ }
+
+ if (stride_rank != start_rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Scombine_hyperslab: stride and start have different rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Scombine_hyperslab: stride not pinned");
+
+ if (NULL == (strd = lp = (hsize_t *)HDmalloc((size_t)stride_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Scombine_hyperslab: failed to allocate stride buffer");
+
+ jlp = (jlong *)strideP;
+ for (i = 0; i < stride_rank; i++) {
+ *lp = (hsize_t)*jlp;
+ lp++;
+ jlp++;
+ } /* end if */
+ }
+
+ if (NULL == block) {
+ blockP = NULL;
+ blk = (hsize_t *)blockP;
+ }
+ else {
+ if ((block_rank = ENVPTR->GetArrayLength(ENVONLY, block)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Scombine_hyperslab: block array length < 0");
+ }
+
+ if (block_rank != start_rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Scombine_hyperslab: block and start have different rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Scombine_hyperslab: block not pinned");
+
+ if (NULL == (blk = lp = (hsize_t *)HDmalloc((size_t)block_rank * sizeof(hsize_t))))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "H5Scombine_hyperslab: failed to allocate block buffer");
+
+ jlp = (jlong *)blockP;
+ for (i = 0; i < block_rank; i++) {
+ *lp = (hsize_t)*jlp;
+ lp++;
+ jlp++;
+ } /* end for */
+ }
+
+ if ((sid = H5Scombine_hyperslab(space_id, (H5S_seloper_t)op, (const hsize_t *)strt, (const hsize_t *)strd,
+ (const hsize_t *)cnt, (const hsize_t *)blk)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (blk)
+ HDfree(blk);
+ if (blockP)
+ UNPIN_LONG_ARRAY(ENVONLY, block, blockP, JNI_ABORT);
+ if (strd)
+ HDfree(strd);
+ if (strideP)
+ UNPIN_LONG_ARRAY(ENVONLY, stride, strideP, JNI_ABORT);
+ if (cnt)
+ HDfree(cnt);
+ if (countP)
+ UNPIN_LONG_ARRAY(ENVONLY, count, countP, JNI_ABORT);
+ if (strt)
+ HDfree(strt);
+ if (startP)
+ UNPIN_LONG_ARRAY(ENVONLY, start, startP, JNI_ABORT);
+
+ return (jlong)sid;
+} /* end Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Smodify_select
+ * Signature: (JIJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Smodify_1select(JNIEnv *env, jclass clss, jlong space1_id, jint op, jlong space2_id)
+{
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if ((status = H5Smodify_select((hid_t)space1_id, (H5S_seloper_t)op, (hid_t)space2_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Smodify_1select */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Scombine_select
+ * Signature: (JIJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Scombine_1select(JNIEnv *env, jclass clss, jlong space1_id, jint op, jlong space2_id)
+{
+ hid_t sid = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((sid = H5Scombine_select((hid_t)space1_id, (H5S_seloper_t)op, (hid_t)space2_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+
+ return (jlong)sid;
+} /* end Java_hdf_hdf5lib_H5_H5Scombine_1select */
+
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */