summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2005-03-24 16:31:29 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2005-03-24 16:31:29 (GMT)
commit346e37b57bdefbe6eaf06c96e9549b8c4f4a7a84 (patch)
treed538b877efc22c117c7cab96f4829e81b533d87c /hl
parent87252df68c4b87dd1330f5de95ac2f9c332dca1c (diff)
downloadhdf5-346e37b57bdefbe6eaf06c96e9549b8c4f4a7a84.zip
hdf5-346e37b57bdefbe6eaf06c96e9549b8c4f4a7a84.tar.gz
hdf5-346e37b57bdefbe6eaf06c96e9549b8c4f4a7a84.tar.bz2
[svn-r10403] Purpose:
new tests bug fix Description: added new tests for iterartors (on many scales, on group, on deleted scales) fixed a bug on H5DSiterate, an ID of the referenced scale was not being closed on the cycle Solution: Platforms tested: linux solaris Misc. update:
Diffstat (limited to 'hl')
-rw-r--r--hl/src/H5DS.c38
-rw-r--r--hl/test/test_ds.c26
2 files changed, 54 insertions, 10 deletions
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index 8dfdc10..891bff3 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -1584,7 +1584,7 @@ herr_t H5DSiterate_scales(hid_t did,
H5DS_iterate_t visitor,
void *visitor_data )
{
- hid_t scale_id=0;
+ hid_t scale_id;
int rank;
hobj_ref_t ref; /* reference to the DS */
hid_t sid; /* space ID */
@@ -1664,16 +1664,32 @@ herr_t H5DSiterate_scales(hid_t did,
/* get the reference */
ref = ((hobj_ref_t *)buf[dim].p)[ i ];
- /* get the DS id */
- if ((scale_id = H5Rdereference(did,H5R_OBJECT,&ref))<0)
- goto out;
-
+ /* disable error reporting, the ID might refer to a deleted dataset */
+ H5E_BEGIN_TRY {
+ /* get the DS id */
+ if ((scale_id = H5Rdereference(did,H5R_OBJECT,&ref))<0)
+ goto out;
+ } H5E_END_TRY;
+
if((ret_value=(visitor)(did,dim,scale_id,visitor_data))!=0)
{
/* set the return IDX OUT value at current scale index and break */
- if (idx!=NULL) *idx = i;
+ if (idx!=NULL)
+ {
+ *idx = i;
+ }
+
+ /* close the DS id */
+ if (H5Dclose(scale_id)<0)
+ goto out;
+
break;
}
+
+ /* close the DS id */
+ if (H5Dclose(scale_id)<0)
+ goto out;
+
} /* i */
} /* if */
@@ -1686,8 +1702,6 @@ herr_t H5DSiterate_scales(hid_t did,
goto out;
if (H5Aclose(aid)<0)
goto out;
- if (scale_id && H5Dclose(scale_id)<0)
- goto out;
if (buf)
free(buf);
@@ -1696,6 +1710,14 @@ herr_t H5DSiterate_scales(hid_t did,
return ret_value;
out:
+ H5E_BEGIN_TRY {
+ H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf);
+ H5Sclose(sid);
+ H5Aclose(aid);
+ H5Tclose(tid);
+ } H5E_END_TRY;
+ if (buf)
+ free(buf);
return FAIL;
}
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index 5e6b2fc..e6da329 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -65,7 +65,6 @@ static int test_iterators(void);
-
/*-------------------------------------------------------------------------
* the main program
*-------------------------------------------------------------------------
@@ -2383,10 +2382,34 @@ static int test_iterators(void)
if (H5Gclose(gid)<0)
goto out;
+ PASSED();
+
+/*-------------------------------------------------------------------------
+ * iterate in deleted scales
+ *-------------------------------------------------------------------------
+ */
+
+ TESTING2("iterate in deleted scales ");
+
+ if (H5Gunlink(fid,"ds_0")<0)
+ goto out;
+
+ /* open the previously written "dset_a" */
+ if ((did = H5Dopen(fid,"dset_a"))<0)
+ goto out;
+
+ /* iterate */
+ if (H5DSiterate_scales(did,0,NULL,op_bogus,NULL)==SUCCESS)
+ goto out;
+
+ /* close */
+ if (H5Dclose(did)<0)
+ goto out;
PASSED();
+
/* close */
if (H5Fclose(fid)<0)
goto out;
@@ -2403,4 +2426,3 @@ out:
return FAIL;
}
-