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 | |
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')
-rw-r--r-- | hl/fortran/src/H5IMcc.c | 10 | ||||
-rw-r--r-- | hl/src/H5DS.c | 458 | ||||
-rw-r--r-- | hl/src/H5IM.c | 143 | ||||
-rw-r--r-- | hl/src/H5LT.c | 26 |
4 files changed, 317 insertions, 320 deletions
diff --git a/hl/fortran/src/H5IMcc.c b/hl/fortran/src/H5IMcc.c index 12c6698..dc1cfc1 100644 --- a/hl/fortran/src/H5IMcc.c +++ b/hl/fortran/src/H5IMcc.c @@ -478,19 +478,19 @@ herr_t H5IM_get_palette( hid_t loc_id, hid_t pal_id; /* Open the dataset. */ - if ( (image_id = H5Dopen( loc_id, image_name )) < 0 ) + if((image_id = H5Dopen(loc_id, image_name)) < 0) return -1; /* Try to find the attribute "PALETTE" on the >>image<< dataset */ - has_pal = H5IM_find_palette( image_id ); + has_pal = H5IM_find_palette(image_id); - if ( has_pal == 1 ) + if(has_pal == 1 ) { - if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) + if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ( (attr_type = H5Aget_type( attr_id )) < 0 ) + if((attr_type = H5Aget_type(attr_id)) < 0) goto out; if ( (attr_class = H5Tget_class( attr_type )) < 0 ) 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; diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 70baf26..e6bd506 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -253,29 +253,29 @@ herr_t H5IMget_image_info( hid_t loc_id, *npals = 0; /* Open the dataset. */ - if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) + if((did = H5Dopen(loc_id, dset_name)) < 0) return -1; /* Try to find the attribute "INTERLACE_MODE" on the >>image<< dataset */ - has_attr = H5LT_find_attribute( did, "INTERLACE_MODE" ); + has_attr = H5LT_find_attribute(did, "INTERLACE_MODE"); /* It exists, get it */ - if ( has_attr == 1 ) + if(has_attr == 1) { - if ( (attr_id = H5Aopen_name( did, "INTERLACE_MODE" )) < 0 ) + if((attr_id = H5Aopen(did, ".", "INTERLACE_MODE", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ( (attr_type = H5Aget_type( attr_id )) < 0 ) + if((attr_type = H5Aget_type(attr_id)) < 0) goto out; - if ( H5Aread( attr_id, attr_type, interlace ) < 0 ) + if(H5Aread(attr_id, attr_type, interlace) < 0) goto out; - if ( H5Tclose( attr_type ) < 0 ) + if(H5Tclose(attr_type) < 0) goto out; - if ( H5Aclose( attr_id ) < 0 ) + if(H5Aclose(attr_id) < 0) goto out; } @@ -327,23 +327,23 @@ herr_t H5IMget_image_info( hid_t loc_id, /* Try to find the attribute "PALETTE" on the >>image<< dataset */ - has_pal = H5IM_find_palette( did ); + has_pal = H5IM_find_palette(did); - if ( has_pal == 1 ) + if(has_pal == 1) { - if ( (attr_id = H5Aopen_name( did, "PALETTE" )) < 0 ) + if((attr_id = H5Aopen(did, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ( (attr_type = H5Aget_type( attr_id )) < 0 ) + if((attr_type = H5Aget_type(attr_id)) < 0) goto out; - if ( (attr_class = H5Tget_class( attr_type )) < 0 ) + if((attr_class = H5Tget_class(attr_type)) < 0) goto out; /* Check if it is really a reference */ - if ( attr_class == H5T_REFERENCE ) + if(attr_class == H5T_REFERENCE) { /* Get the reference(s) */ @@ -563,7 +563,7 @@ herr_t H5IMlink_palette( hid_t loc_id, goto out; if ( H5Tclose( attr_type ) < 0 ) goto out; - if ( H5Aclose( attr_id ) < 0 ) + if(H5Aclose(attr_id) < 0) goto out; } @@ -572,23 +572,22 @@ herr_t H5IMlink_palette( hid_t loc_id, * The attribute already exists, open it *------------------------------------------------------------------------- */ - else if ( ok_pal == 1 ) - + else if(ok_pal == 1) { - if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) + if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ( (attr_type = H5Aget_type( attr_id )) < 0 ) + if((attr_type = H5Aget_type(attr_id)) < 0) goto out; - if ( (attr_class = H5Tget_class( attr_type )) < 0 ) + if((attr_class = H5Tget_class(attr_type)) < 0) goto out; /* Get and save the old reference(s) */ - if ( (attr_space_id = H5Aget_space( attr_id )) < 0 ) + if((attr_space_id = H5Aget_space(attr_id)) < 0) goto out; - n_refs = H5Sget_simple_extent_npoints( attr_space_id ); + n_refs = H5Sget_simple_extent_npoints(attr_space_id); dim_ref = n_refs + 1; @@ -699,29 +698,29 @@ herr_t H5IMunlink_palette( hid_t loc_id, return -1; /* Try to find the attribute "PALETTE" on the >>image<< dataset */ - ok_pal = H5LT_find_attribute( image_id, "PALETTE" ); + ok_pal = H5LT_find_attribute(image_id, "PALETTE"); /* It does not exist. Nothing to do */ - if ( ok_pal == 0 ) + if(ok_pal == 0) return -1; /* The attribute exists, open it */ - else if ( ok_pal == 1 ) + else if(ok_pal == 1) { - if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) + if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ( (attr_type = H5Aget_type( attr_id )) < 0 ) + if((attr_type = H5Aget_type(attr_id)) < 0) goto out; - if ( (attr_class = H5Tget_class( attr_type )) < 0 ) + if((attr_class = H5Tget_class(attr_type)) < 0) goto out; /* Check if it is really a reference */ - if ( attr_class == H5T_REFERENCE ) + if(attr_class == H5T_REFERENCE) { - /* Deelete the attribute */ + /* Delete the attribute */ if(H5Adelete2(image_id, ".", "PALETTE", H5P_DEFAULT) < 0) goto out; @@ -781,29 +780,29 @@ herr_t H5IMget_npalettes( hid_t loc_id, *npals = 0; /* Open the dataset. */ - if ( (image_id = H5Dopen( loc_id, image_name )) < 0 ) + if((image_id = H5Dopen(loc_id, image_name)) < 0) return -1; /* Try to find the attribute "PALETTE" on the >>image<< dataset */ - has_pal = H5IM_find_palette( image_id ); + has_pal = H5IM_find_palette(image_id); - if ( has_pal == 1 ) + if(has_pal == 1 ) { - if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) + if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ( (attr_type = H5Aget_type( attr_id )) < 0 ) + if((attr_type = H5Aget_type(attr_id)) < 0) goto out; - if ( (attr_class = H5Tget_class( attr_type )) < 0 ) + if((attr_class = H5Tget_class(attr_type)) < 0) goto out; /* Check if it is really a reference */ - if ( attr_class == H5T_REFERENCE ) + if(attr_class == H5T_REFERENCE) { - if ( (attr_space_id = H5Aget_space( attr_id )) < 0 ) + if((attr_space_id = H5Aget_space(attr_id)) < 0) goto out; *npals = H5Sget_simple_extent_npoints( attr_space_id ); @@ -874,28 +873,28 @@ herr_t H5IMget_palette_info( hid_t loc_id, hsize_t pal_maxdims[2]; /* Open the dataset. */ - if ( (image_id = H5Dopen( loc_id, image_name )) < 0 ) + if((image_id = H5Dopen(loc_id, image_name)) < 0) return -1; /* Try to find the attribute "PALETTE" on the >>image<< dataset */ - has_pal = H5IM_find_palette( image_id ); + has_pal = H5IM_find_palette(image_id); - if ( has_pal == 1 ) + if(has_pal == 1) { - if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) + if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ( (attr_type = H5Aget_type( attr_id )) < 0 ) + if((attr_type = H5Aget_type(attr_id)) < 0) goto out; - if ( (attr_class = H5Tget_class( attr_type )) < 0 ) + if((attr_class = H5Tget_class(attr_type)) < 0) goto out; /* Get the reference(s) */ - if ( (attr_space_id = H5Aget_space( attr_id )) < 0 ) + if((attr_space_id = H5Aget_space(attr_id)) < 0) goto out; - n_refs = H5Sget_simple_extent_npoints( attr_space_id ); + n_refs = H5Sget_simple_extent_npoints(attr_space_id); dim_ref = n_refs; @@ -986,28 +985,28 @@ herr_t H5IMget_palette( hid_t loc_id, hid_t pal_id; /* Open the dataset. */ - if ( (image_id = H5Dopen( loc_id, image_name )) < 0 ) + if((image_id = H5Dopen(loc_id, image_name)) < 0) return -1; /* Try to find the attribute "PALETTE" on the >>image<< dataset */ - has_pal = H5IM_find_palette( image_id ); + has_pal = H5IM_find_palette(image_id); - if ( has_pal == 1 ) + if(has_pal == 1 ) { - if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) + if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ( (attr_type = H5Aget_type( attr_id )) < 0 ) + if((attr_type = H5Aget_type(attr_id)) < 0) goto out; - if ( (attr_class = H5Tget_class( attr_type )) < 0 ) + if((attr_class = H5Tget_class(attr_type)) < 0) goto out; /* Get the reference(s) */ - if ( (attr_space_id = H5Aget_space( attr_id )) < 0 ) + if((attr_space_id = H5Aget_space(attr_id)) < 0) goto out; - n_refs = H5Sget_simple_extent_npoints( attr_space_id ); + n_refs = H5Sget_simple_extent_npoints(attr_space_id); dim_ref = n_refs; @@ -1089,30 +1088,29 @@ herr_t H5IMis_image( hid_t loc_id, return -1; /* Try to find the attribute "CLASS" on the dataset */ - has_class = H5LT_find_attribute( did, "CLASS" ); + has_class = H5LT_find_attribute(did, "CLASS"); - if ( has_class == 0 ) + if(has_class == 0) { - H5Dclose( did ); + H5Dclose(did); return 0; } - - else if ( has_class == 1 ) + else if(has_class == 1) { - if ( (attr_id = H5Aopen_name( did, "CLASS" )) < 0 ) + if((attr_id = H5Aopen(did, ".", "CLASS", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ( (attr_type = H5Aget_type( attr_id )) < 0 ) + if((attr_type = H5Aget_type(attr_id)) < 0) goto out; - if ( H5Tget_class( attr_type ) < 0 ) + if(H5Tget_class(attr_type) < 0) goto out; - if ( H5Aread( attr_id, attr_type, attr_data ) < 0 ) + if(H5Aread(attr_id, attr_type, attr_data) < 0) goto out; - if( strcmp( attr_data, IMAGE_CLASS ) == 0 ) + if(strcmp(attr_data, IMAGE_CLASS) == 0) ret = 1; else ret = 0; @@ -1175,30 +1173,29 @@ herr_t H5IMis_palette( hid_t loc_id, return -1; /* Try to find the attribute "CLASS" on the dataset */ - has_class = H5LT_find_attribute( did, "CLASS" ); + has_class = H5LT_find_attribute(did, "CLASS"); - if ( has_class == 0 ) + if(has_class == 0) { H5Dclose( did ); return 0; } - - else if ( has_class == 1 ) + else if(has_class == 1) { - if ( (attr_id = H5Aopen_name( did, "CLASS" )) < 0 ) + if((attr_id = H5Aopen(did, ".", "CLASS", H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if ( (attr_type = H5Aget_type( attr_id )) < 0 ) + if((attr_type = H5Aget_type(attr_id)) < 0) goto out; - if ( H5Tget_class( attr_type ) < 0 ) + if(H5Tget_class(attr_type) < 0) goto out; - if ( H5Aread( attr_id, attr_type, attr_data ) < 0 ) + if(H5Aread(attr_id, attr_type, attr_data) < 0) goto out; - if( strcmp( attr_data, PALETTE_CLASS ) == 0 ) + if(strcmp(attr_data, PALETTE_CLASS) == 0) ret = 1; else ret = 0; diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 6e47549..1810c1e 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1718,22 +1718,22 @@ herr_t H5LTget_attribute_ndims( hid_t loc_id, hid_t obj_id; /* Open the object */ - if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) + if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; /* Open the attribute. */ - if ( ( attr_id = H5Aopen_name( obj_id, attr_name ) ) < 0 ) + if((attr_id = H5Aopen(obj_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5Oclose(obj_id); return -1; } /* Get the dataspace handle */ - if ( (sid = H5Aget_space( attr_id )) < 0 ) + if((sid = H5Aget_space(attr_id)) < 0) goto out; /* Get rank */ - if ( (*rank = H5Sget_simple_extent_ndims( sid )) < 0 ) + if((*rank = H5Sget_simple_extent_ndims(sid)) < 0) goto out; /* Terminate access to the attribute */ @@ -1785,21 +1785,21 @@ herr_t H5LTget_attribute_info( hid_t loc_id, hid_t obj_id; /* Open the object */ - if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) + if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; /* Open the attribute. */ - if ( ( attr_id = H5Aopen_name( obj_id, attr_name ) ) < 0 ) + if((attr_id = H5Aopen(obj_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5Oclose(obj_id); return -1; } /* Get an identifier for the datatype. */ - tid = H5Aget_type( attr_id ); + tid = H5Aget_type(attr_id); /* Get the class. */ - *type_class = H5Tget_class( tid ); + *type_class = H5Tget_class(tid); /* Get the size. */ *type_size = H5Tget_size( tid ); @@ -2999,7 +2999,7 @@ static herr_t H5LT_get_attribute_mem(hid_t loc_id, if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) goto out; - if((attr_id = H5Aopen_name(obj_id, attr_name)) < 0) + if((attr_id = H5Aopen(obj_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Aread(attr_id, mem_type_id, data) < 0) @@ -3048,16 +3048,16 @@ herr_t H5LT_get_attribute_disk( hid_t loc_id, hid_t attr_id; hid_t attr_type; - if ( ( attr_id = H5Aopen_name( loc_id, attr_name ) ) < 0 ) + if(( attr_id = H5Aopen(loc_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0) return -1; - if ( (attr_type = H5Aget_type( attr_id )) < 0 ) + if((attr_type = H5Aget_type(attr_id)) < 0) goto out; - if ( H5Aread( attr_id, attr_type, attr_out ) < 0 ) + if(H5Aread(attr_id, attr_type, attr_out) < 0) goto out; - if ( H5Tclose( attr_type ) < 0 ) + if(H5Tclose(attr_type) < 0) goto out; if ( H5Aclose( attr_id ) < 0 ) |