summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5diff/h5diff_common.c51
-rw-r--r--tools/src/h5diff/h5diff_main.c4
-rw-r--r--tools/src/h5dump/h5dump.c31
3 files changed, 47 insertions, 39 deletions
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index a38f6d1..1ba3bb3 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -494,32 +494,39 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const
}
}
- /* Copy the VFD driver info for both the files if it's the onion file */
- if (opts->vfd_info[0].u.name) {
- if (!HDstrcmp(opts->vfd_info[0].u.name, "onion")) {
- if (opts->vfd_info[0].info)
- onion_fa_g_1.revision_num = HDatoi((char *)(opts->vfd_info[0].info));
- else
- onion_fa_g_1.revision_num = 0;
-
- /* Need to free this memory */
- opts->vfd_info[0].info = HDmalloc(sizeof(H5FD_onion_fapl_info_t));
- HDmemcpy(opts->vfd_info[0].info, &onion_fa_g_1, sizeof(H5FD_onion_fapl_info_t));
+ /* If file 1 uses the onion VFD, get the revision number */
+ if (opts->vfd_info[0].u.name && !HDstrcmp(opts->vfd_info[0].u.name, "onion")) {
+ if (opts->vfd_info[0].info) {
+ errno = 0;
+ onion_fa_g_1.revision_num = HDstrtoull(opts->vfd_info[0].info, NULL, 10);
+ if (errno == ERANGE) {
+ HDprintf("Invalid onion revision specified for file 1\n");
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
}
- } /* driver name defined */
+ else
+ onion_fa_g_1.revision_num = 0;
- if (opts->vfd_info[1].u.name) {
- if (!HDstrcmp(opts->vfd_info[1].u.name, "onion")) {
- if (opts->vfd_info[1].info)
- onion_fa_g_2.revision_num = HDatoi((char *)(opts->vfd_info[1].info));
- else
- onion_fa_g_2.revision_num = 0;
+ opts->vfd_info[0].info = &onion_fa_g_1;
+ }
- /* Need to free this memory */
- opts->vfd_info[1].info = HDmalloc(sizeof(H5FD_onion_fapl_info_t));
- HDmemcpy(opts->vfd_info[1].info, &onion_fa_g_2, sizeof(H5FD_onion_fapl_info_t));
+ /* If file 2 uses the onion VFD, get the revision number */
+ if (opts->vfd_info[1].u.name && !HDstrcmp(opts->vfd_info[1].u.name, "onion")) {
+ if (opts->vfd_info[1].info) {
+ errno = 0;
+ onion_fa_g_2.revision_num = HDstrtoull(opts->vfd_info[1].info, NULL, 10);
+ if (errno == ERANGE) {
+ HDprintf("Invalid onion revision specified for file 2\n");
+ usage();
+ h5diff_exit(EXIT_FAILURE);
+ }
}
- } /* driver name defined */
+ else
+ onion_fa_g_2.revision_num = 0;
+
+ opts->vfd_info[1].info = &onion_fa_g_2;
+ }
/* check options */
check_options(opts);
diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c
index 7b39104..2a43b56 100644
--- a/tools/src/h5diff/h5diff_main.c
+++ b/tools/src/h5diff/h5diff_main.c
@@ -127,10 +127,6 @@ main(int argc, char *argv[])
HDfree(opts.sset[i]->count.data);
if (opts.sset[i]->block.data)
HDfree(opts.sset[i]->block.data);
- if (opts.vfd_info[0].info)
- HDfree(opts.vfd_info[1].info);
- if (opts.vfd_info[1].info)
- HDfree(opts.vfd_info[1].info);
HDfree(opts.sset[i]);
opts.sset[i] = NULL;
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index a82dbb2..84669a2 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -1314,23 +1314,28 @@ end_collect:
}
}
- /* Copy the VFD driver info for the input file if it's the onion file */
- if (vfd_info_g.u.name) {
- if (!HDstrcmp(vfd_info_g.u.name, "onion")) {
- onion_fa_g.revision_num = 0;
+ /* If the file uses the onion VFD, get the revision number */
+ if (vfd_info_g.u.name && !HDstrcmp(vfd_info_g.u.name, "onion")) {
- if (vfd_info_g.info) {
- if (!HDstrcmp(vfd_info_g.info, "revision_count"))
- get_onion_revision_count = TRUE;
- else {
- onion_fa_g.revision_num = HDstrtoull((const char *)(vfd_info_g.info), NULL, 0);
- HDprintf("Using revision %" PRIu64 "\n", onion_fa_g.revision_num);
+ if (vfd_info_g.info) {
+ if (!HDstrcmp(vfd_info_g.info, "revision_count"))
+ get_onion_revision_count = TRUE;
+ else {
+ errno = 0;
+ onion_fa_g.revision_num = HDstrtoull(vfd_info_g.info, NULL, 10);
+ if (errno == ERANGE) {
+ HDprintf("Invalid onion revision specified\n");
+ goto error;
}
- }
- vfd_info_g.info = &onion_fa_g;
+ HDprintf("Using revision %" PRIu64 "\n", onion_fa_g.revision_num);
+ }
}
- } /* driver name defined */
+ else
+ onion_fa_g.revision_num = 0;
+
+ vfd_info_g.info = &onion_fa_g;
+ }
parse_end:
/* check for file name to be processed */