summaryrefslogtreecommitdiffstats
path: root/tools/h5ls/h5ls.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5ls/h5ls.c')
-rw-r--r--tools/h5ls/h5ls.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index b1d9ee9..420ff3f 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1263,8 +1263,16 @@ dump_dataset_values(hid_t dset)
info.arr_suf = "";
info.arr_sep = " ";
- info.cmpd_pre = "";
- info.cmpd_suf = "";
+ if (label_g)
+ {
+ info.cmpd_pre = "{";
+ info.cmpd_suf = "}";
+ }
+ else
+ {
+ info.cmpd_pre = "";
+ info.cmpd_suf = "";
+ }
info.cmpd_sep = " ";
if (label_g) info.cmpd_name = "%s=";
@@ -1777,7 +1785,9 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
/* Show detailed information about the object, beginning with information
* which is common to all objects. */
if(verbose_g > 0) {
- char comment[50];
+ size_t buf_size = 0;
+ char* comment = NULL;
+ ssize_t cmt_bufsize = -1;
/* Display attributes */
if(obj_type >= 0)
@@ -1803,14 +1813,23 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
} /* end if */
/* Object comment */
- comment[0] = '\0';
- H5Oget_comment(obj, comment, sizeof(comment));
- HDstrcpy(comment + sizeof(comment) - 4, "...");
- if(comment[0]) {
- printf(" %-10s \"", "Comment:");
- display_string(stdout, comment, FALSE);
- puts("\"");
- } /* end if */
+ cmt_bufsize = H5Oget_comment(obj, comment, buf_size);
+
+ /* if the actual length of the comment is longer than cmt_bufsize, then call
+ * H5Oget_comment again with the correct value.
+ * If the call to H5Oget_comment returned an error, skip this block */
+ if (cmt_bufsize > 0) {
+ comment = (char *)HDmalloc((size_t)cmt_bufsize); /* new_size including null terminator */
+ if(comment) {
+ cmt_bufsize = H5Oget_comment(obj, comment, cmt_bufsize);
+ if(cmt_bufsize > 0) {
+ printf(" %-10s \"", "Comment:");
+ display_string(stdout, comment, FALSE);
+ puts("\"");
+ } /* end if */
+ HDfree(comment);
+ }
+ }
} /* end if */
/* Detailed list for object */