diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2019-06-24 20:04:38 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2019-06-24 20:04:38 (GMT) |
commit | 7485981bcabfeb09ced49b840bf828c00816157a (patch) | |
tree | 94812430157a39049efec811cc147d2c9a8d83a7 /hl/src/H5LT.c | |
parent | 61b2dddc25483f43be5869d3436ee20e9864e05a (diff) | |
parent | 35fd0ec8ceffe96cee352187154da15c967fb990 (diff) | |
download | hdf5-7485981bcabfeb09ced49b840bf828c00816157a.zip hdf5-7485981bcabfeb09ced49b840bf828c00816157a.tar.gz hdf5-7485981bcabfeb09ced49b840bf828c00816157a.tar.bz2 |
Merge pull request #8 in ~VCHOI/my_third_fork from develop to bugfix/new_shutdown_fsm
* commit '35fd0ec8ceffe96cee352187154da15c967fb990':
Updated H5Tcopy() to get the dataset's datatype through the VOL when that is passed in as the object ID.
Fix fortran test and test library linking
Update GCC 6 & 7 flags for CMake builds
Move -Wnormalized down into GCC 6.x flags
Put the memcpy overlap check back into H5MM.
Fixed the heap overflow in t_filters_parallel
Fixed some low-hanging fruit from -fsanitize in t_filters_parallel.
Add lib dir for testing plugins
Add support for GCC 7.x warnings, update warnhist script to account for them, clean up warnings.
Add H5_HLDLL prefix for windows link
HDFFV-10805 cleanup examples and test code
Fix minor typo in H5S_select_iter_release
Add missing fortran mods
HDFFV-10805 Fix test of library libinfo
Cleanup possible CMake target conflicts
Correct CMake issues
Diffstat (limited to 'hl/src/H5LT.c')
-rw-r--r-- | hl/src/H5LT.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 0074d02..3ebca95 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2264,7 +2264,7 @@ out: *------------------------------------------------------------------------- */ static char* -realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_add) +realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str_to_add) { size_t size_str_to_add, size_str; @@ -2360,7 +2360,6 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) { char **name = NULL; /*member names */ unsigned char *value = NULL; /*value array */ - unsigned char *copy = NULL; /*a pointer to value array */ int nmembs; /*number of members */ char tmp_str[TMP_LEN]; int nchars; /*number of output characters */ @@ -2418,17 +2417,15 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) nchars = HDsnprintf(tmp_str, TMP_LEN, "\"%s\"", name[i]); if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; - HDsnprintf(tmp_str, TMP_LEN, "%*s ", MAX(0, 16 - nchars), ""); + HDmemset(tmp_str, ' ', (size_t)MAX(3, 19 - nchars) + 1); + tmp_str[MAX(3, 19 - nchars)] = '\0'; if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value + (size_t)i * dst_size; if (H5T_SGN_NONE == H5Tget_sign(native)) - HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)((void *)copy))); + HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)(value + (size_t)i * dst_size))); else - HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)((void *)copy))); + HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)(value + (size_t)i * dst_size))); if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; @@ -2450,8 +2447,12 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) out: if(0 == nmembs) { - HDsnprintf(tmp_str, TMP_LEN, "\n%*s <empty>", (int)(indt + 4), ""); + str = realloc_and_append(no_ubuf, str_len, str, "\n"); + HDassert((indt + 4) < TMP_LEN); + HDmemset(tmp_str, ' ', (indt + 4) + 1); + tmp_str[(indt + 4)] = '\0'; str = realloc_and_append(no_ubuf, str_len, str, tmp_str); + str = realloc_and_append(no_ubuf, str_len, str, " <empty>"); } /* end if */ /* Release resources */ |