summaryrefslogtreecommitdiffstats
path: root/java/src/jni/h5iImp.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2016-08-22 17:05:00 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2016-08-22 17:05:00 (GMT)
commit737bb567355940ec0938ab0bacc0eb18ad4201c7 (patch)
tree1aefa9bd84a886997773107314cc8d0c4c2a10c0 /java/src/jni/h5iImp.c
parentf14e4b3e2061c8fb714413473a65d9d61328b8b7 (diff)
downloadhdf5-737bb567355940ec0938ab0bacc0eb18ad4201c7.zip
hdf5-737bb567355940ec0938ab0bacc0eb18ad4201c7.tar.gz
hdf5-737bb567355940ec0938ab0bacc0eb18ad4201c7.tar.bz2
[svn-r30313] HDFFV-9972: unsatisfied link error under debug on Windows.
Added windows name suffix for debug to CMake cmd_arg for examples and test. Fix issues discovered under debug testing; Create a version of H5Iget_name that correctly returns the name. Rework PIN_JAVA_STRING macro and usage to eliminate possible memory leaks by using if-else instead of mid-routine return. Update example to use new H5Iget_name API. Tested: windows under debug
Diffstat (limited to 'java/src/jni/h5iImp.c')
-rw-r--r--java/src/jni/h5iImp.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c
index 9fce3ef..d2f845a 100644
--- a/java/src/jni/h5iImp.c
+++ b/java/src/jni/h5iImp.c
@@ -91,6 +91,45 @@ Java_hdf_hdf5lib_H5_H5Iget_1name
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Iget_name_str
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Iget_1name_1str
+ (JNIEnv *env, jclass clss, jlong obj_id)
+{
+ char *aName;
+ jstring str = NULL;
+ ssize_t buf_size;
+
+ /* get the length of the name */
+ buf_size = H5Iget_name((hid_t)obj_id, NULL, 0);
+
+ if (buf_size <= 0) {
+ h5badArgument(env, "H5Iget_name: buf_size <= 0");
+ } /* end if */
+ else {
+ buf_size++; /* add extra space for the null terminator */
+ aName = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
+ if (aName == NULL) {
+ h5outOfMemory(env, "H5Iget_name: malloc failed");
+ } /* end if */
+ else {
+ buf_size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size);
+ if (buf_size < 0) {
+ h5libraryError(env);
+ } /* end if */
+ else {
+ str = ENVPTR->NewStringUTF(ENVPAR aName);
+ }
+ HDfree(aName);
+ }
+ }
+ return str;
+} /* end Java_hdf_hdf5lib_H5_H5Iget_1name */
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Iget_ref
* Signature: (J)I
*/