diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-09-27 22:42:20 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-09-27 22:42:20 (GMT) |
commit | c63f9b42ec89ff649f4f086e2f422fa01d9967b1 (patch) | |
tree | 563d292a805c97be9136799016215ea99af39452 | |
parent | a9a10b0a055824f676cf426fcd928772aeaa99c8 (diff) | |
download | hdf5-c63f9b42ec89ff649f4f086e2f422fa01d9967b1.zip hdf5-c63f9b42ec89ff649f4f086e2f422fa01d9967b1.tar.gz hdf5-c63f9b42ec89ff649f4f086e2f422fa01d9967b1.tar.bz2 |
[svn-r14162] Description:
Make H5Adelete versioned and switch internal library use to H5Adelete2.
Add regression test for H5Adelete1
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 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
AIX/32 5.3 (copper) w/FORTRAN, w/parallel, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
-rw-r--r-- | c++/src/H5Object.cpp | 6 | ||||
-rw-r--r-- | fortran/src/H5Af.c | 16 | ||||
-rw-r--r-- | hl/src/H5DS.c | 4 | ||||
-rw-r--r-- | hl/src/H5IM.c | 4 | ||||
-rw-r--r-- | hl/src/H5LT.c | 6 | ||||
-rw-r--r-- | src/H5Adeprec.c | 14 | ||||
-rw-r--r-- | src/H5Apublic.h | 18 | ||||
-rw-r--r-- | src/H5vers.txt | 1 | ||||
-rw-r--r-- | src/H5version.h | 15 | ||||
-rw-r--r-- | test/gen_mergemsg.c | 6 | ||||
-rw-r--r-- | test/tattr.c | 191 | ||||
-rw-r--r-- | test/tmisc.c | 16 |
12 files changed, 212 insertions, 85 deletions
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 790ded9..2c711e3 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -250,11 +250,9 @@ int H5Object::getNumAttrs() const //-------------------------------------------------------------------------- void H5Object::removeAttr( const char* name ) const { - herr_t ret_value = H5Adelete( id, name ); + herr_t ret_value = H5Adelete2(id, ".", name, H5P_DEFAULT); if( ret_value < 0 ) - { - throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed"); - } + throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete2 failed"); } //-------------------------------------------------------------------------- diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c index 1e50dc8..6b49624 100644 --- a/fortran/src/H5Af.c +++ b/fortran/src/H5Af.c @@ -810,7 +810,7 @@ done: /*---------------------------------------------------------------------------- * Name: h5adelete_c - * Purpose: Call H5Adelete to delete an attribute + * Purpose: Call H5Adelete2 to delete an attribute * Inputs: obj_id - object identifier * name - name of the attribute * namelen - name length @@ -822,23 +822,25 @@ done: int_f nh5adelete_c (hid_t_f *obj_id, _fcd name, size_t_f *namelen) { - char *c_name=NULL; /* Buffer to hold C string */ - int_f ret_value=0; /* Return value */ + char *c_name = NULL; /* Buffer to hold C string */ + int_f ret_value = 0; /* Return value */ /* * Convert FORTRAN name to C name */ - if ((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL) + if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL) HGOTO_DONE(FAIL); /* - * Call H5Adelete function. + * Call H5Adelete2 function. */ - if (H5Adelete((hid_t)*obj_id, c_name) < 0) + if(H5Adelete2((hid_t)*obj_id, ".", c_name, H5P_DEFAULT) < 0) HGOTO_DONE(FAIL); done: - if(c_name) HDfree(c_name); + if(c_name) + HDfree(c_name); + return ret_value; } diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 8c10623..141fc88 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -486,7 +486,7 @@ herr_t H5DSattach_scale(hid_t did, */ /* the attribute must be deleted, in order to the new one can reflect the changes*/ - if (H5Adelete(dsid,REFERENCE_LIST)<0) + if (H5Adelete2(dsid, ".", REFERENCE_LIST, H5P_DEFAULT) < 0) goto out; /* store the IDX information (index of the dataset that has the DS) */ @@ -836,7 +836,7 @@ herr_t H5DSdetach_scale(hid_t did, */ /* the attribute must be deleted, in order to the new one can reflect the changes*/ - if (H5Adelete(dsid,REFERENCE_LIST)<0) + if (H5Adelete2(dsid, ".", REFERENCE_LIST, H5P_DEFAULT) < 0) goto out; /* don't do anything for an empty array */ diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 4f91ea3..30a479e 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -612,7 +612,7 @@ herr_t H5IMlink_palette( hid_t loc_id, goto out; /* The attribute must be deleted, in order to the new one can reflect the changes*/ - if ( H5Adelete( image_id, "PALETTE" ) < 0 ) + if(H5Adelete2(image_id, ".", "PALETTE", H5P_DEFAULT) < 0) goto out; /* Create a new reference for this palette. */ @@ -736,7 +736,7 @@ herr_t H5IMunlink_palette( hid_t loc_id, { /* Deelete the attribute */ - if ( H5Adelete( image_id, "PALETTE" ) < 0 ) + if(H5Adelete2(image_id, ".", "PALETTE", H5P_DEFAULT) < 0) goto out; } /* H5T_REFERENCE */ diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index d7f720a..e26669f 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1146,7 +1146,7 @@ herr_t H5LTset_attribute_string( hid_t loc_id, /* The attribute already exists, delete it */ if ( has_attr == 1 ) { - if ( H5Adelete( obj_id, attr_name ) < 0 ) + if(H5Adelete2(obj_id, ".", attr_name, H5P_DEFAULT) < 0) goto out; } @@ -1226,7 +1226,7 @@ herr_t H5LT_set_attribute_numerical( hid_t loc_id, /* The attribute already exists, delete it */ if ( has_attr == 1 ) { - if ( H5Adelete( obj_id, attr_name ) < 0 ) + if(H5Adelete2(obj_id, ".", attr_name, H5P_DEFAULT) < 0) goto out; } @@ -3119,7 +3119,7 @@ herr_t H5LT_set_attribute_string(hid_t dset_id, /* the attribute already exists, delete it */ if ( has_attr == 1 ) { - if ( H5Adelete(dset_id,name)<0) + if(H5Adelete2(dset_id, ".", name, H5P_DEFAULT) < 0) return FAIL; } diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index e9d8327..6c4502e 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -443,28 +443,31 @@ done: FUNC_LEAVE_API(ret_value) } /* H5Aiterate() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /*-------------------------------------------------------------------------- NAME - H5Adelete + H5Adelete1 PURPOSE Deletes an attribute from a location USAGE - herr_t H5Adelete (loc_id, name) + herr_t H5Adelete1(loc_id, name) hid_t loc_id; IN: Object (dataset or group) to have attribute deleted from const char *name; IN: Name of attribute to delete RETURNS Non-negative on success/Negative on failure DESCRIPTION This function removes the named attribute from a dataset or group. + NOTE + Deprecated in favor of H5Adelete2 --------------------------------------------------------------------------*/ herr_t -H5Adelete(hid_t loc_id, const char *name) +H5Adelete1(hid_t loc_id, const char *name) { H5G_loc_t loc; /* Object location */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Adelete, FAIL) + FUNC_ENTER_API(H5Adelete1, FAIL) H5TRACE2("e", "i*s", loc_id, name); /* check arguments */ @@ -481,5 +484,6 @@ H5Adelete(hid_t loc_id, const char *name) done: FUNC_LEAVE_API(ret_value) -} /* H5Adelete() */ +} /* H5Adelete1() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Apublic.h b/src/H5Apublic.h index 3a440a9..e1106f9 100644 --- a/src/H5Apublic.h +++ b/src/H5Apublic.h @@ -92,7 +92,23 @@ H5_DLL int H5Aget_num_attrs(hid_t loc_id); H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name); H5_DLL herr_t H5Aiterate(hid_t loc_id, unsigned *attr_num, H5A_operator_t op, void *op_data); -H5_DLL herr_t H5Adelete(hid_t loc_id, const char *name); + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/* Macros */ + + +/* Typedefs */ + + +/* Function prototypes */ +H5_DLL herr_t H5Adelete1(hid_t loc_id, const char *name); + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ #ifdef __cplusplus } diff --git a/src/H5vers.txt b/src/H5vers.txt index ec7910d..3bafc28 100644 --- a/src/H5vers.txt +++ b/src/H5vers.txt @@ -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: H5Adelete; ; v10, v18 FUNCTION: H5Eclear; ; v10, v18 FUNCTION: H5Eget_auto; ; v10, v18 FUNCTION: H5Eprint; ; v10, v18 diff --git a/src/H5version.h b/src/H5version.h index a1418f4..bdfa8bb 100644 --- a/src/H5version.h +++ b/src/H5version.h @@ -38,6 +38,10 @@ /* Functions */ /*************/ +#if !defined(H5Adelete_vers) +#define H5Adelete_vers 1 +#endif /* !defined(H5Adelete_vers) */ + #if !defined(H5Eclear_vers) #define H5Eclear_vers 1 #endif /* !defined(H5Eclear_vers) */ @@ -103,6 +107,17 @@ /* Functions */ /*************/ +#if !defined(H5Adelete_vers) || H5Adelete_vers == 2 +#ifndef H5Adelete_vers +#define H5Adelete_vers 2 +#endif /* H5Adelete_vers */ +#define H5Adelete H5Adelete2 +#elif H5Adelete_vers == 1 +#define H5Adelete H5Adelete1 +#else /* H5Adelete_vers */ +#error "H5Adelete_vers set to invalid value" +#endif /* H5Adelete_vers */ + #if !defined(H5Eclear_vers) || H5Eclear_vers == 2 #ifndef H5Eclear_vers #define H5Eclear_vers 2 diff --git a/test/gen_mergemsg.c b/test/gen_mergemsg.c index c543c4c..b7d07d2 100644 --- a/test/gen_mergemsg.c +++ b/test/gen_mergemsg.c @@ -158,7 +158,7 @@ int main() assert(gid > 0); /* Delete 2nd attribute */ - ret = H5Adelete(gid, ATTR2); + ret = H5Adelete2(gid, ".", ATTR2, H5P_DEFAULT); assert(ret >= 0); /* Close first group */ @@ -225,7 +225,7 @@ int main() assert(gid > 0); /* Delete 3rd attribute */ - ret = H5Adelete(gid, ATTR3); + ret = H5Adelete2(gid, ".", ATTR3, H5P_DEFAULT); assert(ret >= 0); /* Create dataspace for 3rd attribute */ @@ -272,7 +272,7 @@ int main() assert(gid > 0); /* Delete 2nd attribute */ - ret = H5Adelete(gid, ATTR2); + ret = H5Adelete2(gid, ".", ATTR2, H5P_DEFAULT); assert(ret >= 0); /* Close first group */ diff --git a/test/tattr.c b/test/tattr.c index c85931c..2c57d49 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -1490,85 +1490,85 @@ test_attr_delete(hid_t fapl) CHECK(fid1, FAIL, "H5Fopen"); /* Open the dataset */ - dataset=H5Dopen(fid1,DSET1_NAME); + dataset = H5Dopen(fid1, DSET1_NAME); CHECK(dataset, FAIL, "H5Dopen"); /* Verify the correct number of attributes */ - ret=H5Aget_num_attrs(dataset); + ret = H5Aget_num_attrs(dataset); VERIFY(ret, 3, "H5Aget_num_attrs"); /* Try to delete bogus attribute */ - ret=H5Adelete(dataset,"Bogus"); - VERIFY(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", "Bogus", H5P_DEFAULT); + VERIFY(ret, FAIL, "H5Adelete2"); /* Verify the correct number of attributes */ - ret=H5Aget_num_attrs(dataset); + ret = H5Aget_num_attrs(dataset); VERIFY(ret, 3, "H5Aget_num_attrs"); /* Delete middle (2nd) attribute */ - ret=H5Adelete(dataset,ATTR2_NAME); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", ATTR2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Verify the correct number of attributes */ - ret=H5Aget_num_attrs(dataset); + ret = H5Aget_num_attrs(dataset); VERIFY(ret, 2, "H5Aget_num_attrs"); /* Open 1st attribute for the dataset */ - attr=H5Aopen_idx(dataset,0); + attr = H5Aopen_idx(dataset, 0); CHECK(attr, FAIL, "H5Aopen_idx"); /* Verify Name */ - name_len=H5Aget_name(attr, (size_t)ATTR_NAME_LEN,attr_name); + name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN,attr_name); VERIFY(name_len, HDstrlen(ATTR1_NAME), "H5Aget_name"); - if(HDstrcmp(attr_name,ATTR1_NAME)) + if(HDstrcmp(attr_name, ATTR1_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR1_NAME); /* Close attribute */ - ret=H5Aclose(attr); + ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Open last (formally 3rd) attribute for the dataset */ - attr=H5Aopen_idx(dataset,1); + attr = H5Aopen_idx(dataset, 1); CHECK(attr, FAIL, "H5Aopen_idx"); /* Verify Name */ - name_len=H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); + name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); if(HDstrcmp(attr_name,ATTR3_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); /* Close attribute */ - ret=H5Aclose(attr); + ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Delete first attribute */ - ret=H5Adelete(dataset,ATTR1_NAME); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", ATTR1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Verify the correct number of attributes */ - ret=H5Aget_num_attrs(dataset); + ret = H5Aget_num_attrs(dataset); VERIFY(ret, 1, "H5Aget_num_attrs"); /* Open last (formally 3rd) attribute for the dataset */ - attr=H5Aopen_idx(dataset,0); + attr = H5Aopen_idx(dataset, 0); CHECK(attr, FAIL, "H5Aopen_idx"); /* Verify Name */ - name_len=H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); + name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, attr_name); VERIFY(name_len, HDstrlen(ATTR3_NAME), "H5Aget_name"); - if(HDstrcmp(attr_name,ATTR3_NAME)) + if(HDstrcmp(attr_name, ATTR3_NAME)) TestErrPrintf("attribute name different: attr_name=%s, should be %s\n",attr_name,ATTR3_NAME); /* Close attribute */ - ret=H5Aclose(attr); + ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); /* Delete first attribute */ - ret=H5Adelete(dataset,ATTR3_NAME); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", ATTR3_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Verify the correct number of attributes */ - ret=H5Aget_num_attrs(dataset); + ret = H5Aget_num_attrs(dataset); VERIFY(ret, 0, "H5Aget_num_attrs"); /* Close dataset */ @@ -1663,13 +1663,13 @@ test_attr_dtype_shared(hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Delete attribute */ - ret = H5Adelete(dset_id, ATTR1_NAME); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dset_id, ".", ATTR1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Check reference count on named datatype */ ret = H5Oget_info(file_id, TYPE1_NAME, &oinfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info"); - VERIFY(oinfo.rc, 2, "H5Adelete"); + VERIFY(oinfo.rc, 2, "H5Adelete2"); /* Create attribute on dataset */ attr_id = H5Acreate(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT); @@ -2220,8 +2220,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) for(u--; u >= min_dense; u--) { /* Delete attribute */ sprintf(attrname, "attr %02u", u); - ret = H5Adelete(dataset, attrname); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", attrname, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Verify attributes still left */ ret = test_attr_dense_verify(dataset, u); @@ -2234,8 +2234,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) /* Delete one more attribute, which should cause reversion to compact storage */ sprintf(attrname, "attr %02u", u); - ret = H5Adelete(dataset, attrname); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", attrname, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Check on dataset's attribute storage status */ is_dense = H5O_is_attr_dense_test(dataset); @@ -2247,8 +2247,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) /* Delete another attribute, to verify deletion in compact storage */ sprintf(attrname, "attr %02u", (u - 1)); - ret = H5Adelete(dataset, attrname); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", attrname, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Check on dataset's attribute storage status */ is_dense = H5O_is_attr_dense_test(dataset); @@ -2687,8 +2687,8 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /* Delete second attribute, attributes should still be stored densely */ /* Delete attribute */ - ret = H5Adelete(dataset, attrname); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", attrname, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Check on dataset's attribute storage status */ is_dense = H5O_is_attr_dense_test(dataset); @@ -2700,8 +2700,8 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 0; sprintf(attrname, "attr %02u", u); - ret = H5Adelete(dataset, attrname); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", attrname, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Check on dataset's attribute storage status */ is_dense = H5O_is_attr_dense_test(dataset); @@ -2908,8 +2908,8 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 1; sprintf(attrname, "attr %02u", u); - ret = H5Adelete(dataset, attrname); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", attrname, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Check on dataset's attribute storage status */ is_empty = H5O_is_attr_empty_test(dataset); @@ -2923,8 +2923,8 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 3; sprintf(attrname, "attr %02u", u); - ret = H5Adelete(dataset, attrname); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", attrname, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Check on dataset's attribute storage status */ is_empty = H5O_is_attr_empty_test(dataset); @@ -2938,8 +2938,8 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 2; sprintf(attrname, "attr %02u", u); - ret = H5Adelete(dataset, attrname); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", attrname, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Check on dataset's attribute storage status */ is_empty = H5O_is_attr_empty_test(dataset); @@ -2953,8 +2953,8 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 0; sprintf(attrname, "attr %02u", u); - ret = H5Adelete(dataset, attrname); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(dataset, ".", attrname, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Check on dataset's attribute storage status */ is_empty = H5O_is_attr_empty_test(dataset); @@ -3220,6 +3220,95 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) /**************************************************************** ** +** test_attr_deprec(): Test basic H5A (attribute) code. +** Tests deprecated API routines +** +****************************************************************/ +static void +test_attr_deprec(hid_t fcpl, hid_t fapl) +{ +#ifndef H5_NO_DEPRECATED_SYMBOLS + hid_t fid; /* HDF5 File ID */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Deprecated Attribute Routines\n")); + + /* Create file */ + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(fid, FAIL, "H5Fcreate"); + + /* Create dataspace for dataset attributes */ + sid = H5Screate(H5S_SCALAR); + CHECK(sid, FAIL, "H5Screate"); + + /* Create a dataset */ + dataset = H5Dcreate(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dcreate"); + + + /* Add attribute to dataset */ + + /* Create attribute */ + attr = H5Acreate(dataset, "attr", H5T_NATIVE_UINT, sid, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate"); + + /* Close attribute */ + ret = H5Aclose(attr); + CHECK(ret, FAIL, "H5Aclose"); + + + /* Close dataspaces */ + ret = H5Sclose(sid); + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + + + /* Re-open the file and delete the attribute */ + + /* Re-open file */ + fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl); + CHECK(fid, FAIL, "H5Fopen"); + + /* Open dataset */ + dataset = H5Dopen(fid, DSET1_NAME); + CHECK(dataset, FAIL, "H5Dopen"); + + + /* Delete attribute */ + ret = H5Adelete1(dataset, "attr"); + CHECK(ret, FAIL, "H5Adelete1"); + + + /* Close Dataset */ + ret = H5Dclose(dataset); + CHECK(ret, FAIL, "H5Dclose"); + + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); +#else /* H5_NO_DEPRECATED_SYMBOLS */ + /* Shut compiler up */ + fcpl = fcpl; fapl = fapl; + + /* Output message about test being skipped */ + MESSAGE(5, ("Skipping Test On Deprecated Attribute Routines\n")); + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ +} /* test_attr_deprec() */ + + +/**************************************************************** +** ** test_attr_many(): Test basic H5A (attribute) code. ** Tests storing lots of attributes ** @@ -8181,8 +8270,8 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) CHECK(gid, FAIL, "H5Gopen2"); /* Delete first attribute */ - ret = H5Adelete(gid, ATTR7_NAME); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(gid, ".", ATTR7_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Re-create first attribute */ aid = H5Acreate(gid, ATTR7_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT); @@ -8192,8 +8281,8 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Delete second attribute */ - ret = H5Adelete(gid, ATTR8_NAME); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(gid, ".", ATTR8_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Re-create second attribute */ aid = H5Acreate(gid, ATTR8_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT); @@ -8321,6 +8410,7 @@ test_attr(void) test_attr_dense_limits(my_fcpl, my_fapl); /* Test dense attribute storage limits */ test_attr_big(my_fcpl, my_fapl); /* Test storing big attribute */ test_attr_null_space(my_fcpl, my_fapl); /* Test storing attribute with NULL dataspace */ + test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */ test_attr_many(my_fcpl, my_fapl); /* Test storing lots of attributes */ /* Attribute creation order tests */ @@ -8359,6 +8449,7 @@ test_attr(void) test_attr_open(new_format, fcpl, my_fapl); /* Test opening attributes by name */ test_attr_big(fcpl, my_fapl); /* Test storing big attribute */ test_attr_null_space(fcpl, my_fapl); /* Test storing attribute with NULL dataspace */ + test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */ /* Tests that address specific bugs */ test_attr_bug1(fcpl, my_fapl); /* Test odd allocation operations */ diff --git a/test/tmisc.c b/test/tmisc.c index 4656afa..aa95bb0 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -4363,8 +4363,8 @@ test_misc25a(void) CHECK(gid, FAIL, "H5Gopen2"); /* Delete 2nd attribute */ - ret = H5Adelete(gid, MISC25A_ATTR2_NAME); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(gid, ".", MISC25A_ATTR2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Close first group */ ret = H5Gclose(gid); @@ -4429,8 +4429,8 @@ test_misc25a(void) CHECK(gid, FAIL, "H5Gopen2"); /* Delete 3rd attribute */ - ret = H5Adelete(gid, MISC25A_ATTR3_NAME); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(gid, ".", MISC25A_ATTR3_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Create dataspace for 3rd attribute */ sid = H5Screate(H5S_SCALAR); @@ -4476,8 +4476,8 @@ test_misc25a(void) CHECK(gid, FAIL, "H5Gopen2"); /* Delete 2nd attribute */ - ret = H5Adelete(gid, MISC25A_ATTR2_NAME); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(gid, ".", MISC25A_ATTR2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Close first group */ ret = H5Gclose(gid); @@ -4696,8 +4696,8 @@ test_misc25c(void) CHECK(ret, FAIL, "H5Lmove"); /* Delete the first attribute */ - ret = H5Adelete(gid, MISC25C_ATTRNAME); - CHECK(ret, FAIL, "H5Adelete"); + ret = H5Adelete2(gid, ".", MISC25C_ATTRNAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Adelete2"); /* Close the dataset group */ ret = H5Gclose(gid); |