[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:
This commit is contained in:
Pedro Vicente Nunes 2005-03-24 11:31:29 -05:00
parent 87252df68c
commit 346e37b57b
2 changed files with 54 additions and 10 deletions

View File

@ -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;
}

View File

@ -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;
}