summaryrefslogtreecommitdiffstats
path: root/src/H5Aint.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Aint.c')
-rw-r--r--src/H5Aint.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 9b24950..de9d36a 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -294,7 +294,7 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, cons
H5A_t * attr = NULL; /* Attribute created */
hssize_t snelmts; /* elements in attribute */
size_t nelmts; /* elements in attribute */
- htri_t exists; /* Whether attribute exists */
+ hbool_t exists; /* Whether attribute exists */
H5A_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr)
@@ -310,9 +310,10 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, cons
* name, but it's going to be hard to unwind all the special cases on
* failure, so just check first, for now - QAK)
*/
- if ((exists = H5O__attr_exists(loc->oloc, attr_name)) < 0)
+ exists = FALSE;
+ if (H5O__attr_exists(loc->oloc, attr_name, &exists) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes")
- else if (exists > 0)
+ if (exists)
HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists")
/* Check if the dataspace has an extent set (or is NULL) */
@@ -1467,20 +1468,21 @@ done:
*
*-------------------------------------------------------------------------
*/
-htri_t
-H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name)
+herr_t
+H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name, hbool_t *attr_exists)
{
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
- hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
- htri_t ret_value = FAIL; /* Return value */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(obj_name);
HDassert(attr_name);
+ HDassert(attr_exists);
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -1493,7 +1495,7 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name)
loc_found = TRUE;
/* Check if the attribute exists */
- if ((ret_value = H5O__attr_exists(obj_loc.oloc, attr_name)) < 0)
+ if (H5O__attr_exists(obj_loc.oloc, attr_name, attr_exists) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done: