diff options
Diffstat (limited to 'java/src/jni')
-rw-r--r-- | java/src/jni/h5aImp.c | 29 | ||||
-rw-r--r-- | java/src/jni/h5dImp.c | 22 | ||||
-rw-r--r-- | java/src/jni/h5fImp.c | 9 | ||||
-rw-r--r-- | java/src/jni/h5tImp.c | 31 | ||||
-rw-r--r-- | java/src/jni/h5tImp.h | 9 | ||||
-rw-r--r-- | java/src/jni/h5util.c | 2 |
6 files changed, 90 insertions, 12 deletions
diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c index eaa356e..9f22665 100644 --- a/java/src/jni/h5aImp.c +++ b/java/src/jni/h5aImp.c @@ -94,11 +94,18 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1name (JNIEnv *env, jclass clss, jlong loc_id, jstring name) { +#ifndef H5_NO_DEPRECATED_SYMBOLS const char *attrName = NULL; +#endif hid_t attr_id = H5I_INVALID_HID; UNUSED(clss); +#ifdef H5_NO_DEPRECATED_SYMBOLS + UNUSED(loc_id); + UNUSED(name); + H5_UNIMPLEMENTED(ENVONLY, "H5Aopen_name: not implemented"); +#else if (NULL == name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_name: attribute name is null"); @@ -106,10 +113,13 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1name if((attr_id = H5Aopen_name((hid_t)loc_id, attrName)) < 0) H5_LIBRARY_ERROR(ENVONLY); +#endif done: +#ifndef H5_NO_DEPRECATED_SYMBOLS if (attrName) UNPIN_JAVA_STRING(ENVONLY, name, attrName); +#endif return (jlong)attr_id; } /* end Java_hdf_hdf5lib_H5__1H5Aopen_1name */ @@ -127,8 +137,14 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1idx UNUSED(clss); +#ifdef H5_NO_DEPRECATED_SYMBOLS + UNUSED(loc_id); + UNUSED(idx); + H5_UNIMPLEMENTED(ENVONLY, "H5Aopen_idx: not implemented"); +#else if ((attr_id = H5Aopen_idx((hid_t) loc_id, (unsigned int) idx)) < 0) H5_LIBRARY_ERROR(ENVONLY); +#endif done: return (jlong)attr_id; @@ -1028,7 +1044,7 @@ H5AreadVL_str /* * When repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings), - * H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect + * H5Treclaim() may crash on Windows because the Java GC will not be able to collect * free space in time. Instead, we use "H5free_memory(strs[i])" to free individual strings * once done. */ @@ -1125,7 +1141,7 @@ done: if (h5str.s) h5str_free(&h5str); if (readBuf) { - H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, readBuf); + H5Treclaim(tid, sid, H5P_DEFAULT, readBuf); HDfree(readBuf); } if (sid >= 0) @@ -1313,7 +1329,7 @@ H5AwriteVL_asstr /* * When repeatedly writing a dataset with a large number of strs (e.g., 1,000,000 strings), - * H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect + * H5Treclaim() may crash on Windows because the Java GC will not be able to collect * free space in time. Instead, we use "H5free_memory(strs[i])" to free individual strings * once done. */ @@ -1356,7 +1372,7 @@ done: if (utf8) UNPIN_JAVA_STRING(ENVONLY, jstr, utf8); if (writeBuf) { - H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, writeBuf); + H5Treclaim(tid, sid, H5P_DEFAULT, writeBuf); HDfree(writeBuf); } if (sid >= 0) @@ -1512,8 +1528,13 @@ Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs UNUSED(clss); +#ifdef H5_NO_DEPRECATED_SYMBOLS + UNUSED(loc_id); + H5_UNIMPLEMENTED(ENVONLY, "H5Aget_num_attrs: not implemented"); +#else if ((retVal = H5Aget_num_attrs((hid_t)loc_id)) < 0) H5_LIBRARY_ERROR(ENVONLY); +#endif done: return (jint)retVal; diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c index 5500847..b395189 100644 --- a/java/src/jni/h5dImp.c +++ b/java/src/jni/h5dImp.c @@ -340,12 +340,21 @@ Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim (JNIEnv *env, jclass clss, jlong type_id, jlong space_id, jlong xfer_plist_id, jbyteArray buf) { +#ifndef H5_NO_DEPRECATED_SYMBOLS jboolean vlenBufIsCopy; jbyte *vlenBuf = NULL; +#endif herr_t status = FAIL; UNUSED(clss); +#ifdef H5_NO_DEPRECATED_SYMBOLS + UNUSED(type_id); + UNUSED(space_id); + UNUSED(xfer_plist_id); + UNUSED(buf); + H5_UNIMPLEMENTED(ENVONLY, "H5Dvlen_reclaim: not implemented"); +#else if (NULL == buf) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dvlen_reclaim: buffer is NULL"); @@ -353,10 +362,13 @@ Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim if ((status = H5Dvlen_reclaim((hid_t)type_id, (hid_t)space_id, (hid_t)xfer_plist_id, vlenBuf)) < 0) H5_LIBRARY_ERROR(ENVONLY); +#endif done: +#ifndef H5_NO_DEPRECATED_SYMBOLS if (vlenBuf) UNPIN_BYTE_ARRAY(ENVONLY, buf, vlenBuf, (status < 0) ? JNI_ABORT : 0); +#endif return (jint)status; } /* end Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim */ @@ -1172,7 +1184,7 @@ H5DreadVL_str /* * When repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings), - * H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect + * H5Treclaim() may crash on Windows because the Java GC will not be able to collect * free space in time. Instead, we use "H5free_memory(strs[i])" to free individual strings * once done. */ @@ -1230,7 +1242,7 @@ H5DreadVL_asstr if (mem_space == H5S_ALL) { /* - * Retrieve a valid dataspace for H5Dvlen_reclaim(). + * Retrieve a valid dataspace for H5Treclaim(). */ if ((mem_space = H5Dget_space(did)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1285,7 +1297,7 @@ done: if (h5str.s) h5str_free(&h5str); if (readBuf) { - H5Dvlen_reclaim(tid, mem_space, xfer_plist_id, readBuf); + H5Treclaim(tid, mem_space, xfer_plist_id, readBuf); HDfree(readBuf); } if (close_mem_space) @@ -1504,7 +1516,7 @@ H5DwriteVL_asstr if (mem_space == H5S_ALL) { /* - * Retrieve a valid dataspace for H5Dvlen_reclaim(). + * Retrieve a valid dataspace for H5Treclaim(). */ if ((mem_space = H5Dget_space(did)) < 0) H5_LIBRARY_ERROR(ENVONLY); @@ -1565,7 +1577,7 @@ done: if (utf8) UNPIN_JAVA_STRING(ENVONLY, obj, utf8); if (writeBuf) { - H5Dvlen_reclaim(tid, mem_space, xfer_plist_id, writeBuf); + H5Treclaim(tid, mem_space, xfer_plist_id, writeBuf); HDfree(writeBuf); } if (close_mem_space) diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c index 4fd6807..2eb3ad5 100644 --- a/java/src/jni/h5fImp.c +++ b/java/src/jni/h5fImp.c @@ -156,15 +156,17 @@ JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Fis_1hdf5 (JNIEnv *env, jclass clss, jstring name) { +#ifndef H5_NO_DEPRECATED_SYMBOLS const char *fileName = NULL; +#endif htri_t bval = JNI_FALSE; UNUSED(clss); #ifdef H5_NO_DEPRECATED_SYMBOLS + UNUSED(name); H5_UNIMPLEMENTED(ENVONLY, "H5Fis_hdf5: not implemented"); -#endif - +#else if (NULL == name) H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fis_hdf5: file name is NULL"); @@ -174,10 +176,13 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5 H5_LIBRARY_ERROR(ENVONLY); bval = (bval > 0) ? JNI_TRUE : JNI_FALSE; +#endif done: +#ifndef H5_NO_DEPRECATED_SYMBOLS if (fileName) UNPIN_JAVA_STRING(ENVONLY, name, fileName); +#endif return (jboolean)bval; } /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */ diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index 460f12e..3302b7d 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -980,6 +980,37 @@ done: /* * Class: hdf_hdf5lib_H5 + * Method: H5Treclaim + * Signature: (JJJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Treclaim + (JNIEnv *env, jclass clss, jlong type_id, jlong space_id, + jlong xfer_plist_id, jbyteArray buf) +{ + jboolean bufIsCopy; + jbyte *pinBuf = NULL; + herr_t status = FAIL; + + UNUSED(clss); + + if (NULL == buf) + H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Treclaim: buffer is NULL"); + + PIN_BYTE_ARRAY(ENVONLY, buf, pinBuf, &bufIsCopy, "H5Treclaim: buffer not pinned"); + + if ((status = H5Treclaim((hid_t)type_id, (hid_t)space_id, (hid_t)xfer_plist_id, pinBuf)) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + if (pinBuf) + UNPIN_BYTE_ARRAY(ENVONLY, buf, pinBuf, (status < 0) ? JNI_ABORT : 0); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Treclaim */ + +/* + * Class: hdf_hdf5lib_H5 * Method: _H5Tclose * Signature: (J)I */ diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h index 374d992..a63969b 100644 --- a/java/src/jni/h5tImp.h +++ b/java/src/jni/h5tImp.h @@ -401,6 +401,15 @@ Java_hdf_hdf5lib_H5_H5Tpack /* * Class: hdf_hdf5lib_H5 + * Method: H5Treclaim + * Signature: (JJJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Treclaim + (JNIEnv*, jclass, jlong, jlong, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 * Method: _H5Tclose * Signature: (J)I */ diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index af83caa..700f75f 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -2781,7 +2781,7 @@ h5str_dump_simple_dset /* Reclaim any VL memory, if necessary */ if (vl_data) { - if (H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf) < 0) + if (H5Treclaim(p_type, sm_space, H5P_DEFAULT, sm_buf) < 0) H5_LIBRARY_ERROR(ENVONLY); } |