From a68c4c7981ba4224e72f64556483f3707be94ffc Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Wed, 16 Feb 2005 15:45:38 -0500 Subject: [svn-r10019] Purpose: new test Description: added a test for the iterator function that verifies if the scales meet certain criteria (having the same size as the dimensions sizes of the dataset and they are not empty datasets) Solution: Platforms tested: linux solaris Misc. update: --- hl/src/H5DS.c | 290 ++---------------------------------------------------- hl/test/test_ds.c | 254 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 256 insertions(+), 288 deletions(-) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 0615a80..902fb9b 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -1267,7 +1267,7 @@ out: * Parameters: * * hid_t DID; IN: the dataset - * unsigned int dim; IN: the dimension of dset + * unsigned int dim; IN: the dimension of the dataset * int *idx; IN/OUT: input the index to start iterating, output the next index * to visit. If NULL, start at the first position. * H5DS_iterate_t visitor; IN: the visitor function @@ -1303,7 +1303,7 @@ herr_t H5DSiterate_scales(hid_t did, H5DS_iterate_t visitor, void *visitor_data ) { - hid_t scale_id; + hid_t scale_id=0; int rank; hobj_ref_t ref; /* reference to the DS */ hid_t sid; /* space ID */ @@ -1369,14 +1369,18 @@ herr_t H5DSiterate_scales(hid_t did, for(i=j_idx; i>data<< dataset must exist - *------------------------------------------------------------------------- - */ - /* get dataset space */ - if ((sid = H5Dget_space(did))<0) - goto out; - - /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid))<0) - goto out; - - /* close dataset space */ - if (H5Sclose(sid)<0) - goto out; - - /* DIM range checking */ - if (dim>=(unsigned int )rank) - goto out; - - /* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */ - if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0) - return FAIL; - - /* it does not exist */ - if (has_dimlist == 0) - goto out; - -/*------------------------------------------------------------------------- - * the attribute exists, open it - *------------------------------------------------------------------------- - */ - - else if ( has_dimlist == 1 ) - { - if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) - goto out; - if ((tid = H5Aget_type(aid))<0) - goto out; - if ((sid = H5Aget_space(aid))<0) - goto out; - - /* allocate and initialize the VL */ - buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); - - if (buf == NULL) - goto out; - - /* read */ - if (H5Aread(aid,tid,buf)<0) - goto out; - - for(i=0,n=0; i>data<< dataset */ - if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0) - goto out; - - if (has_dimlist == 0) - return SUCCESS; - - else if (has_dimlist == 1 ) - { - if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) - goto out; - if ((tid = H5Aget_type(aid))<0) - goto out; - if ((sid = H5Aget_space(aid))<0) - goto out; - - /* allocate and initialize the VL */ - buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); - - if (buf == NULL) - goto out; - - /* read */ - if (H5Aread(aid,tid,buf)<0) - goto out; - - if ( buf[dim].len > 0 ) - { - if (idx!=NULL) - j_idx = *idx; - else - j_idx=0; - - /* iterate */ - for(i=j_idx; i