summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-06-13 14:56:39 (GMT)
committerGitHub <noreply@github.com>2023-06-13 14:56:39 (GMT)
commit9e7e2f8b8edc868b50e6d004f37ce1a2bf9da3f9 (patch)
tree133584e57854d604bfbdd5dd3e14f871b904b343
parent281dbf49dcafd93201b327538f8a931a9b2de8b5 (diff)
downloadhdf5-9e7e2f8b8edc868b50e6d004f37ce1a2bf9da3f9.zip
hdf5-9e7e2f8b8edc868b50e6d004f37ce1a2bf9da3f9.tar.gz
hdf5-9e7e2f8b8edc868b50e6d004f37ce1a2bf9da3f9.tar.bz2
Fix a misc warning in test/vol.c (#3112)
The compiler complains about using integers instead of size_t for some sizes.
-rw-r--r--test/vol.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/vol.c b/test/vol.c
index 6bcae6b..1c4f9ca 100644
--- a/test/vol.c
+++ b/test/vol.c
@@ -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 */
+ herr_t ret_value = SUCCEED;
/* Verify the info is correct before continuing */
if (val != INT_MAX) {
@@ -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() */