diff options
-rw-r--r-- | hl/src/H5DS.c | 18 | ||||
-rw-r--r-- | hl/src/H5DS.h | 7 | ||||
-rw-r--r-- | hl/test/test_ds.c | 26 |
3 files changed, 25 insertions, 26 deletions
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index a9a93e1..66cb7b4 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -885,7 +885,7 @@ out: } /*------------------------------------------------------------------------- - * Function: H5DSget_nscales + * Function: H5DSget_num_scales * * Purpose: get the number of scales linked to the IDX dimension of DNAME * @@ -904,9 +904,8 @@ out: *------------------------------------------------------------------------- */ -herr_t H5DSget_nscales(hid_t did, - unsigned int dim, - int *nscales) +int H5DSget_num_scales(hid_t did, + unsigned int dim) { int has_dimlist; hid_t sid; /* space ID */ @@ -915,6 +914,7 @@ herr_t H5DSget_nscales(hid_t did, int rank; /* rank of dataset */ hvl_t *buf; /* VL buffer to store in the attribute */ H5I_type_t it; /* ID type */ + int nscales; /*------------------------------------------------------------------------- * parameter checking @@ -979,7 +979,7 @@ herr_t H5DSget_nscales(hid_t did, if (H5Aread(aid,tid,buf)<0) goto out; - *nscales=(int)buf[dim].len; + nscales=(int)buf[dim].len; /* close */ if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) @@ -995,7 +995,7 @@ herr_t H5DSget_nscales(hid_t did, } /* has_dimlist */ - return SUCCESS; + return nscales; /* error zone, gracefully close */ out: @@ -1459,12 +1459,12 @@ out: *------------------------------------------------------------------------- */ -herr_t H5DSis_scale(hid_t did) +htri_t H5DSis_scale(hid_t did) { hid_t tid; /* attribute type ID */ hid_t aid; /* attribute ID */ herr_t has_class; /* has the "CLASS" attribute */ - herr_t is_ds; /* boolean return value */ + htri_t is_ds; /* boolean return value */ H5I_type_t it; /* ID type */ char buf[20]; @@ -1598,7 +1598,7 @@ herr_t H5DSiterate_scales(hid_t did, return FAIL; /* get the number of scales assotiated with this DIM */ - if (H5DSget_nscales(did,dim,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,dim))<0) goto out; /* get dataset space */ diff --git a/hl/src/H5DS.h b/hl/src/H5DS.h index 327f602..48e2365 100644 --- a/hl/src/H5DS.h +++ b/hl/src/H5DS.h @@ -51,9 +51,8 @@ herr_t H5DSdetach_scale(hid_t did, herr_t H5DSset_scale(hid_t dsid, char *dimname); -herr_t H5DSget_nscales(hid_t did, - unsigned int dim, - int *nscales); +int H5DSget_num_scales(hid_t did, + unsigned int dim); herr_t H5DSset_label(hid_t did, unsigned int idx, @@ -68,7 +67,7 @@ ssize_t H5DSget_scale_name(hid_t did, char *name, size_t size); -herr_t H5DSis_scale(hid_t did); +htri_t H5DSis_scale(hid_t did); herr_t H5DSiterate_scales(hid_t did, unsigned int dim, diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 52a891f..501aa35 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -333,13 +333,13 @@ static int test_simple(void) goto out; /* verify that "dset_a" has 1 dimension scale at DIM 0 */ - if (H5DSget_nscales(did,0,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,0))<0) goto out; if (nscales!=2) goto out; /* verify that "dset_a" has 3 dimension scales at DIM 1 */ - if (H5DSget_nscales(did,1,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,1))<0) goto out; if (nscales!=3) goto out; @@ -388,13 +388,13 @@ static int test_simple(void) goto out; /* verify that "dset_b" has 1 dimension scale at DIM 0 */ - if (H5DSget_nscales(did,0,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,0))<0) goto out; if (nscales!=1) goto out; /* verify that "dset_b" has 0 dimension scales at DIM 1 */ - if (H5DSget_nscales(did,1,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,1))<0) goto out; if (nscales!=0) goto out; @@ -487,12 +487,12 @@ static int test_simple(void) if ((did = H5Dopen(fid,"dset_c"))<0) goto out; /* verify that "dset_c" has 1 dimension scale at DIM 0 */ - if (H5DSget_nscales(did,0,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,0))<0) goto out; if (nscales!=1) goto out; /* verify that "dset_c" has 3 dimension scales at DIM 1 */ - if (H5DSget_nscales(did,1,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,1))<0) goto out; if (nscales!=3) goto out; @@ -532,7 +532,7 @@ static int test_simple(void) if ((did = H5Dopen(fid,"dset_c"))<0) goto out; /* verify that "dset_c" has 2 dimension scales at DIM 1 */ - if (H5DSget_nscales(did,1,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,1))<0) goto out; if (nscales!=2) goto out; @@ -572,7 +572,7 @@ static int test_simple(void) if ((did = H5Dopen(fid,"dset_c"))<0) goto out; /* verify that "dset_c" has 1 dimension scale at DIM 1 */ - if (H5DSget_nscales(did,1,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,1))<0) goto out; if (nscales!=1) goto out; @@ -612,7 +612,7 @@ static int test_simple(void) if ((did = H5Dopen(fid,"dset_c"))<0) goto out; /* verify that "dset_c" has 1 dimension scale at DIM 1 */ - if (H5DSget_nscales(did,1,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,1))<0) goto out; if (nscales!=0) goto out; @@ -731,7 +731,7 @@ static int test_simple(void) goto out; /* verify that "ds_d_1" has only 1 scale at DIM0 */ - if (H5DSget_nscales(did,DIM0,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,DIM0))<0) goto out; if (nscales!=1) goto out; @@ -770,7 +770,7 @@ static int test_simple(void) goto out; /* verify that "ds_d_1" has no scale at DIM1 */ - if (H5DSget_nscales(did,DIM1,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,DIM1))<0) goto out; if (nscales!=0) goto out; @@ -805,7 +805,7 @@ static int test_simple(void) goto out; /* verify that "ds_d_2" has only 1 scale at DIM1 */ - if (H5DSget_nscales(did,DIM0,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,DIM0))<0) goto out; if (nscales!=1) goto out; @@ -819,7 +819,7 @@ static int test_simple(void) goto out; /* verify that "ds_d_2" has only 1 scale at DIM1 */ - if (H5DSget_nscales(did,DIM0,&nscales)<0) + if ((nscales = H5DSget_num_scales(did,DIM0))<0) goto out; if (nscales!=1) goto out; |