diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2001-01-10 21:24:54 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2001-01-10 21:24:54 (GMT) |
commit | 8e20f98805d784a57afdaf73012d96a6ea1f1a30 (patch) | |
tree | 654de108f44deb4972268f83261b6905d4b00cc0 | |
parent | 2ae44ebdbadf06a6771ebe45e2784a05d17da22c (diff) | |
download | hdf5-8e20f98805d784a57afdaf73012d96a6ea1f1a30.zip hdf5-8e20f98805d784a57afdaf73012d96a6ea1f1a30.tar.gz hdf5-8e20f98805d784a57afdaf73012d96a6ea1f1a30.tar.bz2 |
[svn-r3264] Purpose:
Bug fix
Description:
I dropped the boat on this one. I assigned prefix to NULL after it'd
been allocated...My bad.
Solution:
Stopped doing that.
Platforms tested:
Linux
-rw-r--r-- | tools/h5dump.c | 8 | ||||
-rw-r--r-- | tools/h5ls.c | 12 | ||||
-rw-r--r-- | tools/h5tools.h | 27 |
3 files changed, 15 insertions, 32 deletions
diff --git a/tools/h5dump.c b/tools/h5dump.c index 1f854c4..b5a7b7c 100644 --- a/tools/h5dump.c +++ b/tools/h5dump.c @@ -838,7 +838,7 @@ dump_attr(hid_t attr, const char *attr_name, void UNUSED *op_data) * *-----------------------------------------------------------------------*/ static herr_t -dump_selected_attr(hid_t loc_id, char *name) +dump_selected_attr(hid_t loc_id, const char *name) { int j; char *obj_name, *attr_name; @@ -1685,7 +1685,7 @@ main(int argc, const char *argv[]) { hid_t fid, gid; const char *progname = "h5dump"; - char *fname = NULL; + const char *fname = NULL; int i, display_bb = 0, display_all = 1, newwidth = 0; void *edata; hid_t (*func)(void*); @@ -1834,8 +1834,7 @@ main(int argc, const char *argv[]) /* init the find_objs_t */ info.threshold = 0; info.prefix_len = prefix_len; - info.prefix = malloc((size_t)info.prefix_len); - info.prefix[0] = '\0'; + info.prefix = calloc((size_t)info.prefix_len, 1); info.group_table = group_table; info.type_table = type_table; info.dset_table = dset_table; @@ -1843,7 +1842,6 @@ main(int argc, const char *argv[]) /* find all shared objects */ H5Giterate(fid, "/", NULL, find_objs, (void *)&info); - prefix = NULL; /* does there exist unamed committed data type */ for (i = 0; i < type_table->nobjs; i++) diff --git a/tools/h5ls.c b/tools/h5ls.c index 4fdc673..2ceecb0 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -16,18 +16,6 @@ #include <h5tools.h> /* - * File drivers - */ -#if defined VERSION13 -#include <H5FDsec2.h> -#include <H5FDmulti.h> -#include <H5FDfamily.h> -#elif defined VERSION12 -#include <H5Fpublic.h> -#endif - - -/* * If defined then include the file name as part of the object name when * printing full object names. Otherwise leave the file name off. */ diff --git a/tools/h5tools.h b/tools/h5tools.h index f48c7af..13aaeed 100644 --- a/tools/h5tools.h +++ b/tools/h5tools.h @@ -14,13 +14,9 @@ #include <hdf5.h> #include <stdio.h> -#if H5_VERS_MAJOR == 1 -# if H5_VERS_MINOR == 2 -# define VERSION12 -# elif H5_VERS_MINOR == 3 -# define VERSION13 -# endif /* H5_VERS_MINOR == 2 */ -#endif /* H5_VERS_MAJOR = 1 */ +#if H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 2 +#define VERSION12 +#endif /* H5_VERS_MAJOR == 1 && H5_VERS_MINOR == 2 */ #define ESCAPE_HTML 1 @@ -387,7 +383,7 @@ enum { * the ``opt_arg'' variable. get_option returns the shortname equivalent of * the option. The long options are specified in the following way: * - * struct long_options[] = { + * struct long_options foo[] = { * { "filename", require_arg, 'f' }, * { "append", no_arg, 'a' }, * { "width", require_arg, 'w' }, @@ -410,8 +406,8 @@ enum { * end. */ typedef struct long_options { - const char *name; /* name of the long option */ - int has_arg; /* whether we should look for an arg */ + const char *name; /* name of the long option */ + int has_arg; /* whether we should look for an arg */ char shortval; /* the shortname equivalent of long arg * this gets returned from get_option */ } long_options; @@ -424,9 +420,9 @@ extern int get_option(int argc, const char **argv, const char *opt, extern hid_t h5dump_fixtype(hid_t f_type); extern int h5dump_dset(FILE *stream, const h5dump_t *info, hid_t dset, - hid_t p_typ, int indentlevel); + hid_t p_typ, int indentlevel); extern int h5dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, - hid_t type, hid_t space, void *mem, int indentlevel); + hid_t type, hid_t space, void *mem, int indentlevel); extern hid_t h5dump_fopen(const char *fname, char *drivername, size_t drivername_len); @@ -476,10 +472,11 @@ extern void init_prefix(char **temp, int); #define COL 3 -extern int indent; +extern int indent; /*how far in to indent the line */ +extern int nCols; /*max number of columns for outputting */ +extern FILE *rawdatastream; /*output stream for raw data */ + extern void indentation(int); -extern int nCols; -extern FILE *rawdatastream; /* output stream for raw data */ /* taken from h5dump.h*/ #define BOOT_BLOCK "BOOT_BLOCK" |