diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2016-08-22 17:05:00 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2016-08-22 17:05:00 (GMT) |
commit | 737bb567355940ec0938ab0bacc0eb18ad4201c7 (patch) | |
tree | 1aefa9bd84a886997773107314cc8d0c4c2a10c0 /java/src/jni/h5eImp.c | |
parent | f14e4b3e2061c8fb714413473a65d9d61328b8b7 (diff) | |
download | hdf5-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/h5eImp.c')
-rw-r--r-- | java/src/jni/h5eImp.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c index 84cbacd..6e05515 100644 --- a/java/src/jni/h5eImp.c +++ b/java/src/jni/h5eImp.c @@ -98,14 +98,15 @@ Java_hdf_hdf5lib_H5_H5Eregister_1class const char* the_lib_name; const char* the_version; - PIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version, -1); + PIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version); + if (the_cls_name != NULL && the_lib_name != NULL && the_version != NULL) { + ret_val = H5Eregister_class(the_cls_name, the_lib_name, the_version); - ret_val = H5Eregister_class(the_cls_name, the_lib_name, the_version); + UNPIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version); - UNPIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version); - - if (ret_val < 0) - h5libraryError(env); + if (ret_val < 0) + h5libraryError(env); + } return (jlong)ret_val; } /* end Java_hdf_hdf5lib_H5_H5Eregister_1class */ @@ -159,14 +160,15 @@ Java_hdf_hdf5lib_H5_H5Ecreate_1msg h5badArgument(env, "H5Ecreate_msg: invalid argument"); } /* end if */ else { - PIN_JAVA_STRING(err_msg, the_err_msg, -1); - - ret_val = H5Ecreate_msg((hid_t)err_id, error_msg_type, the_err_msg); + PIN_JAVA_STRING(err_msg, the_err_msg); + if (the_err_msg != NULL) { + ret_val = H5Ecreate_msg((hid_t)err_id, error_msg_type, the_err_msg); - UNPIN_JAVA_STRING(err_msg, the_err_msg); + UNPIN_JAVA_STRING(err_msg, the_err_msg); - if (ret_val < 0) - h5libraryError(env); + if (ret_val < 0) + h5libraryError(env); + } } /* end else */ return (jlong)ret_val; @@ -305,7 +307,7 @@ Java_hdf_hdf5lib_H5_H5Eget_1class_1name */ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eset_1current_1stack - (JNIEnv *env, jclass cls, jlong stk_id) + (JNIEnv *env, jclass cls, jlong stk_id) { if (stk_id < 0) { h5badArgument(env, "H5Eset_current_stack: invalid argument"); @@ -358,15 +360,16 @@ Java_hdf_hdf5lib_H5_H5Epush2 h5badArgument(env, "H5Epush: invalid minor_id argument"); } /* end else if */ else { - PIN_JAVA_STRING_THREE0(filename, fName, funcname, fncName, err_desc, errMsg); + PIN_JAVA_STRING_THREE(filename, fName, funcname, fncName, err_desc, errMsg); + if (fName != NULL && fncName != NULL && errMsg != NULL) { + ret_val = H5Epush2((hid_t)stk_id, fName, fncName, (unsigned)linenumber, (hid_t)class_id, + (hid_t)major_id, (hid_t)minor_id, errMsg); - ret_val = H5Epush2((hid_t)stk_id, fName, fncName, (unsigned)linenumber, (hid_t)class_id, - (hid_t)major_id, (hid_t)minor_id, errMsg); + UNPIN_JAVA_STRING_THREE(filename, fName, funcname, fncName, err_desc, errMsg); - UNPIN_JAVA_STRING_THREE(filename, fName, funcname, fncName, err_desc, errMsg); - - if (ret_val < 0) - h5libraryError(env); + if (ret_val < 0) + h5libraryError(env); + } } /* end else */ } /* end Java_hdf_hdf5lib_H5_H5Epush2 */ |