diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2022-05-06 00:02:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-06 00:02:46 (GMT) |
commit | 89f8f843532835662e4c649aad368b7c7cae7006 (patch) | |
tree | 03e47f49e74b8b03416a4f963476f1ffcb03a465 /src/H5Gloc.c | |
parent | 0566defd2c7b48fd3b07e5d626f8069c1131f917 (diff) | |
download | hdf5-89f8f843532835662e4c649aad368b7c7cae7006.zip hdf5-89f8f843532835662e4c649aad368b7c7cae7006.tar.gz hdf5-89f8f843532835662e4c649aad368b7c7cae7006.tar.bz2 |
Onion VFD: Sync with develop. (#1732)
* Sync with develop. h5dump is broken, so I can't test the tools.
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5Gloc.c')
-rw-r--r-- | src/H5Gloc.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 346ecdc..fb94685 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -559,8 +559,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G__loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type, - const void *crt_info) +H5G__loc_insert(H5G_loc_t *grp_loc, char *name, H5G_loc_t *obj_loc, H5O_type_t obj_type, const void *crt_info) { H5O_link_t lnk; /* Link for object to insert */ herr_t ret_value = SUCCEED; /* Return value */ @@ -577,9 +576,8 @@ H5G__loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, H5O_ty lnk.cset = H5F_DEFAULT_CSET; lnk.corder = 0; /* Will be reset if the group is tracking creation order */ lnk.corder_valid = FALSE; /* Indicate that the creation order isn't valid (yet) */ - /* Casting away const OK -QAK */ - lnk.name = (char *)name; - lnk.u.hard.addr = obj_loc->oloc->addr; + lnk.name = name; + lnk.u.hard.addr = obj_loc->oloc->addr; /* Insert new group into current group's symbol table */ if (H5G_obj_insert(grp_loc->oloc, name, &lnk, TRUE, obj_type, crt_info) < 0) @@ -904,10 +902,10 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/, H5G_own_loc_t *own_loc /*out*/) { - H5G_loc_sc_t *udata = (H5G_loc_sc_t *)_udata; /* User data passed in */ - H5O_name_t comment; /* Object header "comment" message */ - htri_t exists; /* Whether a "comment" message already exists */ - herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_sc_t *udata = (H5G_loc_sc_t *)_udata; /* User data passed in */ + H5O_name_t comment = {0}; /* Object header "comment" message */ + htri_t exists; /* Whether a "comment" message already exists */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -927,13 +925,15 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ /* Add the new message */ if (udata->comment && *udata->comment) { - /* Casting away const OK -QAK */ - comment.s = (char *)udata->comment; + if (NULL == (comment.s = HDstrdup(udata->comment))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy group comment") if (H5O_msg_create(obj_loc->oloc, H5O_NAME_ID, 0, H5O_UPDATE_TIME, &comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message") } /* end if */ done: + HDfree(comment.s); + /* Indicate that this callback didn't take ownership of the group * * location for the object */ *own_loc = H5G_OWN_NONE; |