[svn-r14187] Description:

Put H5Acreate() under API versioning, with all internal usage shifted
to H5Acreate2().

	Add regression tests for H5Acreate1().

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-04 17:19:07 -05:00
parent 041de441c5
commit 1de51c7bc1
42 changed files with 1733 additions and 1725 deletions

View File

@ -103,7 +103,7 @@ Attribute H5Object::createAttribute( const char* name, const DataType& data_type
hid_t type_id = data_type.getId();
hid_t space_id = data_space.getId();
hid_t plist_id = create_plist.getId();
hid_t attr_id = H5Acreate( id, name, type_id, space_id, plist_id );
hid_t attr_id = H5Acreate2(id, ".", name, type_id, space_id, plist_id, H5P_DEFAULT, H5P_DEFAULT );
// If the attribute id is valid, create and return the Attribute object
if( attr_id > 0 )
@ -112,9 +112,7 @@ Attribute H5Object::createAttribute( const char* name, const DataType& data_type
return( attr );
}
else
{
throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate failed");
}
throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed");
}
//--------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
Attribute Examples:
H5Acreate example: Show how to create an attribute for a dataset and a group
H5Acreate2 example: Show how to create an attribute for a dataset and a group
----------------
{
hid_t file;
@ -22,15 +22,15 @@ H5Acreate example: Show how to create an attribute for a dataset and a group
dataspace = H5Screate_simple(rank, dimsf, NULL);
/* Create a dataset */
dataset=H5Dcreate(file,"Dataset1",H5T_UINT8,dataspace,H5P_DEFAULT);
dataset = H5Dcreate(file, "Dataset1", H5T_UINT8, dataspace, H5P_DEFAULT);
<Write data to first dataset>
/* Create an attribute for the dataset */
attr=H5Acreate(dataset,"Attr1",H5T_INT32,H5S_SCALAR,H5P_DEFAULT);
attr = H5Acreate2(dataset, ".", "Attr1", H5T_INT32, H5S_SCALAR, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write attribute information */
H5Awrite(attr,H5T_INT32,&attr_data);
H5Awrite(attr, H5T_INT32, &attr_data);
/* Close attribute */
H5Aclose(attr);
@ -39,13 +39,13 @@ H5Acreate example: Show how to create an attribute for a dataset and a group
H5Dclose(dataset);
/* Create a group */
group=H5Gcreate2(file, "/Group One", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
group = H5Gcreate2(file, "/Group One", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Create an attribute for the dataset */
attr=H5Acreate(group,"Attr1",H5T_INT32,H5S_SCALAR,H5P_DEFAULT);
attr = H5Acreate2(group, ".", "Attr1", H5T_INT32, H5S_SCALAR, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write attribute information */
H5Awrite(attr,H5T_INT32,&attr_data);
H5Awrite(attr, H5T_INT32, &attr_data);
/* Close attribute */
H5Aclose(attr);

View File

@ -111,7 +111,7 @@ main (void)
/*
* Create array attribute.
*/
attr1 = H5Acreate(dataset, ANAME, H5T_NATIVE_FLOAT, aid1, H5P_DEFAULT);
attr1 = H5Acreate2(dataset, ".", ANAME, H5T_NATIVE_FLOAT, aid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Write array attribute.
@ -122,8 +122,8 @@ main (void)
* Create scalar attribute.
*/
aid2 = H5Screate(H5S_SCALAR);
attr2 = H5Acreate(dataset, "Integer attribute", H5T_NATIVE_INT, aid2,
H5P_DEFAULT);
attr2 = H5Acreate2(dataset, ".", "Integer attribute", H5T_NATIVE_INT, aid2,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Write scalar attribute.
@ -137,7 +137,7 @@ main (void)
atype = H5Tcopy(H5T_C_S1);
H5Tset_size(atype, 5);
H5Tset_strpad(atype,H5T_STR_NULLTERM);
attr3 = H5Acreate(dataset, ANAMES, atype, aid3, H5P_DEFAULT);
attr3 = H5Acreate2(dataset, ".", ANAMES, atype, aid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Write string attribute.

View File

@ -288,14 +288,15 @@ create_standard_file(const char *filename, hid_t fcpl_id)
/* Begin using the messages many times. Do this by creating datasets
* that use this datatype, dataspace, and have this attribute.
*/
for(x=0; x<NUM_DATASETS; ++x) {
for(x = 0; x < NUM_DATASETS; ++x) {
/* Create a dataset */
dset_id = H5Dcreate(file_id, DSETNAME[x], type_id, space_id, H5P_DEFAULT);
if(dset_id < 0) goto error;
/* Create an attribute on the dataset */
attr_id = H5Acreate(dset_id, "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT);
attr_id = H5Acreate2(dset_id, ".", "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if(attr_id < 0) goto error;
/* Write data to the attribute */
ret = H5Awrite(attr_id, H5T_NATIVE_INT, attr_data);
if(ret < 0) goto error;

View File

@ -20,7 +20,7 @@
/*----------------------------------------------------------------------------
* Name: h5acreate_c
* Purpose: Call H5Acreate to create an attribute
* Purpose: Call H5Acreate2 to create an attribute
* Inputs: obj_id - object identifier
* name - name of the attribute
* namelen - name length
@ -34,25 +34,27 @@
* Modifications:
*---------------------------------------------------------------------------*/
int_f
nh5acreate_c (hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *crt_prp, hid_t_f *attr_id)
nh5acreate_c(hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *type_id,
hid_t_f *space_id, hid_t_f *crt_prp, 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(NULL == (c_name = HD5f2cstring(name, (size_t)*namelen)))
HGOTO_DONE(FAIL);
/*
* Call H5Acreate function.
* Call H5Acreate2 function.
*/
if((*attr_id = (hid_t_f)H5Acreate((hid_t)*obj_id, c_name, (hid_t)*type_id, (hid_t)*space_id, (hid_t)*crt_prp))<0)
if((*attr_id = (hid_t_f)H5Acreate2((hid_t)*obj_id, ".", c_name, (hid_t)*type_id, (hid_t)*space_id, (hid_t)*crt_prp, H5P_DEFAULT, H5P_DEFAULT)) < 0)
HGOTO_DONE(FAIL);
done:
if(c_name) HDfree(c_name);
if(c_name)
HDfree(c_name);
return ret_value;
}

View File

@ -235,31 +235,30 @@ herr_t H5DSattach_scale(hid_t did,
/* create one entry array */
dims = (hsize_t*) malloc (1 * sizeof (hsize_t));
if (dims == NULL)
if(dims == NULL)
return FAIL;
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 = H5Acreate2(did, ".", DIMENSION_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 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;
for(i=0; i<rank; i++)
{
for(i = 0; i < rank; i++) {
buf[i].len = 0;
buf[i].p = NULL;
}
@ -410,32 +409,32 @@ herr_t H5DSattach_scale(hid_t did,
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 = H5Acreate2(dsid, ".", REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT, 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)
goto out;
@ -494,31 +493,31 @@ herr_t H5DSattach_scale(hid_t did,
dsbuf[nelmts-1] = dsl;
/* create a new data space for the new references array */
dims = (hsize_t*) malloc ( (size_t)nelmts * sizeof (hsize_t));
if (dims == NULL)
dims = (hsize_t *)malloc((size_t)nelmts * sizeof(hsize_t));
if(dims == NULL)
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)
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 = H5Acreate2(dsid, ".", REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT, 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)
@ -840,41 +839,38 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* don't do anything for an empty array */
if (nelmts)
if(nelmts)
{
/* create a new data space for the new references array */
dims = (hsize_t*) malloc ( (size_t)nelmts * sizeof (hsize_t));
if (dims == NULL)
dims = (hsize_t*)malloc((size_t)nelmts * sizeof (hsize_t));
if(dims == NULL)
goto out;
dims[0] = nelmts;
dsbufn = malloc((size_t)nelmts * sizeof(ds_list_t));
if (dsbufn == NULL)
if(dsbufn == NULL)
goto out;
/* store the new information */
for(i=0; i<nelmts; i++)
{
for(i = 0; i < nelmts; i++)
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 = H5Acreate2(dsid, ".", REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT, 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 */
@ -1445,26 +1441,26 @@ 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 = H5Acreate2(did, ".", DIMENSION_LABELS, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* allocate and initialize */
buf = (const char **)malloc((size_t)rank * sizeof(char *));
if (buf == NULL)
if(buf == NULL)
goto out;
for(i=0; i<(unsigned int)rank; i++)
for(i = 0; i < (unsigned int)rank; i++)
buf[i] = NULL;
/* store the label information in the required index */

View File

@ -52,19 +52,19 @@ herr_t H5IMmake_image_8bit( hid_t loc_id,
dims[2] = 1;
/* Make the dataset */
if ( H5LTmake_dataset( loc_id, dset_name, IMAGE8_RANK, dims, H5T_NATIVE_UCHAR, buffer ) < 0 )
if ( H5LTmake_dataset( loc_id, dset_name, IMAGE8_RANK, dims, H5T_NATIVE_UCHAR, buffer ) < 0)
return -1;
/* Attach the CLASS attribute */
if ( H5LTset_attribute_string( loc_id, dset_name, "CLASS", IMAGE_CLASS ) < 0 )
if ( H5LTset_attribute_string( loc_id, dset_name, "CLASS", IMAGE_CLASS ) < 0)
return -1;
/* Attach the VERSION attribute */
if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION ) < 0 )
if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION ) < 0)
return -1;
/* Attach the IMAGE_SUBCLASS attribute */
if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_INDEXED" ) < 0 )
if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_INDEXED" ) < 0)
return -1;
return 0;
@ -124,23 +124,23 @@ herr_t H5IMmake_image_24bit( hid_t loc_id,
else return -1;
/* Make the dataset */
if ( H5LTmake_dataset( loc_id, dset_name, IMAGE24_RANK, dims, H5T_NATIVE_UCHAR, buffer ) < 0 )
if ( H5LTmake_dataset( loc_id, dset_name, IMAGE24_RANK, dims, H5T_NATIVE_UCHAR, buffer ) < 0)
return -1;
/* Attach the CLASS attribute */
if ( H5LTset_attribute_string( loc_id, dset_name, "CLASS", IMAGE_CLASS ) < 0 )
if ( H5LTset_attribute_string( loc_id, dset_name, "CLASS", IMAGE_CLASS ) < 0)
return -1;
/* Attach the VERSION attribute */
if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION ) < 0 )
if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_VERSION", IMAGE_VERSION ) < 0)
return -1;
/* Attach the IMAGE_SUBCLASS attribute */
if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_TRUECOLOR" ) < 0 )
if ( H5LTset_attribute_string( loc_id, dset_name, "IMAGE_SUBCLASS", "IMAGE_TRUECOLOR" ) < 0)
return -1;
/* Attach the INTERLACE_MODE attribute. This attributes is only for true color images */
if ( H5LTset_attribute_string( loc_id, dset_name, "INTERLACE_MODE", interlace ) < 0 )
if ( H5LTset_attribute_string( loc_id, dset_name, "INTERLACE_MODE", interlace ) < 0)
return -1;
return 0;
@ -280,11 +280,11 @@ herr_t H5IMget_image_info( hid_t loc_id,
}
/* Get the dataspace handle */
if ( (sid = H5Dget_space( did )) < 0 )
if ( (sid = H5Dget_space( did )) < 0)
goto out;
/* Get dimensions */
if ( H5Sget_simple_extent_dims( sid, dims, NULL) < 0 )
if ( H5Sget_simple_extent_dims( sid, dims, NULL) < 0)
goto out;
/* Initialize the image dimensions */
@ -319,7 +319,7 @@ herr_t H5IMget_image_info( hid_t loc_id,
}
/* Close */
if ( H5Sclose( sid ) < 0 )
if ( H5Sclose( sid ) < 0)
goto out;
@ -348,27 +348,27 @@ herr_t H5IMget_image_info( hid_t loc_id,
/* Get the reference(s) */
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 );
if ( H5Sclose( attr_space_id ) < 0 )
if ( H5Sclose( attr_space_id ) < 0)
goto out;
} /* H5T_REFERENCE */
if ( H5Tclose( attr_type ) < 0 )
if ( H5Tclose( attr_type ) < 0)
goto out;
/* Close the attribute. */
if ( H5Aclose( attr_id ) < 0 )
if ( H5Aclose( attr_id ) < 0)
goto out;
}
/* End access to the dataset and release resources used by it. */
if ( H5Dclose( did ) < 0 )
if ( H5Dclose( did ) < 0)
goto out;
return 0;
@ -407,11 +407,11 @@ herr_t H5IMread_image( hid_t loc_id,
hid_t did;
/* Open the dataset. */
if ( (did = H5Dopen( loc_id, dset_name )) < 0 )
if ( (did = H5Dopen( loc_id, dset_name )) < 0)
return -1;
/* Read */
if ( H5Dread( did, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer ) < 0 )
if ( H5Dread( did, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer ) < 0)
goto out;
/* End access to the dataset and release resources used by it. */
@ -468,11 +468,11 @@ herr_t H5IMmake_palette( hid_t loc_id,
return -1;
/* Attach the attribute "CLASS" to the >>palette<< dataset*/
if ( H5LTset_attribute_string( loc_id, pal_name, "CLASS", PALETTE_CLASS ) < 0 )
if ( H5LTset_attribute_string( loc_id, pal_name, "CLASS", PALETTE_CLASS ) < 0)
return -1;
/* Attach the attribute "PAL_VERSION" to the >>palette<< dataset*/
if ( H5LTset_attribute_string( loc_id, pal_name, "PAL_VERSION", "1.2" ) < 0 )
if ( H5LTset_attribute_string( loc_id, pal_name, "PAL_VERSION", "1.2" ) < 0)
return -1;
return 0;
@ -527,7 +527,7 @@ herr_t H5IMlink_palette( hid_t loc_id,
*/
/* First we get the image id */
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 */
@ -537,31 +537,31 @@ herr_t H5IMlink_palette( hid_t loc_id,
* It does not exist. We create the attribute and one reference
*-------------------------------------------------------------------------
*/
if ( ok_pal == 0 )
if(ok_pal == 0 )
{
if ( (attr_space_id = H5Screate( H5S_SCALAR )) < 0 )
if((attr_space_id = H5Screate(H5S_SCALAR)) < 0)
goto out;
/* Create the attribute type for the reference */
if ( (attr_type = H5Tcopy( H5T_STD_REF_OBJ )) < 0 )
if((attr_type = H5Tcopy(H5T_STD_REF_OBJ)) < 0)
goto out;
/* Create the attribute "PALETTE" to be attached to the image*/
if ( (attr_id = H5Acreate( image_id, "PALETTE", attr_type, attr_space_id, H5P_DEFAULT )) < 0 )
if((attr_id = H5Acreate2(image_id, ".", "PALETTE", attr_type, attr_space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* Create a reference. The reference is created on the local id. */
if ( H5Rcreate( &ref, loc_id, pal_name, H5R_OBJECT, -1 ) < 0 )
if(H5Rcreate(&ref, loc_id, pal_name, H5R_OBJECT, -1) < 0)
goto out;
/* Write the attribute with the reference */
if ( H5Awrite( attr_id, attr_type, &ref ) < 0 )
if(H5Awrite(attr_id, attr_type, &ref) < 0)
goto out;
/* close */
if ( H5Sclose( attr_space_id ) < 0 )
if(H5Sclose(attr_space_id) < 0)
goto out;
if ( H5Tclose( attr_type ) < 0 )
if ( H5Tclose( attr_type ) < 0)
goto out;
if(H5Aclose(attr_id) < 0)
goto out;
@ -593,7 +593,7 @@ herr_t H5IMlink_palette( hid_t loc_id,
refbuf = malloc( sizeof(hobj_ref_t) * (int)dim_ref );
if ( H5Aread( attr_id, attr_type, refbuf ) < 0 )
if ( H5Aread( attr_id, attr_type, refbuf ) < 0)
goto out;
/* The attribute must be deleted, in order to the new one can reflect the changes*/
@ -601,33 +601,33 @@ herr_t H5IMlink_palette( hid_t loc_id,
goto out;
/* Create a new reference for this palette. */
if ( H5Rcreate( &ref, loc_id, pal_name, H5R_OBJECT, -1 ) < 0 )
if ( H5Rcreate( &ref, loc_id, pal_name, H5R_OBJECT, -1 ) < 0)
goto out;
refbuf[n_refs] = ref;
/* Create the data space for the new references */
if ( H5Sclose( attr_space_id ) < 0 )
if(H5Sclose(attr_space_id) < 0)
goto out;
if ( (attr_space_id = H5Screate_simple( 1, &dim_ref, NULL )) < 0 )
if((attr_space_id = H5Screate_simple(1, &dim_ref, NULL)) < 0)
goto out;
/* Create the attribute again with the changes of space */
if ( H5Aclose( attr_id ) < 0 )
if(H5Aclose(attr_id) < 0)
goto out;
if ( (attr_id = H5Acreate( image_id, "PALETTE", attr_type, attr_space_id, H5P_DEFAULT )) < 0 )
if((attr_id = H5Acreate2(image_id, ".", "PALETTE", attr_type, attr_space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* Write the attribute with the new references */
if ( H5Awrite( attr_id, attr_type, refbuf ) < 0 )
if(H5Awrite(attr_id, attr_type, refbuf) < 0)
goto out;
/* close */
if ( H5Sclose( attr_space_id ) < 0 )
if(H5Sclose(attr_space_id) < 0)
goto out;
if ( H5Aclose( attr_id ) < 0 )
if(H5Aclose(attr_id) < 0)
goto out;
free( refbuf );
@ -635,7 +635,7 @@ herr_t H5IMlink_palette( hid_t loc_id,
} /* ok_pal == 1 */
/* Close the image dataset. */
if ( H5Dclose( image_id ) < 0 )
if ( H5Dclose( image_id ) < 0)
return -1;
return 0;
@ -694,7 +694,7 @@ herr_t H5IMunlink_palette( hid_t loc_id,
*/
/* First we get the image id */
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 */
@ -726,17 +726,17 @@ herr_t H5IMunlink_palette( hid_t loc_id,
} /* H5T_REFERENCE */
if ( H5Tclose( attr_type ) < 0 )
if ( H5Tclose( attr_type ) < 0)
goto out;
/* Close the attribute. */
if ( H5Aclose( attr_id ) < 0 )
if ( H5Aclose( attr_id ) < 0)
goto out;
} /* ok_pal */
/* Close the image dataset. */
if ( H5Dclose( image_id ) < 0 )
if ( H5Dclose( image_id ) < 0)
return -1;
return 0;
@ -807,22 +807,22 @@ herr_t H5IMget_npalettes( hid_t loc_id,
*npals = H5Sget_simple_extent_npoints( attr_space_id );
if ( H5Sclose( attr_space_id ) < 0 )
if ( H5Sclose( attr_space_id ) < 0)
goto out;
} /* H5T_REFERENCE */
if ( H5Tclose( attr_type ) < 0 )
if ( H5Tclose( attr_type ) < 0)
goto out;
/* Close the attribute. */
if ( H5Aclose( attr_id ) < 0 )
if ( H5Aclose( attr_id ) < 0)
goto out;
}
/* Close the image dataset. */
if ( H5Dclose( image_id ) < 0 )
if ( H5Dclose( image_id ) < 0)
return -1;
return 0;
@ -900,32 +900,32 @@ herr_t H5IMget_palette_info( hid_t loc_id,
refbuf = malloc( sizeof(hobj_ref_t) * (int)dim_ref );
if ( H5Aread( attr_id, attr_type, refbuf ) < 0 )
if ( H5Aread( attr_id, attr_type, refbuf ) < 0)
goto out;
/* Get the actual palette */
if ( (pal_id = H5Rdereference( image_id, H5R_OBJECT, &refbuf[pal_number] )) < 0 )
if ( (pal_id = H5Rdereference( image_id, H5R_OBJECT, &refbuf[pal_number] )) < 0)
goto out;
if ( (pal_space_id = H5Dget_space( pal_id )) < 0 )
if ( (pal_space_id = H5Dget_space( pal_id )) < 0)
goto out;
if ( H5Sget_simple_extent_ndims( pal_space_id ) < 0 )
if ( H5Sget_simple_extent_ndims( pal_space_id ) < 0)
goto out;
if ( H5Sget_simple_extent_dims( pal_space_id, pal_dims, pal_maxdims ) < 0 )
if ( H5Sget_simple_extent_dims( pal_space_id, pal_dims, pal_maxdims ) < 0)
goto out;
/* close */
if (H5Dclose(pal_id)<0)
goto out;
if ( H5Sclose( pal_space_id ) < 0 )
if ( H5Sclose( pal_space_id ) < 0)
goto out;
if ( H5Sclose( attr_space_id ) < 0 )
if ( H5Sclose( attr_space_id ) < 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;
free( refbuf );
@ -933,7 +933,7 @@ herr_t H5IMget_palette_info( hid_t loc_id,
}
/* Close the image dataset. */
if ( H5Dclose( image_id ) < 0 )
if ( H5Dclose( image_id ) < 0)
return -1;
return 0;
@ -1012,31 +1012,31 @@ herr_t H5IMget_palette( hid_t loc_id,
refbuf = malloc( sizeof(hobj_ref_t) * (int)dim_ref );
if ( H5Aread( attr_id, attr_type, refbuf ) < 0 )
if ( H5Aread( attr_id, attr_type, refbuf ) < 0)
goto out;
/* Get the palette id */
if ( (pal_id = H5Rdereference( image_id, H5R_OBJECT, &refbuf[pal_number] )) < 0 )
if ( (pal_id = H5Rdereference( image_id, H5R_OBJECT, &refbuf[pal_number] )) < 0)
goto out;
/* Read the palette dataset */
if ( H5Dread( pal_id, H5Dget_type(pal_id), H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data ) < 0 )
if ( H5Dread( pal_id, H5Dget_type(pal_id), H5S_ALL, H5S_ALL, H5P_DEFAULT, pal_data ) < 0)
goto out;
/* close */
if (H5Dclose(pal_id)<0)
goto out;
if ( H5Sclose( attr_space_id ) < 0 )
if ( H5Sclose( attr_space_id ) < 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;
free( refbuf );
}
/* Close the image dataset. */
if ( H5Dclose( image_id ) < 0 )
if ( H5Dclose( image_id ) < 0)
return -1;
return 0;
@ -1084,7 +1084,7 @@ herr_t H5IMis_image( hid_t loc_id,
ret = -1;
/* 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 "CLASS" on the dataset */
@ -1115,16 +1115,16 @@ herr_t H5IMis_image( hid_t loc_id,
else
ret = 0;
if ( H5Tclose( attr_type ) < 0 )
if ( H5Tclose( attr_type ) < 0)
goto out;
if ( H5Aclose( attr_id ) < 0 )
if ( H5Aclose( attr_id ) < 0)
goto out;
}
/* Close the dataset. */
if ( H5Dclose( did ) < 0 )
if ( H5Dclose( did ) < 0)
return -1;
return ret;
@ -1169,7 +1169,7 @@ herr_t H5IMis_palette( hid_t loc_id,
ret = -1;
/* 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 "CLASS" on the dataset */
@ -1200,16 +1200,16 @@ herr_t H5IMis_palette( hid_t loc_id,
else
ret = 0;
if ( H5Tclose( attr_type ) < 0 )
if ( H5Tclose( attr_type ) < 0)
goto out;
if ( H5Aclose( attr_id ) < 0 )
if ( H5Aclose( attr_id ) < 0)
goto out;
}
/* Close the dataset. */
if ( H5Dclose( did ) < 0 )
if ( H5Dclose( did ) < 0)
return -1;
return ret;

View File

@ -1141,30 +1141,28 @@ herr_t H5LTset_attribute_string( hid_t loc_id,
goto out;
/* Verify if the attribute already exists */
has_attr = H5LT_find_attribute( obj_id, attr_name );
has_attr = H5LT_find_attribute(obj_id, attr_name);
/* The attribute already exists, delete it */
if ( has_attr == 1 )
{
if(H5Adelete2(obj_id, ".", attr_name, H5P_DEFAULT) < 0)
goto out;
}
if(has_attr == 1)
if(H5Adelete2(obj_id, ".", attr_name, H5P_DEFAULT) < 0)
goto out;
/* Create and write the attribute */
if ( (attr_id = H5Acreate( obj_id, attr_name, attr_type, attr_space_id, H5P_DEFAULT )) < 0 )
if((attr_id = H5Acreate2(obj_id, ".", attr_name, attr_type, attr_space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if ( H5Awrite( attr_id, attr_type, attr_data ) < 0 )
if(H5Awrite(attr_id, attr_type, attr_data) < 0)
goto out;
if ( H5Aclose( attr_id ) < 0 )
if(H5Aclose(attr_id) < 0)
goto out;
if ( H5Sclose( attr_space_id ) < 0 )
if(H5Sclose(attr_space_id) < 0)
goto out;
if ( H5Tclose(attr_type) < 0 )
if(H5Tclose(attr_type) < 0)
goto out;
/* Close the object */
@ -1221,33 +1219,31 @@ herr_t H5LT_set_attribute_numerical( hid_t loc_id,
goto out;
/* Verify if the attribute already exists */
has_attr = H5LT_find_attribute( obj_id, attr_name );
has_attr = H5LT_find_attribute(obj_id, attr_name);
/* The attribute already exists, delete it */
if ( has_attr == 1 )
{
if(H5Adelete2(obj_id, ".", attr_name, H5P_DEFAULT) < 0)
goto out;
}
if(has_attr == 1)
if(H5Adelete2(obj_id, ".", attr_name, H5P_DEFAULT) < 0)
goto out;
/* Create the attribute. */
if ( (attr_id = H5Acreate( obj_id, attr_name, tid, sid, H5P_DEFAULT )) < 0 )
if((attr_id = H5Acreate2(obj_id, ".", attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* Write the attribute data. */
if ( H5Awrite( attr_id, tid, data ) < 0 )
if(H5Awrite(attr_id, tid, data) < 0)
goto out;
/* Close the attribute. */
if ( H5Aclose( attr_id ) < 0 )
if(H5Aclose(attr_id) < 0)
goto out;
/* Close the dataspace. */
if ( H5Sclose( sid ) < 0 )
if(H5Sclose(sid) < 0)
goto out;
/* Close the object */
if(H5Oclose(obj_id) < 0 )
if(H5Oclose(obj_id) < 0)
return -1;
return 0;
@ -1874,7 +1870,7 @@ hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type)
input_len = strlen(text);
myinput = strdup(text);
if((type_id = H5LTyyparse())<0)
if((type_id = H5LTyyparse()) < 0)
goto out;
free(myinput);
@ -1944,7 +1940,7 @@ print_enum(hid_t type, char* str, int indt)
if((nmembs = H5Tget_nmembers(type))==0)
goto out;
assert(nmembs>0);
if((super = H5Tget_super(type))<0)
if((super = H5Tget_super(type)) < 0)
goto out;
/* Use buffer of INT or UNSIGNED INT to print enum values because
@ -1967,13 +1963,13 @@ print_enum(hid_t type, char* str, int indt)
for (i = 0; i < nmembs; i++) {
if((name[i] = H5Tget_member_name(type, (unsigned)i))==NULL)
goto out;
if(H5Tget_member_value(type, (unsigned)i, value + i * super_size)<0)
if(H5Tget_member_value(type, (unsigned)i, value + i * super_size) < 0)
goto out;
}
/* Convert values to native data type */
if (native > 0) {
if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT)<0)
if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0)
goto out;
}
@ -2055,11 +2051,11 @@ herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *
if(len && !str) {
text_str = (char*)calloc(str_len, sizeof(char));
text_str[0]='\0';
if((ret = H5LT_dtype_to_text(dtype, &text_str, lang_type, &str_len, 1))<0)
if((ret = H5LT_dtype_to_text(dtype, &text_str, lang_type, &str_len, 1)) < 0)
goto out;
*len = strlen(text_str) + 1;
} else if(len && str) {
if((ret = H5LT_dtype_to_text(dtype, &str, lang_type, len, 0))<0)
if((ret = H5LT_dtype_to_text(dtype, &str, lang_type, len, 0)) < 0)
goto out;
str[*len-1] = '\0';
}
@ -2110,7 +2106,7 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t *
goto out;
}
if((tcls = H5Tget_class(dtype))<0)
if((tcls = H5Tget_class(dtype)) < 0)
goto out;
switch (tcls) {
@ -2207,15 +2203,15 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t *
H5T_cset_t cset;
htri_t is_vlstr;
if((tmp_type = H5Tcopy(dtype))<0)
if((tmp_type = H5Tcopy(dtype)) < 0)
goto out;
if((size = H5Tget_size(tmp_type))==0)
goto out;
if((str_pad = H5Tget_strpad(tmp_type))<0)
if((str_pad = H5Tget_strpad(tmp_type)) < 0)
goto out;
if((cset = H5Tget_cset(tmp_type))<0)
if((cset = H5Tget_cset(tmp_type)) < 0)
goto out;
if((is_vlstr = H5Tis_variable_str(tmp_type))<0)
if((is_vlstr = H5Tis_variable_str(tmp_type)) < 0)
goto out;
/* Print lead-in */
@ -2253,18 +2249,18 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t *
/* Reproduce a C type string */
if((str_type = H5Tcopy(H5T_C_S1))<0)
if((str_type = H5Tcopy(H5T_C_S1)) < 0)
goto out;
if(is_vlstr) {
if(H5Tset_size(str_type, H5T_VARIABLE)<0)
if(H5Tset_size(str_type, H5T_VARIABLE) < 0)
goto out;
} else {
if(H5Tset_size(str_type, size)<0)
if(H5Tset_size(str_type, size) < 0)
goto out;
}
if(H5Tset_cset(str_type, cset)<0)
if(H5Tset_cset(str_type, cset) < 0)
goto out;
if(H5Tset_strpad(str_type, str_pad)<0)
if(H5Tset_strpad(str_type, str_pad) < 0)
goto out;
indentation(indent + COL, *dt_str);
@ -2276,13 +2272,13 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t *
}
/* Change the endianness and see if they're equal. */
if((order = H5Tget_order(tmp_type))<0)
if((order = H5Tget_order(tmp_type)) < 0)
goto out;
if(order==H5T_ORDER_LE) {
if(H5Tset_order(str_type, H5T_ORDER_LE)<0)
if(H5Tset_order(str_type, H5T_ORDER_LE) < 0)
goto out;
} else if(order==H5T_ORDER_BE) {
if(H5Tset_order(str_type, H5T_ORDER_BE)<0)
if(H5Tset_order(str_type, H5T_ORDER_BE) < 0)
goto out;
}
@ -2293,15 +2289,15 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t *
/* If not equal to C variable-length string, check Fortran type.
* Actually H5Tequal can't tell difference between H5T_C_S1 and H5T_FORTRAN_S1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
if(H5Tclose(str_type)<0)
if(H5Tclose(str_type) < 0)
goto out;
if((str_type = H5Tcopy(H5T_FORTRAN_S1))<0)
if((str_type = H5Tcopy(H5T_FORTRAN_S1)) < 0)
goto out;
if(H5Tset_cset(str_type, cset)<0)
if(H5Tset_cset(str_type, cset) < 0)
goto out;
if(H5Tset_size(str_type, size)<0)
if(H5Tset_size(str_type, size) < 0)
goto out;
if(H5Tset_strpad(str_type, str_pad)<0)
if(H5Tset_strpad(str_type, str_pad) < 0)
goto out;
/* Are the two types equal? */
@ -2311,13 +2307,13 @@ herr_t H5LT_dtype_to_text(hid_t dtype, char **dt_str, H5LT_lang_t lang, size_t *
}
/* Change the endianness and see if they're equal. */
if((order = H5Tget_order(tmp_type))<0)
if((order = H5Tget_order(tmp_type)) < 0)
goto out;
if(order==H5T_ORDER_LE) {
if(H5Tset_order(str_type, H5T_ORDER_LE)<0)
if(H5Tset_order(str_type, H5T_ORDER_LE) < 0)
goto out;
} else if(order==H5T_ORDER_BE) {
if(H5Tset_order(str_type, H5T_ORDER_BE)<0)
if(H5Tset_order(str_type, H5T_ORDER_BE) < 0)
goto out;
}
@ -2371,19 +2367,19 @@ next:
indent += COL;
indentation(indent + COL, *dt_str);
if((super = H5Tget_super(dtype))<0)
if((super = H5Tget_super(dtype)) < 0)
goto out;
if(H5LTdtype_to_text(super, NULL, lang, &super_len)<0)
if(H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
goto out;
stmp = (char*)calloc(super_len, sizeof(char));
if(H5LTdtype_to_text(super, stmp, lang, &super_len)<0)
if(H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
goto out;
strcat(*dt_str, stmp);
free(stmp);
strcat(*dt_str, ";\n");
H5Tclose(super);
if(print_enum(dtype, *dt_str, indent)<0)
if(print_enum(dtype, *dt_str, indent) < 0)
goto out;
/* Print closing */
@ -2404,12 +2400,12 @@ next:
indent += COL;
indentation(indent + COL, *dt_str);
if((super = H5Tget_super(dtype))<0)
if((super = H5Tget_super(dtype)) < 0)
goto out;
if(H5LTdtype_to_text(super, NULL, lang, &super_len)<0)
if(H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
goto out;
stmp = (char*)calloc(super_len, sizeof(char));
if(H5LTdtype_to_text(super, stmp, lang, &super_len)<0)
if(H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
goto out;
strcat(*dt_str, stmp);
free(stmp);
@ -2437,7 +2433,7 @@ next:
indentation(indent + COL, *dt_str);
/* Get array information */
if((ndims = H5Tget_array_ndims(dtype))<0)
if((ndims = H5Tget_array_ndims(dtype)) < 0)
goto out;
if(H5Tget_array_dims(dtype, dims, NULL) < 0)
goto out;
@ -2449,12 +2445,12 @@ next:
}
strcat(*dt_str, " ");
if((super = H5Tget_super(dtype))<0)
if((super = H5Tget_super(dtype)) < 0)
goto out;
if(H5LTdtype_to_text(super, NULL, lang, &super_len)<0)
if(H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
goto out;
stmp = (char*)calloc(super_len, sizeof(char));
if(H5LTdtype_to_text(super, stmp, lang, &super_len)<0)
if(H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
goto out;
strcat(*dt_str, stmp);
free(stmp);
@ -2478,7 +2474,7 @@ next:
char* mtmp;
int nmembs;
if((nmembs = H5Tget_nmembers(dtype))<0)
if((nmembs = H5Tget_nmembers(dtype)) < 0)
goto out;
sprintf(*dt_str, "H5T_COMPOUND {\n");
@ -2487,20 +2483,20 @@ next:
for (i = 0; i < nmembs; i++) {
if((mname = H5Tget_member_name(dtype, (unsigned)i))==NULL)
goto out;
if((mtype = H5Tget_member_type(dtype, (unsigned)i))<0)
if((mtype = H5Tget_member_type(dtype, (unsigned)i)) < 0)
goto out;
moffset = H5Tget_member_offset(dtype, (unsigned)i);
indentation(indent + COL, *dt_str);
if((mclass = H5Tget_class(mtype))<0)
if((mclass = H5Tget_class(mtype)) < 0)
goto out;
if (H5T_COMPOUND == mclass)
indent += COL;
if(H5LTdtype_to_text(mtype, NULL, lang, &mlen)<0)
if(H5LTdtype_to_text(mtype, NULL, lang, &mlen) < 0)
goto out;
mtmp = (char*)calloc(mlen, sizeof(char));
if(H5LTdtype_to_text(mtype, mtmp, lang, &mlen)<0)
if(H5LTdtype_to_text(mtype, mtmp, lang, &mlen) < 0)
goto out;
strcat(*dt_str, mtmp);
free(mtmp);
@ -3113,18 +3109,18 @@ herr_t H5LT_set_attribute_string(hid_t dset_id,
* create the attribute type
*-------------------------------------------------------------------------
*/
if ((tid = H5Tcopy(H5T_C_S1))<0)
if ((tid = H5Tcopy(H5T_C_S1)) < 0)
return FAIL;
size = strlen(buf) + 1; /* extra null term */
if (H5Tset_size(tid,(size_t)size)<0)
if (H5Tset_size(tid,(size_t)size) < 0)
goto out;
if (H5Tset_strpad(tid,H5T_STR_NULLTERM)<0)
if(H5Tset_strpad(tid, H5T_STR_NULLTERM) < 0)
goto out;
if ((sid = H5Screate(H5S_SCALAR))<0)
if((sid = H5Screate(H5S_SCALAR)) < 0)
goto out;
@ -3132,19 +3128,19 @@ herr_t H5LT_set_attribute_string(hid_t dset_id,
* create and write the attribute
*-------------------------------------------------------------------------
*/
if ((aid = H5Acreate(dset_id,name,tid,sid,H5P_DEFAULT))<0)
if((aid = H5Acreate2(dset_id, ".", name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if (H5Awrite(aid,tid,buf)<0)
if(H5Awrite(aid, tid, buf) < 0)
goto out;
if (H5Aclose(aid)<0)
if(H5Aclose(aid) < 0)
goto out;
if (H5Sclose(sid)<0)
if(H5Sclose(sid) < 0)
goto out;
if (H5Tclose(tid)<0)
if(H5Tclose(tid) < 0)
goto out;
return SUCCEED;

File diff suppressed because it is too large Load Diff

View File

@ -379,38 +379,42 @@ create_attrs_1(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
fapl))<0)
fapl)) < 0)
goto error;
if(create_dsets(file)<0)
if(create_dsets(file) < 0)
goto error;
/*
* Create all(user specifies the number) attributes for each dataset
*/
for(i=0; i<NUM_DSETS; i++) {
for(i = 0; i < NUM_DSETS; i++) {
sprintf(dset_name, "dataset %d", i);
open_t.start = retrieve_time();
if((dataset=H5Dopen(file, dset_name))<0)
if((dataset = H5Dopen(file, dset_name)) < 0)
goto error;
perf(&open_t, open_t.start, retrieve_time());
for(j=0; j<NUM_ATTRS; j++) {
sprintf(attr_name, "all attrs for each dset %d", j);
attr_t.start = retrieve_time();
if((attr = H5Acreate(dataset, attr_name, H5T_NATIVE_DOUBLE,
small_space, H5P_DEFAULT)) < 0)
goto error;
if (H5Aclose(attr) < 0) goto error;
perf(&attr_t, attr_t.start, retrieve_time());
if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL)<0) goto error;
}
for(j = 0; j < NUM_ATTRS; j++) {
sprintf(attr_name, "all attrs for each dset %d", j);
attr_t.start = retrieve_time();
if((attr = H5Acreate2(dataset, ".", attr_name, H5T_NATIVE_DOUBLE,
small_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
if(H5Aclose(attr) < 0)
goto error;
perf(&attr_t, attr_t.start, retrieve_time());
if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
} /* end for */
close_t.start = retrieve_time();
if(H5Dclose(dataset)<0) goto error;
if(H5Dclose(dataset) < 0)
goto error;
perf(&close_t, close_t.start, retrieve_time());
if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error;
}
if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
} /* end for */
if(facc_type == FACC_MPIO || facc_type == FACC_MPIPOSIX) {
#ifdef H5_HAVE_PARALLEL
@ -434,7 +438,7 @@ create_attrs_1(void)
print_perf(open_t, close_t, attr_t);
}
if (H5Fclose(file)<0) goto error;
if (H5Fclose(file) < 0) goto error;
return 0;
@ -480,36 +484,40 @@ create_attrs_2(void)
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
goto error;
/*
* Create all(user specifies the number) attributes for each new dataset
*/
for(i=0; i<NUM_DSETS; i++) {
for(i = 0; i < NUM_DSETS; i++) {
sprintf(dset_name, "dataset %d", i);
create_t.start = retrieve_time();
if((dataset = H5Dcreate(file, dset_name, H5T_NATIVE_DOUBLE,
space, H5P_DEFAULT)) < 0)
goto error;
space, H5P_DEFAULT)) < 0)
goto error;
perf(&create_t, create_t.start, retrieve_time());
for(j=0; j<NUM_ATTRS; j++) {
sprintf(attr_name, "all attrs for each dset %d", j);
attr_t.start = retrieve_time();
if((attr = H5Acreate(dataset, attr_name, H5T_NATIVE_DOUBLE,
small_space, H5P_DEFAULT)) < 0)
goto error;
if (H5Aclose(attr) < 0) goto error;
perf(&attr_t, attr_t.start, retrieve_time());
if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error;
}
for(j = 0; j < NUM_ATTRS; j++) {
sprintf(attr_name, "all attrs for each dset %d", j);
attr_t.start = retrieve_time();
if((attr = H5Acreate2(dataset, ".", attr_name, H5T_NATIVE_DOUBLE,
small_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
if(H5Aclose(attr) < 0)
goto error;
perf(&attr_t, attr_t.start, retrieve_time());
if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
} /* end for */
close_t.start = retrieve_time();
if(H5Dclose(dataset)<0) goto error;
if(H5Dclose(dataset) < 0)
goto error;
perf(&close_t, close_t.start, retrieve_time());
if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error;
}
if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
} /* end for */
if(facc_type == FACC_MPIO || facc_type == FACC_MPIPOSIX) {
#ifdef H5_HAVE_PARALLEL
@ -534,7 +542,7 @@ create_attrs_2(void)
print_perf(create_t, close_t, attr_t);
}
if (H5Fclose(file)<0) goto error;
if (H5Fclose(file) < 0) goto error;
return 0;
@ -583,10 +591,10 @@ create_attrs_3(void)
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT,
fapl))<0)
fapl)) < 0)
goto error;
if(create_dsets(file)<0)
if(create_dsets(file) < 0)
goto error;
/*
@ -595,32 +603,35 @@ create_attrs_3(void)
*/
loop_num = NUM_ATTRS/BATCH_ATTRS;
for(i=0; i<loop_num; i++) {
for(j=0; j<NUM_DSETS; j++) {
sprintf(dset_name, "dataset %d", j);
open_t.start = retrieve_time();
if((dataset = H5Dopen(file, dset_name)) < 0)
goto error;
perf(&open_t, open_t.start, retrieve_time());
for(i = 0; i < loop_num; i++) {
for(j = 0; j < NUM_DSETS; j++) {
sprintf(dset_name, "dataset %d", j);
open_t.start = retrieve_time();
if((dataset = H5Dopen(file, dset_name)) < 0)
goto error;
perf(&open_t, open_t.start, retrieve_time());
for(k=0; k<BATCH_ATTRS; k++) {
sprintf(attr_name, "some attrs for each dset %d %d",
i, k);
attr_t.start = retrieve_time();
if((attr = H5Acreate(dataset, attr_name,
H5T_NATIVE_DOUBLE, small_space, H5P_DEFAULT))
< 0) goto error;
if (H5Aclose(attr) < 0) goto error;
perf(&attr_t, attr_t.start, retrieve_time());
if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error;
}
for(k = 0; k < BATCH_ATTRS; k++) {
sprintf(attr_name, "some attrs for each dset %d %d", i, k);
attr_t.start = retrieve_time();
if((attr = H5Acreate2(dataset, ".", attr_name, H5T_NATIVE_DOUBLE,
small_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
if(H5Aclose(attr) < 0)
goto error;
perf(&attr_t, attr_t.start, retrieve_time());
if(flush_attr && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
} /* end for */
close_t.start = retrieve_time();
if(H5Dclose(dataset)<0) goto error;
perf(&close_t, close_t.start, retrieve_time());
if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error;
}
}
close_t.start = retrieve_time();
if(H5Dclose(dataset) < 0)
goto error;
perf(&close_t, close_t.start, retrieve_time());
if(flush_dset && H5Fflush(file, H5F_SCOPE_LOCAL) < 0)
goto error;
} /* end for */
} /* end for */
if(facc_type == FACC_MPIO || facc_type == FACC_MPIPOSIX) {
#ifdef H5_HAVE_PARALLEL
@ -644,7 +655,7 @@ create_attrs_3(void)
print_perf(open_t, close_t, attr_t);
}
if (H5Fclose(file)<0) goto error;
if (H5Fclose(file) < 0) goto error;
return 0;
@ -812,17 +823,17 @@ main(int argc, char **argv)
#endif /*H5_HAVE_PARALLEL*/
}
nerrors += create_dspace()<0 ?1:0;
nerrors += create_dspace() < 0 ?1:0;
if((RUN_TEST & TEST_1) || !RUN_TEST)
nerrors += create_attrs_1()<0 ?1:0;
nerrors += create_attrs_1() < 0 ?1:0;
if((RUN_TEST & TEST_2) || !RUN_TEST)
nerrors += create_attrs_2()<0 ?1:0;
nerrors += create_attrs_2() < 0 ?1:0;
if(((RUN_TEST & TEST_3) || !RUN_TEST) && BATCH_ATTRS && NUM_ATTRS)
nerrors += create_attrs_3()<0 ?1:0;
nerrors += create_attrs_3() < 0 ?1:0;
if (H5Sclose(space)<0) goto error;
if (H5Sclose(small_space)<0) goto error;
if (H5Sclose(space) < 0) goto error;
if (H5Sclose(small_space) < 0) goto error;
h5_cleanup(FILENAME, fapl);

View File

@ -276,7 +276,7 @@ done:
* Function: H5A_create
*
* Purpose:
* This is the guts of the H5Acreate function.
* This is the guts of creating an attribute.
* Usage:
* hid_t H5A_create (ent, name, type, space)
* const H5G_entry_t *ent; IN: Pointer to symbol table entry for object to attribute

View File

@ -105,14 +105,15 @@ H5A_init_deprec_interface(void)
FUNC_LEAVE_NOAPI(H5A_init())
} /* H5A_init_deprec_interface() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*--------------------------------------------------------------------------
NAME
H5Acreate
H5Acreate1
PURPOSE
Creates an attribute on an object
USAGE
hid_t H5Acreate (loc_id, name, type_id, space_id, plist_id)
hid_t H5Acreate1(loc_id, name, type_id, space_id, plist_id)
hid_t loc_id; IN: Object (dataset or group) to be attached to
const char *name; IN: Name of attribute to create
hid_t type_id; IN: ID of datatype for attribute
@ -129,9 +130,12 @@ H5A_init_deprec_interface(void)
The attribute ID returned from this function must be released with H5Aclose
or resource leaks will develop.
NOTE
Deprecated in favor of H5Acreate2
--------------------------------------------------------------------------*/
hid_t
H5Acreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
hid_t plist_id)
{
H5G_loc_t loc; /* Object location */
@ -139,7 +143,7 @@ H5Acreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
H5S_t *space; /* Dataspace to use for attribute */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(H5Acreate, FAIL)
FUNC_ENTER_API(H5Acreate1, FAIL)
H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, plist_id);
/* check arguments */
@ -162,9 +166,8 @@ H5Acreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id,
done:
FUNC_LEAVE_API(ret_value)
} /* H5Acreate() */
} /* H5Acreate1() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/*--------------------------------------------------------------------------
NAME
@ -185,6 +188,8 @@ done:
H5Aclose or resource leaks will develop.
The location object may be either a group or a dataset, both of
which may have any sort of attribute.
NOTE
Deprecated in favor of H5Aopen
--------------------------------------------------------------------------*/
hid_t
H5Aopen_name(hid_t loc_id, const char *name)

View File

@ -75,14 +75,6 @@ H5_DLL herr_t H5Adelete2(hid_t loc_id, const char *obj_name,
H5_DLL herr_t H5Adelete_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 lapl_id);
/* Functions and variables defined for compatibility with previous versions
* of the HDF5 API.
*
* Use of these functions and variables is deprecated.
*/
H5_DLL hid_t H5Acreate(hid_t loc_id, const char *name, hid_t type_id,
hid_t space_id, hid_t plist_id);
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
* Use of these symbols is deprecated.
@ -100,6 +92,8 @@ typedef herr_t (*H5A_operator1_t)(hid_t location_id/*in*/,
/* Function prototypes */
H5_DLL hid_t H5Acreate1(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);
H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx);
H5_DLL int H5Aget_num_attrs(hid_t loc_id);

View File

@ -1890,7 +1890,7 @@ H5T_subset_t
H5T_conv_struct_subset(const H5T_cdata_t *cdata)
{
H5T_conv_struct_t *priv;
H5T_subset_t ret_value = FALSE; /* Return value */
H5T_subset_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_conv_struct_subset)

View File

@ -45,6 +45,7 @@
# API function names
# (although not required, it's easier to compare this file with the headers
# generated if the list below is in alphanumeric sort order - QAK)
FUNCTION: H5Acreate; ; v10, v18
FUNCTION: H5Adelete; ; v10, v18
FUNCTION: H5Aiterate; H5A_operator; v10, v18
FUNCTION: H5Arename; ; v16, v18

View File

@ -38,6 +38,10 @@
/* Functions */
/*************/
#if !defined(H5Acreate_vers)
#define H5Acreate_vers 1
#endif /* !defined(H5Acreate_vers) */
#if !defined(H5Adelete_vers)
#define H5Adelete_vers 1
#endif /* !defined(H5Adelete_vers) */
@ -115,6 +119,17 @@
/* Functions */
/*************/
#if !defined(H5Acreate_vers) || H5Acreate_vers == 2
#ifndef H5Acreate_vers
#define H5Acreate_vers 2
#endif /* H5Acreate_vers */
#define H5Acreate H5Acreate2
#elif H5Acreate_vers == 1
#define H5Acreate H5Acreate1
#else /* H5Acreate_vers */
#error "H5Acreate_vers set to invalid value"
#endif /* H5Acreate_vers */
#if !defined(H5Adelete_vers) || H5Adelete_vers == 2
#ifndef H5Adelete_vers
#define H5Adelete_vers 2

View File

@ -63,28 +63,28 @@ test_dangle_dataset(H5F_close_degree_t degree)
TESTING(" dangling dataset IDs");
if(H5open()<0)
if(H5open() < 0)
TEST_ERROR;
/* Create file access property list */
if((fapl=H5Pcreate(H5P_FILE_ACCESS))<0)
if((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Set file close degree */
if(H5Pset_fclose_degree(fapl,degree)<0)
if(H5Pset_fclose_degree(fapl,degree) < 0)
TEST_ERROR;
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
if((fid = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
if((fid = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
if((sid = H5Screate (H5S_SCALAR))<0)
if((sid = H5Screate (H5S_SCALAR)) < 0)
TEST_ERROR;
if((dsid = H5Dcreate (fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT))<0)
if((dsid = H5Dcreate (fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0)
TEST_ERROR;
if(H5Dclose(dsid)<0)
if(H5Dclose(dsid) < 0)
TEST_ERROR;
/* Try creating duplicate dataset */
@ -93,12 +93,12 @@ test_dangle_dataset(H5F_close_degree_t degree)
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((dsid = H5Dopen (fid, DSETNAME))<0)
if((dsid = H5Dopen (fid, DSETNAME)) < 0)
TEST_ERROR;
} /* end for */
@ -109,16 +109,16 @@ test_dangle_dataset(H5F_close_degree_t degree)
} 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)
if(H5close() < 0)
TEST_ERROR;
if(h5_get_file_size(filename)<0)
if(h5_get_file_size(filename) < 0)
TEST_ERROR;
/* Clean up temporary file */
@ -159,24 +159,24 @@ test_dangle_group(H5F_close_degree_t degree)
TESTING(" dangling group IDs");
if(H5open()<0)
if(H5open() < 0)
TEST_ERROR;
/* Create file access property list */
if((fapl=H5Pcreate(H5P_FILE_ACCESS))<0)
if((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Set file close degree */
if(H5Pset_fclose_degree(fapl,degree)<0)
if(H5Pset_fclose_degree(fapl,degree) < 0)
TEST_ERROR;
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
if((fid = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
if((fid = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
if((gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid)<0)
if(H5Gclose(gid) < 0)
TEST_ERROR;
/* Try creating duplicate group */
@ -200,16 +200,16 @@ test_dangle_group(H5F_close_degree_t degree)
} 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)
if(H5close() < 0)
TEST_ERROR;
if(h5_get_file_size(filename)<0)
if(h5_get_file_size(filename) < 0)
TEST_ERROR;
/* Clean up temporary file */
@ -275,7 +275,7 @@ test_dangle_datatype1(H5F_close_degree_t degree)
TEST_ERROR;
/* Try creating duplicate named datatype */
if((tid = H5Tcopy (H5T_NATIVE_INT))<0)
if((tid = H5Tcopy (H5T_NATIVE_INT)) < 0)
TEST_ERROR;
H5E_BEGIN_TRY {
if(H5Tcommit2(fid, TYPENAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) >= 0)
@ -435,29 +435,29 @@ test_dangle_attribute(H5F_close_degree_t degree)
TESTING(" dangling attribute IDs");
if(H5open()<0)
if(H5open() < 0)
TEST_ERROR;
/* Create file access property list */
if((fapl=H5Pcreate(H5P_FILE_ACCESS))<0)
if((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Set file close degree */
if(H5Pset_fclose_degree(fapl,degree)<0)
if(H5Pset_fclose_degree(fapl,degree) < 0)
TEST_ERROR;
h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename);
if((fid = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
if((sid = H5Screate (H5S_SCALAR))<0)
if((sid = H5Screate(H5S_SCALAR)) < 0)
TEST_ERROR;
if((dsid = H5Dcreate (fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT))<0)
if((dsid = H5Dcreate(fid, DSETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Create an attribute on the dataset */
if((aid = H5Acreate (dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT))<0)
if((aid = H5Acreate2(dsid, ".", ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Don't worry about writing the attribute - it will have a fill value */
@ -468,7 +468,7 @@ test_dangle_attribute(H5F_close_degree_t degree)
/* Try creating duplicate attribute */
H5E_BEGIN_TRY {
if((aid = H5Acreate(dsid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT)) >= 0)
if((aid = H5Acreate2(dsid, ".", ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0)
TEST_ERROR;
} H5E_END_TRY;
@ -496,10 +496,10 @@ test_dangle_attribute(H5F_close_degree_t degree)
if(H5Pclose(fapl) < 0)
TEST_ERROR;
if(H5close()<0)
if(H5close() < 0)
TEST_ERROR;
if(h5_get_file_size(filename)<0)
if(h5_get_file_size(filename) < 0)
TEST_ERROR;
/* Clean up temporary file */

View File

@ -2487,7 +2487,7 @@ test_transient (hid_t fapl)
/* It should not be possible to create an attribute for a transient type */
H5E_BEGIN_TRY {
status = H5Acreate (type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT);
status = H5Acreate2(type, ".", "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY;
if (status>=0) {
H5_FAILED();
@ -2633,8 +2633,8 @@ test_named (hid_t fapl)
}
/* It should be possible to define an attribute for the named type */
if((attr1 = H5Acreate (type, "attr1", H5T_NATIVE_UCHAR, space,
H5P_DEFAULT)) < 0) goto error;
if((attr1 = H5Acreate2(type, ".", "attr1", H5T_NATIVE_UCHAR, space,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
for(i = 0; i < (size_t)ds_size[0]; i++)
for(j = 0; j < (size_t)ds_size[1]; j++)
attr_data[i][j] = (int)(i * ds_size[1] + j);

View File

@ -91,7 +91,7 @@ int main()
assert(ret >= 0);
/* Add 1st attribute on first group */
aid = H5Acreate(gid, ATTR1, tid, sid, H5P_DEFAULT);
aid = H5Acreate2(gid, ".", ATTR1, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(aid > 0);
/* Close dataspace */
@ -117,7 +117,7 @@ int main()
assert(ret >= 0);
/* Add 2nd attribute on first group */
aid = H5Acreate(gid, ATTR2, tid, sid, H5P_DEFAULT);
aid = H5Acreate2(gid, ".", ATTR2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(aid > 0);
/* Close dataspace */
@ -191,7 +191,7 @@ int main()
assert(ret >= 0);
/* Add 3rd attribute on first group (smaller than 2nd attribute) */
aid = H5Acreate(gid, ATTR3, tid, sid, H5P_DEFAULT);
aid = H5Acreate2(gid, ".", ATTR3, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(aid > 0);
/* Close dataspace */
@ -239,7 +239,7 @@ int main()
assert(ret >= 0);
/* Re-create 2nd attribute on first group */
aid = H5Acreate(gid, ATTR2, tid, sid, H5P_DEFAULT);
aid = H5Acreate2(gid, ".", ATTR2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(aid > 0);
/* Close dataspace */
@ -303,7 +303,7 @@ int main()
assert(ret >= 0);
/* Re-create 2nd attribute on first group */
aid = H5Acreate(gid, ATTR2, tid, sid, H5P_DEFAULT);
aid = H5Acreate2(gid, ".", ATTR2, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(aid > 0);
/* Close dataspace */

View File

@ -63,11 +63,11 @@ main(void)
assert(gid > 0);
/* Create an attribute for the group */
attr=H5Acreate(gid,NULLATTR,H5T_NATIVE_INT,sid,H5P_DEFAULT);
assert(attr>0);
attr = H5Acreate2(gid, ".", NULLATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(attr > 0);
/* Close attribute */
ret=H5Aclose(attr);
ret = H5Aclose(attr);
assert(ret>=0);
/* Close the group */

View File

@ -8616,7 +8616,7 @@ object_info(hid_t fapl)
sprintf(attrname, "attr %02u", v);
/* Create attribute */
if((attr_id = H5Acreate(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR
if((attr_id = H5Acreate2(group_id2, ".", attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Close attribute */
if(H5Aclose(attr_id) < 0) TEST_ERROR
@ -8664,7 +8664,7 @@ object_info(hid_t fapl)
sprintf(attrname, "attr %02u", v);
/* Create attribute */
if((attr_id = H5Acreate(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR
if((attr_id = H5Acreate2(group_id2, ".", attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Close attribute */
if(H5Aclose(attr_id) < 0) TEST_ERROR
@ -8813,7 +8813,7 @@ object_info_old(hid_t fapl)
sprintf(attrname, "attr %02u", v);
/* Create attribute */
if((attr_id = H5Acreate(group_id2, attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) TEST_ERROR
if((attr_id = H5Acreate2(group_id2, ".", attrname, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Close attribute */
if(H5Aclose(attr_id) < 0) TEST_ERROR

View File

@ -256,7 +256,7 @@ attach_ref_attr(hid_t file_id, hid_t loc_id)
/* create an attribute with two object references */
if(H5Rcreate(&ref[0], file_id, dsetname1, H5R_OBJECT, -1) < 0) TEST_ERROR
if(H5Rcreate(&ref[1], file_id, dsetname2, H5R_OBJECT, -1) < 0) TEST_ERROR
if((aid = H5Acreate(loc_id, "obj_ref_attr", H5T_STD_REF_OBJ, sid_ref, H5P_DEFAULT)) < 0) TEST_ERROR
if((aid = H5Acreate2(loc_id, ".", "obj_ref_attr", H5T_STD_REF_OBJ, sid_ref, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Awrite(aid, H5T_STD_REF_OBJ, ref) < 0) TEST_ERROR
if(H5Sclose(sid) < 0) TEST_ERROR
@ -329,12 +329,12 @@ attach_reg_ref_attr(hid_t file_id, hid_t loc_id)
if(H5Rcreate(&ref[1], file_id, dsetnamev, H5R_DATASET_REGION, space_id) < 0) TEST_ERROR
/* create reg_ref attribute */
if((aid = H5Acreate(loc_id, "reg_ref_attr", H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT)) < 0) TEST_ERROR
if((aid = H5Acreate2(loc_id, ".", "reg_ref_attr", H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Awrite(aid, H5T_STD_REF_DSETREG, ref) < 0) TEST_ERROR
/* attach the reg_ref attribute to the dataset itself */
if(H5Aclose(aid) < 0) TEST_ERROR
if((aid = H5Acreate(dsetv_id, "reg_ref_attr", H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT)) < 0) TEST_ERROR
if((aid = H5Acreate2(dsetv_id, ".", "reg_ref_attr", H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Awrite(aid, H5T_STD_REF_DSETREG, ref) < 0) TEST_ERROR
if(H5Sclose(spacer_id) < 0) TEST_ERROR
@ -488,7 +488,7 @@ test_copy_attach_attribute_vl(hid_t loc_id)
((int *)buf[i].p)[j] = j+1;
} /* end for */
if((aid = H5Acreate(loc_id, "vlen attribute", tid, sid, H5P_DEFAULT)) < 0)
if((aid = H5Acreate2(loc_id, ".", "vlen attribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto done;
if(H5Awrite(aid, tid, buf) < 0)
@ -542,7 +542,7 @@ test_copy_attach_attributes(hid_t loc_id, hid_t type_id)
attr_data[0] = 100 * i;
attr_data[1] = 200 * i;
if((aid = H5Acreate(loc_id, attr_name, type_id, sid, H5P_DEFAULT)) < 0)
if((aid = H5Acreate2(loc_id, ".", attr_name, type_id, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto done;
if(H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0)
@ -596,12 +596,12 @@ test_copy_attach_paired_attributes(hid_t loc_id, hid_t loc_id2, hid_t type_id)
attr_data[1] = 200 * i;
/* Add attribute to first object */
if((aid = H5Acreate(loc_id, attr_name, type_id, sid, H5P_DEFAULT)) < 0) goto done;
if((aid = H5Acreate2(loc_id, ".", attr_name, type_id, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto done;
if(H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0) goto done;
if(H5Aclose(aid) < 0) goto done;
/* Add attribute to second object */
if((aid = H5Acreate(loc_id2, attr_name, type_id, sid, H5P_DEFAULT)) < 0) goto done;
if((aid = H5Acreate2(loc_id2, ".", attr_name, type_id, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto done;
if(H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0) goto done;
if(H5Aclose(aid) < 0) goto done;
}

View File

@ -198,12 +198,11 @@ rsrv_ohdr(void)
attrval[3][i] = 3;
}
for (i = 0; i< 2000; i++)
{
for(i = 0; i < 2000; i++) {
sprintf(attrname, "attr %d", i);
H5E_BEGIN_TRY{
aid = H5Screate_simple(2, dims, NULL);
attr_id = H5Acreate (dataset_id, attrname, H5T_STD_I32BE, aid, H5P_DEFAULT);
attr_id = H5Acreate2(dataset_id, ".", attrname, H5T_STD_I32BE, aid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr_id, H5T_NATIVE_INT, attrval);
status = H5Aclose(attr_id);
} H5E_END_TRY

View File

@ -192,8 +192,8 @@ test_attr_basic_write(hid_t fapl)
/* Try to create an attribute on the file (should create an attribute on root group) */
attr = H5Acreate(fid1, ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(fid1, ".", ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Close attribute */
ret = H5Aclose(attr);
@ -217,23 +217,23 @@ test_attr_basic_write(hid_t fapl)
/* Create an attribute for the dataset */
attr=H5Acreate(dataset,ATTR1_NAME,H5T_NATIVE_INT,sid2,H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
ret=H5Acreate(dataset,ATTR1_NAME,H5T_NATIVE_INT,sid2,H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate");
ret = H5Acreate2(dataset, ".", ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate2");
/* Write attribute information */
ret=H5Awrite(attr,H5T_NATIVE_INT,attr_data1);
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1);
CHECK(ret, FAIL, "H5Awrite");
/* Create an another attribute for the dataset */
attr2=H5Acreate(dataset,ATTR1A_NAME,H5T_NATIVE_INT,sid2,H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr2 = H5Acreate2(dataset, ".", ATTR1A_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write attribute information */
ret=H5Awrite(attr2,H5T_NATIVE_INT,attr_data1a);
ret = H5Awrite(attr2, H5T_NATIVE_INT, attr_data1a);
CHECK(ret, FAIL, "H5Awrite");
/* Check storage size for attribute */
@ -343,27 +343,27 @@ test_attr_basic_write(hid_t fapl)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create an attribute for the group */
attr=H5Acreate(group,ATTR2_NAME,H5T_NATIVE_INT,sid2,H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(group, ".", ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check storage size for attribute */
attr_size=H5Aget_storage_size(attr);
VERIFY(attr_size, (ATTR2_DIM1*ATTR2_DIM2*sizeof(int)), "H5Aget_storage_size");
attr_size = H5Aget_storage_size(attr);
VERIFY(attr_size, (ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), "H5Aget_storage_size");
/* Try to create the same attribute again (should fail) */
ret=H5Acreate(group,ATTR2_NAME,H5T_NATIVE_INT,sid2,H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate");
ret = H5Acreate2(group, ".", ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate2");
/* Write attribute information */
ret=H5Awrite(attr,H5T_NATIVE_INT,attr_data2);
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2);
CHECK(ret, FAIL, "H5Awrite");
/* Check storage size for attribute */
attr_size=H5Aget_storage_size(attr);
VERIFY(attr_size, (ATTR2_DIM1*ATTR2_DIM2*sizeof(int)), "H5A_get_storage_size");
attr_size = H5Aget_storage_size(attr);
VERIFY(attr_size, (ATTR2_DIM1 * ATTR2_DIM2 * sizeof(int)), "H5A_get_storage_size");
/* Close attribute */
ret=H5Aclose(attr);
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Close Attribute dataspace */
@ -500,8 +500,8 @@ test_attr_flush(hid_t fapl)
set = H5Dcreate(fil, DSET1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT);
CHECK(set, FAIL, "H5Dcreate");
att = H5Acreate(set, ATTR1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT);
CHECK(att, FAIL, "H5Acreate");
att = H5Acreate2(set, ".", ATTR1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(att, FAIL, "H5Acreate2");
ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
@ -585,8 +585,8 @@ test_attr_plist(hid_t fapl)
VERIFY(cset, H5T_CSET_ASCII, "H5Pget_char_encoding");
/* Create an attribute for the dataset using the property list */
attr=H5Acreate(dataset,ATTR1_NAME,H5T_NATIVE_INT,sid2,plist);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", ATTR1_NAME, H5T_NATIVE_INT, sid2, plist, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Close the property list, and get the attribute's property list */
ret = H5Pclose(plist);
@ -608,7 +608,7 @@ test_attr_plist(hid_t fapl)
/* Create a new property list and modify it to use a different encoding */
plist = H5Pcreate(H5P_ATTRIBUTE_CREATE);
CHECK(plist, FAIL, "H5Pcreate");
ret=H5Pset_char_encoding(plist, H5T_CSET_UTF8);
ret = H5Pset_char_encoding(plist, H5T_CSET_UTF8);
CHECK(ret, FAIL, "H5Pset_char_encoding");
/* Get the character encoding and ensure that it has been changed */
@ -617,8 +617,8 @@ test_attr_plist(hid_t fapl)
VERIFY(cset, H5T_CSET_UTF8, "H5Pget_char_encoding");
/* Create an attribute for the dataset using the modified property list */
attr=H5Acreate(dataset,ATTR2_NAME,H5T_NATIVE_INT,sid2,plist);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", ATTR2_NAME, H5T_NATIVE_INT, sid2, plist, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Close the property list and attribute */
ret = H5Pclose(plist);
@ -707,19 +707,19 @@ test_attr_compound_write(hid_t fapl)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create complex attribute for the dataset */
attr=H5Acreate(dataset,ATTR4_NAME,tid1,sid2,H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
ret=H5Acreate(dataset,ATTR4_NAME,tid1,sid2,H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate");
ret = H5Acreate2(dataset, ".", ATTR4_NAME, tid1, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate2");
/* Write complex attribute data */
ret=H5Awrite(attr,tid1,attr_data4);
ret = H5Awrite(attr, tid1, attr_data4);
CHECK(ret, FAIL, "H5Awrite");
/* Close attribute */
ret=H5Aclose(attr);
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Close attribute's dataspace */
@ -917,7 +917,7 @@ test_attr_scalar_write(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
dataset=H5Dcreate(fid1,DSET1_NAME,H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT);
dataset = H5Dcreate(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
/* Create dataspace for attribute */
@ -925,19 +925,19 @@ test_attr_scalar_write(hid_t fapl)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create an attribute for the dataset */
attr=H5Acreate(dataset,ATTR5_NAME,H5T_NATIVE_FLOAT,sid2,H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
ret=H5Acreate(dataset,ATTR5_NAME,H5T_NATIVE_FLOAT,sid2,H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate");
ret = H5Acreate2(dataset, ".", ATTR5_NAME, H5T_NATIVE_FLOAT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate2");
/* Write attribute information */
ret=H5Awrite(attr,H5T_NATIVE_FLOAT,&attr_data5);
ret = H5Awrite(attr, H5T_NATIVE_FLOAT, &attr_data5);
CHECK(ret, FAIL, "H5Awrite");
/* Close attribute */
ret=H5Aclose(attr);
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
ret = H5Sclose(sid1);
@ -1057,7 +1057,7 @@ test_attr_mult_write(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
dataset=H5Dcreate(fid1,DSET1_NAME,H5T_NATIVE_UCHAR,sid1,H5P_DEFAULT);
dataset = H5Dcreate(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate");
/* Close dataset's dataspace */
@ -1069,19 +1069,19 @@ test_attr_mult_write(hid_t fapl)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create 1st attribute for the dataset */
attr=H5Acreate(dataset,ATTR1_NAME,H5T_NATIVE_INT,sid2,H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
ret=H5Acreate(dataset,ATTR1_NAME,H5T_NATIVE_INT,sid2,H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate");
ret = H5Acreate2(dataset, ".", ATTR1_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate2");
/* Write 1st attribute data */
ret=H5Awrite(attr,H5T_NATIVE_INT,attr_data1);
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data1);
CHECK(ret, FAIL, "H5Awrite");
/* Close 1st attribute */
ret=H5Aclose(attr);
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Close attribute's dataspace */
@ -1093,19 +1093,19 @@ test_attr_mult_write(hid_t fapl)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create 2nd attribute for the dataset */
attr=H5Acreate(dataset,ATTR2_NAME,H5T_NATIVE_INT,sid2,H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
ret=H5Acreate(dataset,ATTR2_NAME,H5T_NATIVE_INT,sid2,H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate");
ret = H5Acreate2(dataset, ".", ATTR2_NAME, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate2");
/* Write 2nd attribute information */
ret=H5Awrite(attr,H5T_NATIVE_INT,attr_data2);
ret = H5Awrite(attr, H5T_NATIVE_INT, attr_data2);
CHECK(ret, FAIL, "H5Awrite");
/* Close 2nd attribute */
ret=H5Aclose(attr);
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Close 2nd attribute's dataspace */
@ -1117,19 +1117,19 @@ test_attr_mult_write(hid_t fapl)
CHECK(sid2, FAIL, "H5Screate_simple");
/* Create 3rd attribute for the dataset */
attr=H5Acreate(dataset,ATTR3_NAME,H5T_NATIVE_DOUBLE,sid2,H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Try to create the same attribute again (should fail) */
ret=H5Acreate(dataset,ATTR3_NAME,H5T_NATIVE_DOUBLE,sid2,H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate");
ret = H5Acreate2(dataset, ".", ATTR3_NAME, H5T_NATIVE_DOUBLE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VERIFY(ret, FAIL, "H5Acreate2");
/* Write 3rd attribute information */
ret=H5Awrite(attr,H5T_NATIVE_DOUBLE,attr_data3);
ret = H5Awrite(attr, H5T_NATIVE_DOUBLE, attr_data3);
CHECK(ret, FAIL, "H5Awrite");
/* Close 3rd attribute */
ret=H5Aclose(attr);
ret = H5Aclose(attr);
CHECK(ret, FAIL, "H5Aclose");
/* Close 3rd attribute's dataspace */
@ -1669,13 +1669,13 @@ test_attr_dtype_shared(hid_t fapl)
VERIFY(oinfo.rc, 2, "H5Dcreate");
/* Create attribute on dataset */
attr_id = H5Acreate(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate");
attr_id = H5Acreate2(dset_id, ".", ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
/* Check reference count on named datatype */
ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info");
VERIFY(oinfo.rc, 3, "H5Acreate");
VERIFY(oinfo.rc, 3, "H5Oget_info");
/* Close attribute */
ret = H5Aclose(attr_id);
@ -1691,13 +1691,13 @@ test_attr_dtype_shared(hid_t fapl)
VERIFY(oinfo.rc, 2, "H5Adelete2");
/* Create attribute on dataset */
attr_id = H5Acreate(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate");
attr_id = H5Acreate2(dset_id, ".", ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
/* Check reference count on named datatype */
ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info");
VERIFY(oinfo.rc, 3, "H5Acreate");
VERIFY(oinfo.rc, 3, "H5Oget_info");
/* Write data into the attribute */
ret = H5Awrite(attr_id, H5T_NATIVE_INT, &data);
@ -1918,8 +1918,8 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
for(u = 0; u < max_compact; u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -1937,8 +1937,8 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
/* Add one more attribute, to push into "dense" storage */
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check on dataset's attribute storage status */
is_dense = H5O_is_attr_dense_test(dataset);
@ -1953,8 +1953,8 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Attempt to add attribute again, which should fail */
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
VERIFY(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VERIFY(attr, FAIL, "H5Acreate2");
/* Close dataspace */
ret = H5Sclose(sid);
@ -2053,8 +2053,8 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
for(u = 0; u < max_compact; u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -2076,8 +2076,8 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
/* Add one more attribute, to push into "dense" storage */
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check on dataset's attribute storage status */
is_dense = H5O_is_attr_dense_test(dataset);
@ -2193,8 +2193,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
for(u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -2368,8 +2368,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
for(u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -2527,8 +2527,8 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
for(u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -2666,8 +2666,8 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 0;
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -2687,8 +2687,8 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 1;
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -2842,8 +2842,8 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 0;
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Close attribute */
ret = H5Aclose(attr);
@ -2861,8 +2861,8 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 1;
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Close attribute */
ret = H5Aclose(attr);
@ -2880,9 +2880,9 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 2;
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT);
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if(latest_format) {
CHECK(attr, FAIL, "H5Acreate");
CHECK(attr, FAIL, "H5Acreate2");
/* Close attribute */
ret = H5Aclose(attr);
@ -2904,8 +2904,8 @@ test_attr_big(hid_t fcpl, hid_t fapl)
/* Create attribute */
u = 3;
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Close attribute */
ret = H5Aclose(attr);
@ -2981,7 +2981,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
} /* end if */
else {
/* Shouldn't be able to create "big" attributes with older version of format */
VERIFY(attr, FAIL, "H5Acreate");
VERIFY(attr, FAIL, "H5Acreate2");
/* Check on dataset's attribute storage status */
/* (when attributes are shared, the "big" attribute goes into the shared
@ -3080,8 +3080,8 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Create attribute */
HDstrcpy(attrname, "null attr");
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, null_sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, null_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Try to read data from the attribute */
/* (shouldn't fail, but should leave buffer alone) */
@ -3121,8 +3121,8 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
/* Create attribute */
HDstrcpy(attrname, "null attr #2");
attr = H5Acreate(dataset, attrname, H5T_NATIVE_UINT, null_sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, H5T_NATIVE_UINT, null_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Try to write data to the attribute */
/* (shouldn't fail, but should leave buffer alone) */
@ -3272,8 +3272,8 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
/* Add attribute to dataset */
/* Create attribute */
attr = H5Acreate(dataset, "attr", H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate1(dataset, "attr", H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate1");
/* Close attribute */
ret = H5Aclose(attr);
@ -3382,8 +3382,8 @@ test_attr_many(hid_t fcpl, hid_t fapl)
for(u = 0; u < NATTR_MANY; u++) {
sprintf(attrname, "a-%06u", u);
aid = H5Acreate(fid, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(fid, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
ret = H5Awrite(aid, H5T_NATIVE_UINT, &u);
CHECK(ret, FAIL, "H5Awrite");
@ -3632,8 +3632,8 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
for(u = 0; u < max_compact; u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -3832,8 +3832,8 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
for(u = 0; u < max_compact; u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -3855,8 +3855,8 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
/* Create another attribute, to push into dense storage */
sprintf(attrname, "attr %02u", max_compact);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -4220,8 +4220,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
for(u = 0; u < max_compact; u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -4243,8 +4243,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
/* Create another attribute, to push into dense storage */
sprintf(attrname, "attr %02u", max_compact);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -4307,8 +4307,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
for(u = (min_dense - 1); u < (max_compact + 1); u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -4431,8 +4431,8 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
for(u = (min_dense - 1); u < (max_compact + 1); u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -4601,8 +4601,8 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
for(u = 0; u < max_compact * 2; u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -4937,8 +4937,8 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
for(u = 0; u < max_compact; u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -4974,8 +4974,8 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
for(; u < (max_compact * 2); u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -5175,8 +5175,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
for(u = 0; u < max_compact; u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -5285,8 +5285,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
for(u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -5418,8 +5418,8 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
for(u = 0; u < (max_compact * 2); u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -5992,8 +5992,8 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
for(u = 0; u < max_compact; u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -6051,8 +6051,8 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
for(u = max_compact; u < (max_compact * 2); u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -6318,8 +6318,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
for(u = 0; u < max_compact; u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -6376,8 +6376,8 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
for(u = max_compact; u < (max_compact * 2); u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -6602,8 +6602,8 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
for(u = 0; u < max_compact; u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -6660,8 +6660,8 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
for(u = max_compact; u < (max_compact * 2); u++) {
/* Create attribute */
sprintf(attrname, "attr %02u", u);
attr = H5Acreate(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(my_dataset, ".", attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write data into the attribute */
ret = H5Awrite(attr, H5T_NATIVE_UINT, &u);
@ -7211,8 +7211,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Alternate between creating "small" & "big" attributes */
if(u % 2) {
/* Create "small" attribute on first dataset */
attr = H5Acreate(dataset, attrname, attr_tid, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is not shared */
is_shared = H5A_is_shared_test(attr);
@ -7225,8 +7225,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
} /* end if */
else {
/* Create "big" attribute on first dataset */
attr = H5Acreate(dataset, attrname, attr_tid, big_sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, attr_tid, big_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is shared */
is_shared = H5A_is_shared_test(attr);
@ -7263,8 +7263,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Alternate between creating "small" & "big" attributes */
if(u % 2) {
/* Create "small" attribute on second dataset */
attr = H5Acreate(dataset2, attrname, attr_tid, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset2, ".", attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is not shared */
is_shared = H5A_is_shared_test(attr);
@ -7277,8 +7277,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
} /* end if */
else {
/* Create "big" attribute on second dataset */
attr = H5Acreate(dataset2, attrname, attr_tid, big_sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset2, ".", attrname, attr_tid, big_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is shared */
is_shared = H5A_is_shared_test(attr);
@ -7652,8 +7652,8 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Alternate between creating "small" & "big" attributes */
if(u % 2) {
/* Create "small" attribute on first dataset */
attr = H5Acreate(dataset, attrname, attr_tid, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is not shared */
is_shared = H5A_is_shared_test(attr);
@ -7666,8 +7666,8 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
} /* end if */
else {
/* Create "big" attribute on first dataset */
attr = H5Acreate(dataset, attrname, attr_tid, big_sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, attr_tid, big_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is shared */
is_shared = H5A_is_shared_test(attr);
@ -7704,8 +7704,8 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
/* Alternate between creating "small" & "big" attributes */
if(u % 2) {
/* Create "small" attribute on second dataset */
attr = H5Acreate(dataset2, attrname, attr_tid, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset2, ".", attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is not shared */
is_shared = H5A_is_shared_test(attr);
@ -7718,8 +7718,8 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
} /* end if */
else {
/* Create "big" attribute on second dataset */
attr = H5Acreate(dataset2, attrname, attr_tid, big_sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset2, ".", attrname, attr_tid, big_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is shared */
is_shared = H5A_is_shared_test(attr);
@ -8016,8 +8016,8 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Alternate between creating "small" & "big" attributes */
if(u % 2) {
/* Create "small" attribute on first dataset */
attr = H5Acreate(dataset, attrname, attr_tid, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is not shared */
is_shared = H5A_is_shared_test(attr);
@ -8030,8 +8030,8 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
} /* end if */
else {
/* Create "big" attribute on first dataset */
attr = H5Acreate(dataset, attrname, attr_tid, big_sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset, ".", attrname, attr_tid, big_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is shared */
is_shared = H5A_is_shared_test(attr);
@ -8068,8 +8068,8 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Alternate between creating "small" & "big" attributes */
if(u % 2) {
/* Create "small" attribute on second dataset */
attr = H5Acreate(dataset2, attrname, attr_tid, sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset2, ".", attrname, attr_tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is not shared */
is_shared = H5A_is_shared_test(attr);
@ -8082,8 +8082,8 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
} /* end if */
else {
/* Create "big" attribute on second dataset */
attr = H5Acreate(dataset2, attrname, attr_tid, big_sid, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(dataset2, ".", attrname, attr_tid, big_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Check that attribute is shared */
is_shared = H5A_is_shared_test(attr);
@ -8142,7 +8142,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
/* Open attribute on first dataset */
attr = H5Aopen(dataset, ".", attrname, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
CHECK(attr, FAIL, "H5Aopen");
if(u % 2) {
/* Check that attribute is not shared */
@ -8269,8 +8269,8 @@ test_attr_bug1(hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gopen2");
/* Create attribute on first group */
aid = H5Acreate(gid, ATTR7_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", ATTR7_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
@ -8302,8 +8302,8 @@ test_attr_bug1(hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gopen2");
/* Create another attribute on first group */
aid = H5Acreate(gid, ATTR8_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", ATTR8_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
@ -8328,8 +8328,8 @@ test_attr_bug1(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Adelete2");
/* Re-create first attribute */
aid = H5Acreate(gid, ATTR7_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", ATTR7_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
@ -8339,8 +8339,8 @@ test_attr_bug1(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Adelete2");
/* Re-create second attribute */
aid = H5Acreate(gid, ATTR8_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", ATTR8_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");

View File

@ -951,8 +951,8 @@ test_get_file_id(void)
/* Create an attribute for the dataset. Make a duplicated file ID from
* this attribute. And close it.
*/
attr_id=H5Acreate(dataset_id,ATTR_NAME,H5T_NATIVE_INT,dataspace_id,H5P_DEFAULT);
CHECK(ret, FAIL, "H5Acreate");
attr_id = H5Acreate2(dataset_id, ".", ATTR_NAME, H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Acreate2");
/* Test H5Iget_file_id() */
check_file_id(fid, attr_id);
@ -960,8 +960,8 @@ test_get_file_id(void)
/* Create a named datatype. Make a duplicated file ID from
* this attribute. And close it.
*/
datatype_id=H5Tcopy(H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Acreate");
datatype_id = H5Tcopy(H5T_NATIVE_INT);
CHECK(ret, FAIL, "H5Tcopy");
ret = H5Tcommit2(fid, TYPE_NAME, datatype_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tcommit2");
@ -1621,8 +1621,8 @@ test_file_getname(void)
VERIFY_STR(name, FILE1, "H5Fget_name");
/* Create an attribute for the dataset */
attr_id = H5Acreate(dataset_id,TESTA_ATTRNAME,H5T_NATIVE_INT,space_id,H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate");
attr_id = H5Acreate2(dataset_id, ".", TESTA_ATTRNAME, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
/* Get and verify file name */
name_len = H5Fget_name(attr_id, name, (size_t)TESTA_NAME_BUF_SIZE);

View File

@ -280,10 +280,9 @@ test_h5s_basic(void)
/* Now use the bad dataspace as the space for an attribute */
H5E_BEGIN_TRY {
aid1 = H5Acreate(dset1, BASICATTR,
H5T_NATIVE_INT, sid1, H5P_DEFAULT);
aid1 = H5Acreate2(dset1, ".", BASICATTR, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY
VERIFY(aid1, FAIL, "H5Acreate");
VERIFY(aid1, FAIL, "H5Acreate2");
/* Make sure that dataspace reads using the bad dataspace fail */
H5E_BEGIN_TRY {
@ -406,8 +405,8 @@ test_h5s_null(void)
VERIFY(val, 1, "H5Dread");
/* Create an attribute for the group */
attr=H5Acreate(did,NULLATTR,H5T_NATIVE_INT,sid,H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate");
attr = H5Acreate2(did, ".", NULLATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr, FAIL, "H5Acreate2");
/* Write "nothing" to the attribute */
ret = H5Awrite(attr, H5T_NATIVE_INT, &val);

View File

@ -408,8 +408,8 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format)
for(i = 0; i < NATTR; i++) {
sprintf(name, "Attribute %02d", i);
attribute = H5Acreate(dataset, name, H5T_NATIVE_INT, filespace, H5P_DEFAULT);
CHECK(attribute, FAIL, "H5Acreate");
attribute = H5Acreate2(dataset, ".", name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attribute, FAIL, "H5Acreate2");
/* Keep a copy of the attribute names around for later */
anames[i] = HDstrdup(name);

View File

@ -421,8 +421,8 @@ static void test_misc2_write_attribute(void)
root1 = H5Gopen2(file1, "/", H5P_DEFAULT);
CHECK(root1, FAIL, "H5Gopen2");
att1 = H5Acreate(root1, MISC2_ATT_NAME_1, type, dataspace, H5P_DEFAULT);
CHECK(att1, FAIL, "H5Acreate");
att1 = H5Acreate2(root1, ".", MISC2_ATT_NAME_1, type, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(att1, FAIL, "H5Acreate2");
data.string = string_att1;
@ -448,8 +448,8 @@ static void test_misc2_write_attribute(void)
root2 = H5Gopen2(file2, "/", H5P_DEFAULT);
CHECK(root2, FAIL, "H5Gopen2");
att2 = H5Acreate(root2, MISC2_ATT_NAME_2, type, dataspace, H5P_DEFAULT);
CHECK(att2, FAIL, "H5Acreate");
att2 = H5Acreate2(root2, ".", MISC2_ATT_NAME_2, type, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(att2, FAIL, "H5Acreate2");
data.string = string_att2;
@ -1022,57 +1022,56 @@ test_misc6(void)
CHECK(ret,FAIL,"H5Dclose");
/* Close file */
ret=H5Fclose(loc_id);
CHECK(ret,FAIL,"H5Fclose");
ret = H5Fclose(loc_id);
CHECK(ret, FAIL, "H5Fclose");
/* Loop through adding attributes to each dataset */
for(u=0; u<MISC6_NUMATTR; u++) {
for(u = 0; u < MISC6_NUMATTR; u++) {
/* Create name for attribute */
sprintf(attr_name,"Attr#%u",u);
sprintf(attr_name, "Attr#%u", u);
/* Open the file */
loc_id=H5Fopen(MISC6_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(loc_id,FAIL,"H5Fopen");
loc_id = H5Fopen(MISC6_FILE, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(loc_id, FAIL, "H5Fopen");
/* Open first dataset */
dataset_id=H5Dopen(loc_id, MISC6_DSETNAME1);
CHECK(dataset_id,FAIL,"H5Dopen");
dataset_id = H5Dopen(loc_id, MISC6_DSETNAME1);
CHECK(dataset_id, FAIL, "H5Dopen");
/* Add attribute to dataset */
attr_id=H5Acreate(dataset_id,attr_name,H5T_NATIVE_INT,space_id,H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate");
attr_id = H5Acreate2(dataset_id, ".", attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
/* Close attribute */
ret=H5Aclose(attr_id);
ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");
/* Close dataset */
ret=H5Dclose(dataset_id);
ret = H5Dclose(dataset_id);
CHECK(ret, FAIL, "H5Dclose");
/* Open second dataset */
dataset_id=H5Dopen(loc_id, MISC6_DSETNAME2);
CHECK(dataset_id,FAIL,"H5Dopen");
dataset_id = H5Dopen(loc_id, MISC6_DSETNAME2);
CHECK(dataset_id, FAIL, "H5Dopen");
/* Add attribute to dataset */
attr_id=H5Acreate(dataset_id,attr_name,H5T_NATIVE_INT,space_id,H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate");
attr_id = H5Acreate2(dataset_id, ".", attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
/* Close attribute */
ret=H5Aclose(attr_id);
ret = H5Aclose(attr_id);
CHECK(ret, FAIL, "H5Aclose");
/* Close dataset */
ret=H5Dclose(dataset_id);
ret = H5Dclose(dataset_id);
CHECK(ret, FAIL, "H5Dclose");
/* Close file */
ret=H5Fclose(loc_id);
ret = H5Fclose(loc_id);
CHECK(ret,FAIL,"H5Fclose");
} /* end for */
/* Close dataspace */
@ -2883,15 +2882,15 @@ test_misc18(void)
sprintf(attr_name,"Attr %u",u);
/* Create & close attribute on first dataset */
aid = H5Acreate(did1, attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(did1, ".", attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
ret = H5Aclose(aid);
CHECK(ret, FAIL, "HAclose");
/* Create & close attribute on second dataset */
aid = H5Acreate(did2, attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(did2, ".", attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
ret = H5Aclose(aid);
CHECK(ret, FAIL, "HAclose");
@ -3180,8 +3179,8 @@ test_misc19(void)
CHECK(sid, FAIL, "H5Screate");
/* Create an attribute */
aid = H5Acreate(gid,MISC19_ATTR_NAME,H5T_NATIVE_INT,sid,H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", MISC19_ATTR_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
/* Check the reference count */
rc = H5Iget_ref(aid);
@ -4296,8 +4295,8 @@ test_misc25a(void)
CHECK(ret, FAIL, "H5Tset_size");
/* Add 1st attribute on first group */
aid = H5Acreate(gid, MISC25A_ATTR1_NAME, tid, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", MISC25A_ATTR1_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
/* Close dataspace */
ret = H5Sclose(sid);
@ -4322,8 +4321,8 @@ test_misc25a(void)
CHECK(ret, FAIL, "H5Tset_size");
/* Add 2nd attribute on first group */
aid = H5Acreate(gid, MISC25A_ATTR2_NAME, tid, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", MISC25A_ATTR2_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
/* Close dataspace */
ret = H5Sclose(sid);
@ -4395,8 +4394,8 @@ test_misc25a(void)
CHECK(ret, FAIL, "H5Tset_size");
/* Add 3rd attribute on first group (smaller than 2nd attribute) */
aid = H5Acreate(gid, MISC25A_ATTR3_NAME, tid, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", MISC25A_ATTR3_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
/* Close dataspace */
ret = H5Sclose(sid);
@ -4443,8 +4442,8 @@ test_misc25a(void)
CHECK(ret, FAIL, "H5Tset_size");
/* Re-create 2nd attribute on first group */
aid = H5Acreate(gid, MISC25A_ATTR2_NAME, tid, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", MISC25A_ATTR2_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
/* Close dataspace */
ret = H5Sclose(sid);
@ -4507,8 +4506,8 @@ test_misc25a(void)
CHECK(ret, FAIL, "H5Tset_size");
/* Re-create 2nd attribute on first group */
aid = H5Acreate(gid, MISC25A_ATTR2_NAME, tid, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", MISC25A_ATTR2_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
/* Close dataspace */
ret = H5Sclose(sid);
@ -4637,8 +4636,8 @@ test_misc25c(void)
CHECK(ret, FAIL, "H5Gclose");
/* Add an attribute to the dataset group */
aid = H5Acreate(gid, MISC25C_ATTRNAME, H5T_NATIVE_CHAR, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", MISC25C_ATTRNAME, H5T_NATIVE_CHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
/* Close the attribute */
ret = H5Aclose(aid);
@ -4653,8 +4652,8 @@ test_misc25c(void)
CHECK(ret, FAIL, "H5Gclose");
/* Add second attribute to the dataset group */
aid = H5Acreate(gid, MISC25C_ATTRNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate");
aid = H5Acreate2(gid, ".", MISC25C_ATTRNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(aid, FAIL, "H5Acreate2");
/* Close the attribute */
ret = H5Aclose(aid);

View File

@ -998,8 +998,8 @@ static void sohm_attr_helper(hid_t fcpl_id)
/* Create and verify an attribute on a group */
group_id = H5Gcreate2(file_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(group_id, "H5Gcreate2");
attr_id = H5Acreate(group_id, "attribute", type_id, space_id, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate");
attr_id = H5Acreate2(group_id, ".", "attribute", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate2");
ret = H5Awrite(attr_id, H5T_NATIVE_INT, wdata);
CHECK_I(ret, "H5Awrite");
@ -1034,8 +1034,8 @@ static void sohm_attr_helper(hid_t fcpl_id)
/* Create and verify an attribute */
group_id = H5Gcreate2(file_id, "another_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(group_id, "H5Gcreate2");
attr_id = H5Acreate(group_id, "attribute", type_id, space_id, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate");
attr_id = H5Acreate2(group_id, ".", "attribute", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate2");
ret = H5Awrite(attr_id, H5T_NATIVE_INT, wdata);
CHECK_I(ret, "H5Awrite");
@ -1484,8 +1484,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
dset_id = H5Dcreate(file_id, DSETNAME[x], dtype1_id, dspace1_id, dcpl1_id);
CHECK_I(dset_id, "H5Dcreate");
attr_id = H5Acreate(dset_id, "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate");
attr_id = H5Acreate2(dset_id, ".", "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate2");
ret = H5Awrite(attr_id, attr_type_id, attr_string1);
CHECK_I(ret, "H5Awrite");
@ -1533,8 +1533,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
dset_id = H5Dcreate(group_id, DSETNAME[x], dtype2_id, dspace2_id, dcpl2_id);
CHECK_I(dset_id, "H5Dcreate");
attr_id = H5Acreate(dset_id, "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate");
attr_id = H5Acreate2(dset_id, ".", "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate2");
ret = H5Awrite(attr_id, attr_type_id, attr_string2);
CHECK_I(ret, "H5Awrite");
@ -1574,8 +1574,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
dset_id = H5Dcreate(group_id, DSETNAME[x], dtype1_id, dspace1_id, dcpl1_id);
CHECK_I(dset_id, "H5Dcreate");
attr_id = H5Acreate(dset_id, "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate");
attr_id = H5Acreate2(dset_id, ".", "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate2");
ret = H5Awrite(attr_id, attr_type_id, attr_string1);
CHECK_I(ret, "H5Awrite");
@ -1587,8 +1587,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
dset_id = H5Dcreate(group_id, DSETNAME[x+1], dtype2_id, dspace2_id, dcpl2_id);
CHECK_I(dset_id, "H5Dcreate");
attr_id = H5Acreate(dset_id, "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate");
attr_id = H5Acreate2(dset_id, ".", "attr_name", attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate2");
ret = H5Awrite(attr_id, attr_type_id, attr_string2);
CHECK_I(ret, "H5Awrite");
@ -1632,8 +1632,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
attr_string1[1] = attr_name[1] = (x % 10) + '0';
/* Create an attribute on the group */
attr_id = H5Acreate(group_id, attr_name, attr_type_id, attr_space_id, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate");
attr_id = H5Acreate2(group_id, ".", attr_name, attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate2");
ret = H5Awrite(attr_id, attr_type_id, attr_string1);
CHECK_I(ret, "H5Awrite");
@ -1672,8 +1672,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
attr_string1[1] = attr_name[1] = (x % 10) + '0';
/* Create an attribute on the group */
attr_id = H5Acreate(group_id, attr_name, attr_type_id, attr_space_id, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate");
attr_id = H5Acreate2(group_id, ".", attr_name, attr_type_id, attr_space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate2");
ret = H5Awrite(attr_id, attr_type_id, attr_string1);
CHECK_I(ret, "H5Awrite");
@ -2573,8 +2573,8 @@ static void delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id,
CHECK_I(ret, "H5Dwrite");
/* Create an attribute on the dataset. */
attr_id = H5Acreate(dset_id, "attr_name", H5T_NATIVE_CHAR, dspace_id[x], H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate");
attr_id = H5Acreate2(dset_id, ".", "attr_name", H5T_NATIVE_CHAR, dspace_id[x], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate2");
/* Write to attribute */
ret = H5Awrite(attr_id, H5T_NATIVE_CHAR, &wdata);

View File

@ -19,17 +19,17 @@
* operations. -- Threaded program --
* ------------------------------------------------------------------
*
* Plan: Attempt to break H5Acreate by making many simultaneous create
* Plan: Attempt to break H5Acreate2 by making many simultaneous create
* calls.
*
* Claim: N calls to H5Acreate should create N attributes for a dataset
* Claim: N calls to H5Acreate2 should create N attributes for a dataset
* if threadsafe. If some unprotected shared data exists for the
* dataset (eg, a count of the number of attributes in the
* dataset), there is a small chance that consecutive reads occur
* before a write to that shared variable.
*
* HDF5 APIs exercised in thread:
* H5Acreate, H5Awrite, H5Aclose.
* H5Acreate2, H5Awrite, H5Aclose.
*
* Created: Oct 5 1999
* Programmer: Chee Wai LEE
@ -167,9 +167,9 @@ void *tts_acreate_thread(void *client_data)
/* Create attribute */
attribute_name = gen_name(attrib_data->current_index);
attribute = H5Acreate(attrib_data->dataset, attribute_name,
attribute = H5Acreate2(attrib_data->dataset, ".", attribute_name,
attrib_data->datatype, attrib_data->dataspace,
H5P_DEFAULT);
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write data to the attribute */
attribute_data = malloc(sizeof(int));

View File

@ -530,8 +530,8 @@ void test_attrname(hid_t fid, const char * string)
CHECK(ret, FAIL, "H5Tset_size");
/* Create the attribute and check that its name is correct */
attr_id = H5Acreate(group_id, string, dtype_id, space_id, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate");
attr_id = H5Acreate2(group_id, ".", string, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
ret = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf);
CHECK(ret, FAIL, "H5Aget_name");
ret = strcmp(read_buf, string);

View File

@ -597,8 +597,8 @@ static void test_write_vl_string_attribute(void)
CHECK(dataspace, FAIL, "H5Screate");
/* Test creating a "normal" sized string attribute */
att = H5Acreate(root, "test_scalar", type, dataspace, H5P_DEFAULT);
CHECK(att, FAIL, "H5Acreate");
att = H5Acreate2(root, ".", "test_scalar", type, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(att, FAIL, "H5Acreate2");
ret = H5Awrite(att, type, &string_att);
CHECK(ret, FAIL, "H5Awrite");
@ -615,8 +615,8 @@ static void test_write_vl_string_attribute(void)
CHECK(ret, FAIL, "HAclose");
/* Test creating a "large" sized string attribute */
att = H5Acreate(root, "test_scalar_large", type, dataspace, H5P_DEFAULT);
CHECK(att, FAIL, "H5Acreate");
att = H5Acreate2(root, ".", "test_scalar_large", type, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(att, FAIL, "H5Acreate2");
string_att_write = (char*)HDcalloc((size_t)8192, sizeof(char));
HDmemset(string_att_write, 'A', (size_t)8191);

View File

@ -824,7 +824,7 @@ test_filespace(hid_t fapl)
sprintf(objname,"%s %u",ATTRNAME,u);
/* Create an attribute on the first dataset */
if((attr = H5Acreate(dataset, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if((attr = H5Acreate2(dataset, ".", objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Don't worry about writing the attribute - it will have a fill value */
@ -832,7 +832,7 @@ test_filespace(hid_t fapl)
if(H5Aclose(attr) < 0) FAIL_STACK_ERROR
/* Create an attribute on the second dataset */
if((attr = H5Acreate(dataset2, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if((attr = H5Acreate2(dataset2, ".", objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Don't worry about writing the attribute - it will have a fill value */
@ -1191,7 +1191,7 @@ test_filespace(hid_t fapl)
if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0) FAIL_STACK_ERROR
/* Create an attribute on the dataset */
if((attr = H5Acreate(dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if((attr = H5Acreate2(dataset, ".", ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Don't worry about writing the attribute - it will have a fill value */
@ -1200,7 +1200,7 @@ test_filespace(hid_t fapl)
/* Create another attribute with same name */
H5E_BEGIN_TRY {
attr = H5Acreate(dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT);
attr = H5Acreate2(dataset, ".", ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY;
if(attr >= 0) {
H5Aclose(attr);

View File

@ -84,11 +84,11 @@ test_sec2(void)
/* Set property list and file name for SEC2 driver. */
fapl = h5_fileaccess();
if(H5Pset_fapl_sec2(fapl)<0)
if(H5Pset_fapl_sec2(fapl) < 0)
TEST_ERROR;
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
@ -100,7 +100,7 @@ test_sec2(void)
TEST_ERROR;
/* Check file handle API */
if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle)<0)
if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
TEST_ERROR;
if(*fhandle<0)
TEST_ERROR;
@ -115,7 +115,7 @@ test_sec2(void)
if(file_size<1*KB || file_size>4*KB)
TEST_ERROR;
if(H5Fclose(file)<0)
if(H5Fclose(file) < 0)
TEST_ERROR;
h5_cleanup(FILENAME, fapl);
PASSED();
@ -175,17 +175,17 @@ test_direct(void)
/* Set property list and file name for Direct driver. Set memory alignment boundary
* and file block size to 512 which is the minimum for Linux 2.6. */
fapl = h5_fileaccess();
if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE)<0)
if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0)
TEST_ERROR;
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
/* Verify the file access properties */
if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize)<0)
if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0)
TEST_ERROR;
if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE)
TEST_ERROR;
if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE)<0)
if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0)
TEST_ERROR;
H5E_BEGIN_TRY {
@ -207,7 +207,7 @@ test_direct(void)
TEST_ERROR;
/* Check file handle API */
if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle)<0)
if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0)
TEST_ERROR;
if(*fhandle<0)
TEST_ERROR;
@ -239,25 +239,25 @@ test_direct(void)
/* Create the data space1 */
dims1[0] = DSET1_DIM1;
dims1[1] = DSET1_DIM2;
if ((space1 = H5Screate_simple(2, dims1, NULL))<0)
if ((space1 = H5Screate_simple(2, dims1, NULL)) < 0)
TEST_ERROR;
/* Create the dset1 */
if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT))<0)
if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0)
if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
if(H5Dclose(dset1)<0)
if(H5Dclose(dset1) < 0)
TEST_ERROR;
if((dset1=H5Dopen(file, DSET1_NAME))<0)
if((dset1=H5Dopen(file, DSET1_NAME)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check)<0)
if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@ -276,25 +276,25 @@ test_direct(void)
/* Create the data space2. For data set 2, memory address and data size are not aligned. */
dims2[0] = DSET2_DIM;
if ((space2 = H5Screate_simple(1, dims2, NULL))<0)
if ((space2 = H5Screate_simple(1, dims2, NULL)) < 0)
TEST_ERROR;
/* Create the dset2 */
if ((dset2 = H5Dcreate(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT))<0)
if ((dset2 = H5Dcreate(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
if (H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2)<0)
if (H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0)
TEST_ERROR;
if(H5Dclose(dset2)<0)
if(H5Dclose(dset2) < 0)
TEST_ERROR;
if((dset2=H5Dopen(file, DSET2_NAME))<0)
if((dset2=H5Dopen(file, DSET2_NAME)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
if (H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2)<0)
if (H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@ -307,15 +307,15 @@ test_direct(void)
}
}
if(H5Sclose(space1)<0)
if(H5Sclose(space1) < 0)
TEST_ERROR;
if(H5Dclose(dset1)<0)
if(H5Dclose(dset1) < 0)
TEST_ERROR;
if(H5Sclose(space2)<0)
if(H5Sclose(space2) < 0)
TEST_ERROR;
if(H5Dclose(dset2)<0)
if(H5Dclose(dset2) < 0)
TEST_ERROR;
if(H5Fclose(file)<0)
if(H5Fclose(file) < 0)
TEST_ERROR;
if(points)
free(points);
@ -379,11 +379,11 @@ test_core(void)
/* Set property list and file name for CORE driver */
fapl = h5_fileaccess();
if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE)<0)
if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
TEST_ERROR;
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
@ -394,7 +394,7 @@ test_core(void)
if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle)<0)
if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle) < 0)
TEST_ERROR;
if(fhandle==NULL)
{
@ -412,16 +412,16 @@ test_core(void)
if(file_size<2*KB || file_size>6*KB)
TEST_ERROR;
if(H5Fclose(file)<0)
if(H5Fclose(file) < 0)
TEST_ERROR;
/* Open the file with backing store off for read and write.
* Changes won't be saved in file. */
if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE)<0)
if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE) < 0)
TEST_ERROR;
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0)
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Allocate memory for data set. */
@ -437,25 +437,25 @@ test_core(void)
/* Create the data space1 */
dims1[0] = DSET1_DIM1;
dims1[1] = DSET1_DIM2;
if ((space1 = H5Screate_simple(2, dims1, NULL))<0)
if ((space1 = H5Screate_simple(2, dims1, NULL)) < 0)
TEST_ERROR;
/* Create the dset1 */
if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT))<0)
if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0)
if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
if(H5Dclose(dset1)<0)
if(H5Dclose(dset1) < 0)
TEST_ERROR;
if((dset1=H5Dopen(file, DSET1_NAME))<0)
if((dset1=H5Dopen(file, DSET1_NAME)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check)<0)
if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@ -472,32 +472,32 @@ test_core(void)
}
}
if(H5Dclose(dset1)<0)
if(H5Dclose(dset1) < 0)
TEST_ERROR;
if(H5Fclose(file)<0)
if(H5Fclose(file) < 0)
TEST_ERROR;
/* Open the file with backing store on for read and write.
* Changes will be saved in file. */
if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE)<0)
if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
TEST_ERROR;
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0)
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Create the dset1 */
if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT))<0)
if ((dset1 = H5Dcreate(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points)<0)
if (H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
if(H5Dclose(dset1)<0)
if(H5Dclose(dset1) < 0)
TEST_ERROR;
if((dset1=H5Dopen(file, DSET1_NAME))<0)
if((dset1=H5Dopen(file, DSET1_NAME)) < 0)
TEST_ERROR;
/* Reallocate memory for reading buffer. */
@ -507,7 +507,7 @@ test_core(void)
check=(int*)malloc(DSET1_DIM1*DSET1_DIM2*sizeof(int));
/* Read the data back from dset1 */
if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check)<0)
if (H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@ -533,11 +533,11 @@ test_core(void)
if(file_size<64*KB || file_size>256*KB)
TEST_ERROR;
if(H5Sclose(space1)<0)
if(H5Sclose(space1) < 0)
TEST_ERROR;
if(H5Dclose(dset1)<0)
if(H5Dclose(dset1) < 0)
TEST_ERROR;
if(H5Fclose(file)<0)
if(H5Fclose(file) < 0)
TEST_ERROR;
if(points)
free(points);
@ -597,7 +597,7 @@ test_family_opens(char *fname, hid_t fa_pl)
if(file >= 0) TEST_ERROR
/* Case 3: reopen file with wrong member size */
if(H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT)<0)
if(H5Pset_fapl_family(fa_pl, (hsize_t)128, H5P_DEFAULT) < 0)
TEST_ERROR;
H5E_BEGIN_TRY {
@ -613,7 +613,7 @@ test_family_opens(char *fname, hid_t fa_pl)
break;
}
if(H5Pset_fapl_family(fa_pl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT)<0)
if(H5Pset_fapl_family(fa_pl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
H5E_BEGIN_TRY {
@ -671,14 +671,14 @@ test_family(void)
/* Set property list and file name for FAMILY driver */
fapl = h5_fileaccess();
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT)<0)
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
if(H5Fclose(file)<0)
if(H5Fclose(file) < 0)
TEST_ERROR;
/* Test different wrong ways to reopen family files where there's only
@ -687,10 +687,10 @@ test_family(void)
TEST_ERROR;
/* Reopen the file with default member file size */
if(H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT)<0)
if(H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR;
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0)
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Check file size API */
@ -702,7 +702,7 @@ test_family(void)
TEST_ERROR;
/* Create and write dataset */
if((space=H5Screate_simple(2, dims, NULL))<0)
if((space=H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
@ -713,30 +713,30 @@ test_family(void)
if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
if((dset=H5Dcreate(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT))<0)
if((dset=H5Dcreate(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0)
TEST_ERROR;
for(i=0; i<FAMILY_NUMBER; i++)
for(j=0; j<FAMILY_SIZE; j++)
buf[i][j] = i*10000+j;
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)<0)
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
TEST_ERROR;
/* check file handle API */
if((fapl2=H5Pcreate(H5P_FILE_ACCESS))<0)
if((fapl2=H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
if(H5Pset_family_offset(fapl2, (hsize_t)0)<0)
if(H5Pset_family_offset(fapl2, (hsize_t)0) < 0)
TEST_ERROR;
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle)<0)
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
TEST_ERROR;
if(*fhandle<0)
TEST_ERROR;
if(H5Pset_family_offset(fapl2, (hsize_t)(FAMILY_SIZE*2))<0)
if(H5Pset_family_offset(fapl2, (hsize_t)(FAMILY_SIZE*2)) < 0)
TEST_ERROR;
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2)<0)
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
TEST_ERROR;
if(*fhandle2<0)
TEST_ERROR;
@ -755,28 +755,28 @@ test_family(void)
TEST_ERROR;
}
if(H5Sclose(space)<0)
if(H5Sclose(space) < 0)
TEST_ERROR;
if(H5Dclose(dset)<0)
if(H5Dclose(dset) < 0)
TEST_ERROR;
if(H5Pclose(fapl2)<0)
if(H5Pclose(fapl2) < 0)
TEST_ERROR;
if(H5Fclose(file)<0)
if(H5Fclose(file) < 0)
TEST_ERROR;
/* Test different wrong ways to reopen family files when there're multiple
* member files existing. */
if(test_family_opens(filename, fapl)<0)
if(test_family_opens(filename, fapl) < 0)
TEST_ERROR;
/* Reopen the file with correct member file size. */
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT)<0)
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
TEST_ERROR;
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0)
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
if(H5Fclose(file)<0)
if(H5Fclose(file) < 0)
TEST_ERROR;
h5_cleanup(FILENAME, fapl);
@ -834,7 +834,7 @@ test_family_compat(void)
/* Set property list and file name for FAMILY driver */
fapl = h5_fileaccess();
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT)<0)
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT) < 0)
TEST_ERROR;
h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof filename);
@ -847,13 +847,13 @@ test_family_compat(void)
}
strcat(pathname, filename);
if((file=H5Fopen(pathname, H5F_ACC_RDONLY, fapl))<0)
if((file=H5Fopen(pathname, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR;
if(H5Fclose(file)<0)
if(H5Fclose(file) < 0)
TEST_ERROR;
if(H5Pclose(fapl)<0)
if(H5Pclose(fapl) < 0)
TEST_ERROR;
PASSED();
@ -979,27 +979,27 @@ test_multi(void)
memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX*3/4;
if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE)<0)
if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0)
TEST_ERROR;
h5_fixname(FILENAME[3], fapl, filename, sizeof filename);
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
if(H5Fclose(file)<0)
if(H5Fclose(file) < 0)
TEST_ERROR;
/* Test wrong ways to reopen multi files */
if(test_multi_opens(filename)<0)
if(test_multi_opens(filename) < 0)
TEST_ERROR;
/* Reopen the file */
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl))<0)
if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Create and write data set */
if((space=H5Screate_simple(2, dims, NULL))<0)
if((space=H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
@ -1020,27 +1020,27 @@ test_multi(void)
if(file_size < HADDR_MAX/4 || file_size > HADDR_MAX/2)
TEST_ERROR;
if((dset=H5Dcreate(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT))<0)
if((dset=H5Dcreate(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0)
TEST_ERROR;
for(i=0; i<MULTI_SIZE; i++)
for(j=0; j<MULTI_SIZE; j++)
buf[i][j] = i*10000+j;
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)<0)
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
TEST_ERROR;
if((fapl2=H5Pcreate(H5P_FILE_ACCESS))<0)
if((fapl2=H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
if(H5Pset_multi_type(fapl2, H5FD_MEM_SUPER)<0)
if(H5Pset_multi_type(fapl2, H5FD_MEM_SUPER) < 0)
TEST_ERROR;
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle)<0)
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle) < 0)
TEST_ERROR;
if(*fhandle<0)
TEST_ERROR;
if(H5Pset_multi_type(fapl2, H5FD_MEM_DRAW)<0)
if(H5Pset_multi_type(fapl2, H5FD_MEM_DRAW) < 0)
TEST_ERROR;
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2)<0)
if(H5Fget_vfd_handle(file, fapl2, (void **)&fhandle2) < 0)
TEST_ERROR;
if(*fhandle2<0)
TEST_ERROR;
@ -1056,11 +1056,11 @@ test_multi(void)
if(file_size < HADDR_MAX/2 || file_size > HADDR_MAX)
TEST_ERROR;
if(H5Sclose(space)<0)
if(H5Sclose(space) < 0)
TEST_ERROR;
if(H5Dclose(dset)<0)
if(H5Dclose(dset) < 0)
TEST_ERROR;
if(H5Pclose(fapl2)<0)
if(H5Pclose(fapl2) < 0)
TEST_ERROR;
/* Create and write attribute for the root group. */
@ -1068,34 +1068,34 @@ test_multi(void)
FAIL_STACK_ERROR
/* Attribute string. */
if((atype = H5Tcopy(H5T_C_S1))<0)
if((atype = H5Tcopy(H5T_C_S1)) < 0)
TEST_ERROR;
if(H5Tset_size(atype, strlen(meta) + 1)<0)
if(H5Tset_size(atype, strlen(meta) + 1) < 0)
TEST_ERROR;
if(H5Tset_strpad(atype, H5T_STR_NULLTERM)<0)
if(H5Tset_strpad(atype, H5T_STR_NULLTERM) < 0)
TEST_ERROR;
/* Create and write attribute */
if((aspace = H5Screate_simple(1, adims, NULL))<0)
if((aspace = H5Screate_simple(1, adims, NULL)) < 0)
TEST_ERROR;
if((attr = H5Acreate(root, "Metadata", atype, aspace, H5P_DEFAULT))<0)
if((attr = H5Acreate2(root, ".", "Metadata", atype, aspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
if(H5Awrite(attr, atype, meta)<0)
if(H5Awrite(attr, atype, meta) < 0)
TEST_ERROR;
/* Close IDs */
if(H5Tclose(atype)<0)
if(H5Tclose(atype) < 0)
TEST_ERROR;
if(H5Sclose(aspace)<0)
if(H5Sclose(aspace) < 0)
TEST_ERROR;
if(H5Aclose(attr)<0)
if(H5Aclose(attr) < 0)
TEST_ERROR;
if(H5Fclose(file)<0)
if(H5Fclose(file) < 0)
TEST_ERROR;
h5_cleanup(FILENAME, fapl);
@ -1134,18 +1134,18 @@ error:
int
main(void)
{
int nerrors=0;
int nerrors = 0;
h5_reset();
nerrors += test_sec2()<0 ?1:0;
nerrors += test_core()<0 ?1:0;
nerrors += test_family()<0 ?1:0;
nerrors += test_family_compat()<0 ?1:0;
nerrors += test_multi()<0 ?1:0;
nerrors += test_direct()<0 ?1:0;
nerrors += test_sec2() < 0 ? 1 : 0;
nerrors += test_core() < 0 ? 1 : 0;
nerrors += test_family() < 0 ? 1 : 0;
nerrors += test_family_compat() < 0 ? 1 : 0;
nerrors += test_multi() < 0 ? 1 : 0;
nerrors += test_direct() < 0 ? 1 : 0;
if (nerrors){
if(nerrors) {
printf("***** %d Virtual File Driver TEST%s FAILED! *****\n",
nerrors, nerrors > 1 ? "S" : "");
return 1;
@ -1154,3 +1154,4 @@ main(void)
printf("All Virtual File Driver tests passed.\n");
return 0;
}

View File

@ -338,16 +338,16 @@ void null_dataset(void)
/* Write "nothing" to the dataset (with type conversion) */
ret=H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, &uval);
ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, &uval);
VRFY((ret >= 0), "H5Dwrite succeeded");
/* Create an attribute for the group */
attr=H5Acreate(dataset,attr_name,H5T_NATIVE_UINT,sid,H5P_DEFAULT);
VRFY((attr>=0), "H5Acreate");
attr = H5Acreate2(dataset, ".", attr_name, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((attr >= 0), "H5Acreate2");
/* Write "nothing" to the attribute (with type conversion) */
ret = H5Awrite(attr, H5T_NATIVE_INT, &val);
VRFY((ret>=0), "H5Awrite");
VRFY((ret >= 0), "H5Awrite");
H5Aclose (attr);
H5Dclose (dataset);
@ -1300,21 +1300,21 @@ void write_attribute(hid_t obj_id, int this_type, int num)
if(this_type == is_group) {
sprintf(attr_name, "Group Attribute %d", num);
sid = H5Screate(H5S_SCALAR);
aid = H5Acreate(obj_id, attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT);
aid = H5Acreate2(obj_id, ".", attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(aid, H5T_NATIVE_INT, &num);
H5Aclose(aid);
H5Sclose(sid);
}
} /* end if */
else if(this_type == is_dset) {
sprintf(attr_name, "Dataset Attribute %d", num);
for(i=0; i<8; i++)
attr_data[i] = i;
sid = H5Screate_simple(dspace_rank, dspace_dims, NULL);
aid = H5Acreate(obj_id, attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT);
aid = H5Acreate2(obj_id, ".", attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(aid, H5T_NATIVE_INT, attr_data);
H5Aclose(aid);
H5Sclose(sid);
}
} /* end else-if */
}

View File

@ -618,7 +618,7 @@ int test_attributes(const char *file,
herr_t status;
/* Create a file */
if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0)
if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
/* Create a 1D dataset */
@ -682,7 +682,7 @@ int test_datasets(const char *file,
memset(buf,0,sizeof buf);
/* Create a file */
if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0)
if ((fid = H5Fcreate(file, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
/* Create a 1D dataset */
@ -972,13 +972,13 @@ void write_attr_in(hid_t loc_id,
[ 1 ] 3 0 3
*/
sid = H5Screate_simple(1,dims,NULL);
sid = H5Screate_simple(1, dims, NULL);
tid = H5Tvlen_create(H5T_NATIVE_INT);
aid = H5Acreate(loc_id,"vlen",tid,sid,H5P_DEFAULT);
status = H5Awrite(aid,tid,buf5);
assert(status>=0);
status = H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf5);
assert(status>=0);
aid = H5Acreate2(loc_id, ".", "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf5);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
assert(status >= 0);
status = H5Aclose(aid);
status = H5Tclose(tid);
status = H5Sclose(sid);
@ -1243,13 +1243,13 @@ position enum2D of </g1> enum2D of </g1> difference
[ 2 1 ] 11 0 11
*/
sid = H5Screate_simple(2,dims2,NULL);
sid = H5Screate_simple(2, dims2, NULL);
tid = H5Tvlen_create(H5T_NATIVE_INT);
aid = H5Acreate(loc_id,"vlen2D",tid,sid,H5P_DEFAULT);
status = H5Awrite(aid,tid,buf52);
assert(status>=0);
status = H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf52);
assert(status>=0);
aid = H5Acreate2(loc_id, ".", "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf52);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
assert(status >= 0);
status = H5Aclose(aid);
status = H5Tclose(tid);
status = H5Sclose(sid);
@ -1640,13 +1640,13 @@ position vlen3D of </g1> vlen3D of </g1> difference
[ 1 1 0 ] 10 0 10
etc
*/
sid = H5Screate_simple(3,dims3,NULL);
sid = H5Screate_simple(3, dims3, NULL);
tid = H5Tvlen_create(H5T_NATIVE_INT);
aid = H5Acreate(loc_id,"vlen3D",tid,sid,H5P_DEFAULT);
status = H5Awrite(aid,tid,buf53);
assert(status>=0);
status = H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf53);
assert(status>=0);
aid = H5Acreate2(loc_id, ".", "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf53);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
assert(status >= 0);
status = H5Aclose(aid);
status = H5Tclose(tid);
status = H5Sclose(sid);
@ -2438,19 +2438,19 @@ int test_hyperslab(const char *fname,
/* create */
fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0)
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
if (H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue)<0)
if (H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue) < 0)
goto out;
if(H5Pset_chunk(dcpl, 1, chunk_dims)<0)
if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
goto out;
if ((f_sid = H5Screate_simple(1,dims,NULL))<0)
if ((f_sid = H5Screate_simple(1,dims,NULL)) < 0)
goto out;
if ((did = H5Dcreate(fid,"big",H5T_NATIVE_CHAR,f_sid,dcpl))<0)
if ((did = H5Dcreate(fid,"big",H5T_NATIVE_CHAR,f_sid,dcpl)) < 0)
goto out;
if ((m_sid = H5Screate_simple(1, hs_size, hs_size))<0)
if ((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
goto out;
if ((tid = H5Dget_type(did))<0)
if ((tid = H5Dget_type(did)) < 0)
goto out;
if ((size = H5Tget_size(tid))<=0)
goto out;
@ -2476,13 +2476,13 @@ int test_hyperslab(const char *fname,
}
hs_start[0] = i * GBLL/(1024*1024);
if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL)<0)
if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
goto out;
/* write only one hyperslab */
if ( i==512*512)
{
if (H5Dwrite (did,H5T_NATIVE_CHAR,m_sid,f_sid,H5P_DEFAULT,buf)<0)
if (H5Dwrite (did,H5T_NATIVE_CHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
goto out;
}
@ -2491,13 +2491,13 @@ int test_hyperslab(const char *fname,
buf=NULL;
/* close */
if(H5Sclose(f_sid)<0)
if(H5Sclose(f_sid) < 0)
goto out;
if(H5Sclose(m_sid)<0)
if(H5Sclose(m_sid) < 0)
goto out;
if(H5Pclose(dcpl)<0)
if(H5Pclose(dcpl) < 0)
goto out;
if(H5Dclose(did)<0)
if(H5Dclose(did) < 0)
goto out;
H5Fclose(fid);
@ -2535,25 +2535,23 @@ int write_attr(hid_t loc_id,
hid_t sid;
/* create a space */
if (( sid = H5Screate_simple(rank,dims,NULL)) < 0 )
if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
goto out;
/* create the attribute */
if (( aid = H5Acreate(loc_id,name,tid,sid,H5P_DEFAULT)) < 0 )
if((aid = H5Acreate2(loc_id, ".", name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* write */
if ( buf )
{
if ( H5Awrite(aid,tid,buf) < 0 )
if(buf)
if(H5Awrite(aid, tid, buf) < 0)
goto out;
}
/* close */
H5Aclose(aid);
H5Sclose(sid);
return SUCCEED;
return SUCCEED;
out:

View File

@ -379,7 +379,7 @@ gent_attribute(void)
/* attribute 1 */
dims[0] = 24;
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (root, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT);
attr = H5Acreate2(root, ".", "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "attribute of root group");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@ -388,7 +388,7 @@ gent_attribute(void)
/* attribute 2 */
dims[0] = 10;
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (root, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT);
attr = H5Acreate2(root, ".", "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for (i = 0; i < 10; i++) data[i] = i+1;
@ -399,7 +399,7 @@ gent_attribute(void)
/* attribute 3 */
dims[0] = 10;
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (root, "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT);
attr = H5Acreate2(root, ".", "attr3", H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for (i = 0; i < 10; i++) d[i] = 0.1 * i;
@ -409,7 +409,7 @@ gent_attribute(void)
/* attribute 4 */
space = H5Screate(H5S_SCALAR);
attr = H5Acreate (root, "attr4", H5T_STD_I32BE, space, H5P_DEFAULT);
attr = H5Acreate2(root, ".", "attr4", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT, &point);
H5Sclose(space);
H5Aclose(attr);
@ -418,7 +418,7 @@ gent_attribute(void)
space = H5Screate(H5S_SCALAR);
type = H5Tcopy(H5T_C_S1);
H5Tset_size(type, 17);
attr = H5Acreate (root, "attr5", type, space, H5P_DEFAULT);
attr = H5Acreate2(root, ".", "attr5", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, type, string);
H5Tclose(type);
@ -931,7 +931,7 @@ static void gent_all(void)
dims[0] = 10;
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT);
attr = H5Acreate2(group, ".", "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "abcdefghi");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@ -939,7 +939,7 @@ static void gent_all(void)
dims[0] = 2; dims[1] = 2;
space = H5Screate_simple(2, dims, NULL);
attr = H5Acreate (group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT);
attr = H5Acreate2(group, ".", "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
H5Awrite(attr, H5T_NATIVE_INT, data);
H5Sclose(space);
@ -962,7 +962,7 @@ static void gent_all(void)
/* attributes of dset1.1.1 */
dims[0] = 27;
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT);
attr = H5Acreate2(dataset, ".", "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "1st attribute of dset1.1.1");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@ -970,7 +970,7 @@ static void gent_all(void)
dims[0] = 27;
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT);
attr = H5Acreate2(dataset, ".", "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "2nd attribute of dset1.1.1");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@ -1165,7 +1165,7 @@ static void gent_many(void)
/* add attributes to dset1 */
dims[0] = 10;
space2 = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT);
attr = H5Acreate2(dataset, ".", "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "abcdefghi");
H5Awrite(attr, H5T_NATIVE_CHAR, buf);
H5Sclose(space2);
@ -1173,7 +1173,7 @@ static void gent_many(void)
dims[0] = 2; dims[1] = 2;
space2 = H5Screate_simple(2, dims, NULL);
attr = H5Acreate (dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT);
attr = H5Acreate2(dataset, ".", "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
H5Awrite(attr, H5T_NATIVE_INT, data);
H5Sclose(space2);
@ -1181,7 +1181,7 @@ static void gent_many(void)
dims[0] = 10;
space2 = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT);
attr = H5Acreate2(dataset, ".", "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
for (i = 0; i < 10; i++)
d[i] = 0.1 * i;
H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
@ -1489,7 +1489,7 @@ hsize_t sdim;
dims[0] = 3;
space2 = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (dataset, "attr1", fxdlenstr2, space2, H5P_DEFAULT);
attr = H5Acreate2(dataset, ".", "attr1", fxdlenstr2, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(&(buf2[0*LENSTR2]), "0123456789");
sprintf(&(buf2[1*LENSTR2]), "abcdefghij");
sprintf(&(buf2[2*LENSTR2]), "ABCDEFGHIJ");
@ -2950,7 +2950,7 @@ void gent_split_file(void)
dims[0] = 1;
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate(root, "Metadata", atype, space, H5P_DEFAULT);
attr = H5Acreate2(root, ".", "Metadata", atype, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, atype, meta);
H5Tclose(atype);
H5Sclose(space);
@ -3120,7 +3120,7 @@ static void gent_vlstr(void)
root = H5Gopen2(fid1, "/", H5P_DEFAULT);
dataspace = H5Screate(H5S_SCALAR);
att = H5Acreate(root, "test_scalar", tid1, dataspace, H5P_DEFAULT);
att = H5Acreate2(root, ".", "test_scalar", tid1, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(att, tid1, &string_att);
/* Close */
@ -3312,20 +3312,20 @@ static void write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
buf5[0].len = 1;
buf5[0].p = malloc( 1 * sizeof(int));
((int *)buf5[0].p)[0]=1;
buf5[0].p = malloc(1 * sizeof(int));
((int *)buf5[0].p)[0] = 1;
buf5[1].len = 2;
buf5[1].p = malloc( 2 * sizeof(int));
((int *)buf5[1].p)[0]=2;
((int *)buf5[1].p)[1]=3;
buf5[1].p = malloc(2 * sizeof(int));
((int *)buf5[1].p)[0] = 2;
((int *)buf5[1].p)[1] = 3;
sid = H5Screate_simple(1,dims,NULL);
sid = H5Screate_simple(1, dims, NULL);
tid = H5Tvlen_create(H5T_NATIVE_INT);
aid = H5Acreate(loc_id,"vlen",tid,sid,H5P_DEFAULT);
status = H5Awrite(aid,tid,buf5);
assert(status>=0);
status = H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf5);
assert(status>=0);
aid = H5Acreate2(loc_id, ".", "vlen", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf5);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf5);
assert(status >= 0);
status = H5Aclose(aid);
status = H5Tclose(tid);
status = H5Sclose(sid);
@ -3419,23 +3419,24 @@ static void write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
n=0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 2; j++) {
for(i = 0; i < 3; i++) {
for(j = 0; j < 2; j++) {
int l;
buf52[i][j].p = malloc((i + 1) * sizeof(int));
buf52[i][j].len = i + 1;
for (l = 0; l < i + 1; l++)
((int *)buf52[i][j].p)[l] = n++;
for(l = 0; l < i + 1; l++)
((int *)buf52[i][j].p)[l] = n++;
}
}
sid = H5Screate_simple(2,dims2,NULL);
sid = H5Screate_simple(2, dims2, NULL);
tid = H5Tvlen_create(H5T_NATIVE_INT);
aid = H5Acreate(loc_id,"vlen2D",tid,sid,H5P_DEFAULT);
status = H5Awrite(aid,tid,buf52);
assert(status>=0);
status = H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf52);
assert(status>=0);
aid = H5Acreate2(loc_id, ".", "vlen2D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf52);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf52);
assert(status >= 0);
status = H5Aclose(aid);
status = H5Tclose(tid);
status = H5Sclose(sid);
@ -3548,26 +3549,27 @@ static void write_attr_in(hid_t loc_id,
*/
/* Allocate and initialize VL dataset to write */
n=0;
for (i = 0; i < 4; i++) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++) {
n = 0;
for(i = 0; i < 4; i++) {
for(j = 0; j < 3; j++) {
for(k = 0; k < 2; k++) {
int l;
buf53[i][j][k].p = malloc((i + 1) * sizeof(int));
buf53[i][j][k].len = i + 1;
for (l = 0; l < i + 1; l++)
((int *)buf53[i][j][k].p)[l] = n++;
for(l = 0; l < i + 1; l++)
((int *)buf53[i][j][k].p)[l] = n++;
}
}
}
sid = H5Screate_simple(3,dims3,NULL);
sid = H5Screate_simple(3, dims3, NULL);
tid = H5Tvlen_create(H5T_NATIVE_INT);
aid = H5Acreate(loc_id,"vlen3D",tid,sid,H5P_DEFAULT);
status = H5Awrite(aid,tid,buf53);
assert(status>=0);
status = H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf53);
assert(status>=0);
aid = H5Acreate2(loc_id, ".", "vlen3D", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Awrite(aid, tid, buf53);
assert(status >= 0);
status = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf53);
assert(status >= 0);
status = H5Aclose(aid);
status = H5Tclose(tid);
status = H5Sclose(sid);
@ -4154,18 +4156,19 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
herr_t status;
/* Create a buf space */
sid = H5Screate_simple(rank,dims,NULL);
sid = H5Screate_simple(rank, dims, NULL);
/* Create the attribute */
aid = H5Acreate(loc_id,attr_name,tid,sid,H5P_DEFAULT);
aid = H5Acreate2(loc_id, ".", attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/* Write the buf */
if ( buf )
status = H5Awrite(aid,tid,buf);
if(buf)
status = H5Awrite(aid, tid, buf);
/* Close */
status = H5Aclose(aid);
status = H5Sclose(sid);
return status;
}
@ -4417,16 +4420,16 @@ static void gent_named_dtype_attr(void)
assert(ret >= 0);
/* Create a scalar dataspace used for all objects */
sid=H5Screate(H5S_SCALAR);
assert(sid>0);
sid = H5Screate(H5S_SCALAR);
assert(sid > 0);
/* Create attribute on commited datatype */
aid=H5Acreate(tid,F42_ATTRNAME,H5T_STD_I32LE,sid,H5P_DEFAULT);
assert(aid>0);
aid = H5Acreate2(tid, ".", F42_ATTRNAME, H5T_STD_I32LE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(aid > 0);
/* Write data into the attribute */
ret=H5Awrite(aid,H5T_NATIVE_INT,&data);
assert(ret>=0);
ret = H5Awrite(aid, H5T_NATIVE_INT, &data);
assert(ret >= 0);
/*-------------------------------------------------------------------------
* dataset
@ -4434,16 +4437,16 @@ static void gent_named_dtype_attr(void)
*/
/* Create dataset */
did=H5Dcreate(fid,F42_DSETNAME,tid,sid,H5P_DEFAULT);
assert(did>0);
did = H5Dcreate(fid, F42_DSETNAME, tid, sid, H5P_DEFAULT);
assert(did > 0);
/* Create attribute on dataset */
aid=H5Acreate(did,F42_ATTRNAME,tid,sid,H5P_DEFAULT);
assert(aid>0);
aid = H5Acreate2(did, ".", F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(aid > 0);
/* Write data into the attribute */
ret=H5Awrite(aid,H5T_NATIVE_INT,&data);
assert(ret>=0);
ret = H5Awrite(aid, H5T_NATIVE_INT, &data);
assert(ret >= 0);
/*-------------------------------------------------------------------------
* group
@ -4452,15 +4455,15 @@ static void gent_named_dtype_attr(void)
/* Create a group */
gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(gid>0);
assert(gid > 0);
/* Create attribute on group */
aid=H5Acreate(gid,F42_ATTRNAME,tid,sid,H5P_DEFAULT);
assert(aid>0);
aid = H5Acreate2(gid, ".", F42_ATTRNAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
assert(aid > 0);
/* Write data into the attribute */
ret=H5Awrite(aid,H5T_NATIVE_INT,&data);
assert(ret>=0);
ret = H5Awrite(aid, H5T_NATIVE_INT, &data);
assert(ret >= 0);
/*-------------------------------------------------------------------------
* close
@ -4513,7 +4516,7 @@ static void gent_null_space(void)
H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf);
/* attribute */
attr = H5Acreate (root, "attr", H5T_NATIVE_UINT, space, H5P_DEFAULT);
attr = H5Acreate2(root, ".", "attr", H5T_NATIVE_UINT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(attr, H5T_NATIVE_INT, &point); /* Nothing can be written */
H5Dclose(dataset);
@ -5762,7 +5765,7 @@ gent_hyperslab(void)
*-------------------------------------------------------------------------
*/
static void
gent_group_creation_order()
gent_group_creation_order(void)
{
hid_t fid; /* file ID */
hid_t gid; /* group ID */
@ -5902,7 +5905,7 @@ out:
*-------------------------------------------------------------------------
*/
static void
gent_attr_creation_order()
gent_attr_creation_order(void)
{
hid_t fid; /* file id */
hid_t gid; /* group id */
@ -5910,11 +5913,11 @@ gent_attr_creation_order()
hid_t sid; /* space id */
hid_t aid; /* attribute id */
hid_t gcpl_id; /* group creation property list ID */
hid_t dcpl_id; /* dataset creation property list ID */
hid_t dcpl_id; /* dataset creation property list ID */
int i;
char *attr_name[3] = {"c", "b", "a" };
const char *attr_name[3] = {"c", "b", "a" };
if ((fid = H5Fcreate(FILE59, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
if((fid = H5Fcreate(FILE59, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* create group creation property list */
@ -5939,23 +5942,21 @@ gent_attr_creation_order()
*/
/* create dataspace for dataset */
if ((sid = H5Screate(H5S_SCALAR)) < 0)
if((sid = H5Screate(H5S_SCALAR)) < 0)
goto out;
/* create a dataset */
if ((did = H5Dcreate(fid, "dset", H5T_NATIVE_UCHAR, sid, dcpl_id)) < 0)
if((did = H5Dcreate(fid, "dset", H5T_NATIVE_UCHAR, sid, dcpl_id)) < 0)
goto out;
/* add attributes */
for(i = 0; i < 3; i++)
{
if ((aid = H5Acreate(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT)) < 0)
for(i = 0; i < 3; i++) {
if((aid = H5Acreate2(did, ".", attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
if (H5Aclose(aid) < 0)
if(H5Aclose(aid) < 0)
goto out;
} /* end for */
if (H5Dclose(did) < 0)
@ -5967,33 +5968,30 @@ gent_attr_creation_order()
*-------------------------------------------------------------------------
*/
if ((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
if((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
for(i = 0; i < 3; i++)
{
if ((aid = H5Acreate(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT)) < 0)
for(i = 0; i < 3; i++) {
if((aid = H5Acreate2(gid, ".", attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
if (H5Aclose(aid) < 0)
if(H5Aclose(aid) < 0)
goto out;
} /* end for */
if (H5Gclose(gid) < 0)
goto out;
/* close */
if (H5Sclose(sid) < 0)
if(H5Sclose(sid) < 0)
goto out;
if (H5Pclose(dcpl_id) < 0)
if(H5Pclose(dcpl_id) < 0)
goto out;
if (H5Pclose(gcpl_id) < 0)
if(H5Pclose(gcpl_id) < 0)
goto out;
if (H5Fclose(fid) < 0)
if(H5Fclose(fid) < 0)
goto out;
return;

View File

@ -207,7 +207,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
dims[0] = 10;
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT);
attr = H5Acreate2(group, ".", "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "abcdefghi");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@ -215,7 +215,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
dims[0] = 2; dims[1] = 2;
space = H5Screate_simple(2, dims, NULL);
attr = H5Acreate (group, "attr2", H5T_STD_I32BE, space, H5P_DEFAULT);
attr = H5Acreate2(group, ".", "attr2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
H5Awrite(attr, H5T_NATIVE_INT, data);
H5Sclose(space);
@ -238,7 +238,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
/* attributes of dset1.1.1 */
dims[0] = 27;
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT);
attr = H5Acreate2(dataset, ".", "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "1st attribute of dset1.1.1");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);
@ -246,7 +246,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
dims[0] = 27;
space = H5Screate_simple(1, dims, NULL);
attr = H5Acreate (dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT);
attr = H5Acreate2(dataset, ".", "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
sprintf(buf, "2nd attribute of dset1.1.1");
H5Awrite(attr, H5T_NATIVE_SCHAR, buf);
H5Sclose(space);

View File

@ -417,16 +417,16 @@ int do_copy_objects(hid_t fidin,
* copy attrs
*-------------------------------------------------------------------------
*/
if (copy_attr(grp_in,grp_out,options)<0)
if (copy_attr(grp_in,grp_out,options) < 0)
goto error;
if (gcpl_id>0) {
if (H5Pclose(gcpl_id)<0)
if (H5Pclose(gcpl_id) < 0)
goto error;
}
if (H5Gclose(grp_out)<0)
if (H5Gclose(grp_out) < 0)
goto error;
if (H5Gclose(grp_in)<0)
if (H5Gclose(grp_in) < 0)
goto error;
break;
@ -440,15 +440,15 @@ int do_copy_objects(hid_t fidin,
has_filter = 0;
/* early detection of references */
if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0)
if ((dset_in=H5Dopen(fidin,travt->objs[i].name)) < 0)
goto error;
if ((ftype_id=H5Dget_type (dset_in))<0)
if ((ftype_id=H5Dget_type (dset_in)) < 0)
goto error;
if (H5T_REFERENCE==H5Tget_class(ftype_id))
is_ref=1;
if (H5Tclose(ftype_id)<0)
if (H5Tclose(ftype_id) < 0)
goto error;
if (H5Dclose(dset_in)<0)
if (H5Dclose(dset_in) < 0)
goto error;
@ -466,20 +466,20 @@ int do_copy_objects(hid_t fidin,
{
int j;
if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0)
if ((dset_in=H5Dopen(fidin,travt->objs[i].name)) < 0)
goto error;
if ((f_space_id=H5Dget_space(dset_in))<0)
if ((f_space_id=H5Dget_space(dset_in)) < 0)
goto error;
if ((ftype_id=H5Dget_type (dset_in))<0)
if ((ftype_id=H5Dget_type (dset_in)) < 0)
goto error;
if ((dcpl_id=H5Dget_create_plist(dset_in))<0)
if ((dcpl_id=H5Dget_create_plist(dset_in)) < 0)
goto error;
if ((dcpl_out = H5Pcopy (dcpl_id))<0)
if ((dcpl_out = H5Pcopy (dcpl_id)) < 0)
goto error;
if ( (rank=H5Sget_simple_extent_ndims(f_space_id))<0)
if ( (rank=H5Sget_simple_extent_ndims(f_space_id)) < 0)
goto error;
HDmemset(dims, 0, sizeof dims);
if ( H5Sget_simple_extent_dims(f_space_id,dims,NULL)<0)
if ( H5Sget_simple_extent_dims(f_space_id,dims,NULL) < 0)
goto error;
nelmts=1;
for (j=0; j<rank; j++)
@ -522,7 +522,7 @@ int do_copy_objects(hid_t fidin,
/* apply the filter */
if (apply_s) {
if (apply_filters(travt->objs[i].name,rank,dims,dcpl_out,options,&has_filter)<0)
if (apply_filters(travt->objs[i].name,rank,dims,dcpl_out,options,&has_filter) < 0)
goto error;
}
@ -537,7 +537,7 @@ int do_copy_objects(hid_t fidin,
} H5E_END_TRY;
if (dset_out==FAIL)
{
if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,wtype_id,f_space_id,dcpl_id))<0)
if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,wtype_id,f_space_id,dcpl_id)) < 0)
goto error;
apply_f=0;
}
@ -554,9 +554,9 @@ int do_copy_objects(hid_t fidin,
if (buf != NULL )
{
if (H5Dread(dset_in,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
if (H5Dread(dset_in,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0)
goto error;
if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0)
if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0)
goto error;
}
@ -616,9 +616,9 @@ int do_copy_objects(hid_t fidin,
hs_nelmts *= hs_size[k];
}
if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL)<0)
if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
goto error;
if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL)<0)
if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
goto error;
}
else
@ -693,11 +693,11 @@ int do_copy_objects(hid_t fidin,
* copy attrs
*-------------------------------------------------------------------------
*/
if (copy_attr(dset_in,dset_out,options)<0)
if (copy_attr(dset_in,dset_out,options) < 0)
goto error;
/*close */
if (H5Dclose(dset_out)<0)
if (H5Dclose(dset_out) < 0)
goto error;
}/*!H5T_REFERENCE*/
@ -708,17 +708,17 @@ int do_copy_objects(hid_t fidin,
* close
*-------------------------------------------------------------------------
*/
if (H5Tclose(ftype_id)<0)
if (H5Tclose(ftype_id) < 0)
goto error;
if (H5Tclose(wtype_id)<0)
if (H5Tclose(wtype_id) < 0)
goto error;
if (H5Pclose(dcpl_id)<0)
if (H5Pclose(dcpl_id) < 0)
goto error;
if (H5Pclose(dcpl_out)<0)
if (H5Pclose(dcpl_out) < 0)
goto error;
if (H5Sclose(f_space_id)<0)
if (H5Sclose(f_space_id) < 0)
goto error;
if (H5Dclose(dset_in)<0)
if (H5Dclose(dset_in) < 0)
goto error;
}
@ -748,11 +748,11 @@ int do_copy_objects(hid_t fidin,
fidout, /* Destination file or group identifier */
travt->objs[i].name, /* Name of the destination object */
pid, /* Properties which apply to the copy */
H5P_DEFAULT)<0) /* Properties which apply to the new hard link */
H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
goto error;
/* close property */
if (H5Pclose(pid)<0)
if (H5Pclose(pid) < 0)
goto error;
@ -760,15 +760,15 @@ int do_copy_objects(hid_t fidin,
* copy attrs manually
*-------------------------------------------------------------------------
*/
if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0)
if ((dset_in=H5Dopen(fidin,travt->objs[i].name)) < 0)
goto error;
if ((dset_out=H5Dopen(fidout,travt->objs[i].name))<0)
if ((dset_out=H5Dopen(fidout,travt->objs[i].name)) < 0)
goto error;
if (copy_attr(dset_in,dset_out,options)<0)
if (copy_attr(dset_in,dset_out,options) < 0)
goto error;
if (H5Dclose(dset_in)<0)
if (H5Dclose(dset_in) < 0)
goto error;
if (H5Dclose(dset_out)<0)
if (H5Dclose(dset_out) < 0)
goto error;
} /* end do we have request for filter/chunking */
@ -923,7 +923,7 @@ int copy_attr(hid_t loc_in,
goto error;
/* get name */
if (H5Aget_name( attr_id, (size_t)255, name )<0)
if (H5Aget_name( attr_id, (size_t)255, name ) < 0)
goto error;
/* get the file datatype */
@ -969,12 +969,12 @@ int copy_attr(hid_t loc_in,
*-------------------------------------------------------------------------
*/
buf=(void *) HDmalloc((size_t)(nelmts*msize));
if ( buf==NULL){
buf = (void *)HDmalloc((size_t)(nelmts * msize));
if(buf == NULL) {
error_msg(progname, "cannot read into memory\n" );
goto error;
}
if (H5Aread(attr_id,wtype_id,buf)<0)
if(H5Aread(attr_id, wtype_id, buf) < 0)
goto error;
/*-------------------------------------------------------------------------
@ -982,24 +982,23 @@ int copy_attr(hid_t loc_in,
*-------------------------------------------------------------------------
*/
if ((attr_out=H5Acreate(loc_out,name,ftype_id,space_id,H5P_DEFAULT))<0)
if((attr_out = H5Acreate2(loc_out, ".", name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
if(H5Awrite(attr_out,wtype_id,buf)<0)
if(H5Awrite(attr_out, wtype_id, buf) < 0)
goto error;
/*close*/
if (H5Aclose(attr_out)<0)
if(H5Aclose(attr_out) < 0)
goto error;
if (buf)
if(buf)
free(buf);
} /*H5T_REFERENCE*/
if (options->verbose)
if(options->verbose)
printf(FORMAT_OBJ_ATTR, "attr", name);
/*-------------------------------------------------------------------------
@ -1007,10 +1006,10 @@ int copy_attr(hid_t loc_in,
*-------------------------------------------------------------------------
*/
if (H5Tclose(ftype_id)<0) goto error;
if (H5Tclose(wtype_id)<0) goto error;
if (H5Sclose(space_id)<0) goto error;
if (H5Aclose(attr_id)<0) goto error;
if (H5Tclose(ftype_id) < 0) goto error;
if (H5Tclose(wtype_id) < 0) goto error;
if (H5Sclose(space_id) < 0) goto error;
if (H5Aclose(attr_id) < 0) goto error;
} /* u */
@ -1059,7 +1058,7 @@ static void print_dataset_info(hid_t dcpl_id,
strcpy(strfilter,"\0");
/* get information about input filters */
if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
return;
for ( i=0; i<nfilters; i++)

View File

@ -522,7 +522,7 @@ static int copy_refs_attr(hid_t loc_in,
* copy
*-------------------------------------------------------------------------
*/
if((attr_out = H5Acreate(loc_out, name, ftype_id, space_id, H5P_DEFAULT)) < 0)
if((attr_out = H5Acreate2(loc_out, ".", name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
if(nelmts)
if(H5Awrite(attr_out, mtype_id, refbuf) < 0)
@ -602,7 +602,7 @@ static int copy_refs_attr(hid_t loc_in,
* copy
*-------------------------------------------------------------------------
*/
if((attr_out = H5Acreate(loc_out, name, ftype_id, space_id, H5P_DEFAULT)) < 0)
if((attr_out = H5Acreate2(loc_out, ".", name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
if(nelmts)
if(H5Awrite(attr_out, mtype_id, refbuf) < 0)

File diff suppressed because it is too large Load Diff

View File

@ -66,7 +66,7 @@ static void gen_file(void)
dset_id = H5Dcreate(file, DATASET_NAME, type_id, space_id, H5P_DEFAULT);
for(i = 1; i <= NUM_ATTRS; i++) {
sprintf(attrname, "%s%d", ATTR_NAME,i);
attr_id = H5Acreate(dset_id, attrname, type_id, space_id, H5P_DEFAULT);
attr_id = H5Acreate2(dset_id, ".", attrname, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
ret = H5Aclose(attr_id);
}