Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quiets a const warning in H5RS code #1181

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/H5RS.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,16 @@ H5RS_wrap(const char *s)
if (NULL == (ret_value = H5FL_MALLOC(H5RS_str_t)))
HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, NULL, "memory allocation failed")

/* Set the internal fields */
ret_value->s = (char *)s;
/* Set the internal fields
*
* We ignore warnings about storing a const char pointer in the struct
* since we never modify or free the string when the wrapped struct
* field is set to TRUE.
*/
H5_GCC_CLANG_DIAG_OFF("cast-qual")
ret_value->s = (char *)s;
H5_GCC_CLANG_DIAG_ON("cast-qual")

ret_value->len = HDstrlen(s);
ret_value->end = ret_value->s + ret_value->len;

Expand Down