diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2016-03-06 15:57:22 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2016-03-06 15:57:22 (GMT) |
commit | c95332e8aeacc5551d3c9541256afd98d89b01d7 (patch) | |
tree | 608472c365ebd3ee682b70ebd7984cc370302589 /tools/lib | |
parent | f037387935769c8113d1b6494bf2b8af08dbece9 (diff) | |
download | hdf5-c95332e8aeacc5551d3c9541256afd98d89b01d7.zip hdf5-c95332e8aeacc5551d3c9541256afd98d89b01d7.tar.gz hdf5-c95332e8aeacc5551d3c9541256afd98d89b01d7.tar.bz2 |
[svn-r29289] Merge of r29222, 29261, 29270, 29272, 29274, 29275 from trunk
tools patches
Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1
autotools serial
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5tools_dump.c | 30 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 51 |
2 files changed, 46 insertions, 35 deletions
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 39cfbeb..5d91276 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -1360,7 +1360,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools if (ctx->ndims > 2) { for (i = 0; i < (size_t) ctx->ndims - 2; i++) { - max_start[i] = temp_start[i] + sset->count.data[i]; + max_start[i] = temp_start[i] + sset->count.data[i] * sset->stride.data[i]; temp_count[i] = 1; } } @@ -1402,14 +1402,10 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools /* increment start dimension */ do { reset_dim = 0; - temp_start[current_outer_dim]++; + temp_start[current_outer_dim] += sset->stride.data[current_outer_dim]; if (temp_start[current_outer_dim] >= max_start[current_outer_dim]) { temp_start[current_outer_dim] = sset->start.data[current_outer_dim]; - /* consider block */ - if (sset->block.data[current_outer_dim] > 1) - temp_start[current_outer_dim]++; - current_outer_dim--; reset_dim = 1; } @@ -3525,12 +3521,22 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s ", "VALUE "); H5Pfill_value_defined(dcpl_id, &fvstatus); - if(fvstatus == H5D_FILL_VALUE_UNDEFINED) - h5tools_str_append(&buffer, "%s", "H5D_FILL_VALUE_UNDEFINED"); - else { - ctx->indent_level--; - h5tools_print_fill_value(&buffer, info, ctx, dcpl_id, type_id, obj_id); - ctx->indent_level++; + switch (fvstatus) { + case H5D_FILL_VALUE_UNDEFINED: + h5tools_str_append(&buffer, "%s", "H5D_FILL_VALUE_UNDEFINED"); + break; + case H5D_FILL_VALUE_DEFAULT: + h5tools_str_append(&buffer, "%s", "H5D_FILL_VALUE_DEFAULT"); + break; + case H5D_FILL_VALUE_USER_DEFINED: + ctx->indent_level--; + h5tools_print_fill_value(&buffer, info, ctx, dcpl_id, type_id, obj_id); + ctx->indent_level++; + break; + case H5D_FILL_VALUE_ERROR: + default: + HDassert(0); + break; } h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index a09a003..b87abf6 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -177,7 +177,7 @@ warn_msg(const char *fmt, ...) /*------------------------------------------------------------------------- * Function: help_ref_msg * - * Purpose: Print a message to refer help page + * Purpose: Print a message to refer help page * * Return: Nothing * @@ -224,7 +224,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti /* check for more flag-like tokens */ if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') { return EOF; - } + } else if (HDstrcmp(argv[opt_ind], "--") == 0) { opt_ind++; return EOF; @@ -248,10 +248,10 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti opt_arg = &arg[len + 1]; } else if (l_opts[i].has_arg != optional_arg) { - if (opt_ind < (argc - 1)) + if (opt_ind < (argc - 1)) if (argv[opt_ind + 1][0] != '-') opt_arg = argv[++opt_ind]; - } + } else if (l_opts[i].has_arg == require_arg) { if (opt_err) HDfprintf(rawerrorstream, @@ -262,7 +262,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti } else opt_arg = NULL; - } + } else { if (arg[len] == '=') { if (opt_err) @@ -288,7 +288,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti opt_ind++; sp = 1; - } + } else { register char *cp; /* pointer into current token */ @@ -313,7 +313,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti if (argv[opt_ind][sp + 1] != '\0') { /* flag value is rest of current token */ opt_arg = &argv[opt_ind++][sp + 1]; - } + } else if (++opt_ind >= argc) { if (opt_err) HDfprintf(rawerrorstream, @@ -321,7 +321,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti argv[0], opt_opt); opt_opt = '?'; - } + } else { /* flag value is next token */ opt_arg = argv[opt_ind++]; @@ -334,8 +334,13 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti /* check the next argument */ opt_ind++; /* we do have an extra argument, check if not last */ - if ( argv[opt_ind][0] != '-' && (opt_ind+1) < argc ) { - opt_arg = argv[opt_ind++]; + if ( (opt_ind+1) < argc ) { + if ( argv[opt_ind][0] != '-' ) { + opt_arg = argv[opt_ind++]; + } + else { + opt_arg = NULL; + } } else { opt_arg = NULL; @@ -376,7 +381,7 @@ indentation(int x) if (x < h5tools_nCols) { while (x-- > 0) PRINTVALSTREAM(rawoutstream, " "); - } + } else { HDfprintf(rawerrorstream, "error: the indentation exceeds the number of cols.\n"); HDexit(1); @@ -721,7 +726,7 @@ tmpfile(void) /*------------------------------------------------------------------------- * Function: H5tools_get_symlink_info * - * Purpose: Get symbolic link (soft, external) info and its target object type + * Purpose: Get symbolic link (soft, external) info and its target object type (dataset, group, named datatype) and path, if exist * * Patameters: @@ -729,9 +734,9 @@ tmpfile(void) * - [IN] linkpath : link path * - [OUT] link_info: returning target object info (h5tool_link_info_t) * - * Return: - * 2 : given pathname is object - * 1 : Succed to get link info. + * Return: + * 2 : given pathname is object + * 1 : Succed to get link info. * 0 : Detected as a dangling link * -1 : H5 API failed. * @@ -795,7 +800,7 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ } /* end if */ /*----------------------------------------------------- - * if link type is external link use different lapl to + * if link type is external link use different lapl to * follow object in other file */ if(link_info->linfo.type == H5L_TYPE_EXTERNAL) { @@ -816,7 +821,7 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ */ /* check if target object exist */ l_ret = H5Oexists_by_name(file_id, linkpath, lapl); - + /* detect dangling link */ if(l_ret == FALSE) { ret = 0; @@ -824,7 +829,7 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ } /* end if */ /* function failed */ else if(l_ret < 0) - goto out; + goto out; /* get target object info */ if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0) { @@ -889,8 +894,8 @@ int h5tools_getstatus(void) } /*----------------------------------------------------------- - * PURPOSE : - * if environment variable H5TOOLS_BUFSIZE is set, + * PURPOSE : + * if environment variable H5TOOLS_BUFSIZE is set, * update H5TOOLS_BUFSIZE and H5TOOLS_MALLOCSIZE from the env * This can be called from each tools main() as part of initial act. * Note: this is more of debugging purpose for now. @@ -907,11 +912,11 @@ int h5tools_getenv_update_hyperslab_bufsize(void) hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10); if (errno != 0 || hyperslab_bufsize_mb <= 0) { - - /* TODO: later when pubilshed + + /* TODO: later when pubilshed HDfprintf(rawerrorstream,"Error: Invalid environment variable \"H5TOOLS_BUFSIZE\" : %s\n", env_str); */ - + goto error; } |