summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2014-02-04 15:11:20 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2014-02-04 15:11:20 (GMT)
commitee10548723a74680a65ad0f324602e172b246f19 (patch)
tree2e67acad33935c24f775699187c4ac253baef750 /test
parentddf75b10f64026f9e1c55534997c2b3a37af0140 (diff)
downloadhdf5-ee10548723a74680a65ad0f324602e172b246f19.zip
hdf5-ee10548723a74680a65ad0f324602e172b246f19.tar.gz
hdf5-ee10548723a74680a65ad0f324602e172b246f19.tar.bz2
[svn-r24681] Description:
Fix for HDF5/HDFFV-8620 H5Rget_name with NULL name parameter fails. The name parameter now excepts NULL, in which case the length of then name is returned. Tested: jam (intel and gnu)
Diffstat (limited to 'test')
-rw-r--r--test/getname.c15
-rw-r--r--test/trefer.c4
2 files changed, 16 insertions, 3 deletions
diff --git a/test/getname.c b/test/getname.c
index fbad220..31440d6 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -2524,6 +2524,14 @@ test_obj_ref(hid_t fapl)
if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR
if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
*buf = '\0';
+
+ /* Check H5Rget_name returns the correct length of the name when name is NULL */
+ i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 0);
+ if(i != 9) TEST_ERROR
+ /* Make sure size parameter is ignored */
+ i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], NULL, 200);
+ if(i != 9) TEST_ERROR
+
i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf));
if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR
PASSED()
@@ -2761,7 +2769,12 @@ test_reg_ref(hid_t fapl)
/* Get name of the dataset the first region reference points to using H5Rget_name */
TESTING("H5Rget_name to get name from region reference(hyperslab)");
*buf1 = '\0';
- name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, NAME_BUF_SIZE);
+
+ /* Check H5Rget_name returns the correct length of the name when name is NULL */
+ name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], NULL, 0);
+ if(name_size1 != 7) TEST_ERROR
+
+ name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, NAME_BUF_SIZE );
if(!((HDstrcmp(buf1, "/MATRIX") == 0) &&(name_size1 == 7))) TEST_ERROR
PASSED()
diff --git a/test/trefer.c b/test/trefer.c
index 698e95a..8f8a28e 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -205,9 +205,9 @@ test_reference_params(void)
name_size = H5Rget_name(-1, H5R_DATASET_REGION, &rbuf[0], NULL, 0);
VERIFY(name_size, FAIL, "H5Rget_name loc_id");
name_size = H5Rget_name(fid1, H5R_DATASET_REGION, NULL, NULL, 0);
- VERIFY(ret, FAIL, "H5Rget_name ref");
+ VERIFY(name_size, FAIL, "H5Rget_name ref");
name_size = H5Rget_name(fid1, H5R_MAXTYPE, &rbuf[0], NULL, 0);
- VERIFY(ret, FAIL, "H5Rget_name type");
+ VERIFY(name_size, FAIL, "H5Rget_name type");
/* Test parameters to H5Rget_region */
ret = H5Rget_region(-1, H5R_OBJECT, &rbuf[0]);