diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-04-21 06:55:42 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-04-21 06:55:42 (GMT) |
commit | 0cf3f85ccec2776e4e6276cbc3b1b72f21536e0b (patch) | |
tree | 8e4ad75b45bddd06f1274abc9ceebfa3b1570e28 /tools/lib | |
parent | 31fb2d13de02c9e7139abdb5f346a3f0b9f472e3 (diff) | |
download | hdf5-0cf3f85ccec2776e4e6276cbc3b1b72f21536e0b.zip hdf5-0cf3f85ccec2776e4e6276cbc3b1b72f21536e0b.tar.gz hdf5-0cf3f85ccec2776e4e6276cbc3b1b72f21536e0b.tar.bz2 |
[svn-r10637] Purpose:
Bug fix/code cleanup
Description:
Add tests to determine that very long (64K+) object names are working.
Fixed a couple of bugs in h5dump where they weren't...
Platforms tested:
FreeBSD 4.11 (sleipnir)
Solaris 2.9 (shanti)
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5tools_ref.c | 14 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index b607d7d..fbcc734 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -36,7 +36,8 @@ extern hid_t thefile; -extern char *prefix; +size_t prefix_len = 1024; +char *prefix; extern char *progname; extern int d_status; @@ -227,17 +228,19 @@ fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) { hid_t obj; char *tmp; + size_t tmp_len; H5G_stat_t statbuf; ref_path_table_entry_t *pte; char *thepath; H5Gget_objinfo(group, name, FALSE, &statbuf); - tmp = (char *) malloc(strlen(prefix) + strlen(name) + 2); + tmp_len = strlen(prefix) + strlen(name) + 2; + tmp = (char *) malloc(tmp_len); if (tmp == NULL) return FAIL; - thepath = (char *) malloc(strlen(prefix) + strlen(name) + 2); + thepath = (char *) malloc(tmp_len); if (thepath == NULL) { free(tmp); @@ -264,6 +267,11 @@ fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) break; case H5G_GROUP: if ((obj = H5Gopen(group, name)) >= 0) { + if (prefix_len <= tmp_len) { + prefix_len = tmp_len + 1; + prefix = realloc(prefix, prefix_len); + } + strcat(strcat(prefix, "/"), name); pte = ref_path_table_lookup(thepath); if (pte == NULL) { diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index e92f972..df103d7 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -435,7 +435,7 @@ find_objs(hid_t group, const char *name, void *op_data) switch (statbuf.type) { case H5G_GROUP: if ((obj = H5Gopen(group, name)) >= 0) { - if (info->prefix_len < (HDstrlen(info->prefix) + HDstrlen(name) + 2)) { + while (info->prefix_len < (HDstrlen(info->prefix) + HDstrlen(name) + 2)) { info->prefix_len *= 2; info->prefix = HDrealloc(info->prefix, info->prefix_len * sizeof(char)); |