diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-04-06 18:36:16 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-04-06 18:36:16 (GMT) |
commit | 9f2f5b2626dfb1f83d7361296a80e496a40633ab (patch) | |
tree | b84b2c9ce28568948b23c9ab876701444e7c5971 /tools | |
parent | b232e44df543a513103b28d4c80af2089ff2b413 (diff) | |
parent | 9da5bbcc9bae79f91788e72bace53ed2323e887f (diff) | |
download | hdf5-9f2f5b2626dfb1f83d7361296a80e496a40633ab.zip hdf5-9f2f5b2626dfb1f83d7361296a80e496a40633ab.tar.gz hdf5-9f2f5b2626dfb1f83d7361296a80e496a40633ab.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/hdf5_1_8)
* commit '9da5bbcc9bae79f91788e72bace53ed2323e887f':
H5repack bug fixes from develop
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 18 | ||||
-rw-r--r-- | tools/h5repack/h5repack_main.c | 44 |
2 files changed, 46 insertions, 16 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 58f65ef..e3a7d75 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -672,11 +672,14 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, break; - /*------------------------------------------------------------------------- - * H5TRAV_TYPE_DATASET - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * H5TRAV_TYPE_DATASET + *------------------------------------------------------------------------- + */ case H5TRAV_TYPE_DATASET: + { + hbool_t use_h5ocopy; + has_filter = 0; req_filter = 0; @@ -734,9 +737,10 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, * otherwise we do a copy using H5Ocopy *------------------------------------------------------------------------- */ - if (options->op_tbl->nelems || options->all_filter == 1 - || options->all_layout == 1 || is_ref || is_named) { + use_h5ocopy = !(options->op_tbl->nelems || options->all_filter == 1 + || options->all_layout == 1 || is_ref || is_named); + if (!use_h5ocopy) { int j; if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) @@ -1105,7 +1109,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name); } /* end whether we have request for filter/chunking */ + break; + } /* H5TRAV_TYPE_DATASET */ /*------------------------------------------------------------------------- * H5TRAV_TYPE_NAMED_DATATYPE diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index f57a128..6223d29 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -228,6 +228,8 @@ int read_info(const char *filename, pack_opt_t *options) /* cycle until end of file reached */ while (1) { + if (EOF == fscanf(fp, "%9s", stype)) + break; /* Info indicator must be for layout or filter */ if (HDstrcmp(stype,"-l") && HDstrcmp(stype, "-f")) { @@ -269,7 +271,7 @@ int read_info(const char *filename, pack_opt_t *options) if (!HDstrcmp(stype, "-l")) { if (h5repack_addlayout(comp_info, options) == -1) { - error_msg("could not add chunck option\n"); + error_msg("could not add chunk option\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; goto done; @@ -369,13 +371,13 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) case 'h': usage(h5tools_getprogname()); h5tools_setstatus(EXIT_SUCCESS); - ret_value = -1; + ret_value = 1; goto done; case 'V': print_version(h5tools_getprogname()); h5tools_setstatus(EXIT_SUCCESS); - ret_value = -1; + ret_value = 1; goto done; case 'v': @@ -413,9 +415,12 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'e': - ret_value = read_info(opt_arg, options); - if (ret_value < 0) + if ((ret_value = read_info(opt_arg, options)) < 0) { + error_msg("failed to read from repack options file <%s>\n", opt_arg); + h5tools_setstatus(EXIT_FAILURE); + ret_value = -1; goto done; + } break; case 'n': @@ -496,7 +501,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'q': - if (H5_INDEX_UNKNOWN == set_sort_by(opt_arg)) { + if (H5_INDEX_UNKNOWN == (sort_by = set_sort_by(opt_arg))) { error_msg(" failed to set sort by form <%s>\n", opt_arg); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; @@ -505,7 +510,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'z': - if (set_sort_order(opt_arg) == H5_ITER_UNKNOWN) { + if (H5_ITER_UNKNOWN == (sort_order = set_sort_order(opt_arg))) { error_msg(" failed to set sort order form <%s>\n", opt_arg); h5tools_setstatus(EXIT_FAILURE); ret_value = -1; @@ -565,11 +570,12 @@ done: */ int main(int argc, const char **argv) { - pack_opt_t options; /*the global options */ + pack_opt_t options; /*the global options */ H5E_auto2_t func; H5E_auto2_t tools_func; void *edata; void *tools_edata; + int parse_ret; HDmemset(&options, 0, sizeof(pack_opt_t)); @@ -589,20 +595,32 @@ int main(int argc, const char **argv) /* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */ if (h5tools_getenv_update_hyperslab_bufsize() < 0) { + HDprintf("Error occurred while retrieving H5TOOLS_BUFSIZE value\n"); h5tools_setstatus(EXIT_FAILURE); goto done; } /* initialize options */ if (h5repack_init(&options, 0, FALSE) < 0) { + HDprintf("Error occurred while initializing repack options\n"); h5tools_setstatus(EXIT_FAILURE); goto done; } + /* Initialize default indexing options */ sort_by = H5_INDEX_CRT_ORDER; - if (parse_command_line(argc, argv, &options) < 0) + parse_ret = parse_command_line(argc, argv, &options); + if (parse_ret < 0) { + HDprintf("Error occurred while parsing command-line options\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + else if (parse_ret > 0) { + /* Short-circuit success */ + h5tools_setstatus(EXIT_SUCCESS); goto done; + } if (enable_error_stack > 0) { H5Eset_auto2(H5E_DEFAULT, func, edata); @@ -610,7 +628,13 @@ int main(int argc, const char **argv) } /* pack it */ - h5tools_setstatus(h5repack(infile, outfile, &options)); + if (h5repack(infile, outfile, &options) < 0) { + HDprintf("Error occurred while repacking\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + + h5tools_setstatus(EXIT_SUCCESS); done: /* free tables */ |