summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-03-25 21:31:06 (GMT)
committerGitHub <noreply@github.com>2022-03-25 21:31:06 (GMT)
commit15971fbd160ab061725f238379cc638ed37f05ef (patch)
tree1be26bd1be27c67ba674ddc39611d68959c3c207 /java
parentf73b4c618cb680f8be9b2f2510c34442ec24d713 (diff)
downloadhdf5-15971fbd160ab061725f238379cc638ed37f05ef.zip
hdf5-15971fbd160ab061725f238379cc638ed37f05ef.tar.gz
hdf5-15971fbd160ab061725f238379cc638ed37f05ef.tar.bz2
Hdf5 1 12 merges (#1528)
* Use internal version of H5Eprint2 to avoid possible stack overflow (#661) * Add support for parallel filters to h5repack (#832) * Allow parallel filters feature for comm size of 1 (#840) * Avoid popping API context when one wasn't pushed (#848) * Fix several warnings (#720) * Don't allow H5Pset(get)_all_coll_metadata_ops for DXPLs (#1201) * Fix free list tracking and cleanup cast alignment warnings (#1288) * Fix free list tracking and cleanup cast alignment warnings * Add free list tracking code to H5FL 'arr' routines * Fix usage of several HDfprintf format specifiers after HDfprintf removal (#1324) * Use appropriate printf format specifiers for haddr_t and hsize_t types directly (#1340) * Fix H5ACmpio dirty bytes creation debugging (#1357) * Fix documentation for H5D_space_status_t enum values (#1372) * Parallel rank0 deadlock fixes (#1183) * Fix several places where rank 0 can skip past collective MPI operations on failure * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix a few issues noted by LGTM (#1421) * Fix cache sanity checking code by moving functions to wider scope (#1435) * Fix metadata cache bug when resizing a pinned/protected entry (v2) (#1463) * Disable memory alloc sanity checks by default for Autotools debug builds (#1468) * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'java')
-rw-r--r--java/src/jni/h5util.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index 3a08ea7..78ddcf3 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -870,11 +870,8 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
}
else {
if (typeSize > 0) {
- if (NULL == (this_str = (char *)HDmalloc(typeSize + 1)))
+ if (NULL == (this_str = HDstrdup(tmp_str)))
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
-
- HDstrncpy(this_str, tmp_str, typeSize);
- this_str[typeSize] = '\0';
}
}
@@ -3664,19 +3661,14 @@ obj_info_all(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_d
info_all_t *datainfo = (info_all_t *)op_data;
H5O_info2_t object_info;
htri_t object_exists;
- size_t str_len;
datainfo->otype[datainfo->count] = -1;
datainfo->ltype[datainfo->count] = -1;
datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF;
- str_len = HDstrlen(name);
- if (NULL == (datainfo->objname[datainfo->count] = (char *)HDmalloc(str_len + 1)))
+ if (NULL == (datainfo->objname[datainfo->count] = HDstrdup(name)))
goto done;
- HDstrncpy(datainfo->objname[datainfo->count], name, str_len);
- (datainfo->objname[datainfo->count])[str_len] = '\0';
-
if ((object_exists = H5Oexists_by_name(loc_id, name, H5P_DEFAULT)) < 0)
goto done;
@@ -3702,7 +3694,6 @@ obj_info_max(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_d
{
info_all_t *datainfo = (info_all_t *)op_data;
H5O_info2_t object_info;
- size_t str_len;
datainfo->otype[datainfo->count] = -1;
datainfo->ltype[datainfo->count] = -1;
@@ -3710,13 +3701,9 @@ obj_info_max(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_d
datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF;
/* This will be freed by h5str_array_free(oName, n) */
- str_len = HDstrlen(name);
- if (NULL == (datainfo->objname[datainfo->count] = (char *)HDmalloc(str_len + 1)))
+ if (NULL == (datainfo->objname[datainfo->count] = HDstrdup(name)))
goto done;
- HDstrncpy(datainfo->objname[datainfo->count], name, str_len);
- (datainfo->objname[datainfo->count])[str_len] = '\0';
-
if (H5Oget_info3(loc_id, &object_info, H5O_INFO_ALL) < 0)
goto done;