diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-07-27 19:26:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 19:26:17 (GMT) |
commit | 95e5349089b95dfb95f0f8ce2d6db1bc04ba6c82 (patch) | |
tree | f2bd0c1f37cf3b15b4ce199984fbe164a276f88e /test/vol.c | |
parent | df5dcb2a735dd5bb3ee2cc700119109605976e41 (diff) | |
download | hdf5-95e5349089b95dfb95f0f8ce2d6db1bc04ba6c82.zip hdf5-95e5349089b95dfb95f0f8ce2d6db1bc04ba6c82.tar.gz hdf5-95e5349089b95dfb95f0f8ce2d6db1bc04ba6c82.tar.bz2 |
Misc warnings and cross-compile improvements (#3281)
Diffstat (limited to 'test/vol.c')
-rw-r--r-- | test/vol.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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() */ |