summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-30 19:03:28 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-30 19:03:28 (GMT)
commit8d71b4cbcdc7e184b7fdb110744cd9c7d0c4b508 (patch)
tree1792dd8d02dac6ff1b53ba4152b4cdf171d5d2c8
parent0e06a92d0e1e129c46f27115f2b15ca2995ac59e (diff)
downloadhdf5-8d71b4cbcdc7e184b7fdb110744cd9c7d0c4b508.zip
hdf5-8d71b4cbcdc7e184b7fdb110744cd9c7d0c4b508.tar.gz
hdf5-8d71b4cbcdc7e184b7fdb110744cd9c7d0c4b508.tar.bz2
[svn-r14219] Description:
Change H5Arename2 -> H5Arename_by_name and un-deprecate H5Arename1 back to H5Arename. 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
-rw-r--r--c++/src/H5Object.cpp4
-rw-r--r--src/H5A.c49
-rw-r--r--src/H5Adeprec.c43
-rw-r--r--src/H5Apublic.h4
-rw-r--r--src/H5vers.txt1
-rw-r--r--src/H5version.h15
-rw-r--r--test/tattr.c22
7 files changed, 58 insertions, 80 deletions
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 39f21c4..e3dafa7 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -277,9 +277,9 @@ void H5Object::removeAttr( const H5std_string& name ) const
//--------------------------------------------------------------------------
void H5Object::renameAttr(const char* oldname, const char* newname) const
{
- herr_t ret_value = H5Arename2(id, ".", oldname, newname, H5P_DEFAULT);
+ herr_t ret_value = H5Arename(id, oldname, newname);
if (ret_value < 0)
- throw AttributeIException(inMemFunc("renameAttr"), "H5Arename2 failed");
+ throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed");
}
//--------------------------------------------------------------------------
diff --git a/src/H5A.c b/src/H5A.c
index 012d7ee..d4a02a6 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -1707,7 +1707,48 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Arename2
+ * Function: H5Arename
+ *
+ * Purpose: Rename an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Raymond Lu
+ * October 23, 2002
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
+{
+ H5G_loc_t loc; /* Object location */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Arename, FAIL)
+ H5TRACE3("e", "i*s*s", loc_id, old_name, new_name);
+
+ /* check arguments */
+ if(!old_name || !new_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil")
+ if(H5I_ATTR == H5I_get_type(loc_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
+ if(H5G_loc(loc_id, & loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+
+ /* Avoid thrashing things if the names are the same */
+ if(HDstrcmp(old_name, new_name))
+ /* Call attribute rename routine */
+ if(H5O_attr_rename(loc.oloc, H5AC_dxpl_id, old_name, new_name) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Arename() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Arename_by_name
*
* Purpose: Rename an attribute
*
@@ -1720,7 +1761,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Arename2(hid_t loc_id, const char *obj_name, const char *old_attr_name,
+H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
const char *new_attr_name, hid_t lapl_id)
{
H5G_loc_t loc; /* Object location */
@@ -1730,7 +1771,7 @@ H5Arename2(hid_t loc_id, const char *obj_name, const char *old_attr_name,
hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Arename2, FAIL)
+ FUNC_ENTER_API(H5Arename_by_name, FAIL)
H5TRACE5("e", "i*s*s*si", loc_id, obj_name, old_attr_name, new_attr_name,
lapl_id);
@@ -1774,7 +1815,7 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
FUNC_LEAVE_API(ret_value)
-} /* H5Arename2() */
+} /* H5Arename_by_name() */
/*--------------------------------------------------------------------------
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index c490dcc..af3b7f9 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -345,49 +345,6 @@ done:
} /* H5Aget_num_attrs() */
-/*-------------------------------------------------------------------------
- * Function: H5Arename1
- *
- * Purpose: Rename an attribute
- *
- * Note: Deprecated in favor of H5Arename2
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Raymond Lu
- * October 23, 2002
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Arename1(hid_t loc_id, const char *old_name, const char *new_name)
-{
- H5G_loc_t loc; /* Object location */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Arename1, FAIL)
- H5TRACE3("e", "i*s*s", loc_id, old_name, new_name);
-
- /* check arguments */
- if(!old_name || !new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "name is nil")
- if(H5I_ATTR == H5I_get_type(loc_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5G_loc(loc_id, & loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
-
- /* Avoid thrashing things if the names are the same */
- if(HDstrcmp(old_name, new_name))
- /* Call attribute rename routine */
- if(H5O_attr_rename(loc.oloc, H5AC_dxpl_id, old_name, new_name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* H5Arename1() */
-
-
/*--------------------------------------------------------------------------
NAME
H5Aiterate1
diff --git a/src/H5Apublic.h b/src/H5Apublic.h
index 7de9cbc..8637b2e 100644
--- a/src/H5Apublic.h
+++ b/src/H5Apublic.h
@@ -68,7 +68,8 @@ H5_DLL herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name,
H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
H5A_info_t *ainfo /*out*/, hid_t lapl_id);
-H5_DLL herr_t H5Arename2(hid_t loc_id, const char *obj_name,
+H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name);
+H5_DLL herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name,
const char *old_attr_name, const char *new_attr_name, hid_t lapl_id);
H5_DLL herr_t H5Aiterate2(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data,
@@ -101,7 +102,6 @@ H5_DLL hid_t H5Aopen_name(hid_t loc_id, const char *name);
H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx);
H5_DLL int H5Aget_num_attrs(hid_t loc_id);
H5_DLL herr_t H5Adelete1(hid_t loc_id, const char *name);
-H5_DLL herr_t H5Arename1(hid_t loc_id, const char *old_name, const char *new_name);
H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
void *op_data);
diff --git a/src/H5vers.txt b/src/H5vers.txt
index fb268c1..aa85e7e 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -48,7 +48,6 @@
FUNCTION: H5Acreate; ; v10, v18
FUNCTION: H5Adelete; ; v10, v18
FUNCTION: H5Aiterate; H5A_operator; v10, v18
-FUNCTION: H5Arename; ; v16, v18
FUNCTION: H5Dcreate; ; v10, v18
FUNCTION: H5Dopen; ; v10, v18
FUNCTION: H5Eclear; ; v10, v18
diff --git a/src/H5version.h b/src/H5version.h
index 938279d..208dfa0 100644
--- a/src/H5version.h
+++ b/src/H5version.h
@@ -50,10 +50,6 @@
#define H5Aiterate_vers 1
#endif /* !defined(H5Aiterate_vers) */
-#if !defined(H5Arename_vers)
-#define H5Arename_vers 1
-#endif /* !defined(H5Arename_vers) */
-
#if !defined(H5Dcreate_vers)
#define H5Dcreate_vers 1
#endif /* !defined(H5Dcreate_vers) */
@@ -186,17 +182,6 @@
#error "H5Aiterate_vers set to invalid value"
#endif /* H5Aiterate_vers */
-#if !defined(H5Arename_vers) || H5Arename_vers == 2
-#ifndef H5Arename_vers
-#define H5Arename_vers 2
-#endif /* H5Arename_vers */
-#define H5Arename H5Arename2
-#elif H5Arename_vers == 1
-#define H5Arename H5Arename1
-#else /* H5Arename_vers */
-#error "H5Arename_vers set to invalid value"
-#endif /* H5Arename_vers */
-
#if !defined(H5Dcreate_vers) || H5Dcreate_vers == 2
#ifndef H5Dcreate_vers
#define H5Dcreate_vers 2
diff --git a/test/tattr.c b/test/tattr.c
index 124d4a7..5bf24f4 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -258,8 +258,8 @@ test_attr_basic_write(hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* change attribute name */
- ret = H5Arename2(dataset, ".", ATTR1_NAME, ATTR_TMP_NAME, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Arename2");
+ ret = H5Arename(dataset, ATTR1_NAME, ATTR_TMP_NAME);
+ CHECK(ret, FAIL, "H5Arename");
/* Open attribute again */
attr = H5Aopen(dataset, ATTR_TMP_NAME, H5P_DEFAULT);
@@ -2382,8 +2382,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
sprintf(new_attrname, "new attr %02u", u);
/* Rename attribute */
- ret = H5Arename2(fid, DSET1_NAME, attrname, new_attrname, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Arename2");
+ ret = H5Arename_by_name(fid, DSET1_NAME, attrname, new_attrname, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Arename_by_name");
/* Check # of attributes */
ret = H5Oget_info(dataset, ".", &oinfo, H5P_DEFAULT);
@@ -3323,12 +3323,8 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
- /* Rename attribute */
- ret = H5Arename1(dataset, "attr", "attr2");
- CHECK(ret, FAIL, "H5Arename1");
-
/* Delete attribute */
- ret = H5Adelete1(dataset, "attr2");
+ ret = H5Adelete1(dataset, "attr");
CHECK(ret, FAIL, "H5Adelete1");
@@ -7596,8 +7592,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
sprintf(attrname2, "new attr %02u", u);
/* Change second dataset's attribute's name */
- ret = H5Arename2(fid, DSET2_NAME, attrname, attrname2, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Arename2");
+ ret = H5Arename_by_name(fid, DSET2_NAME, attrname, attrname2, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Arename_by_name");
/* Check refcount on attributes now */
@@ -7652,8 +7648,8 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
/* Change second dataset's attribute's name back to original */
- ret = H5Arename2(fid, DSET2_NAME, attrname2, attrname, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Arename2");
+ ret = H5Arename_by_name(fid, DSET2_NAME, attrname2, attrname, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Arename_by_name");
/* Check refcount on attributes now */