From bc6115931877c6f6d63977f2c03c5e2dbffe3e56 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 2 Oct 2019 15:13:37 -0500 Subject: HDFFV-10919 merge synching --- tools/lib/h5tools.c | 32 +++--- tools/lib/h5tools_dump.c | 92 ++++++++-------- tools/src/h5dump/h5dump.c | 3 +- tools/src/h5repack/h5repack.c | 89 +++++---------- tools/src/h5repack/h5repack_copy.c | 138 ++++++------------------ tools/src/h5repack/h5repack_main.c | 10 +- tools/src/misc/h5debug.c | 116 ++++++++++---------- tools/test/h5repack/testfiles/h5repack-help.txt | 10 +- 8 files changed, 189 insertions(+), 301 deletions(-) diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index f103647..627d4f2 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -1241,10 +1241,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t H5T_class_t type_class; if((size = H5Tget_size(tid)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); if((type_class = H5Tget_class(tid)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); switch (type_class) { case H5T_INTEGER: @@ -1264,7 +1264,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t bytes_wrote = HDfwrite(mem, 1, bytes_in, stream); if(bytes_wrote != bytes_in || (0 == bytes_wrote && HDferror(stream))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); block_index -= (hsize_t)bytes_wrote; mem = mem + bytes_wrote; @@ -1287,7 +1287,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t if (s != NULL) size = HDstrlen(s); else - H5E_THROW(FAIL, H5E_tools_min_id_g, "NULL string") + H5E_THROW(FAIL, H5E_tools_min_id_g, "NULL string"); } else { s = (char *) mem; @@ -1295,7 +1295,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); if (1 != HDfwrite(&tempuchar, sizeof(unsigned char), 1, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); } /* i */ } /* for (block_index = 0; block_index < block_nelmts; block_index++) */ } @@ -1306,7 +1306,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t unsigned nmembs; if((snmembs = H5Tget_nmembers(tid)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed"); nmembs = (unsigned)snmembs; for (block_index = 0; block_index < block_nelmts; block_index++) { @@ -1322,7 +1322,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed"); } H5Tclose(memb); @@ -1350,7 +1350,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } else { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed"); } for (block_index = 0; block_index < block_nelmts; block_index++) { @@ -1358,7 +1358,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t /* dump the array element */ if (render_bin_output(stream, container, memb, mem, nelmts) < 0) { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); } } H5Tclose(memb); @@ -1380,7 +1380,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t /* dump the array element */ if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *)((void *)mem))->p)), nelmts) < 0) { H5Tclose(memb); - H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed"); } } H5Tclose(memb); @@ -1426,7 +1426,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; if (size != HDfwrite(mem, sizeof(char), size, stream)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed"); } /* end for */ break; @@ -1434,7 +1434,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t case H5T_NCLASSES: default: /* Badness */ - H5E_THROW(FAIL, H5E_tools_min_id_g, "bad type class") + H5E_THROW(FAIL, H5E_tools_min_id_g, "bad type class"); break; } /* end switch */ @@ -1562,12 +1562,12 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, hid_t type_id = -1; if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed") + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); nblocks = (hsize_t)snblocks; /* Print block information */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); ndims = (unsigned)sndims; alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); @@ -1683,12 +1683,12 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, hid_t type_id = -1; if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed") + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") + H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); ndims = (unsigned)sndims; if((dtype = H5Dget_type(region_id)) < 0) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index beb397c..eaac94a 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -618,12 +618,12 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, HDassert(buffer); if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed") + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed"); nblocks = (hsize_t)snblocks; /* Print block information */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); ndims = (unsigned)sndims; /* Render the region { element begin */ @@ -944,12 +944,12 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, HDassert(buffer); if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed") + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) - H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") + H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); ndims = (unsigned)sndims; /* Render the region { element begin */ @@ -1156,7 +1156,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c unsigned int vl_data = 0; /* contains VL datatypes */ if ((size_t) ctx->ndims > NELMTS(sm_size)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed"); if (ctx->ndims > 0) init_acc_pos(ctx, total_size); @@ -1184,10 +1184,10 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c /* calculate the potential number of elements we're going to print */ if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed"); sm_nelmts = (hsize_t)ssm_nelmts; if (sm_nelmts > 0) { @@ -1196,7 +1196,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c * a hyperslab whose size is manageable. */ if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); if (ctx->ndims > 0) for (i = ctx->ndims; i > 0; --i) { @@ -1210,17 +1210,17 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c HDassert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/ if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine") + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine"); if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); /* read the data */ if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); /* print the data */ flags = START_OF_DATA; @@ -1234,7 +1234,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c /* print array indices. get the lower bound of the hyperslab and calulate the element position at the start of hyperslab */ if(H5Sget_select_bounds(f_space, low, high) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed"); elmtno = 0; for (i = 0; i < (size_t) ctx->ndims - 1; i++) { @@ -1259,13 +1259,13 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); if(H5Sclose(sm_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if(sm_buf) HDfree(sm_buf); sm_buf = NULL; } else - H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print") + H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print"); ctx->continuation++; @@ -1462,10 +1462,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/ if((f_space = H5Dget_space(dset)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); ctx->ndims = (unsigned)sndims; /* assume entire data space to be printed */ @@ -1474,7 +1474,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co ctx->p_min_idx[i] = 0; if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); ctx->size_last_dim = total_size[ctx->ndims - 1]; /* Set the compound datatype field list for display */ @@ -1484,7 +1484,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co CATCH if(f_space >= 0 && H5Sclose(f_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); return ret_value; } @@ -1540,15 +1540,15 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont f_space = H5Dget_space(dset); if (f_space == FAIL) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); sndims = H5Sget_simple_extent_ndims(f_space); if(sndims < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); ctx->ndims = (unsigned)sndims; if ((size_t)ctx->ndims > NELMTS(sm_size)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed"); /* Assume entire data space to be printed */ if (ctx->ndims > 0) @@ -1629,7 +1629,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont /* Read the data */ if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) { - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed"); } /* Print the data */ @@ -1667,9 +1667,9 @@ CATCH done: if(sm_space >= 0 && H5Sclose(sm_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if(f_space >= 0 && H5Sclose(f_space) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); return ret_value; } @@ -1696,11 +1696,11 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte sndims = H5Sget_simple_extent_ndims(space); if(sndims < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); ctx->ndims = (unsigned)sndims; if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx)) - H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed"); /* Assume entire data space to be printed */ for (i = 0; i < ctx->ndims; i++) @@ -1900,7 +1900,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ const char *order_s = NULL; /* byte order string */ if((type_class = H5Tget_class(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed"); if (object_search && H5Tcommitted(type) > 0) { H5O_info_t oinfo; obj_t *obj = NULL; /* Found object */ @@ -2280,9 +2280,9 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ char *ttag; if(NULL == (ttag = H5Tget_tag(type))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed"); - ctx->need_prefix = TRUE; + ctx->need_prefix = TRUE; h5tools_str_reset(buffer); h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag); @@ -2308,7 +2308,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_COMPOUND: if((snmembers = H5Tget_nmembers(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); nmembers = (unsigned)snmembers; h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin); @@ -2352,7 +2352,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_ENUM: if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -2382,14 +2382,14 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ case H5T_VLEN: if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin); h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); if(H5Tclose(super) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed") + HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend); @@ -2464,10 +2464,10 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) int i; if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); if((space_type = H5Sget_simple_extent_type(space)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed"); switch(space_type) { case H5S_SCALAR: @@ -2552,15 +2552,15 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i ncols = info->line_ncols; if((snmembs = H5Tget_nmembers(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); nmembs = (unsigned)snmembs; HDassert(nmembs > 0); if((super = H5Tget_super(type)) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed"); if((type_size = H5Tget_size(type)) <= 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed"); /* * Determine what datatype to use for the native values. To simplify @@ -2573,7 +2573,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i dst_size = sizeof(long long); if((sign_type = H5Tget_sign(type))<0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed"); if(H5T_SGN_NONE == sign_type) native = H5T_NATIVE_ULLONG; else @@ -2584,20 +2584,20 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i /* Get the names and raw values of all members */ if(NULL == (name = (char **)HDcalloc((size_t)nmembs, sizeof(char *)))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name") + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name"); if(NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size)))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value") + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value"); for (i = 0; i < nmembs; i++) { name[i] = H5Tget_member_name(type, i); if(H5Tget_member_value(type, i, value + i * type_size) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed"); } /* Convert values to native datatype */ if (native > 0) if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed") + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); /* * Sort members by increasing value @@ -2654,7 +2654,7 @@ CATCH HDfree(value); if(super >= 0 && H5Tclose(super) < 0) - H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class") + H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class"); if(0 == nmembs) h5tools_str_append(buffer, "\n"); @@ -3223,7 +3223,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, *------------------------------------------------------------------------- */ if (H5D_VIRTUAL != stl) { - ctx->need_prefix = TRUE; + ctx->need_prefix = TRUE; h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s %s", FILTERS, BEGIN); diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index b1e736a..0579f63 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1641,8 +1641,7 @@ main(int argc, const char *argv[]) fid = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); } else { - fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, - driver, NULL, 0); + fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0); } if (fid < 0) { diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 24f4e6c..0183cbf 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -220,11 +220,7 @@ h5repack_addlayout(const char *str, pack_opt_t *options) *------------------------------------------------------------------------- */ hid_t -copy_named_datatype(hid_t type_in, - hid_t fidout, - named_dt_t **named_dt_head_p, - trav_table_t *travt, - pack_opt_t *options) +copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) { named_dt_t *dt = *named_dt_head_p; /* Stack pointer */ named_dt_t *dt_ret = NULL; /* Datatype to return */ @@ -248,8 +244,7 @@ copy_named_datatype(hid_t type_in, if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { /* Push onto the stack */ if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "buffer allocation failed failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed failed"); dt->next = *named_dt_head_p; *named_dt_head_p = dt; @@ -289,8 +284,7 @@ copy_named_datatype(hid_t type_in, else dt_ret->id_out = H5Tcopy(type_in); if (dt_ret->id_out < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "H5Tget_native_type-H5Tcopy failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type-H5Tcopy failed"); if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommit_anon failed"); } /* end if named datatype not yet in output file */ @@ -347,12 +341,7 @@ done: *------------------------------------------------------------------------- */ int -copy_attr( - hid_t loc_in, - hid_t loc_out, - named_dt_t **named_dt_head_p, - trav_table_t *travt, - pack_opt_t *options) +copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options) { int ret_value = 0; hid_t attr_id = -1; /* attr ID */ @@ -382,13 +371,13 @@ copy_attr( */ for (u = 0; u < (unsigned) oinfo.num_attrs; u++) { /* open attribute */ - attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT); - if (attr_id < 0) + if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); if (H5Aget_name(attr_id, (size_t) 255, name) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + /* get the file datatype */ if ((ftype_id = H5Aget_type(attr_id)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed"); @@ -405,8 +394,7 @@ copy_attr( /* Copy named dt */ if ((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, travt, options)) < 0) { H5Fclose(fidout); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "copy_named_datatype failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); } if (H5Fclose(fidout) < 0) @@ -425,8 +413,7 @@ copy_attr( /* get dimensions */ if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "H5Sget_simple_extent_dims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); nelmts = 1; for (j = 0; j < rank; j++) @@ -622,8 +609,7 @@ check_options(pack_opt_t *options) } /* end for each object in options */ if (options->all_layout == 1 && has_ck) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "invalid chunking input: 'all' option is present with other objects"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid chunking input: 'all' option is present with other objects"); /*------------------------------------------------------------------------- * Objects to filter @@ -669,14 +655,10 @@ check_options(pack_opt_t *options) if (options->verbose) { if (pack.filter[j].filtn >= 0) { if (pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) { - HDprintf(" <%s> with %s filter %d\n", name, - get_sfilter(pack.filter[j].filtn), - pack.filter[j].filtn); + HDprintf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn), pack.filter[j].filtn); } else { - HDprintf(" <%s> with %s filter\n", - name, - get_sfilter(pack.filter[j].filtn)); + HDprintf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn)); } } } @@ -685,9 +667,7 @@ check_options(pack_opt_t *options) } /* end for each object in options table */ if (options->all_filter == 1 && has_cp) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "invalid compression input: 'all' option is present with " \ - "other objects"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid compression input: 'all' option is present with other objects"); /*------------------------------------------------------------------------- * Check options for the latest format @@ -695,18 +675,14 @@ check_options(pack_opt_t *options) */ if (options->grp_compact < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "invalid maximum number of links to store as header messages"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid maximum number of links to store as header messages"); if (options->grp_indexed < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "invalid minimum number of links to store in indexed format"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid minimum number of links to store in the indexed format"); if (options->grp_indexed > options->grp_compact) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "minimum indexed size is greater than maximum compact size"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "minimum indexed size is greater than the maximum compact size"); for (i = 0; i < 8; i++) if (options->msg_size[i] < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "invalid shared message size"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid shared message size"); /*------------------------------------------------------------------------ * Verify new user userblock options; file name must be present @@ -720,8 +696,7 @@ check_options(pack_opt_t *options) } if (options->ublock_filename == NULL && options->ublock_size != 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "file name missing for user block", options->ublock_filename); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "file name missing for user block", options->ublock_filename); /*------------------------------------------------------------------------ * Verify alignment options; threshold is zero default but alignment not @@ -729,8 +704,7 @@ check_options(pack_opt_t *options) */ if (options->alignment == 0 && options->threshold != 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "alignment for H5Pset_alignment missing"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "alignment for H5Pset_alignment missing"); done: return ret_value; @@ -765,8 +739,7 @@ check_objects(const char* fname, pack_opt_t *options) *------------------------------------------------------------------------- */ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR); /*------------------------------------------------------------------------- * get the list of objects in the file @@ -775,6 +748,7 @@ check_objects(const char* fname, pack_opt_t *options) /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); + /* init table */ trav_table_init(&travt); /* get the list of objects in the file */ @@ -798,8 +772,7 @@ check_objects(const char* fname, pack_opt_t *options) /* the input object names are present in the file and are valid */ if (h5trav_getindext(name, travt) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "%s Could not find <%s> in file <%s>. Exiting...\n", + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose ? "\n" : ""), name, fname); if (options->verbose) HDprintf("...Found\n"); @@ -825,27 +798,21 @@ check_objects(const char* fname, pack_opt_t *options) } else { if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "H5Dopen2 failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); if ((sid = H5Dget_space(did)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "H5Dget_space failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "H5Sget_simple_extent_ndims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); HDmemset(dims, 0, sizeof dims); if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "H5Sget_simple_extent_dims failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); for (j = 0; j < rank; j++) csize *= dims[j]; if (H5Sclose(sid) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "H5Sclose failed"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if (H5Dclose(did) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, - "H5Dclose failed"); - } /* end else (chunk rank is 0) */ + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + } if (csize < ppb) { HDprintf(" \n"); diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 398d632..f6409e3 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -37,7 +37,7 @@ * local functions *------------------------------------------------------------------------- */ -static int Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], +static int get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p); static void print_dataset_info(hid_t dcpl_id, char *objname, double per, int pr); static int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, @@ -145,8 +145,7 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) /* Adjust group creation parameters for root group */ /* (So that it is created in "dense storage" form) */ - if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, - (unsigned) options->grp_indexed) < 0) + if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed to adjust group creation parameters for root group"); for (i = 0; i < 5; i++) { @@ -368,7 +367,7 @@ done: } /* end copy_objects() */ /*------------------------------------------------------------------------- - * Function: Get_hyperslab + * Function: get_hyperslab * * Purpose: Calulate a hyperslab from a dataset for higher performance. * The size of hyperslab is limitted by H5TOOLS_BUFSIZE. @@ -400,7 +399,7 @@ done: *-----------------------------------------*/ int -Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], +get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p) { int ret_value = 0; @@ -521,7 +520,7 @@ Get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], done: return ret_value; -} /* end Get_hyperslab() */ +} /* end get_hyperslab() */ /*------------------------------------------------------------------------- * Function: do_copy_objects @@ -569,7 +568,7 @@ done: * in (2) is that, when using the strip mine size, it assures that the "remaining" part * of the dataset that does not fill an entire strip mine is processed. * - * 1. figure out a hyperslab (dimentions) and size (refer to Get_hyperslab()). + * 1. figure out a hyperslab (dimentions) and size (refer to get_hyperslab()). * 2. Calculate the hyperslab selections as the selection is moving forward. * Selection would be same as the hyperslab except for the remaining edge portion * of the dataset. The code take care of the remaining portion if exist. @@ -678,11 +677,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, } else { if (options->grp_compact > 0 || options->grp_indexed > 0) - if (H5Pset_link_phase_change( - gcpl_out, - (unsigned) options->grp_compact, - (unsigned) options->grp_indexed) - < 0) + if (H5Pset_link_phase_change(gcpl_out, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed"); if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) @@ -799,8 +794,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if ((dcpl_out = H5Pcreate(H5P_DATASET_CREATE)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); } - else - if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) { + else if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) { HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); } @@ -847,25 +841,14 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, * changing to COMPACT. For the reference, COMPACT is limited * by size 64K by library. */ - if (options->layout_g != H5D_COMPACT) { - if (size_dset < options->min_comp) { + if (options->layout_g != H5D_COMPACT) + if (size_dset < options->min_comp) apply_s = 0; - } - } /* apply the filter */ - if (apply_s) { - if (apply_filters( - travt->objs[i].name, - rank, - dims, - msize, - dcpl_out, - options, - &has_filter) - < 0) + if (apply_s) + if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out, options, &has_filter) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "apply_filters failed"); - } /* only if layout change requested for entire file or * individual obj */ @@ -904,36 +887,13 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, * modified dcpl; in that case use the original instead *------------------------------------------------------------------------- */ - dset_out = H5Dcreate2(fidout, - travt->objs[i].name, - wtype_id, - f_space_id, - H5P_DEFAULT, - dcpl_out, - H5P_DEFAULT); - /* if unable to create, retry with original DCPL */ - if (dset_out < 0) { - H5Epush2(H5tools_ERR_STACK_g, - __FILE__, - FUNC, - __LINE__, - H5tools_ERR_CLS_g, - H5E_tools_g, - H5E_tools_min_id_g, - "H5Dcreate2 failed"); - if (options->verbose) { - HDprintf(" warning: could not create dataset <%s>. Applying original settings\n", - travt->objs[i].name); - } - dset_out = H5Dcreate2( - fidout, - travt->objs[i].name, - wtype_id, - f_space_id, - H5P_DEFAULT, - dcpl_in, - H5P_DEFAULT); - if (dset_out < 0) + dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); + if (dset_out == FAIL) { + H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed"); + if (options->verbose) + HDprintf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name); + + if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); apply_f = 0; } /* end if retry dataset create */ @@ -1003,15 +963,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, dcpl_tmp = dcpl_in; /* reading dataset */ } - if (Get_hyperslab( - dcpl_tmp, - rank, - dims, - p_type_nbytes, - hslab_dims, - &hslab_nbytes) - < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Get_hyperslab failed"); + /* get hyperslab dims and size in byte */ + if (get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "get_hyperslab failed"); hslab_buf = HDmalloc((size_t)hslab_nbytes); if (hslab_buf == NULL) @@ -1033,30 +987,14 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ for (k = 0, hs_select_nelmts = 1; k < rank; k++) { /* MIN() is used to get the remaining edge portion if exist. - * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is - * smaller then the hyperslab. - */ + * "dims[k] - hs_sel_offset[k]" is remaining edge portion that is smaller then the hyperslab.*/ hs_sel_count[k] = MIN(dims[k] - hs_sel_offset[k], hslab_dims[k]); hs_select_nelmts *= hs_sel_count[k]; } - if (H5Sselect_hyperslab( - f_space_id, - H5S_SELECT_SET, - hs_sel_offset, - NULL, - hs_sel_count, - NULL) - < 0) + if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); - if (H5Sselect_hyperslab( - hslab_space, - H5S_SELECT_SET, - zero, - NULL, - &hs_select_nelmts, - NULL) - < 0) + if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); } /* end if rank > 0 */ else { @@ -1065,25 +1003,12 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, hs_select_nelmts = 1; } /* end (else) rank == 0 */ - if (H5Dread( - dset_in, - wtype_id, - hslab_space, - f_space_id, - H5P_DEFAULT, - hslab_buf) - < 0) + if(H5Dread(dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); - if (H5Dwrite( - dset_out, - wtype_id, - hslab_space, - f_space_id, - H5P_DEFAULT, - hslab_buf) - < 0) + if(H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); + /* reclaim any VL memory, if necessary */ if (vl_data) H5Dvlen_reclaim(wtype_id, hslab_space, H5P_DEFAULT, hslab_buf); @@ -1129,11 +1054,8 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* print a message that the filter was not applied * (in case there was a filter) */ - if (has_filter && apply_s == 0) { - HDprintf(" \n", - travt->objs[i].name, - (int) options->min_comp); - } + if (has_filter && apply_s == 0) + HDprintf(" \n", travt->objs[i].name, (int) options->min_comp); if (has_filter && apply_f == 0) HDprintf(" \n", travt->objs[i].name); diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index db821ef..c628beb 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -237,11 +237,6 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " Using latest file format with maximum compact group size of 10 and\n"); PRINTVALSTREAM(rawoutstream, " minimum shared datatype size of 20\n"); PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, "5) h5repack --low=0 --high=1 file1 file2\n"); - PRINTVALSTREAM(rawoutstream, "\n"); - PRINTVALSTREAM(rawoutstream, " Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via\n"); - PRINTVALSTREAM(rawoutstream, " H5Pset_libver_bounds() when creating the repacked file, file2\n"); - PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, "5) h5repack -f SHUF -f GZIP=1 file1 file2\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " Add both filters SHUF and GZIP in this order to all datasets\n"); @@ -250,6 +245,11 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " Add bzip2 filter to all datasets\n"); PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, "7) h5repack --low=0 --high=1 file1 file2\n"); + PRINTVALSTREAM(rawoutstream, "\n"); + PRINTVALSTREAM(rawoutstream, " Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via\n"); + PRINTVALSTREAM(rawoutstream, " H5Pset_libver_bounds() when creating the repacked file, file2\n"); + PRINTVALSTREAM(rawoutstream, "\n"); } /*------------------------------------------------------------------------- diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index 96d6b9f..b28457e 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -254,7 +254,7 @@ main(int argc, char *argv[]) uint8_t sig[H5F_SIGNATURE_LEN]; size_t u; H5E_auto2_t func; - void *edata; + void *edata; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t status = SUCCEED; @@ -274,8 +274,8 @@ main(int argc, char *argv[]) H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* - * Open the file and get the file descriptor. - */ + * Open the file and get the file descriptor. + */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { HDfprintf(stderr, "cannot create file access property list\n"); HDexit(1); @@ -309,8 +309,8 @@ main(int argc, char *argv[]) } /* - * Parse command arguments. - */ + * Parse command arguments. + */ if(argc > 2) addr = (haddr_t)HDstrtoll(argv[2], NULL, 0); if(argc > 3) @@ -323,8 +323,8 @@ main(int argc, char *argv[]) extra4 = (haddr_t)HDstrtoll(argv[6], NULL, 0); /* - * Read the signature at the specified file position. - */ + * Read the signature at the specified file position. + */ HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr); if(H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), sig) < 0) { HDfprintf(stderr, "cannot read signature\n"); @@ -332,28 +332,28 @@ main(int argc, char *argv[]) } if(!HDmemcmp(sig, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) { /* - * Debug the file's super block. - */ + * Debug the file's super block. + */ status = H5F_debug(f, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a local heap. - */ + * Debug a local heap. + */ status = H5HL_debug(f, addr, stdout, 0, VCOL); } else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a global heap collection. - */ + * Debug a global heap collection. + */ status = H5HG_debug(f, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a symbol table node. - */ + * Debug a symbol table node. + */ /* Check for extra parameters */ if(extra == 0) { @@ -367,10 +367,10 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a B-tree. B-trees are debugged through the B-tree - * subclass. The subclass identifier is the byte immediately - * after the B-tree signature. - */ + * Debug a B-tree. B-trees are debugged through the B-tree + * subclass. The subclass identifier is the byte immediately + * after the B-tree signature. + */ H5B_subid_t subtype = (H5B_subid_t)sig[H5_SIZEOF_MAGIC]; unsigned ndims; uint32_t dim[H5O_LAYOUT_NDIMS]; @@ -435,8 +435,8 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a v2 B-tree header. - */ + * Debug a v2 B-tree header. + */ const H5B2_class_t *cls = get_H5B2_class(sig); HDassert(cls); @@ -452,8 +452,8 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a v2 B-tree internal node. - */ + * Debug a v2 B-tree internal node. + */ const H5B2_class_t *cls = get_H5B2_class(sig); HDassert(cls); @@ -479,8 +479,8 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a v2 B-tree leaf node. - */ + * Debug a v2 B-tree leaf node. + */ const H5B2_class_t *cls = get_H5B2_class(sig); HDassert(cls); @@ -505,15 +505,15 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a fractal heap header. - */ + * Debug a fractal heap header. + */ status = H5HF_hdr_debug(f, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a fractal heap direct block. - */ + * Debug a fractal heap direct block. + */ /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { @@ -528,8 +528,8 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a fractal heap indirect block. - */ + * Debug a fractal heap indirect block. + */ /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { @@ -544,16 +544,16 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a free space header. - */ + * Debug a free space header. + */ status = H5FS_debug(f, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug free space serialized sections. - */ + * Debug free space serialized sections. + */ /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { @@ -568,16 +568,16 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug shared message master table. - */ + * Debug shared message master table. + */ status = H5SM_table_debug(f, addr, stdout, 0, VCOL, (unsigned) UFAIL, (unsigned) UFAIL); } else if(!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug shared message list index. - */ + * Debug shared message list index. + */ /* Check for enough valid parameters */ if(extra == 0) { @@ -592,8 +592,8 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug an extensible aray header. - */ + * Debug an extensible aray header. + */ const H5EA_class_t *cls = get_H5EA_class(sig); HDassert(cls); @@ -610,8 +610,8 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug an extensible aray index block. - */ + * Debug an extensible aray index block. + */ const H5EA_class_t *cls = get_H5EA_class(sig); HDassert(cls); @@ -628,8 +628,8 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug an extensible aray super block. - */ + * Debug an extensible aray super block. + */ const H5EA_class_t *cls = get_H5EA_class(sig); HDassert(cls); @@ -646,8 +646,8 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug an extensible aray data block. - */ + * Debug an extensible aray data block. + */ const H5EA_class_t *cls = get_H5EA_class(sig); HDassert(cls); @@ -664,8 +664,8 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a fixed array header. - */ + * Debug a fixed array header. + */ const H5FA_class_t *cls = get_H5FA_class(sig); HDassert(cls); @@ -682,8 +682,8 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a fixed array data block. - */ + * Debug a fixed array data block. + */ const H5FA_class_t *cls = get_H5FA_class(sig); HDassert(cls); @@ -700,24 +700,24 @@ main(int argc, char *argv[]) } else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug v2 object header (which have signatures). - */ + * Debug v2 object header (which have signatures). + */ status = H5O_debug(f, addr, stdout, 0, VCOL); } else if(sig[0] == H5O_VERSION_1) { /* - * This could be a v1 object header. Since they don't have a signature - * it's a somewhat "ify" detection. - */ + * This could be a v1 object header. Since they don't have a signature + * it's a somewhat "ify" detection. + */ status = H5O_debug(f, addr, stdout, 0, VCOL); } else { /* - * Got some other unrecognized signature. - */ + * Got some other unrecognized signature. + */ HDprintf("%-*s ", VCOL, "Signature:"); for (u = 0; u < sizeof(sig); u++) { if (sig[u] > ' ' && sig[u] <= '~' && '\\' != sig[u]) diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt index 29a3803..130cd72 100644 --- a/tools/test/h5repack/testfiles/h5repack-help.txt +++ b/tools/test/h5repack/testfiles/h5repack-help.txt @@ -159,11 +159,6 @@ Examples of use: Using latest file format with maximum compact group size of 10 and minimum shared datatype size of 20 -5) h5repack --low=0 --high=1 file1 file2 - - Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via - H5Pset_libver_bounds() when creating the repacked file, file2 - 5) h5repack -f SHUF -f GZIP=1 file1 file2 Add both filters SHUF and GZIP in this order to all datasets @@ -172,3 +167,8 @@ Examples of use: Add bzip2 filter to all datasets +7) h5repack --low=0 --high=1 file1 file2 + + Set low=H5F_LIBVER_EARLIEST and high=H5F_LIBVER_V18 via + H5Pset_libver_bounds() when creating the repacked file, file2 + -- cgit v0.12