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

Fix a misc warning in test/vol.c #3112

Merged
merged 1 commit into from
Jun 13, 2023
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
11 changes: 6 additions & 5 deletions test/vol.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,9 @@ reg_opt_datatype_get(void H5_ATTR_UNUSED *obj, H5VL_datatype_get_args_t *args, h
static herr_t
fake_vol_info_to_str(const void *info, char **str)
{
herr_t ret_value = SUCCEED; /* Return value */
const int val = *(const int *)info;
const int str_size = 16; /* The size of the string */
const int val = *(const int *)info;
const size_t str_size = 16; /* The size of the string */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str_size needed to be a size_t, not an int. The rest is tidying.

herr_t ret_value = SUCCEED;

/* Verify the info is correct before continuing */
if (val != INT_MAX) {
Expand All @@ -584,9 +584,10 @@ fake_vol_info_to_str(const void *info, char **str)
}

/* Allocate the string long enough for the info */
*str = (char *)malloc(str_size);
if (NULL == (*str = (char *)HDcalloc(1, str_size)))
return FAIL;

HDsnprintf(*str, str_size, "%d", *((const int *)info));
HDsnprintf(*str, str_size, "%d", val);

return ret_value;
} /* end fake_vol_info_to_str() */
Expand Down