diff options
-rw-r--r-- | c++/src/H5Object.cpp | 4 | ||||
-rw-r--r-- | examples/Attributes.txt | 8 | ||||
-rw-r--r-- | examples/h5_attribute.c | 4 | ||||
-rw-r--r-- | fortran/src/H5Af.c | 13 | ||||
-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 | ||||
-rw-r--r-- | src/H5Adeprec.c | 2 | ||||
-rw-r--r-- | src/H5Apublic.h | 2 | ||||
-rw-r--r-- | test/dangle.c | 25 | ||||
-rwxr-xr-x | test/objcopy.c | 2 | ||||
-rw-r--r-- | test/tattr.c | 84 | ||||
-rw-r--r-- | test/th5s.c | 4 | ||||
-rw-r--r-- | test/tmisc.c | 4 | ||||
-rw-r--r-- | test/tsohm.c | 10 | ||||
-rw-r--r-- | test/ttsafe_acreate.c | 44 | ||||
-rw-r--r-- | test/tvlstr.c | 8 | ||||
-rw-r--r-- | testpar/t_mdset.c | 14 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 6 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 35 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 14 |
22 files changed, 462 insertions, 458 deletions
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index e298153..cae9155 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -139,7 +139,7 @@ Attribute H5Object::createAttribute( const H5std_string& name, const DataType& d //-------------------------------------------------------------------------- Attribute H5Object::openAttribute( const char* name ) const { - hid_t attr_id = H5Aopen_name( id, name ); + hid_t attr_id = H5Aopen( id, ".", name, H5P_DEFAULT, H5P_DEFAULT ); if( attr_id > 0 ) { Attribute attr( attr_id ); @@ -147,7 +147,7 @@ Attribute H5Object::openAttribute( const char* name ) const } else { - throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_name failed"); + throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed"); } } diff --git a/examples/Attributes.txt b/examples/Attributes.txt index 4af986b..69db544 100644 --- a/examples/Attributes.txt +++ b/examples/Attributes.txt @@ -88,7 +88,7 @@ H5Aread Example: Attach to an attribute of a dataset and read in attr. data dataset=H5Dopen(file,"Dataset1"); /* Get the OID of the attribute */ - attr=H5Aopen_name(dataset,"Attr1"); + attr=H5Aopen(dataset, ".", "Attr1", H5P_DEFAULT, H5P_DEFAULT); /* Read attribute */ H5Aread(attr,H5T_INT32,attr_data); @@ -114,13 +114,13 @@ H5Alink Example: Shows how to share an attribute between two datasets. file=H5Fopen("example.h5", H5F_ACC_RDWR, H5P_DEFAULT); /* Open the first dataset */ - dataset1=H5Dopen(file,"Dataset1"); + dataset1=H5Dopen(file, "Dataset1"); /* Open the first dataset */ - dataset2=H5Dopen(file,"Dataset2"); + dataset2=H5Dopen(file, "Dataset2"); /* Get the OID of the attribute */ - attr=H5Aopen_name(dataset1,"Foo"); + attr=H5Aopen(dataset1, ".", "Foo", H5P_DEFAULT, H5P_DEFAULT); /* * Create an attribute in the second dataset to the attribute in dataset1, diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index 93fda77..3ce72be 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -184,7 +184,7 @@ main (void) * Attach to the scalar attribute using attribute name, then read and * display its value. */ - attr = H5Aopen_name(dataset,"Integer attribute"); + attr = H5Aopen(dataset, ".", "Integer attribute", H5P_DEFAULT, H5P_DEFAULT); ret = H5Aread(attr, H5T_NATIVE_INT, &point_out); printf("The value of the attribute \"Integer attribute\" is %d \n", point_out); ret = H5Aclose(attr); @@ -241,7 +241,7 @@ attr_info(hid_t loc_id, const char *name, const H5A_info_t *ainfo, void *opdata) /* * Open the attribute using its name. */ - attr = H5Aopen_name(loc_id, name); + attr = H5Aopen(loc_id, ".", name, H5P_DEFAULT, H5P_DEFAULT); /* * Display attribute name. diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c index 293d4c0..4d66103 100644 --- a/fortran/src/H5Af.c +++ b/fortran/src/H5Af.c @@ -58,7 +58,7 @@ done: /*---------------------------------------------------------------------------- * Name: h5aopen_name _c - * Purpose: Call H5Aopen_name to open an attribute + * Purpose: Call H5Aopen to open an attribute * Inputs: obj_id - object identifier * name - name of the attribute * namelen - name length @@ -71,23 +71,24 @@ done: int_f nh5aopen_name_c (hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *attr_id) { - char *c_name=NULL; /* Buffer to hold C string */ - int_f ret_value=0; /* Return value */ + char *c_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ /* * Convert FORTRAN name to C name */ - if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL) + if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL) HGOTO_DONE(FAIL); /* * Call H5Aopen function. */ - if ((*attr_id = (hid_t_f)H5Aopen_name((hid_t)*obj_id, c_name)) < 0) + if((*attr_id = (hid_t_f)H5Aopen((hid_t)*obj_id, ".", c_name, H5P_DEFAULT, H5P_DEFAULT)) < 0) HGOTO_DONE(FAIL); done: - if(c_name) HDfree(c_name); + if(c_name) + HDfree(c_name); return ret_value; } 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 ) diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 5fb8dca..1ff98c0 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -164,6 +164,7 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Acreate() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- NAME @@ -220,7 +221,6 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Aopen_name() */ -#ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- NAME diff --git a/src/H5Apublic.h b/src/H5Apublic.h index 3908455..911b7b1 100644 --- a/src/H5Apublic.h +++ b/src/H5Apublic.h @@ -82,7 +82,6 @@ H5_DLL herr_t H5Adelete_by_idx(hid_t loc_id, const char *obj_name, */ H5_DLL hid_t H5Acreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t plist_id); -H5_DLL hid_t H5Aopen_name(hid_t loc_id, const char *name); /* Symbols defined for compatibility with previous versions of the HDF5 API. * @@ -101,6 +100,7 @@ typedef herr_t (*H5A_operator1_t)(hid_t location_id/*in*/, /* Function prototypes */ +H5_DLL hid_t H5Aopen_name(hid_t loc_id, const char *name); H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx); H5_DLL int H5Aget_num_attrs(hid_t loc_id); H5_DLL herr_t H5Adelete1(hid_t loc_id, const char *name); diff --git a/test/dangle.c b/test/dangle.c index cbd29a1..84cc965 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -463,38 +463,37 @@ test_dangle_attribute(H5F_close_degree_t degree) /* Don't worry about writing the attribute - it will have a fill value */ /* Close the attribute on the dataset */ - if(H5Aclose (aid)<0) + if(H5Aclose(aid) < 0) TEST_ERROR; /* Try creating duplicate attribute */ H5E_BEGIN_TRY { - if((aid = H5Acreate (dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT))>=0) + if((aid = H5Acreate(dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT)) >= 0) TEST_ERROR; } H5E_END_TRY; - if(H5Sclose(sid)<0) + if(H5Sclose(sid) < 0) TEST_ERROR; /* Leave open a _lot_ of objects */ - for(u=0; u<MAX_DANGLE; u++) { - if((aid = H5Aopen_name (dsid, ATTRNAME))<0) - TEST_ERROR; - } /* end for */ + for(u = 0; u < MAX_DANGLE; u++) + if((aid = H5Aopen(dsid, ".", ATTRNAME, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR - if(H5Dclose(dsid)<0) - TEST_ERROR; + if(H5Dclose(dsid) < 0) + TEST_ERROR - if(degree==H5F_CLOSE_SEMI) { + if(degree == H5F_CLOSE_SEMI) { H5E_BEGIN_TRY { - if(H5Fclose(fid)>=0) + if(H5Fclose(fid) >= 0) TEST_ERROR; } H5E_END_TRY; } /* end if */ else - if(H5Fclose(fid)<0) + if(H5Fclose(fid) < 0) TEST_ERROR; - if(H5Pclose(fapl)<0) + if(H5Pclose(fapl) < 0) TEST_ERROR; if(H5close()<0) diff --git a/test/objcopy.c b/test/objcopy.c index 88828d4..119ad82 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -792,7 +792,7 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid) if((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Aget_name(aid, ATTR_NAME_LEN, attr_name) < 0) TEST_ERROR - if((aid2 = H5Aopen_name(oid2, attr_name)) < 0) TEST_ERROR + if((aid2 = H5Aopen(oid2, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check the attributes are equal */ if(!compare_attribute(aid, aid2, pid, NULL, oid)) TEST_ERROR diff --git a/test/tattr.c b/test/tattr.c index 4e3058e..b88ba5f 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -204,8 +204,8 @@ test_attr_basic_write(hid_t fapl) CHECK(group, FAIL, "H5Gopen2"); /* Open attribute again */ - attr = H5Aopen_name(group, ATTR1_NAME); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(group, ".", ATTR1_NAME, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); /* Close attribute */ ret = H5Aclose(attr); @@ -262,8 +262,8 @@ test_attr_basic_write(hid_t fapl) CHECK(ret, FAIL, "H5Arename2"); /* Open attribute again */ - attr = H5Aopen_name(dataset, ATTR_TMP_NAME); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset, ".", ATTR_TMP_NAME, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); /* Verify new attribute name */ attr_name_size = H5Aget_name(attr, (size_t)0, NULL); @@ -294,8 +294,8 @@ test_attr_basic_write(hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Open the second attribute again */ - attr2=H5Aopen_name(dataset, ATTR1A_NAME); - CHECK(attr, FAIL, "H5Aopen_name"); + attr2=H5Aopen(dataset, ".", ATTR1A_NAME, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); /* Verify new attribute name */ attr_name_size = H5Aget_name(attr2, (size_t)0, NULL); @@ -415,8 +415,8 @@ test_attr_basic_read(hid_t fapl) VERIFY(oinfo.num_attrs, 2, "H5Oget_info"); /* Open first attribute for the dataset */ - attr = H5Aopen_name(dataset, ATTR_TMP_NAME); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset, ".", ATTR_TMP_NAME, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); /* Read attribute information */ ret = H5Aread(attr, H5T_NATIVE_INT, read_data1); @@ -444,8 +444,8 @@ test_attr_basic_read(hid_t fapl) VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); /* Open the attribute for the group */ - attr = H5Aopen_name(group, ATTR2_NAME); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(group, ".", ATTR2_NAME, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); /* Read attribute information */ ret = H5Aread(attr, H5T_NATIVE_INT, read_data2); @@ -627,8 +627,8 @@ test_attr_plist(hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Re-open the second attribute and ensure that its character encoding is correct */ - attr = H5Aopen_name(dataset, ATTR2_NAME); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset, ".", ATTR2_NAME, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); plist = H5Aget_create_plist(attr); CHECK(plist, FAIL, "H5Aget_create_plist"); ret = H5Pget_char_encoding(plist, &cset); @@ -989,8 +989,8 @@ test_attr_scalar_read(hid_t fapl) VERIFY(oinfo.num_attrs, 1, "H5Oget_info"); /* Open an attribute for the dataset */ - attr = H5Aopen_name(dataset, ATTR5_NAME); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset, ".", ATTR5_NAME, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); /* Read attribute information */ ret = H5Aread(attr, H5T_NATIVE_FLOAT, &rdata); @@ -1733,8 +1733,8 @@ test_attr_dtype_shared(hid_t fapl) CHECK(dset_id, FAIL, "H5Dopen"); /* Open attribute */ - attr_id = H5Aopen_name(dset_id, ATTR1_NAME); - CHECK(attr_id, FAIL, "H5Aopen_name"); + attr_id = H5Aopen(dset_id, ".", ATTR1_NAME, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr_id, FAIL, "H5Aopen"); /* Read data from the attribute */ ret = H5Aread(attr_id, H5T_NATIVE_INT, &rdata); @@ -1800,8 +1800,8 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) for(u = 0; u < max_attr; u++) { /* Open attribute */ sprintf(attrname, "attr %02u", u); - attr = H5Aopen_name(loc_id, attrname); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(loc_id, ".", attrname, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); /* Read data from the attribute */ ret = H5Aread(attr, H5T_NATIVE_UINT, &value); @@ -2423,8 +2423,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) /* Open attribute */ sprintf(attrname, "new attr %02u", u); - attr = H5Aopen_name(dataset, attrname); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); /* Read data from the attribute */ ret = H5Aread(attr, H5T_NATIVE_UINT, &value); @@ -3157,8 +3157,8 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) /* Open first attribute */ HDstrcpy(attrname, "null attr #2"); - attr = H5Aopen_name(dataset, attrname); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); /* Try to read data from the attribute */ /* (shouldn't fail, but should leave buffer alone) */ @@ -3196,8 +3196,8 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) /* Open second attribute */ HDstrcpy(attrname, "null attr"); - attr = H5Aopen_name(dataset, attrname); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); /* Try to write data to the attribute */ /* (shouldn't fail, but should leave buffer alone) */ @@ -3307,7 +3307,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) ret = H5Aget_num_attrs(dataset); VERIFY(ret, 1, "H5Aget_num_attrs"); - /* Open the attribute */ + /* Open the attribute by index */ attr = H5Aopen_idx(dataset, 0); CHECK(attr, FAIL, "H5Aopen_idx"); @@ -3315,6 +3315,14 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); + /* Open the attribute by name */ + attr = H5Aopen_name(dataset, "attr"); + CHECK(attr, FAIL, "H5Aopen_name"); + + /* Close attribute */ + ret = H5Aclose(attr); + CHECK(ret, FAIL, "H5Aclose"); + /* Rename attribute */ ret = H5Arename1(dataset, "attr", "attr2"); @@ -3401,8 +3409,8 @@ test_attr_many(hid_t fcpl, hid_t fapl) sprintf(attrname, "a-%06u", u); - aid = H5Aopen_name(fid, attrname); - CHECK(aid, FAIL, "H5Aopen_name"); + aid = H5Aopen(fid, ".", attrname, H5P_DEFAULT, H5P_DEFAULT); + CHECK(aid, FAIL, "H5Aopen"); ret = H5Aread(aid, H5T_NATIVE_UINT, &value); CHECK(ret, FAIL, "H5Aread"); @@ -7315,8 +7323,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Check refcount on attributes now */ /* Check refcount on renamed attribute */ - attr = H5Aopen_name(dataset2, attrname2); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset2, ".", attrname2, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); if(u % 2) { /* Check that attribute is not shared */ @@ -7339,8 +7347,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check refcount on original attribute */ - attr = H5Aopen_name(dataset, attrname); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); if(u % 2) { /* Check that attribute is not shared */ @@ -7371,8 +7379,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Check refcount on attributes now */ /* Check refcount on renamed attribute */ - attr = H5Aopen_name(dataset2, attrname); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset2, ".", attrname, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); if(u % 2) { /* Check that attribute is not shared */ @@ -7395,8 +7403,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Check refcount on original attribute */ - attr = H5Aopen_name(dataset, attrname); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); if(u % 2) { /* Check that attribute is not shared */ @@ -7759,8 +7767,8 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Check refcount on attributes now */ /* Check refcount on first dataset's attribute */ - attr = H5Aopen_name(dataset, attrname); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); if(u % 2) { /* Check that attribute is not shared */ @@ -8133,7 +8141,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) sprintf(attrname, "attr %02u", u); /* Open attribute on first dataset */ - attr = H5Aopen_name(dataset, attrname); + attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate"); if(u % 2) { diff --git a/test/th5s.c b/test/th5s.c index a67d5a2..e9f7951 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -495,8 +495,8 @@ test_h5s_null(void) CHECK(ret, FAIL, "H5Sclose"); /* Open the attribute for the dataset */ - attr=H5Aopen_name(did,NULLATTR); - CHECK(attr, FAIL, "H5Aopen_name"); + attr = H5Aopen(did, ".", NULLATTR, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); /* Get the space of the dataset */ attr_sid = H5Aget_space(attr); diff --git a/test/tmisc.c b/test/tmisc.c index aa95bb0..5fee9dc 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -497,8 +497,8 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name root = H5Gopen2(file, "/", H5P_DEFAULT); CHECK(root, FAIL, "H5Gopen2"); - att = H5Aopen_name(root, att_name); - CHECK(att, FAIL, "H5Aopen_name"); + att = H5Aopen(root, ".", att_name, H5P_DEFAULT, H5P_DEFAULT); + CHECK(att, FAIL, "H5Aopen"); ret = H5Aread(att, type, &data_check); CHECK(ret, FAIL, "H5Aread"); diff --git a/test/tsohm.c b/test/tsohm.c index e0ddc8c..5b003c3 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -1891,10 +1891,10 @@ static void size2_verify(void) attr_correct_string[0] = attr_name[0] = (x / 10) + '0'; attr_correct_string[1] = attr_name[1] = (x % 10) + '0'; - attr1_id = H5Aopen_name(group1_id, attr_name); - CHECK_I(attr1_id, "H5Aopen_name"); - attr2_id = H5Aopen_name(group2_id, attr_name); - CHECK_I(attr2_id, "H5Aopen_name"); + attr1_id = H5Aopen(group1_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT); + CHECK_I(attr1_id, "H5Aopen"); + attr2_id = H5Aopen(group2_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT); + CHECK_I(attr2_id, "H5Aopen"); ret = H5Aread(attr1_id, attr_type_id, attr_string); CHECK_I(ret, "H5Aread"); @@ -2618,7 +2618,7 @@ static void delete_helper_read(hid_t file_id, hid_t *dspace_id, int x) VERIFY(rdata, (x + 'a'), "H5Dread"); /* Open attribute */ - attr_id = H5Aopen_name(dset_id, "attr_name"); + attr_id = H5Aopen(dset_id, ".", "attr_name", H5P_DEFAULT, H5P_DEFAULT); CHECK_I(attr_id, "H5Aopen"); /* Read */ diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c index d48077c..cfc250b 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -112,47 +112,47 @@ void tts_acreate(void) * Simultaneously create a large number of attributes to be associated * with the dataset */ - for (i = 0; i < NUM_THREADS; i++) { + for(i = 0; i < NUM_THREADS; i++) { attrib_data = malloc(sizeof(ttsafe_name_data_t)); attrib_data->dataset = dataset; attrib_data->datatype = datatype; attrib_data->dataspace = dataspace; attrib_data->current_index = i; - ret=pthread_create(&threads[i], NULL, tts_acreate_thread, attrib_data); - assert(ret==0); - } + ret = pthread_create(&threads[i], NULL, tts_acreate_thread, attrib_data); + assert(ret == 0); + } /* end for */ - for (i = 0; i < NUM_THREADS; i++) { - ret=pthread_join(threads[i], NULL); - assert(ret==0); - } + for(i = 0; i < NUM_THREADS; i++) { + ret = pthread_join(threads[i], NULL); + assert(ret == 0); + } /* end for */ /* verify the correctness of the test */ - for (i = 0; i < NUM_THREADS; i++) { - attribute = H5Aopen_name(dataset,gen_name(i)); + for(i = 0; i < NUM_THREADS; i++) { + attribute = H5Aopen(dataset, ".", gen_name(i), H5P_DEFAULT, H5P_DEFAULT); - if (attribute < 0) + if(attribute < 0) TestErrPrintf("unable to open appropriate attribute. Test failed!\n"); else { ret = H5Aread(attribute, H5T_NATIVE_INT, &buffer); - if (ret < 0 || buffer != i) + if(ret < 0 || buffer != i) TestErrPrintf("wrong data values. Test failed!\n"); H5Aclose(attribute); - } - } + } /* end else */ + } /* end for */ /* close remaining resources */ - ret=H5Sclose(dataspace); - assert(ret>=0); - ret=H5Tclose(datatype); - assert(ret>=0); - ret=H5Dclose(dataset); - assert(ret>=0); - ret=H5Fclose(file); - assert(ret>=0); + ret = H5Sclose(dataspace); + assert(ret >= 0); + ret = H5Tclose(datatype); + assert(ret >= 0); + ret = H5Dclose(dataset); + assert(ret >= 0); + ret = H5Fclose(file); + assert(ret >= 0); } void *tts_acreate_thread(void *client_data) diff --git a/test/tvlstr.c b/test/tvlstr.c index a0eedc6..a758a9e 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -680,8 +680,8 @@ static void test_read_vl_string_attribute(void) CHECK(root, FAIL, "H5Gopen2"); /* Test reading "normal" sized string attribute */ - att = H5Aopen_name(root, "test_scalar"); - CHECK(att, FAIL, "H5Aopen_name"); + att = H5Aopen(root, ".", "test_scalar", H5P_DEFAULT, H5P_DEFAULT); + CHECK(att, FAIL, "H5Aopen"); ret = H5Aread(att, type, &string_att_check); CHECK(ret, FAIL, "H5Aread"); @@ -695,8 +695,8 @@ static void test_read_vl_string_attribute(void) CHECK(ret, FAIL, "HAclose"); /* Test reading "large" sized string attribute */ - att = H5Aopen_name(root, "test_scalar_large"); - CHECK(att, FAIL, "H5Aopen_name"); + att = H5Aopen(root, ".", "test_scalar_large", H5P_DEFAULT, H5P_DEFAULT); + CHECK(att, FAIL, "H5Aopen"); ret = H5Aread(att, type, &string_att_check); CHECK(ret, FAIL, "H5Aread"); diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 085fbfc..83421cb 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -380,8 +380,8 @@ void null_dataset(void) VRFY((uval==2), "H5Dread"); /* Open the attribute for the dataset */ - attr=H5Aopen_name(dataset,attr_name); - VRFY((attr>=0), "H5Aopen_name"); + attr = H5Aopen(dataset, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT); + VRFY((attr >= 0), "H5Aopen"); /* Try reading from the attribute (make certain our buffer is unmodified) */ ret = H5Aread(attr, H5T_NATIVE_INT, &val); VRFY((ret>=0), "H5Aread"); @@ -1330,11 +1330,10 @@ int read_attribute(hid_t obj_id, int this_type, int num) if(this_type == is_group) { sprintf(attr_name, "Group Attribute %d", num); - aid = H5Aopen_name(obj_id, attr_name); + aid = H5Aopen(obj_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT); if(MAINPROCESS) { H5Aread(aid, H5T_NATIVE_INT, &in_num); - vrfy_errors = dataset_vrfy(NULL, NULL, NULL, group_block, - &in_num, &num); + vrfy_errors = dataset_vrfy(NULL, NULL, NULL, group_block, &in_num, &num); } H5Aclose(aid); } @@ -1342,11 +1341,10 @@ int read_attribute(hid_t obj_id, int this_type, int num) sprintf(attr_name, "Dataset Attribute %d", num); for(i=0; i<8; i++) out_data[i] = i; - aid = H5Aopen_name(obj_id, attr_name); + aid = H5Aopen(obj_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT); if(MAINPROCESS) { H5Aread(aid, H5T_NATIVE_INT, in_data); - vrfy_errors = dataset_vrfy(NULL, NULL, NULL, dset_block, in_data, - out_data); + vrfy_errors = dataset_vrfy(NULL, NULL, NULL, dset_block, in_data, out_data); } H5Aclose(aid); } diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index ba72442..01a624c 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -1234,7 +1234,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t UNUSED *info, vo begin_obj(dump_header_format->attributebegin, attr_name, dump_header_format->attributeblockbegin); - if((attr_id = H5Aopen_name(oid, attr_name)) < 0) { + if((attr_id = H5Aopen(oid, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0) { indentation(indent + COL); error_msg(progname, "unable to open attribute \"%s\"\n", attr_name); indentation(indent); @@ -1318,7 +1318,7 @@ dump_selected_attr(hid_t loc_id, const char *name) return FAIL; } /* end if */ - if((attr_id = H5Aopen_name(oid, attr_name)) >= 0) { + if((attr_id = H5Aopen(oid, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { hid_t type, space; type = H5Aget_type(attr_id); @@ -5090,7 +5090,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info, printf("<%sAttribute Name=\"%s\">\n",xmlnsprefix, t_aname); free(t_aname); - if ((attr_id = H5Aopen_name(attr, attr_name)) >= 0) { + if ((attr_id = H5Aopen(attr, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { type = H5Aget_type(attr_id); space = H5Aget_space(attr_id); space_type = H5Sget_simple_extent_type(space); diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index e12b447..06de2bc 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -1336,20 +1336,21 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, printf(" Attribute: "); n = display_string(stdout, attr_name, TRUE); - printf("%*s", MAX(0, 9-n), ""); + printf("%*s", MAX(0, (9 - n)), ""); - if ((attr = H5Aopen_name(obj, attr_name))) { + if((attr = H5Aopen(obj, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT))) { space = H5Aget_space(attr); type = H5Aget_type(attr); /* Data space */ ndims = H5Sget_simple_extent_dims(space, size, NULL); space_type = H5Sget_simple_extent_type(space); - switch (space_type) { + switch(space_type) { case H5S_SCALAR: /* scalar dataspace */ puts(" scalar"); break; + case H5S_SIMPLE: /* simple dataspace */ printf(" {"); @@ -1359,15 +1360,17 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, } puts("}"); break; + case H5S_NULL: /* null dataspace */ puts(" null"); break; + default: /* Unknown dataspace type */ puts(" unknown"); break; - } + } /* end switch */ /* Data type */ printf(" Type: "); @@ -1377,7 +1380,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, /* Data */ memset(&info, 0, sizeof info); info.line_multi_new = 1; - if (nelmts<5) { + if(nelmts < 5) { info.idx_fmt = ""; info.line_1st = " Data: "; info.line_pre = " "; @@ -1393,43 +1396,43 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, } info.line_ncols = width_g; - if (label_g) info.cmpd_name = "%s="; - if (string_g && 1==H5Tget_size(type) && - H5T_INTEGER==H5Tget_class(type)) { + if(label_g) + info.cmpd_name = "%s="; + if(string_g && 1==H5Tget_size(type) && + H5T_INTEGER==H5Tget_class(type)) { info.ascii = TRUE; info.elmt_suf1 = ""; info.elmt_suf2 = ""; info.idx_fmt = "(%s)"; info.line_pre = " %s \""; info.line_suf = "\""; - } + } /* end if */ /* values of type reference */ info.obj_format = "-%lu:"H5_PRINTF_HADDR_FMT; info.obj_hidefileno = 0; - if (hexdump_g) + if(hexdump_g) p_type = H5Tcopy(type); else p_type = h5tools_get_native_type(type); - if (p_type>=0) { + if(p_type >= 0) { temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); - assert(temp_need==(hsize_t)((size_t)temp_need)); + assert(temp_need == (hsize_t)((size_t)temp_need)); need = (size_t)temp_need; buf = malloc(need); assert(buf); - if (H5Aread(attr, p_type, buf)>=0) + if(H5Aread(attr, p_type, buf) >= 0) h5tools_dump_mem(stdout, &info, attr, p_type, space, buf, -1); free(buf); H5Tclose(p_type); - } + } /* end if */ H5Sclose(space); H5Tclose(type); H5Aclose(attr); - } else { + } else putchar('\n'); - } return 0; } diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index d73b3c4..e94c723 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -95,26 +95,24 @@ hsize_t diff_attr(hid_t loc1_id, /* use the name on the first file to open the second file */ H5E_BEGIN_TRY { - if ((attr2_id = H5Aopen_name(loc2_id, name1))<0) - { + if((attr2_id = H5Aopen(loc2_id, ".", name1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - } } H5E_END_TRY; /* get name */ - if (H5Aget_name( attr2_id, 255, name2 )<0) + if(H5Aget_name(attr2_id, 255, name2) < 0) goto error; /* get the file datatype */ - if ((ftype1_id = H5Aget_type( attr1_id )) < 0 ) + if((ftype1_id = H5Aget_type(attr1_id)) < 0) goto error; - if ((ftype2_id = H5Aget_type( attr2_id )) < 0 ) + if((ftype2_id = H5Aget_type(attr2_id)) < 0) goto error; /* get the dataspace handle */ - if ((space1_id = H5Aget_space( attr1_id )) < 0 ) + if((space1_id = H5Aget_space(attr1_id)) < 0) goto error; - if ((space2_id = H5Aget_space( attr2_id )) < 0 ) + if((space2_id = H5Aget_space(attr2_id)) < 0) goto error; /* get dimensions */ |