[svn-r14217] Description:

Change H5Aopen -> H5Aopen_by_name, in order to be more consistent with
other new API routines.

	Re-add H5Aopen as a simpler routine, to open attributes on a particular
object.  (Much like the old H5Aopen_name routine).

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
This commit is contained in:
Quincey Koziol 2007-10-30 11:07:20 -05:00
parent aaddd739b4
commit dbff4af21c
22 changed files with 201 additions and 83 deletions

View File

@ -137,7 +137,7 @@ Attribute H5Object::createAttribute( const H5std_string& name, const DataType& d
//--------------------------------------------------------------------------
Attribute H5Object::openAttribute( const char* name ) const
{
hid_t attr_id = H5Aopen( id, ".", name, H5P_DEFAULT, H5P_DEFAULT );
hid_t attr_id = H5Aopen( id, name, H5P_DEFAULT );
if( attr_id > 0 )
{
Attribute attr( attr_id );

View File

@ -88,7 +88,7 @@ H5Aread Example: Attach to an attribute of a dataset and read in attr. data
dataset=H5Dopen2(file, "Dataset1", H5P_DEFAULT);
/* Get the OID of the attribute */
attr=H5Aopen(dataset, ".", "Attr1", H5P_DEFAULT, H5P_DEFAULT);
attr=H5Aopen(dataset, "Attr1", H5P_DEFAULT);
/* Read attribute */
H5Aread(attr,H5T_INT32,attr_data);
@ -120,7 +120,7 @@ H5Alink Example: Shows how to share an attribute between two datasets.
dataset2=H5Dopen2(file, "Dataset2", H5P_DEFAULT);
/* Get the OID of the attribute */
attr=H5Aopen(dataset1, ".", "Foo", H5P_DEFAULT, H5P_DEFAULT);
attr=H5Aopen(dataset1, "Foo", H5P_DEFAULT);
/*
* Create an attribute in the second dataset to the attribute in dataset1,

View File

@ -184,7 +184,7 @@ main (void)
* Attach to the scalar attribute using attribute name, then read and
* display its value.
*/
attr = H5Aopen(dataset, ".", "Integer attribute", H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, "Integer attribute", 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(loc_id, ".", name, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(loc_id, name, H5P_DEFAULT);
/*
* Display attribute name.

View File

@ -85,7 +85,7 @@ nh5aopen_name_c (hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *attr_id
/*
* Call H5Aopen function.
*/
if((*attr_id = (hid_t_f)H5Aopen((hid_t)*obj_id, ".", c_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((*attr_id = (hid_t_f)H5Aopen((hid_t)*obj_id, c_name, H5P_DEFAULT)) < 0)
HGOTO_DONE(FAIL);
done:

View File

@ -485,7 +485,7 @@ herr_t H5IM_get_palette(hid_t loc_id,
if(has_pal == 1)
{
if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(image_id, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
if((attr_type = H5Aget_type(attr_id)) < 0)

View File

@ -297,7 +297,7 @@ herr_t H5DSattach_scale(hid_t did,
else if ( has_dimlist == 1 )
{
if((aid = H5Aopen(did, ".", DIMENSION_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
goto out;
if((tid = H5Aget_type(aid)) < 0)
@ -450,7 +450,7 @@ herr_t H5DSattach_scale(hid_t did,
else if(has_reflist == 1)
{
if((aid = H5Aopen(dsid, ".", REFERENCE_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(dsid, REFERENCE_LIST, H5P_DEFAULT)) < 0)
goto out;
if((tid = H5Aget_type(aid)) < 0)
@ -674,7 +674,7 @@ herr_t H5DSdetach_scale(hid_t did,
*-------------------------------------------------------------------------
*/
if((aid = H5Aopen(did, ".", DIMENSION_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
return FAIL;
if((tid = H5Aget_type(aid)) < 0)
@ -758,7 +758,7 @@ herr_t H5DSdetach_scale(hid_t did,
*-------------------------------------------------------------------------
*/
if((aid = H5Aopen(dsid, ".", REFERENCE_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(dsid, REFERENCE_LIST, H5P_DEFAULT)) < 0)
goto out;
if((tid = H5Aget_type(aid)) < 0)
@ -1019,7 +1019,7 @@ htri_t H5DSis_attached(hid_t did,
if(has_dimlist == 1)
{
if((aid = H5Aopen(did, ".", DIMENSION_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
goto out;
if((tid = H5Aget_type(aid)) < 0)
@ -1096,7 +1096,7 @@ htri_t H5DSis_attached(hid_t did,
if(has_reflist == 1)
{
if((aid = H5Aopen(dsid, ".", REFERENCE_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(dsid, REFERENCE_LIST, H5P_DEFAULT)) < 0)
goto out;
if((tid = H5Aget_type(aid)) < 0)
@ -1278,7 +1278,7 @@ herr_t H5DSiterate_scales(hid_t did,
else if(has_dimlist == 1)
{
if((aid = H5Aopen(did, ".", DIMENSION_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
goto out;
if((tid = H5Aget_type(aid)) < 0)
goto out;
@ -1488,7 +1488,7 @@ herr_t H5DSset_label(hid_t did,
else
{
if((aid = H5Aopen(did, ".", DIMENSION_LABELS, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0)
goto out;
if((tid = H5Aget_type(aid)) < 0)
@ -1614,7 +1614,7 @@ ssize_t H5DSget_label(hid_t did,
*/
assert (has_labels == 1);
if((aid = H5Aopen(did, ".", DIMENSION_LABELS, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0)
goto out;
if((tid = H5Aget_type(aid)) < 0)
@ -1730,7 +1730,7 @@ ssize_t H5DSget_scale_name(hid_t did,
*-------------------------------------------------------------------------
*/
if((aid = H5Aopen(did, ".", "NAME", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(did, "NAME", H5P_DEFAULT)) < 0)
return FAIL;
/* get space */
@ -1839,7 +1839,7 @@ htri_t H5DSis_scale(hid_t did)
else
{
if((aid = H5Aopen(did, ".", "CLASS", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
goto out;
if((tid = H5Aget_type(aid)) < 0)
@ -1950,7 +1950,7 @@ int H5DSget_num_scales(hid_t did,
else
{
if((aid = H5Aopen(did, ".", DIMENSION_LIST, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(did, DIMENSION_LIST, H5P_DEFAULT)) < 0)
goto out;
if((tid = H5Aget_type(aid)) < 0)
goto out;
@ -2029,7 +2029,7 @@ herr_t H5DS_is_reserved(hid_t did)
return 0;
assert(has_class == 1);
if((aid = H5Aopen(did, ".", "CLASS", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
goto out;
if((tid = H5Aget_type(aid)) < 0)

View File

@ -263,7 +263,7 @@ herr_t H5IMget_image_info( hid_t loc_id,
if(has_attr == 1)
{
if((attr_id = H5Aopen(did, ".", "INTERLACE_MODE", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(did, "INTERLACE_MODE", H5P_DEFAULT)) < 0)
goto out;
if((attr_type = H5Aget_type(attr_id)) < 0)
@ -332,7 +332,7 @@ herr_t H5IMget_image_info( hid_t loc_id,
if(has_pal == 1)
{
if((attr_id = H5Aopen(did, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(did, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
if((attr_type = H5Aget_type(attr_id)) < 0)
@ -574,7 +574,7 @@ herr_t H5IMlink_palette( hid_t loc_id,
*/
else if(ok_pal == 1)
{
if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(image_id, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
if((attr_type = H5Aget_type(attr_id)) < 0)
@ -707,7 +707,7 @@ herr_t H5IMunlink_palette( hid_t loc_id,
/* The attribute exists, open it */
else if(ok_pal == 1)
{
if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(image_id, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
if((attr_type = H5Aget_type(attr_id)) < 0)
@ -789,7 +789,7 @@ herr_t H5IMget_npalettes( hid_t loc_id,
if(has_pal == 1 )
{
if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(image_id, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
if((attr_type = H5Aget_type(attr_id)) < 0)
@ -881,7 +881,7 @@ herr_t H5IMget_palette_info( hid_t loc_id,
if(has_pal == 1)
{
if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(image_id, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
if((attr_type = H5Aget_type(attr_id)) < 0)
@ -993,7 +993,7 @@ herr_t H5IMget_palette( hid_t loc_id,
if(has_pal == 1 )
{
if((attr_id = H5Aopen(image_id, ".", "PALETTE", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(image_id, "PALETTE", H5P_DEFAULT)) < 0)
goto out;
if((attr_type = H5Aget_type(attr_id)) < 0)
@ -1098,7 +1098,7 @@ herr_t H5IMis_image( hid_t loc_id,
else if(has_class == 1)
{
if((attr_id = H5Aopen(did, ".", "CLASS", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
goto out;
if((attr_type = H5Aget_type(attr_id)) < 0)
@ -1183,7 +1183,7 @@ herr_t H5IMis_palette( hid_t loc_id,
else if(has_class == 1)
{
if((attr_id = H5Aopen(did, ".", "CLASS", H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(did, "CLASS", H5P_DEFAULT)) < 0)
goto out;
if((attr_type = H5Aget_type(attr_id)) < 0)

View File

@ -1456,7 +1456,7 @@ herr_t H5LTget_attribute_ndims( hid_t loc_id,
return -1;
/* Open the attribute. */
if((attr_id = H5Aopen(obj_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0)
{
H5Oclose(obj_id);
return -1;
@ -1523,7 +1523,7 @@ herr_t H5LTget_attribute_info( hid_t loc_id,
return -1;
/* Open the attribute. */
if((attr_id = H5Aopen(obj_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0)
{
H5Oclose(obj_id);
return -1;
@ -2733,7 +2733,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(obj_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0)
goto out;
if(H5Aread(attr_id, mem_type_id, data) < 0)
@ -2782,7 +2782,7 @@ herr_t H5LT_get_attribute_disk( hid_t loc_id,
hid_t attr_id;
hid_t attr_type;
if(( attr_id = H5Aopen(loc_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if(( attr_id = H5Aopen(loc_id, attr_name, H5P_DEFAULT)) < 0)
return -1;
if((attr_type = H5Aget_type(attr_id)) < 0)

View File

@ -439,7 +439,67 @@ done:
PURPOSE
Opens an attribute for an object by looking up the attribute name
USAGE
hid_t H5Aopen(loc_id, obj_name, attr_name, aapl_id, lapl_id)
hid_t H5Aopen(loc_id, attr_name, aapl_id)
hid_t loc_id; IN: Object that attribute is attached to
const char *attr_name; IN: Name of attribute to locate and open
hid_t aapl_id; IN: Attribute access property list
RETURNS
ID of attribute on success, negative on failure
DESCRIPTION
This function opens an existing attribute for access. The attribute
name specified is used to look up the corresponding attribute for the
object. The attribute ID returned from this function must be released with
H5Aclose or resource leaks will develop.
--------------------------------------------------------------------------*/
hid_t
H5Aopen(hid_t loc_id, const char *attr_name, hid_t UNUSED aapl_id)
{
H5G_loc_t loc; /* Object location */
H5A_t *attr = NULL; /* Attribute opened */
hid_t ret_value;
FUNC_ENTER_API(H5Aopen, FAIL)
H5TRACE3("i", "i*si", loc_id, attr_name, aapl_id);
/* check arguments */
if(H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if(H5G_loc(loc_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
/* Read in attribute from object header */
if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, H5AC_ind_dxpl_id)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from object header")
attr->initialized = TRUE;
/* Finish initializing attribute */
if(H5A_open_common(&loc, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize attribute")
/* Register the attribute and get an ID for it */
if((ret_value = H5I_register(H5I_ATTR, attr)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register attribute for ID")
done:
/* Cleanup on failure */
if(ret_value < 0)
if(attr && H5A_close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen() */
/*--------------------------------------------------------------------------
NAME
H5Aopen_by_name
PURPOSE
Opens an attribute for an object by looking up the attribute name
USAGE
hid_t H5Aopen_by_name(loc_id, obj_name, attr_name, aapl_id, lapl_id)
hid_t loc_id; IN: Object that attribute is attached to
const char *obj_name; IN: Name of object relative to location
const char *attr_name; IN: Name of attribute to locate and open
@ -455,14 +515,14 @@ done:
H5Aclose or resource leaks will develop.
--------------------------------------------------------------------------*/
hid_t
H5Aopen(hid_t loc_id, const char *obj_name, const char *attr_name,
H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name,
hid_t UNUSED aapl_id, hid_t lapl_id)
{
H5G_loc_t loc; /* Object location */
H5A_t *attr = NULL; /* Attribute opened */
hid_t ret_value;
FUNC_ENTER_API(H5Aopen, FAIL)
FUNC_ENTER_API(H5Aopen_by_name, FAIL)
H5TRACE5("i", "i*s*sii", loc_id, obj_name, attr_name, aapl_id, lapl_id);
/* check arguments */
@ -495,7 +555,7 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
FUNC_LEAVE_API(ret_value)
} /* H5Aopen() */
} /* H5Aopen_by_name() */
/*--------------------------------------------------------------------------

View File

@ -43,8 +43,9 @@ typedef herr_t (*H5A_operator2_t)(hid_t location_id/*in*/,
/* Public function prototypes */
H5_DLL hid_t H5Acreate2(hid_t loc_id, const char *obj_name, const char *attr_name,
hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id);
H5_DLL hid_t H5Aopen(hid_t loc_id, const char *obj_name, const char *attr_name,
hid_t aapl_id, hid_t lapl_id);
H5_DLL hid_t H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id);
H5_DLL hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name,
const char *attr_name, hid_t aapl_id, hid_t lapl_id);
H5_DLL hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t aapl_id,
hid_t lapl_id);

View File

@ -476,7 +476,7 @@ test_dangle_attribute(H5F_close_degree_t degree)
/* Leave open a _lot_ of objects */
for(u = 0; u < MAX_DANGLE; u++)
if((aid = H5Aopen(dsid, ".", ATTRNAME, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((aid = H5Aopen(dsid, ATTRNAME, H5P_DEFAULT)) < 0)
TEST_ERROR
if(H5Dclose(dsid) < 0)

View File

@ -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(oid2, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if((aid2 = H5Aopen(oid2, attr_name, H5P_DEFAULT)) < 0) TEST_ERROR
/* Check the attributes are equal */
if(!compare_attribute(aid, aid2, pid, NULL, oid)) TEST_ERROR

View File

@ -204,7 +204,7 @@ test_attr_basic_write(hid_t fapl)
CHECK(group, FAIL, "H5Gopen2");
/* Open attribute again */
attr = H5Aopen(group, ".", ATTR1_NAME, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(group, ATTR1_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Close attribute */
@ -262,7 +262,7 @@ test_attr_basic_write(hid_t fapl)
CHECK(ret, FAIL, "H5Arename2");
/* Open attribute again */
attr = H5Aopen(dataset, ".", ATTR_TMP_NAME, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, ATTR_TMP_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Verify new attribute name */
@ -294,7 +294,7 @@ test_attr_basic_write(hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Open the second attribute again */
attr2=H5Aopen(dataset, ".", ATTR1A_NAME, H5P_DEFAULT, H5P_DEFAULT);
attr2=H5Aopen(dataset, ATTR1A_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Verify new attribute name */
@ -415,7 +415,7 @@ test_attr_basic_read(hid_t fapl)
VERIFY(oinfo.num_attrs, 2, "H5Oget_info");
/* Open first attribute for the dataset */
attr = H5Aopen(dataset, ".", ATTR_TMP_NAME, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, ATTR_TMP_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Read attribute information */
@ -444,7 +444,7 @@ test_attr_basic_read(hid_t fapl)
VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
/* Open the attribute for the group */
attr = H5Aopen(group, ".", ATTR2_NAME, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(group, ATTR2_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Read attribute information */
@ -627,7 +627,7 @@ 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(dataset, ".", ATTR2_NAME, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, ATTR2_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
plist = H5Aget_create_plist(attr);
CHECK(plist, FAIL, "H5Aget_create_plist");
@ -988,7 +988,7 @@ test_attr_scalar_read(hid_t fapl)
VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
/* Open an attribute for the dataset */
attr = H5Aopen(dataset, ".", ATTR5_NAME, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, ATTR5_NAME, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Read attribute information */
@ -1732,7 +1732,7 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(dset_id, FAIL, "H5Dopen2");
/* Open attribute */
attr_id = H5Aopen(dset_id, ".", ATTR1_NAME, H5P_DEFAULT, H5P_DEFAULT);
attr_id = H5Aopen(dset_id, ATTR1_NAME, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Aopen");
/* Read data from the attribute */
@ -1799,7 +1799,7 @@ 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(loc_id, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(loc_id, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Read data from the attribute */
@ -2422,7 +2422,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
/* Open attribute */
sprintf(attrname, "new attr %02u", u);
attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Read data from the attribute */
@ -3156,7 +3156,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Open first attribute */
HDstrcpy(attrname, "null attr #2");
attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Try to read data from the attribute */
@ -3195,7 +3195,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Open second attribute */
HDstrcpy(attrname, "null attr");
attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Try to write data to the attribute */
@ -3408,7 +3408,7 @@ test_attr_many(hid_t fcpl, hid_t fapl)
sprintf(attrname, "a-%06u", u);
aid = H5Aopen(fid, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
aid = H5Aopen(fid, attrname, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Aopen");
ret = H5Aread(aid, H5T_NATIVE_UINT, &value);
@ -6463,7 +6463,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
*-------------------------------------------------------------------------
*/
static int
attr_open_check(hid_t obj_id, unsigned max_attrs)
attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, unsigned max_attrs)
{
hid_t attr_id; /* ID of attribute to test */
H5A_info_t ainfo; /* Attribute info */
@ -6479,7 +6479,7 @@ attr_open_check(hid_t obj_id, unsigned max_attrs)
for(u = 0; u < max_attrs; u++) {
/* Open the attribute */
sprintf(attrname, "attr %02u", u);
attr_id = H5Aopen(obj_id, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
attr_id = H5Aopen(obj_id, attrname, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Aopen");
/* Get the attribute's information */
@ -6492,6 +6492,38 @@ attr_open_check(hid_t obj_id, unsigned max_attrs)
/* Close attribute */
ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");
/* Open the attribute */
attr_id = H5Aopen_by_name(obj_id, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Aopen_by_name");
/* Get the attribute's information */
ret = H5Aget_info(attr_id, &ainfo);
CHECK(ret, FAIL, "H5Aget_info");
/* Check that the object is the correct one */
VERIFY(ainfo.corder, u, "H5Aget_info");
/* Close attribute */
ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");
/* Open the attribute */
attr_id = H5Aopen_by_name(fid, dsetname, attrname, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Aopen_by_name");
/* Get the attribute's information */
ret = H5Aget_info(attr_id, &ainfo);
CHECK(ret, FAIL, "H5Aget_info");
/* Check that the object is the correct one */
VERIFY(ainfo.corder, u, "H5Aget_info");
/* Close attribute */
ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");
} /* end for */
/* Retrieve current # of errors */
@ -6525,6 +6557,7 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
hsize_t name_count; /* # of records in name index */
hsize_t corder_count; /* # of records in creation order index */
hbool_t use_index; /* Use index on creation order values */
const char *dsetname; /* Name of dataset for attributes */
char attrname[NAME_BUF_SIZE]; /* Name of attribute */
unsigned curr_dset; /* Current dataset to work on */
unsigned u; /* Local index variable */
@ -6573,14 +6606,17 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
switch(curr_dset) {
case 0:
my_dataset = dset1;
dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
dsetname = DSET3_NAME;
break;
default:
@ -6594,9 +6630,15 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for opening a non-existant attribute on an object with no attributes */
ret = H5Aopen(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen");
ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen_by_name");
ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen_by_name");
/* Create attributes, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
/* Create attribute */
@ -6627,11 +6669,17 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
VERIFY(is_dense, FALSE, "H5O_is_attr_dense_test");
/* Check for opening a non-existant attribute on an object with compact attribute storage */
ret = H5Aopen(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen");
ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen_by_name");
ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen_by_name");
/* Test opening attributes stored compactly */
ret = attr_open_check(my_dataset, u);
ret = attr_open_check(fid, dsetname, my_dataset, u);
CHECK(ret, FAIL, "attr_open_check");
} /* end for */
@ -6641,14 +6689,17 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
switch(curr_dset) {
case 0:
my_dataset = dset1;
dsetname = DSET1_NAME;
break;
case 1:
my_dataset = dset2;
dsetname = DSET2_NAME;
break;
case 2:
my_dataset = dset3;
dsetname = DSET3_NAME;
break;
default:
@ -6700,11 +6751,17 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
} /* end if */
/* Check for opening a non-existant attribute on an object with dense attribute storage */
ret = H5Aopen(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
ret = H5Aopen(my_dataset, "foo", H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen");
ret = H5Aopen_by_name(my_dataset, ".", "foo", H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen_by_name");
ret = H5Aopen_by_name(fid, dsetname, "foo", H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Aopen_by_name");
/* Test opening attributes stored compactly */
ret = attr_open_check(my_dataset, u);
ret = attr_open_check(fid, dsetname, my_dataset, u);
CHECK(ret, FAIL, "attr_open_check");
} /* end for */
@ -7322,7 +7379,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Check refcount on attributes now */
/* Check refcount on renamed attribute */
attr = H5Aopen(dataset2, ".", attrname2, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset2, attrname2, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
@ -7346,7 +7403,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Check refcount on original attribute */
attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
@ -7378,7 +7435,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Check refcount on attributes now */
/* Check refcount on renamed attribute */
attr = H5Aopen(dataset2, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset2, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
@ -7402,7 +7459,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Check refcount on original attribute */
attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
@ -7766,7 +7823,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Check refcount on attributes now */
/* Check refcount on first dataset's attribute */
attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
@ -8140,7 +8197,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
sprintf(attrname, "attr %02u", u);
/* Open attribute on first dataset */
attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, attrname, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {

View File

@ -494,7 +494,7 @@ test_h5s_null(void)
CHECK(ret, FAIL, "H5Sclose");
/* Open the attribute for the dataset */
attr = H5Aopen(did, ".", NULLATTR, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(did, NULLATTR, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Aopen");
/* Get the space of the dataset */

View File

@ -497,7 +497,7 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name
root = H5Gopen2(file, "/", H5P_DEFAULT);
CHECK(root, FAIL, "H5Gopen2");
att = H5Aopen(root, ".", att_name, H5P_DEFAULT, H5P_DEFAULT);
att = H5Aopen(root, att_name, H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
ret = H5Aread(att, type, &data_check);

View File

@ -1886,9 +1886,9 @@ 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(group1_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT);
attr1_id = H5Aopen(group1_id, attr_name, H5P_DEFAULT);
CHECK_I(attr1_id, "H5Aopen");
attr2_id = H5Aopen(group2_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT);
attr2_id = H5Aopen(group2_id, attr_name, H5P_DEFAULT);
CHECK_I(attr2_id, "H5Aopen");
ret = H5Aread(attr1_id, attr_type_id, attr_string);
@ -2613,7 +2613,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(dset_id, ".", "attr_name", H5P_DEFAULT, H5P_DEFAULT);
attr_id = H5Aopen(dset_id, "attr_name", H5P_DEFAULT);
CHECK_I(attr_id, "H5Aopen");
/* Read */

View File

@ -130,7 +130,7 @@ void tts_acreate(void)
/* verify the correctness of the test */
for(i = 0; i < NUM_THREADS; i++) {
attribute = H5Aopen(dataset, ".", gen_name(i), H5P_DEFAULT, H5P_DEFAULT);
attribute = H5Aopen(dataset, gen_name(i), H5P_DEFAULT);
if(attribute < 0)
TestErrPrintf("unable to open appropriate attribute. Test failed!\n");

View File

@ -680,7 +680,7 @@ static void test_read_vl_string_attribute(void)
CHECK(root, FAIL, "H5Gopen2");
/* Test reading "normal" sized string attribute */
att = H5Aopen(root, ".", "test_scalar", H5P_DEFAULT, H5P_DEFAULT);
att = H5Aopen(root, "test_scalar", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
ret = H5Aread(att, type, &string_att_check);
@ -695,7 +695,7 @@ static void test_read_vl_string_attribute(void)
CHECK(ret, FAIL, "HAclose");
/* Test reading "large" sized string attribute */
att = H5Aopen(root, ".", "test_scalar_large", H5P_DEFAULT, H5P_DEFAULT);
att = H5Aopen(root, "test_scalar_large", H5P_DEFAULT);
CHECK(att, FAIL, "H5Aopen");
ret = H5Aread(att, type, &string_att_check);

View File

@ -378,7 +378,7 @@ void null_dataset(void)
VRFY((uval==2), "H5Dread");
/* Open the attribute for the dataset */
attr = H5Aopen(dataset, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT);
attr = H5Aopen(dataset, attr_name, H5P_DEFAULT);
VRFY((attr >= 0), "H5Aopen");
/* Try reading from the attribute(make certain our buffer is unmodified) */ ret = H5Aread(attr, H5T_NATIVE_INT, &val);
@ -1326,7 +1326,7 @@ 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(obj_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT);
aid = H5Aopen(obj_id, attr_name, H5P_DEFAULT);
if(MAINPROCESS) {
H5Aread(aid, H5T_NATIVE_INT, &in_num);
vrfy_errors = dataset_vrfy(NULL, NULL, NULL, group_block, &in_num, &num);
@ -1337,7 +1337,7 @@ 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(obj_id, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT);
aid = H5Aopen(obj_id, attr_name, H5P_DEFAULT);
if(MAINPROCESS) {
H5Aread(aid, H5T_NATIVE_INT, in_data);
vrfy_errors = dataset_vrfy(NULL, NULL, NULL, dset_block, in_data, out_data);

View File

@ -1237,7 +1237,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(oid, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
if((attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT)) < 0) {
indentation(indent + COL);
error_msg(progname, "unable to open attribute \"%s\"\n", attr_name);
indentation(indent);
@ -1321,7 +1321,7 @@ dump_selected_attr(hid_t loc_id, const char *name)
return FAIL;
} /* end if */
if((attr_id = H5Aopen(oid, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
if((attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT)) >= 0) {
hid_t type, space;
type = H5Aget_type(attr_id);
@ -5099,7 +5099,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(attr, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) {
type = H5Aget_type(attr_id);
space = H5Aget_space(attr_id);
space_type = H5Sget_simple_extent_type(space);

View File

@ -1338,7 +1338,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo,
n = display_string(stdout, attr_name, TRUE);
printf("%*s", MAX(0, (9 - n)), "");
if((attr = H5Aopen(obj, ".", attr_name, H5P_DEFAULT, H5P_DEFAULT))) {
if((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) {
space = H5Aget_space(attr);
type = H5Aget_type(attr);

View File

@ -95,7 +95,7 @@ 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(loc2_id, ".", name1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((attr2_id = H5Aopen(loc2_id, name1, H5P_DEFAULT)) < 0)
goto error;
} H5E_END_TRY;