summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-07-19 14:47:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-07-19 14:47:13 (GMT)
commit0bbdb70ed7ef9173cce7492bc0c7679367e71d44 (patch)
tree911a6df6808abb87b4ed2c92b5f45714dd8c936e /src
parentc55d0f4e1e09e813fec5fcaa0541150c1ee2a36f (diff)
downloadhdf5-0bbdb70ed7ef9173cce7492bc0c7679367e71d44.zip
hdf5-0bbdb70ed7ef9173cce7492bc0c7679367e71d44.tar.gz
hdf5-0bbdb70ed7ef9173cce7492bc0c7679367e71d44.tar.bz2
[svn-r13989] Description:
Rename H5A_get_version() to H5A_set_version() and actually set the attributes version in the routine. Tested on: Mac OS X/32 10.4.10 (amazon) FreeBSD/32 6.2 (duty) Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c3
-rw-r--r--src/H5Adense.c3
-rw-r--r--src/H5Aint.c27
-rw-r--r--src/H5Apkg.h2
-rw-r--r--src/H5Oattr.c3
-rw-r--r--src/H5Oattribute.c3
6 files changed, 22 insertions, 19 deletions
diff --git a/src/H5A.c b/src/H5A.c
index c308611..5bcbd7f 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -399,7 +399,8 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
attr->obj_opened = TRUE;
/* Set the version to encode the attribute with */
- attr->version = H5A_get_version(attr->oloc.file, attr);
+ if(H5A_set_version(attr->oloc.file, attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "unable to update attribute version")
/* Insert the attribute into the object header */
if(H5O_attr_create(&(attr->oloc), dxpl_id, attr) < 0)
diff --git a/src/H5Adense.c b/src/H5Adense.c
index 00628b4..8549a10 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -908,7 +908,8 @@ H5A_dense_rename(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
attr_copy->name = H5MM_xstrdup(new_name);
/* Recompute the version to encode the attribute with */
- attr_copy->version = H5A_get_version(f, attr_copy);
+ if(H5A_set_version(f, attr_copy) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "unable to update attribute version")
/* Insert renamed attribute back into dense storage */
/* (Possibly making it shared) */
diff --git a/src/H5Aint.c b/src/H5Aint.c
index f57bd6b..6293797 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -671,14 +671,14 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A_get_version
+ * Function: H5A_set_version
*
- * Purpose: Retrieves the correct version to encode attribute with.
+ * Purpose: Sets the correct version to encode attribute with.
* Chooses the oldest version possible, unless the "use the
* latest format" flag is set.
*
- * Return: Success: Version to encode attribute with.
- * Failure: Can't fail
+ * Return: Success: Non-negative
+ * Failure: Negative
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
@@ -686,14 +686,13 @@ done:
*
*-------------------------------------------------------------------------
*/
-unsigned
-H5A_get_version(const H5F_t *f, const H5A_t *attr)
+herr_t
+H5A_set_version(const H5F_t *f, H5A_t *attr)
{
hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */
hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
- unsigned ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOFUNC(H5A_get_version)
+ FUNC_ENTER_NOAPI_NOFUNC(H5A_set_version)
/* check arguments */
HDassert(f);
@@ -715,14 +714,14 @@ H5A_get_version(const H5F_t *f, const H5A_t *attr)
/* Check which version to encode attribute with */
if(use_latest_format)
- ret_value = H5O_ATTR_VERSION_LATEST; /* Write out latest version of format */
+ attr->version = H5O_ATTR_VERSION_LATEST; /* Write out latest version of format */
else if(attr->encoding != H5T_CSET_ASCII)
- ret_value = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
+ attr->version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
else if(type_shared || space_shared)
- ret_value = H5O_ATTR_VERSION_2; /* Write out version with flag for indicating shared datatype or dataspace */
+ attr->version = H5O_ATTR_VERSION_2; /* Write out version with flag for indicating shared datatype or dataspace */
else
- ret_value = H5O_ATTR_VERSION_1; /* Write out basic version */
+ attr->version = H5O_ATTR_VERSION_1; /* Write out basic version */
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5A_get_version() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5A_set_version() */
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index d1cc34c..99cfe5d 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -208,7 +208,7 @@ H5_DLL herr_t H5A_free(H5A_t *attr);
H5_DLL herr_t H5A_close(H5A_t *attr);
H5_DLL H5O_ainfo_t *H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
H5O_ainfo_t *ainfo);
-H5_DLL unsigned H5A_get_version(const H5F_t *f, const H5A_t *attr);
+H5_DLL herr_t H5A_set_version(const H5F_t *f, H5A_t *attr);
/* Attribute "dense" storage routines */
H5_DLL herr_t H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo);
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index b1e5ed3..3e0b757 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -833,7 +833,8 @@ H5O_attr_copy_file(H5F_t UNUSED *file_src, const H5O_msg_class_t UNUSED *mesg_ty
} /* end if(attr_src->data) */
/* Recompute the version to encode the destination attribute */
- attr_dst->version = H5A_get_version(file_dst, attr_dst);
+ if(H5A_set_version(file_dst, attr_dst) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, NULL, "unable to update attribute version")
/* Indicate that the fill values aren't to be written out */
attr_dst->initialized = TRUE;
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 2564386..aacf3a0 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -885,7 +885,8 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
((H5A_t *)mesg->native)->name = H5MM_xstrdup(udata->new_name);
/* Recompute the version to encode the attribute with */
- ((H5A_t *)mesg->native)->version = H5A_get_version(udata->f, ((H5A_t *)mesg->native));
+ if(H5A_set_version(udata->f, ((H5A_t *)mesg->native)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5_ITER_ERROR, "unable to update attribute version")
/* Mark message as dirty */
mesg->dirty = TRUE;