mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-24 17:51:25 +08:00
[svn-r14185] Description:
Move H5Aopen_name() routine to deprecated symbol section and replace internal usage with H5Aopen(). Add simple regression test for H5Aopen_name() to deprecated routine test. Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
This commit is contained in:
parent
3db40827da
commit
bb3afd50c2
c++/src
examples
fortran/src
hl
src
test
testpar
tools
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 )
|
||||
|
458
hl/src/H5DS.c
458
hl/src/H5DS.c
File diff suppressed because it is too large
Load Diff
143
hl/src/H5IM.c
143
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;
|
||||
|
@ -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 )
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
84
test/tattr.c
84
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) {
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
10
test/tsohm.c
10
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 */
|
||||
|
@ -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)
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user