diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2002-02-27 21:52:19 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2002-02-27 21:52:19 (GMT) |
commit | 78e3463dbb62dcc18ebab71eaa7ec675aa9d3cae (patch) | |
tree | 7358d2e41412b3720cfbd96706010f84bbd85643 /tools/lib | |
parent | f6ecbd18b046ddbb504b7365d8b5f1a9eeb0f9a4 (diff) | |
download | hdf5-78e3463dbb62dcc18ebab71eaa7ec675aa9d3cae.zip hdf5-78e3463dbb62dcc18ebab71eaa7ec675aa9d3cae.tar.gz hdf5-78e3463dbb62dcc18ebab71eaa7ec675aa9d3cae.tar.bz2 |
[svn-r5023] Purpose:
Bug Fix
Description:
There was a problem with having a lot of groups nested together. We
could only handle 1024 characters at most, but, in a parallel program
especially, it could occur that there were lots and lots of groups
and would be more than 1024.
Solution:
I made the "objname" part of the obj_t structure a pointer instead of
a fixed size. Added code to allocate/deallocate the memory we need
for it. Had to fix how the "prefix" was being handled in the h5dump
program. It was also set to only 1024 characters in length. I made it
dynamic.
Added a test case...Go me!
Platforms tested:
Linux, Solaris
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5tools_utils.c | 8 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 9f5fa0a..f7306a7 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -318,6 +318,7 @@ init_table(table_t **tbl) table->objs[i].displayed = 0; table->objs[i].recorded = 0; table->objs[i].objflag = 0; + table->objs[i].objname = NULL; } *tbl = table; @@ -495,7 +496,8 @@ find_objs(hid_t group, const char *name, void *op_data) /* named data type */ info->type_table->objs[info->type_table->nobjs-1].objflag = 1; } else { - strcpy (info->type_table->objs[i].objname, tmp); + free(info->type_table->objs[i].objname); + info->type_table->objs[i].objname = HDstrdup(tmp); info->type_table->objs[i].recorded = 1; /* named data type */ @@ -649,11 +651,13 @@ add_obj(table_t *table, unsigned long *objno, char *objname) table->objs[i].displayed = 0; table->objs[i].recorded = 0; table->objs[i].objflag = 0; + table->objs[i].objname = NULL; } } i = table->nobjs++; table->objs[i].objno[0] = objno[0]; table->objs[i].objno[1] = objno[1]; - HDstrcpy(table->objs[i].objname, objname); + free(table->objs[i].objname); + table->objs[i].objname = HDstrdup(objname); } diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index eda8e00b..bb47c94 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -69,7 +69,7 @@ extern int get_option(int argc, const char **argv, const char *opt, /*struct taken from the dumper. needed in table struct*/ typedef struct obj_t { unsigned long objno[2]; - char objname[1024]; + char *objname; int displayed; int recorded; int objflag; |