From 338fdac20dc8bbc09aa1701f092fe28013aa6aa7 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Tue, 19 Jul 2011 15:20:01 -0500 Subject: [svn-r21124] Issue 2763 - adding OAPL_ID as a new parameter to H5Rdereference. A followup commit for r21117. I made 2 changes: 1. Quincey changed H5P_DATASET_ACCESS_DEFAULT to H5P_DEFAULT for the tests that call H5Rdereference. Inside H5R_dereference, I assigned H5P_DATASET_ACCESS_DEFAULT to OAPL_ID if it is H5P_DEFAULT. 2. I added the test for invalid OAPL_ID in trefer.c. Tested on jam, koala, heiwa. --- hl/src/H5DS.c | 10 +++++----- src/H5R.c | 6 ++++++ test/trefer.c | 2 ++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 58be200..6a07e7a 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -690,7 +690,7 @@ herr_t H5DSdetach_scale(hid_t did, ref = ((hobj_ref_t *)buf[idx].p)[j]; /* get the DS id */ - if ((dsid_j = H5Rdereference2(did,H5P_DATASET_ACCESS_DEFAULT,H5R_OBJECT,&ref)) < 0) + if ((dsid_j = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for this DS */ @@ -800,7 +800,7 @@ herr_t H5DSdetach_scale(hid_t did, ref = dsbuf[ii].ref; /* get the dataset id */ - if ((did_i = H5Rdereference2(did,H5P_DATASET_ACCESS_DEFAULT,H5R_OBJECT,&ref)) < 0) + if ((did_i = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for this dataset */ @@ -1048,7 +1048,7 @@ htri_t H5DSis_attached(hid_t did, ref = ((hobj_ref_t *)buf[idx].p)[i]; /* get the scale id for this REF */ - if ((dsid_j = H5Rdereference2(did,H5P_DATASET_ACCESS_DEFAULT,H5R_OBJECT,&ref)) < 0) + if ((dsid_j = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for DS in the parameter list */ @@ -1138,7 +1138,7 @@ htri_t H5DSis_attached(hid_t did, if (ref) { /* get the dataset id */ - if ((did_i = H5Rdereference2(did,H5P_DATASET_ACCESS_DEFAULT,H5R_OBJECT,&ref)) < 0) + if ((did_i = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; /* get info for dataset in the parameter list */ @@ -1342,7 +1342,7 @@ herr_t H5DSiterate_scales(hid_t did, /* disable error reporting, the ID might refer to a deleted dataset */ H5E_BEGIN_TRY { /* get the DS id */ - if ((scale_id = H5Rdereference2(did,H5P_DATASET_ACCESS_DEFAULT,H5R_OBJECT,&ref)) < 0) + if ((scale_id = H5Rdereference2(did,H5P_DEFAULT,H5R_OBJECT,&ref)) < 0) goto out; } H5E_END_TRY; diff --git a/src/H5R.c b/src/H5R.c index e2d6bf3..49ef357 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -466,6 +466,12 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, { H5D_t *dset; /* Pointer to dataset to open */ + /* Get correct property list */ + if(H5P_DEFAULT == oapl_id) + oapl_id = H5P_DATASET_ACCESS_DEFAULT; + else if(TRUE != H5P_isa_class(oapl_id, H5P_DATASET_ACCESS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + /* Open the dataset */ if(NULL == (dset = H5D_open(&loc, oapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found") diff --git a/test/trefer.c b/test/trefer.c index 8d255a5..53f7b92 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -186,6 +186,8 @@ test_reference_params(void) /* Test parameters to H5Rdereference */ dset2 = H5Rdereference2(-1, H5P_DEFAULT, H5R_OBJECT, &rbuf[0]); VERIFY(dset2, FAIL, "H5Rdereference2 loc_id"); + dset2 = H5Rdereference2(dataset, -1, H5R_OBJECT, &rbuf[0]); + VERIFY(dset2, FAIL, "H5Rdereference2 oapl_id"); dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, NULL); VERIFY(dset2, FAIL, "H5Rdereference2 ref"); dset2 = H5Rdereference2(dataset, dapl_id, H5R_MAXTYPE, &rbuf[0]); -- cgit v0.12