From d612aa916b0da818d288cdf4f7e6b39174b3bd61 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 7 Oct 2009 19:20:57 -0500 Subject: [svn-r17611] Bug fix (ID 1628): There was a typo in the H5Pget_preserve that it was returning the wrong value. Fixed. Also added a test in test/cmpd_dset.c to verify the correctness of H5Pset_preserve and H5Pget_preserve. Tested: h5committest plus jam serial. --- src/H5Pdxpl.c | 2 +- test/cmpd_dset.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index efbdfe7..aab8b57 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -839,7 +839,7 @@ H5Pget_preserve(hid_t plist_id) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get value */ - if (H5P_get(plist,H5D_XFER_BKGR_BUF_NAME,&need_bkg)<0) + if (H5P_get(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") /* Set return value */ diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 53c63d7..167e6a1 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -199,6 +199,7 @@ test_compound (char *filename, hid_t fapl) hsize_t f_offset[2]; /*offset of hyperslab in file */ hsize_t h_size[2]; /*size of hyperslab */ hsize_t memb_size[1] = {4}; + int ret_code; /* Create the file */ if ((file = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { @@ -209,8 +210,19 @@ test_compound (char *filename, hid_t fapl) if ((space = H5Screate_simple (2, dim, NULL)) < 0) goto error; /* Create xfer properties to preserve initialized data */ - if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER)) < 0) goto error; - if (H5Pset_preserve (PRESERVE, 1) < 0) goto error; + /* Also verify H5Pset_preserve is initially 0 and then is set to 1. */ + if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) goto error; + if ((ret_code=H5Pget_preserve (PRESERVE)) != 0){ + printf("Preserve status of dataset transfer property list should be" + " 0 (FALSE), got %d\n", ret_code); + goto error; + } + if (H5Pset_preserve (PRESERVE, 1)<0) goto error; + if ((ret_code=H5Pget_preserve (PRESERVE)) != 1){ + printf("Preserve status of dataset transfer property list should be" + " 1 (TRUE), got %d\n", ret_code); + goto error; + } /* *###################################################################### -- cgit v0.12