diff options
author | jrmainzer <72230804+jrmainzer@users.noreply.github.com> | 2021-11-23 01:20:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-23 01:20:56 (GMT) |
commit | 28d0a7b1b93e3918f3c8ee361af3280a2c9ee8a4 (patch) | |
tree | 0ac1b135f2c8a8bd9dbb980ebdbeb36dcf89f2c2 /src/H5Aint.c | |
parent | 65d6d256cf9d04dbeb275025cc2b01d0f36ed3f1 (diff) | |
parent | 68c00b3fa1c0f4ba9b8e9724beb1d0b0b31f69ad (diff) | |
download | hdf5-28d0a7b1b93e3918f3c8ee361af3280a2c9ee8a4.zip hdf5-28d0a7b1b93e3918f3c8ee361af3280a2c9ee8a4.tar.gz hdf5-28d0a7b1b93e3918f3c8ee361af3280a2c9ee8a4.tar.bz2 |
Merge pull request #1217 from jrmainzer/selection_io_with_subfiling_vfd
Selection io with subfiling vfd
Diffstat (limited to 'src/H5Aint.c')
-rw-r--r-- | src/H5Aint.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/src/H5Aint.c b/src/H5Aint.c index f6b955e..300d686 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -844,7 +844,6 @@ done: const void *buf; IN: Buffer of data to write RETURNS Non-negative on success/Negative on failure - DESCRIPTION This function writes a complete attribute to disk. --------------------------------------------------------------------------*/ @@ -949,31 +948,33 @@ done: NAME H5A__get_name PURPOSE - Private function for H5Aget_name. Gets a copy of the name for an - attribute + Gets a copy of the name for an attribute RETURNS - This function returns the length of the attribute's name (which may be - longer than 'buf_size') on success or negative for failure. + Non-negative on success/Negative on failure DESCRIPTION This function retrieves the name of an attribute for an attribute ID. Up to 'buf_size' characters are stored in 'buf' followed by a '\0' string terminator. If the name of the attribute is longer than 'buf_size'-1, the string terminator is stored in the last position of the buffer to properly terminate the string. + This function returns the length of the attribute's name (which may be + longer than 'buf_size') in the 'attr_name_len' parameter. --------------------------------------------------------------------------*/ -ssize_t -H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) +herr_t +H5A__get_name(H5A_t *attr, size_t buf_size, char *buf, size_t *attr_name_len) { - size_t copy_len, nbytes; - ssize_t ret_value = -1; /* Return value */ + size_t copy_len, nbytes; FUNC_ENTER_PACKAGE_NOERR - /* get the real attribute length */ + /* Sanity checks */ + HDassert(attr); + HDassert(attr_name_len); + + /* Get the real attribute length */ nbytes = HDstrlen(attr->shared->name); - HDassert((ssize_t)nbytes >= 0); /*overflow, pretty unlikely --rpm*/ - /* compute the string length which will fit into the user's buffer */ + /* Compute the string length which will fit into the user's buffer */ copy_len = MIN(buf_size - 1, nbytes); /* Copy all/some of the name */ @@ -984,10 +985,10 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) buf[copy_len] = '\0'; } /* end if */ - /* Set return value */ - ret_value = (ssize_t)nbytes; + /* Set actual attribute name length */ + *attr_name_len = nbytes; - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__get_name() */ /*------------------------------------------------------------------------- @@ -1091,13 +1092,10 @@ done: NAME H5A__get_create_plist PURPOSE - private version of H5Aget_create_plist + Private version of H5Aget_create_plist RETURNS This function returns the ID of a copy of the attribute's creation property list, or negative on failure. - - ERRORS - DESCRIPTION This function returns a copy of the creation property list for an attribute. The resulting ID must be closed with H5Pclose() or @@ -1304,7 +1302,7 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj, void **request) HDassert(attr_vol_obj); /* Close the attribute */ - if ((ret_value = H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, request)) < 0) + if (H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute") /* Free the VOL object */ @@ -2661,7 +2659,7 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na FUNC_ENTER_PACKAGE /* Avoid thrashing things if the names are the same */ - if (HDstrcmp(old_attr_name, new_attr_name)) { + if (HDstrcmp(old_attr_name, new_attr_name) != 0) { /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; obj_loc.path = &obj_path; @@ -2768,7 +2766,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5 /* Call internal attribute iteration routine */ if ((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") + HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: /* Release resources */ |