summaryrefslogtreecommitdiffstats
path: root/java/examples
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/examples
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/examples')
-rw-r--r--java/examples/datasets/CMakeLists.txt6
-rw-r--r--java/examples/datatypes/CMakeLists.txt6
-rw-r--r--java/examples/datatypes/H5Ex_T_ObjectReference.java8
-rw-r--r--java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java8
-rw-r--r--java/examples/groups/CMakeLists.txt6
-rw-r--r--java/examples/intro/CMakeLists.txt6
6 files changed, 26 insertions, 14 deletions
diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt
index 5f5f37c..0ba2331 100644
--- a/java/examples/datasets/CMakeLists.txt
+++ b/java/examples/datasets/CMakeLists.txt
@@ -63,7 +63,11 @@ endforeach (HDFJAVA_JAR)
MACRO (ADD_H5_TEST resultfile resultcode)
if (CMAKE_BUILD_TYPE MATCHES Debug)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ if (WIN32)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
+ else()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ endif()
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_test (
NAME JAVA_datasets-${resultfile}
diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt
index 1e305be..5ab513c 100644
--- a/java/examples/datatypes/CMakeLists.txt
+++ b/java/examples/datatypes/CMakeLists.txt
@@ -63,7 +63,11 @@ endforeach (HDFJAVA_JAR)
MACRO (ADD_H5_TEST resultfile resultcode)
if (CMAKE_BUILD_TYPE MATCHES Debug)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ if (WIN32)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
+ else()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ endif()
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_test (
NAME JAVA_datatypes-${resultfile}
diff --git a/java/examples/datatypes/H5Ex_T_ObjectReference.java b/java/examples/datatypes/H5Ex_T_ObjectReference.java
index 3cad6c9..8a09f5b 100644
--- a/java/examples/datatypes/H5Ex_T_ObjectReference.java
+++ b/java/examples/datatypes/H5Ex_T_ObjectReference.java
@@ -256,11 +256,10 @@ public class H5Ex_T_ObjectReference {
object_id = H5.H5Rdereference(dataset_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, dset_data[indx]);
object_type = H5.H5Rget_obj_type(dataset_id, HDF5Constants.H5R_OBJECT, dset_data[indx]);
}
- String[] obj_name = new String[1];
- long name_size = 1;
+ String obj_name = null;
if (object_type >= 0) {
// Get the length of the name and retrieve the name.
- name_size = 1 + H5.H5Iget_name(object_id, obj_name, name_size);
+ obj_name = H5.H5Iget_name(object_id);
}
if ((object_id >= 0) && (object_type >= -1)) {
switch (H5G_obj.get(object_type)) {
@@ -299,8 +298,7 @@ public class H5Ex_T_ObjectReference {
}
}
// Print the name.
- if (name_size > 1)
- System.out.println(": " + obj_name[0]);
+ System.out.println(": " + obj_name);
}
catch (Exception e) {
e.printStackTrace();
diff --git a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
index e354029..e366681 100644
--- a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
@@ -289,11 +289,10 @@ public class H5Ex_T_ObjectReferenceAttribute {
object_id = H5.H5Rdereference(dataset_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, dset_data[indx]);
object_type = H5.H5Rget_obj_type(dataset_id, HDF5Constants.H5R_OBJECT, dset_data[indx]);
}
- String[] obj_name = new String[1];
- long name_size = 1;
+ String obj_name = null;
if (object_type >= 0) {
// Get the length of the name and retrieve the name.
- name_size = 1 + H5.H5Iget_name(object_id, obj_name, name_size);
+ obj_name = H5.H5Iget_name(object_id);
}
if ((object_id >= 0) && (object_type >= -1)) {
switch (H5G_obj.get(object_type)) {
@@ -332,8 +331,7 @@ public class H5Ex_T_ObjectReferenceAttribute {
}
}
// Print the name.
- if (name_size > 1)
- System.out.println(": " + obj_name[0]);
+ System.out.println(": " + obj_name);
}
catch (Exception e) {
e.printStackTrace();
diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt
index 410168a..c23b7d3 100644
--- a/java/examples/groups/CMakeLists.txt
+++ b/java/examples/groups/CMakeLists.txt
@@ -62,7 +62,11 @@ add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G
MACRO (ADD_H5_TEST resultfile resultcode)
if (CMAKE_BUILD_TYPE MATCHES Debug)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ if (WIN32)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
+ else()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ endif()
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_test (
NAME JAVA_groups-${resultfile}
diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt
index 8679943..6b77382 100644
--- a/java/examples/intro/CMakeLists.txt
+++ b/java/examples/intro/CMakeLists.txt
@@ -64,7 +64,11 @@ endforeach (example ${HDF_JAVA_OBJECT_EXAMPLES})
MACRO (ADD_H5_TEST resultfile resultcode)
if (CMAKE_BUILD_TYPE MATCHES Debug)
- set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ if (WIN32)
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_D;")
+ else()
+ set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;")
+ endif()
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_test (
NAME JAVA_intro-${resultfile}