diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-04 19:29:58 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-04 19:29:58 (GMT) |
commit | bb3afd50c2e94cf2db558218c6704dcc285c72e9 (patch) | |
tree | add60605c7c88c64582acde6b3e84051f72ea27b /hl/src/H5DS.c | |
parent | 3db40827da29243b88ade3c3f174f3f5e6cd0622 (diff) | |
download | hdf5-bb3afd50c2e94cf2db558218c6704dcc285c72e9.zip hdf5-bb3afd50c2e94cf2db558218c6704dcc285c72e9.tar.gz hdf5-bb3afd50c2e94cf2db558218c6704dcc285c72e9.tar.bz2 |
[svn-r14185] Description:
Move H5Aopen_name() routine to deprecated symbol section and replace
internal usage with H5Aopen().
Add simple regression test for H5Aopen_name() to deprecated routine
test.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'hl/src/H5DS.c')
-rw-r--r-- | hl/src/H5DS.c | 458 |
1 files changed, 229 insertions, 229 deletions
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 141fc88..6d1c41e 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -56,7 +56,7 @@ herr_t H5DSset_scale(hid_t dsid, *------------------------------------------------------------------------- */ /* get ID type */ - if ((it = H5Iget_type(dsid))<0) + if ((it = H5Iget_type(dsid)) < 0) return FAIL; if (H5I_DATASET!=it) @@ -68,7 +68,7 @@ herr_t H5DSset_scale(hid_t dsid, */ /* try to find the attribute "DIMENSION_LIST" */ - if ((has_dimlist = H5LT_find_attribute(dsid,DIMENSION_LIST))<0) + if ((has_dimlist = H5LT_find_attribute(dsid,DIMENSION_LIST)) < 0) return FAIL; if (has_dimlist == 1) @@ -79,12 +79,12 @@ herr_t H5DSset_scale(hid_t dsid, *------------------------------------------------------------------------- */ - if (H5LT_set_attribute_string(dsid,"CLASS",DIMENSION_SCALE_CLASS)<0) + if (H5LT_set_attribute_string(dsid,"CLASS",DIMENSION_SCALE_CLASS) < 0) return FAIL; if (dimname!=NULL) { - if (H5LT_set_attribute_string(dsid,"NAME",dimname)<0) + if (H5LT_set_attribute_string(dsid,"NAME",dimname) < 0) return FAIL; } @@ -164,9 +164,9 @@ herr_t H5DSattach_scale(hid_t did, return FAIL; /* get ID type */ - if ((it1 = H5Iget_type(did))<0) + if ((it1 = H5Iget_type(did)) < 0) return FAIL; - if ((it2 = H5Iget_type(dsid))<0) + if ((it2 = H5Iget_type(dsid)) < 0) return FAIL; if (H5I_DATASET!=it1 || H5I_DATASET!=it2) @@ -190,11 +190,11 @@ herr_t H5DSattach_scale(hid_t did, */ /* get dataset space */ - if ((sid = H5Dget_space(did))<0) + if ((sid = H5Dget_space(did)) < 0) return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid))<0) + if ((rank=H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* scalar rank */ @@ -202,7 +202,7 @@ herr_t H5DSattach_scale(hid_t did, rank=1; /* close dataset space */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) return FAIL; /* parameter range checking */ @@ -215,15 +215,15 @@ herr_t H5DSattach_scale(hid_t did, *------------------------------------------------------------------------- */ /* create a reference for the >>DS<< dataset */ - if (H5Rcreate(&ref_to_ds,dsid,".",H5R_OBJECT,-1)<0) + if (H5Rcreate(&ref_to_ds,dsid,".",H5R_OBJECT,-1) < 0) return FAIL; /* create a reference for the >>data<< dataset */ - if (H5Rcreate(&dsl.ref,did,".",H5R_OBJECT,-1)<0) + if (H5Rcreate(&dsl.ref,did,".",H5R_OBJECT,-1) < 0) return FAIL; /* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */ - if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0) + if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST)) < 0) return FAIL; /*------------------------------------------------------------------------- @@ -241,15 +241,15 @@ herr_t H5DSattach_scale(hid_t did, dims[0] = rank; /* space for the attribute */ - if ((sid = H5Screate_simple(1,dims,NULL))<0) + if ((sid = H5Screate_simple(1,dims,NULL)) < 0) return FAIL; /* create the type for the attribute "DIMENSION_LIST" */ - if ((tid = H5Tvlen_create(H5T_STD_REF_OBJ))<0) + if ((tid = H5Tvlen_create(H5T_STD_REF_OBJ)) < 0) goto out; /* create the attribute */ - if ((aid = H5Acreate(did,DIMENSION_LIST,tid,sid,H5P_DEFAULT))<0) + if ((aid = H5Acreate(did,DIMENSION_LIST,tid,sid,H5P_DEFAULT)) < 0) goto out; /* allocate and initialize the VL */ @@ -270,17 +270,17 @@ herr_t H5DSattach_scale(hid_t did, ((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds; /* write the attribute with the reference */ - if (H5Awrite(aid,tid,buf)<0) + if (H5Awrite(aid,tid,buf) < 0) goto out; /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) + if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) goto out; - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; if (dims) @@ -298,23 +298,23 @@ herr_t H5DSattach_scale(hid_t did, else if ( has_dimlist == 1 ) { - if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) + if((aid = H5Aopen(did, ".", DIMENSION_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; - if ((sid = H5Aget_space(aid))<0) + 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) + if(buf == NULL) goto out; /* read */ - if (H5Aread(aid,tid,buf)<0) + if(H5Aread(aid, tid, buf) < 0) goto out; /* check to avoid inserting duplicates. it is not FAIL, just do nothing */ @@ -325,7 +325,7 @@ herr_t H5DSattach_scale(hid_t did, ref_j = ((hobj_ref_t *)buf[idx].p)[i]; /* get the scale id for this REF */ - if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref_j))<0) + if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref_j)) < 0) goto out; /* get info for DS in the parameter list */ @@ -341,7 +341,7 @@ herr_t H5DSattach_scale(hid_t did, found_ds = 1; /* close the dereferenced dataset */ - if (H5Dclose(dsid_j)<0) + if (H5Dclose(dsid_j) < 0) goto out; } @@ -365,17 +365,17 @@ herr_t H5DSattach_scale(hid_t did, } /* write the attribute with the new references */ - if (H5Awrite(aid,tid,buf)<0) + if (H5Awrite(aid,tid,buf) < 0) goto out; /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) + if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) goto out; - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; if (buf) free(buf); @@ -388,7 +388,7 @@ herr_t H5DSattach_scale(hid_t did, */ /* try to find the attribute "REFERENCE_LIST" on the >>DS<< dataset */ - if ((has_reflist = H5LT_find_attribute(dsid,REFERENCE_LIST))<0) + if ((has_reflist = H5LT_find_attribute(dsid,REFERENCE_LIST)) < 0) goto out; /*------------------------------------------------------------------------- @@ -406,41 +406,41 @@ herr_t H5DSattach_scale(hid_t did, dims[0] = 1; /* space for the attribute */ - if ((sid = H5Screate_simple(1,dims,NULL))<0) + if ((sid = H5Screate_simple(1,dims,NULL)) < 0) goto out; /* create the compound datatype for the attribute "REFERENCE_LIST" */ - if ((tid = H5Tcreate(H5T_COMPOUND,sizeof(ds_list_t)))<0) + if ((tid = H5Tcreate(H5T_COMPOUND,sizeof(ds_list_t))) < 0) goto out; /* insert reference field */ - if (H5Tinsert(tid,"dataset",HOFFSET(ds_list_t,ref),H5T_STD_REF_OBJ)<0) + if (H5Tinsert(tid,"dataset",HOFFSET(ds_list_t,ref),H5T_STD_REF_OBJ) < 0) goto out; /* insert dimension idx of the dataset field */ - if (H5Tinsert(tid,"dimension",HOFFSET(ds_list_t,dim_idx),H5T_NATIVE_INT)<0) + if (H5Tinsert(tid,"dimension",HOFFSET(ds_list_t,dim_idx),H5T_NATIVE_INT) < 0) goto out; /* create the attribute */ - if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT))<0) + if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT)) < 0) goto out; /* store the IDX information */ dsl.dim_idx = idx; /* write the attribute with the reference */ - if (H5Awrite(aid,tid,&dsl)<0) + if (H5Awrite(aid,tid,&dsl) < 0) goto out; /* close */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if(H5Aclose(aid) < 0) goto out; - if (dims) + if(dims) free(dims); } @@ -449,19 +449,19 @@ herr_t H5DSattach_scale(hid_t did, *------------------------------------------------------------------------- */ - else if ( has_reflist == 1 ) + else if(has_reflist == 1) { - if ((aid = H5Aopen_name(dsid,REFERENCE_LIST))<0) + if((aid = H5Aopen(dsid, ".", REFERENCE_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; /* get and save the old reference(s) */ - if ((sid = H5Aget_space(aid))<0) + if((sid = H5Aget_space(aid)) < 0) goto out; - if ((nelmts = H5Sget_simple_extent_npoints(sid))<0) + if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0) goto out; nelmts++; @@ -471,13 +471,13 @@ herr_t H5DSattach_scale(hid_t did, if (dsbuf == NULL) goto out; - if (H5Aread(aid,tid,dsbuf)<0) + if (H5Aread(aid,tid,dsbuf) < 0) goto out; /* close */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; /*------------------------------------------------------------------------- @@ -499,26 +499,26 @@ herr_t H5DSattach_scale(hid_t did, goto out; dims[0] = nelmts; - if ((sid = H5Screate_simple(1,dims,NULL))<0) + if ((sid = H5Screate_simple(1,dims,NULL)) < 0) goto out; if (dims) free(dims); /* create the attribute again with the changes of space */ - if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT))<0) + if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT)) < 0) goto out; /* write the attribute with the new references */ - if (H5Awrite(aid,tid,dsbuf)<0) + if (H5Awrite(aid,tid,dsbuf) < 0) goto out; /* close */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; if (dsbuf) @@ -531,12 +531,12 @@ herr_t H5DSattach_scale(hid_t did, *------------------------------------------------------------------------- */ - if ((is_ds=H5DSis_scale(dsid))<0) + if ((is_ds=H5DSis_scale(dsid)) < 0) return FAIL; if (is_ds == 0 ) { - if (H5LT_set_attribute_string(dsid,"CLASS",DIMENSION_SCALE_CLASS)<0) + if (H5LT_set_attribute_string(dsid,"CLASS",DIMENSION_SCALE_CLASS) < 0) return FAIL; } @@ -625,9 +625,9 @@ herr_t H5DSdetach_scale(hid_t did, return FAIL; /* get ID type */ - if ((it1 = H5Iget_type(did))<0) + if ((it1 = H5Iget_type(did)) < 0) return FAIL; - if ((it2 = H5Iget_type(dsid))<0) + if ((it2 = H5Iget_type(dsid)) < 0) return FAIL; if (H5I_DATASET!=it1 || H5I_DATASET!=it2) @@ -639,22 +639,22 @@ herr_t H5DSdetach_scale(hid_t did, *------------------------------------------------------------------------- */ /* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */ - if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0) + if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST)) < 0) return FAIL; if (has_dimlist == 0) return FAIL; /* get dataset space */ - if ((sid = H5Dget_space(did))<0) + if ((sid = H5Dget_space(did)) < 0) return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid))<0) + if ((rank=H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* close dataset space */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) return FAIL; @@ -664,10 +664,10 @@ herr_t H5DSdetach_scale(hid_t did, */ /* try to find the attribute "REFERENCE_LIST" on the >>DS<< dataset */ - if ((has_reflist = H5LT_find_attribute(dsid,REFERENCE_LIST))<0) + if((has_reflist = H5LT_find_attribute(dsid, REFERENCE_LIST)) < 0) return FAIL; - if (has_reflist == 0) + if(has_reflist == 0) return FAIL; /*------------------------------------------------------------------------- @@ -675,23 +675,23 @@ herr_t H5DSdetach_scale(hid_t did, *------------------------------------------------------------------------- */ - if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) + if((aid = H5Aopen(did, ".", DIMENSION_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0) return FAIL; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; - if ((sid = H5Aget_space(aid))<0) + 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) + if(buf == NULL) goto out; /* read */ - if (H5Aread(aid,tid,buf)<0) + if (H5Aread(aid,tid,buf) < 0) goto out; /* reset */ @@ -703,7 +703,7 @@ herr_t H5DSdetach_scale(hid_t did, ref = ((hobj_ref_t *)buf[idx].p)[j]; /* get the DS id */ - if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref))<0) + if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) goto out; /* get info for DS in the parameter list */ @@ -723,35 +723,35 @@ herr_t H5DSdetach_scale(hid_t did, found_ds = 1; /* close the dereferenced dataset and break */ - if (H5Dclose(dsid_j)<0) + if (H5Dclose(dsid_j) < 0) goto out; break; } /* close the dereferenced dataset */ - if (H5Dclose(dsid_j)<0) + if (H5Dclose(dsid_j) < 0) goto out; } /* j */ } /* if */ /* write the attribute */ - if (H5Awrite(aid,tid,buf)<0) + if (H5Awrite(aid,tid,buf) < 0) goto out; /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) + if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) goto out; - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if(H5Aclose(aid) < 0) goto out; - if (buf) + if(buf) free(buf); /* the scale must be present */ - if (found_ds == 0) + if(found_ds == 0) goto out; /*------------------------------------------------------------------------- @@ -759,24 +759,24 @@ herr_t H5DSdetach_scale(hid_t did, *------------------------------------------------------------------------- */ - if ((aid = H5Aopen_name(dsid,REFERENCE_LIST))<0) + if((aid = H5Aopen(dsid, ".", REFERENCE_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; /* get and save the old reference(s) */ - if ((sid = H5Aget_space(aid))<0) + if((sid = H5Aget_space(aid)) < 0) goto out; - if ((nelmts = H5Sget_simple_extent_npoints(sid))<0) + if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0) goto out; dsbuf = malloc((size_t)nelmts * sizeof(ds_list_t)); - if (dsbuf == NULL) + if(dsbuf == NULL) goto out; - if (H5Aread(aid,tid,dsbuf)<0) + if (H5Aread(aid,tid,dsbuf) < 0) goto out; for(i=0; i<nelmts; i++) @@ -785,7 +785,7 @@ herr_t H5DSdetach_scale(hid_t did, ref = dsbuf[i].ref; /* get the dataset id */ - if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref))<0) + if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) goto out; /* get info for dataset in the parameter list */ @@ -804,21 +804,21 @@ herr_t H5DSdetach_scale(hid_t did, found_dset=1; /* close the dereferenced dataset and break */ - if (H5Dclose(did_i)<0) + if (H5Dclose(did_i) < 0) goto out; break; } /* if */ /* close the dereferenced dataset */ - if (H5Dclose(did_i)<0) + if (H5Dclose(did_i) < 0) goto out; } /* i */ /* close space and attribute */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; /*------------------------------------------------------------------------- @@ -858,27 +858,27 @@ herr_t H5DSdetach_scale(hid_t did, dsbufn[i] = dsbuf[i]; } - if ((sid = H5Screate_simple(1,dims,NULL))<0) + if ((sid = H5Screate_simple(1,dims,NULL)) < 0) goto out; /* create the attribute again with the changes of space */ - if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT))<0) + if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT)) < 0) goto out; /* write the new attribute with the new references */ - if (H5Awrite(aid,tid,dsbufn)<0) + if (H5Awrite(aid,tid,dsbufn) < 0) goto out; /* close space and attribute */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; } /* nelmts */ /* close type */ - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; if (dsbuf) { @@ -983,9 +983,9 @@ htri_t H5DSis_attached(hid_t did, return FAIL; /* get ID type */ - if ((it1 = H5Iget_type(did))<0) + if ((it1 = H5Iget_type(did)) < 0) return FAIL; - if ((it2 = H5Iget_type(dsid))<0) + if ((it2 = H5Iget_type(dsid)) < 0) return FAIL; if (H5I_DATASET!=it1 || H5I_DATASET!=it2) @@ -997,23 +997,23 @@ htri_t H5DSis_attached(hid_t did, */ /* get dataset space */ - if ((sid = H5Dget_space(did))<0) + if ((sid = H5Dget_space(did)) < 0) return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid))<0) + if ((rank=H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* close dataset space */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; /* parameter range checking */ - if (idx>(unsigned)rank-1) + if(idx > ((unsigned)rank - 1)) goto out; /* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */ - if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0) + if((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0) return FAIL; /*------------------------------------------------------------------------- @@ -1021,25 +1021,25 @@ htri_t H5DSis_attached(hid_t did, *------------------------------------------------------------------------- */ - if ( has_dimlist == 1 ) + if(has_dimlist == 1) { - if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) + if((aid = H5Aopen(did, ".", DIMENSION_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; - if ((sid = H5Aget_space(aid))<0) + 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) + if(buf == NULL) goto out; /* read */ - if (H5Aread(aid,tid,buf)<0) + if (H5Aread(aid,tid,buf) < 0) goto out; /* iterate all the REFs in this dimension IDX */ @@ -1049,7 +1049,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 = H5Rdereference(did,H5R_OBJECT,&ref))<0) + if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) goto out; /* get info for DS in the parameter list */ @@ -1065,20 +1065,20 @@ htri_t H5DSis_attached(hid_t did, found_ds = 1; /* close the dereferenced dataset */ - if (H5Dclose(dsid_j)<0) + if (H5Dclose(dsid_j) < 0) goto out; } /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) + if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) goto out; - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; if (buf) free(buf); @@ -1090,7 +1090,7 @@ htri_t H5DSis_attached(hid_t did, */ /* try to find the attribute "REFERENCE_LIST" on the >>DS<< dataset */ - if ((has_reflist = H5LT_find_attribute(dsid,REFERENCE_LIST))<0) + if((has_reflist = H5LT_find_attribute(dsid, REFERENCE_LIST)) < 0) goto out; /*------------------------------------------------------------------------- @@ -1098,19 +1098,19 @@ htri_t H5DSis_attached(hid_t did, *------------------------------------------------------------------------- */ - if ( has_reflist == 1 ) + if(has_reflist == 1) { - if ((aid = H5Aopen_name(dsid,REFERENCE_LIST))<0) + if((aid = H5Aopen(dsid, ".", REFERENCE_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; /* get and save the old reference(s) */ - if ((sid = H5Aget_space(aid))<0) + if((sid = H5Aget_space(aid)) < 0) goto out; - if ((nelmts = H5Sget_simple_extent_npoints(sid))<0) + if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0) goto out; dsbuf = malloc((size_t)nelmts * sizeof(ds_list_t)); @@ -1118,7 +1118,7 @@ htri_t H5DSis_attached(hid_t did, if (dsbuf == NULL) goto out; - if (H5Aread(aid,tid,dsbuf)<0) + if (H5Aread(aid,tid,dsbuf) < 0) goto out; /*------------------------------------------------------------------------- @@ -1135,7 +1135,7 @@ htri_t H5DSis_attached(hid_t did, if (ref) { /* get the dataset id */ - if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref))<0) + if ((did_i = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) goto out; /* get info for dataset in the parameter list */ @@ -1151,18 +1151,18 @@ htri_t H5DSis_attached(hid_t did, found_dset=1; /* close the dereferenced dataset */ - if (H5Dclose(did_i)<0) + if (H5Dclose(did_i) < 0) goto out; } /* if */ } /* i */ /* close */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; if (dsbuf) free(dsbuf); @@ -1251,52 +1251,52 @@ herr_t H5DSiterate_scales(hid_t did, *------------------------------------------------------------------------- */ /* get ID type */ - if ((it = H5Iget_type(did))<0) + if ((it = H5Iget_type(did)) < 0) return FAIL; if (H5I_DATASET!=it) return FAIL; /* get the number of scales assotiated with this DIM */ - if ((nscales = H5DSget_num_scales(did,dim))<0) + if ((nscales = H5DSget_num_scales(did,dim)) < 0) return FAIL; /* get dataset space */ - if ((sid = H5Dget_space(did))<0) + if ((sid = H5Dget_space(did)) < 0) return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid))<0) + if ((rank=H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* close dataset space */ - if (H5Sclose(sid)<0) + if(H5Sclose(sid) < 0) goto out; /* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */ - if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0) + if((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0) return FAIL; - if (has_dimlist == 0) + if(has_dimlist == 0) return SUCCEED; - else if (has_dimlist == 1 ) + else if(has_dimlist == 1) { - if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) + if((aid = H5Aopen(did, ".", DIMENSION_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; - if ((sid = H5Aget_space(aid))<0) + 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) + if(buf == NULL) goto out; /* read */ - if (H5Aread(aid,tid,buf)<0) + if(H5Aread(aid, tid, buf) < 0) goto out; if ( buf[dim].len > 0 ) @@ -1315,7 +1315,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 = H5Rdereference(did,H5R_OBJECT,&ref))<0) + if ((scale_id = H5Rdereference(did,H5R_OBJECT,&ref)) < 0) goto out; } H5E_END_TRY; @@ -1328,27 +1328,27 @@ herr_t H5DSiterate_scales(hid_t did, } /* close the DS id */ - if (H5Dclose(scale_id)<0) + if (H5Dclose(scale_id) < 0) goto out; break; } /* close the DS id */ - if (H5Dclose(scale_id)<0) + if (H5Dclose(scale_id) < 0) goto out; } /* i */ } /* if */ /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) + if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) goto out; - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; if (buf) free(buf); @@ -1408,7 +1408,7 @@ herr_t H5DSset_label(hid_t did, *------------------------------------------------------------------------- */ /* get ID type */ - if ((it = H5Iget_type(did))<0) + if ((it = H5Iget_type(did)) < 0) return FAIL; if (H5I_DATASET!=it) @@ -1420,19 +1420,19 @@ herr_t H5DSset_label(hid_t did, */ /* try to find the attribute "DIMENSION_LABELS" on the >>data<< dataset */ - if ((has_labels = H5LT_find_attribute(did,DIMENSION_LABELS))<0) + if ((has_labels = H5LT_find_attribute(did,DIMENSION_LABELS)) < 0) return FAIL; /* get dataset space */ - if ((sid = H5Dget_space(did))<0) + if ((sid = H5Dget_space(did)) < 0) return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid))<0) + if ((rank=H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* close dataset space */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; /*------------------------------------------------------------------------- @@ -1445,17 +1445,17 @@ herr_t H5DSset_label(hid_t did, dims[0] = rank; /* space for the attribute */ - if ((sid = H5Screate_simple(1,dims,NULL))<0) + if ((sid = H5Screate_simple(1,dims,NULL)) < 0) goto out; /* create the datatype */ - if ((tid = H5Tcopy(H5T_C_S1))<0) + if ((tid = H5Tcopy(H5T_C_S1)) < 0) goto out; - if (H5Tset_size(tid,H5T_VARIABLE)<0) + if (H5Tset_size(tid,H5T_VARIABLE) < 0) goto out; /* create the attribute */ - if ((aid = H5Acreate(did,DIMENSION_LABELS,tid,sid,H5P_DEFAULT))<0) + if ((aid = H5Acreate(did,DIMENSION_LABELS,tid,sid,H5P_DEFAULT)) < 0) goto out; /* allocate and initialize */ @@ -1471,17 +1471,17 @@ herr_t H5DSset_label(hid_t did, buf[idx] = label; /* write the attribute with the label */ - if (H5Awrite(aid,tid,buf)<0) + if (H5Awrite(aid,tid,buf) < 0) goto out; /* close */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid)<0) + if(H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if(H5Aclose(aid) < 0) goto out; - if (buf) + if(buf) free(buf); } @@ -1492,33 +1492,33 @@ herr_t H5DSset_label(hid_t did, else { - if ((aid = H5Aopen_name(did,DIMENSION_LABELS))<0) + if((aid = H5Aopen(did, ".", DIMENSION_LABELS, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; /* allocate and initialize */ buf = (const char **)malloc((size_t)rank * sizeof(char *)); - if (buf == NULL) + if(buf == NULL) goto out; /* read */ - if (H5Aread(aid,tid,buf)<0) + if(H5Aread(aid, tid, buf) < 0) goto out; /* store the label information in the required index */ buf[idx] = label; /* write the attribute with the new references */ - if (H5Awrite(aid,tid,buf)<0) + if (H5Awrite(aid,tid,buf) < 0) goto out; /* close */ - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; if (buf) free(buf); @@ -1577,7 +1577,7 @@ ssize_t H5DSget_label(hid_t did, *------------------------------------------------------------------------- */ /* get ID type */ - if ((it = H5Iget_type(did))<0) + if ((it = H5Iget_type(did)) < 0) return FAIL; if (H5I_DATASET!=it) @@ -1589,7 +1589,7 @@ ssize_t H5DSget_label(hid_t did, */ /* try to find the attribute "DIMENSION_LABELS" on the >>data<< dataset */ - if ((has_labels = H5LT_find_attribute(did,DIMENSION_LABELS))<0) + if ((has_labels = H5LT_find_attribute(did,DIMENSION_LABELS)) < 0) return FAIL; /* return 0 and NULL for label if no label found */ @@ -1601,15 +1601,15 @@ ssize_t H5DSget_label(hid_t did, } /* get dataset space */ - if ((sid = H5Dget_space(did))<0) + if ((sid = H5Dget_space(did)) < 0) return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid))<0) + if((rank = H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* close dataset space */ - if (H5Sclose(sid)<0) + if(H5Sclose(sid) < 0) goto out; /*------------------------------------------------------------------------- @@ -1618,20 +1618,20 @@ ssize_t H5DSget_label(hid_t did, */ assert (has_labels == 1); - if ((aid = H5Aopen_name(did,DIMENSION_LABELS))<0) + if((aid = H5Aopen(did, ".", DIMENSION_LABELS, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; /* allocate and initialize */ buf = (char **)malloc((size_t)rank * sizeof(char *)); - if (buf == NULL) + if(buf == NULL) goto out; /* read */ - if (H5Aread(aid,tid,buf)<0) + if(H5Aread(aid, tid, buf) < 0) goto out; /* get the real string length */ @@ -1648,9 +1648,9 @@ ssize_t H5DSget_label(hid_t did, label[copy_len]='\0'; /* close */ - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; if (buf) free(buf); @@ -1708,7 +1708,7 @@ ssize_t H5DSget_scale_name(hid_t did, *------------------------------------------------------------------------- */ /* get ID type */ - if ((it = H5Iget_type(did))<0) + if ((it = H5Iget_type(did)) < 0) return FAIL; if (H5I_DATASET!=it) @@ -1723,10 +1723,10 @@ ssize_t H5DSget_scale_name(hid_t did, */ /* try to find the attribute "NAME" on the >>DS<< dataset */ - if ((has_name = H5LT_find_attribute(did,"NAME"))<0) + if((has_name = H5LT_find_attribute(did, "NAME")) < 0) return FAIL; - if (has_name == 0) + if(has_name == 0) return 0; /*------------------------------------------------------------------------- @@ -1734,19 +1734,19 @@ ssize_t H5DSget_scale_name(hid_t did, *------------------------------------------------------------------------- */ - if ((aid = H5Aopen_name(did,"NAME"))<0) + if((aid = H5Aopen(did, ".", "NAME", H5P_DEFAULT, H5P_DEFAULT)) < 0) return FAIL; /* get space */ - if ((sid = H5Aget_space(aid))<0) + if((sid = H5Aget_space(aid)) < 0) goto out; /* get type */ - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; /* get the size */ - if ((nbytes = H5Tget_size(tid))==0) + if((nbytes = H5Tget_size(tid)) == 0) goto out; /* allocate a temporary buffer */ @@ -1755,7 +1755,7 @@ ssize_t H5DSget_scale_name(hid_t did, goto out; /* read */ - if (H5Aread(aid,tid,buf)<0) + if (H5Aread(aid,tid,buf) < 0) goto out; /* compute the string length which will fit into the user's buffer */ @@ -1770,11 +1770,11 @@ ssize_t H5DSget_scale_name(hid_t did, } /* close */ - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; if (buf) { @@ -1828,39 +1828,39 @@ htri_t H5DSis_scale(hid_t did) *------------------------------------------------------------------------- */ /* get ID type */ - if ((it = H5Iget_type(did))<0) + if ((it = H5Iget_type(did)) < 0) return FAIL; - if (H5I_DATASET!=it) + if(H5I_DATASET != it) return FAIL; /* try to find the attribute "CLASS" on the dataset */ - if ((has_class = H5LT_find_attribute(did,"CLASS"))<0) + if((has_class = H5LT_find_attribute(did, "CLASS")) < 0) return FAIL; - if (has_class == 0) + if(has_class == 0) is_ds = 0; else { - if ((aid = H5Aopen_name(did,"CLASS"))<0) + if((aid = H5Aopen(did, ".", "CLASS", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; - if (H5Aread(aid,tid,buf)<0) + if(H5Aread(aid, tid, buf) < 0) goto out; - if( strcmp(buf,DIMENSION_SCALE_CLASS)==0) + if(strcmp(buf, DIMENSION_SCALE_CLASS)==0) is_ds = 1; else is_ds = 0; - if (H5Tclose(tid)<0) + if(H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; } @@ -1913,7 +1913,7 @@ int H5DSget_num_scales(hid_t did, *------------------------------------------------------------------------- */ /* get ID type */ - if ((it = H5Iget_type(did))<0) + if ((it = H5Iget_type(did)) < 0) return FAIL; if (H5I_DATASET!=it) @@ -1924,15 +1924,15 @@ int H5DSget_num_scales(hid_t did, *------------------------------------------------------------------------- */ /* get dataset space */ - if ((sid = H5Dget_space(did))<0) + if ((sid = H5Dget_space(did)) < 0) return FAIL; /* get rank */ - if ((rank=H5Sget_simple_extent_ndims(sid))<0) + if ((rank=H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* close dataset space */ - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; /* dimemsion index IDX range checking */ @@ -1940,11 +1940,11 @@ int H5DSget_num_scales(hid_t did, return FAIL; /* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */ - if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0) + if((has_dimlist = H5LT_find_attribute(did, DIMENSION_LIST)) < 0) return FAIL; /* it does not exist */ - if (has_dimlist == 0) + if(has_dimlist == 0) return 0; /*------------------------------------------------------------------------- @@ -1954,33 +1954,33 @@ int H5DSget_num_scales(hid_t did, else { - if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) + if((aid = H5Aopen(did, ".", DIMENSION_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; - if ((sid = H5Aget_space(aid))<0) + 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) + if(buf == NULL) goto out; /* read */ - if (H5Aread(aid,tid,buf)<0) + if(H5Aread(aid, tid, buf) < 0) goto out; nscales=(int)buf[idx].len; /* close */ - if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) + if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf) < 0) goto out; - if (H5Sclose(sid)<0) + if (H5Sclose(sid) < 0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; if (buf) free(buf); @@ -2026,33 +2026,33 @@ herr_t H5DS_is_reserved(hid_t did) herr_t ret; /* try to find the attribute "CLASS" on the dataset */ - if ((has_class = H5LT_find_attribute(did,"CLASS"))<0) + if((has_class = H5LT_find_attribute(did, "CLASS")) < 0) return -1; - if ( has_class == 0 ) + if(has_class == 0) return 0; - assert( has_class == 1 ); - if ((aid = H5Aopen_name(did,"CLASS"))<0) + assert(has_class == 1); + if((aid = H5Aopen(did, ".", "CLASS", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ((tid = H5Aget_type(aid))<0) + if((tid = H5Aget_type(aid)) < 0) goto out; - if (H5Aread(aid,tid,buf)<0) + if(H5Aread(aid, tid, buf) < 0) goto out; - if ( strcmp(buf,IMAGE_CLASS)==0 || - strcmp(buf,PALETTE_CLASS)==0 || - strcmp(buf,TABLE_CLASS)==0 ) + if(strcmp(buf, IMAGE_CLASS) == 0 || + strcmp(buf, PALETTE_CLASS) == 0 || + strcmp(buf, TABLE_CLASS) == 0 ) ret = 1; else ret = 0; - if (H5Tclose(tid)<0) + if (H5Tclose(tid) < 0) goto out; - if (H5Aclose(aid)<0) + if (H5Aclose(aid) < 0) goto out; |