diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2014-02-04 15:11:20 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2014-02-04 15:11:20 (GMT) |
commit | ee10548723a74680a65ad0f324602e172b246f19 (patch) | |
tree | 2e67acad33935c24f775699187c4ac253baef750 /test/getname.c | |
parent | ddf75b10f64026f9e1c55534997c2b3a37af0140 (diff) | |
download | hdf5-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/getname.c')
-rw-r--r-- | test/getname.c | 15 |
1 files changed, 14 insertions, 1 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() |