diff options
author | David Young <dyoung@hdfgroup.org> | 2022-03-10 19:54:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-10 19:54:20 (GMT) |
commit | 1fb3743f04df101c7245ce045b67d371d462fd70 (patch) | |
tree | b7336b3d48e8016e3967b9175223b4230149bd9c /java | |
parent | b9470be379354af209daf8418b6c571dde99e776 (diff) | |
download | hdf5-1fb3743f04df101c7245ce045b67d371d462fd70.zip hdf5-1fb3743f04df101c7245ce045b67d371d462fd70.tar.gz hdf5-1fb3743f04df101c7245ce045b67d371d462fd70.tar.bz2 |
Fix JNI bug, fix warnings noticed in MSVC CI, be modern & portable (#1480)
Diffstat (limited to 'java')
-rw-r--r-- | java/src/jni/h5util.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 5a01dc9..2de5d87 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -813,7 +813,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i if (NULL == (this_str = (char *)HDmalloc(this_len))) H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, "%g", this_len, tmp_double) < 0) + if (HDsnprintf(this_str, this_len, "%g", tmp_double) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); break; @@ -1160,11 +1160,11 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i H5Otoken_to_str(tid, &oi.token, &token_str); - size_t this_len = 64 + strlen(token_str) + 1; - if (NULL == (this_str = (char *)HDmalloc(this_len))) + size_t that_len = 64 + strlen(token_str) + 1; + if (NULL == (this_str = HDmalloc(that_len))) H5_OUT_OF_MEMORY_ERROR( ENVONLY, "h5str_sprintf: failed to allocate string buffer"); - if (HDsnprintf(this_str, this_len, "%lu:%s", oi.fileno, token_str) < + if (HDsnprintf(this_str, that_len, "%lu:%s", oi.fileno, token_str) < 0) H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsnprintf failure"); |