diff options
Diffstat (limited to 'tools/lib/h5tools_dump.c')
-rw-r--r-- | tools/lib/h5tools_dump.c | 96 |
1 files changed, 68 insertions, 28 deletions
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index b54ed6a..ae43722 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -431,7 +431,7 @@ h5tools_print_region_data_blocks(hid_t region_id, hsize_t numelem; hsize_t numindex; size_t jndx; - int indx; + unsigned indx; int type_size; int ret_value = SUCCEED; hid_t mem_space = -1; @@ -467,7 +467,7 @@ h5tools_print_region_data_blocks(hid_t region_id, if((type_size = H5Tget_size(type_id)) == 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - if((region_buf = HDmalloc(type_size * numelem)) == NULL) + if((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer"); /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ @@ -809,7 +809,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, if((type_size = H5Tget_size(type_id)) == 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); - if((region_buf = HDmalloc(type_size * npoints)) == NULL) + if((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region"); curr_pos = 0; @@ -1144,9 +1144,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c size_row_block = sset->block.data[row_dim]; /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + if (h5tools_detect_vlen(p_type) == TRUE) vl_data = TRUE; /* display loop */ @@ -1557,9 +1555,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont } /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + if (h5tools_detect_vlen(p_type) == TRUE) vl_data = TRUE; /* @@ -1676,7 +1672,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte hid_t type, hid_t space, void *mem) { HERR_INIT(herr_t, SUCCEED) - int i; /*counters */ + unsigned i; /*counters */ hsize_t nelmts; /*total selected elmts */ ctx->ndims = H5Sget_simple_extent_ndims(space); @@ -2127,14 +2123,38 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s ", STRPAD); - if (str_pad == H5T_STR_NULLTERM) - h5tools_str_append(buffer, "H5T_STR_NULLTERM;"); - else if (str_pad == H5T_STR_NULLPAD) - h5tools_str_append(buffer, "H5T_STR_NULLPAD;"); - else if (str_pad == H5T_STR_SPACEPAD) - h5tools_str_append(buffer, "H5T_STR_SPACEPAD;"); - else - h5tools_str_append(buffer, "H5T_STR_ERROR;"); + switch (str_pad) { + case H5T_STR_NULLTERM: + h5tools_str_append(buffer, "H5T_STR_NULLTERM;"); + break; + case H5T_STR_NULLPAD: + h5tools_str_append(buffer, "H5T_STR_NULLPAD;"); + break; + case H5T_STR_SPACEPAD: + h5tools_str_append(buffer, "H5T_STR_SPACEPAD;"); + break; + case H5T_STR_RESERVED_3: + case H5T_STR_RESERVED_4: + case H5T_STR_RESERVED_5: + case H5T_STR_RESERVED_6: + case H5T_STR_RESERVED_7: + case H5T_STR_RESERVED_8: + case H5T_STR_RESERVED_9: + case H5T_STR_RESERVED_10: + case H5T_STR_RESERVED_11: + case H5T_STR_RESERVED_12: + case H5T_STR_RESERVED_13: + case H5T_STR_RESERVED_14: + case H5T_STR_RESERVED_15: + h5tools_str_append(buffer, "H5T_STR_UNKNOWN;"); + break; + case H5T_STR_ERROR: + h5tools_str_append(buffer, "H5T_STR_ERROR;"); + break; + default: + h5tools_str_append(buffer, "ERROR;"); + break; + } h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); ctx->need_prefix = TRUE; @@ -2144,10 +2164,35 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "%s ", CSET); - if (cset == H5T_CSET_ASCII) - h5tools_str_append(buffer, "H5T_CSET_ASCII;"); - else - h5tools_str_append(buffer, "unknown_cset;"); + switch (cset) { + case H5T_CSET_ASCII: + h5tools_str_append(buffer, "H5T_CSET_ASCII;"); + break; + case H5T_CSET_UTF8: + h5tools_str_append(buffer, "H5T_CSET_UTF8;"); + break; + case H5T_CSET_RESERVED_2: + case H5T_CSET_RESERVED_3: + case H5T_CSET_RESERVED_4: + case H5T_CSET_RESERVED_5: + case H5T_CSET_RESERVED_6: + case H5T_CSET_RESERVED_7: + case H5T_CSET_RESERVED_8: + case H5T_CSET_RESERVED_9: + case H5T_CSET_RESERVED_10: + case H5T_CSET_RESERVED_11: + case H5T_CSET_RESERVED_12: + case H5T_CSET_RESERVED_13: + case H5T_CSET_RESERVED_14: + case H5T_CSET_RESERVED_15: + h5tools_str_append(buffer, "H5T_CSET_UNKNOWN;"); + case H5T_CSET_ERROR: + h5tools_str_append(buffer, "H5T_CSET_ERROR;"); + break; + default: + h5tools_str_append(buffer, "ERROR;"); + break; + } h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0); ctx->need_prefix = TRUE; @@ -2853,7 +2898,6 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, hsize_t size; /* size of external file */ hsize_t storage_size; hsize_t curr_pos = 0; /* total data element position */ - hsize_t elmt_counter = 0;/* counts the # elements printed.*/ haddr_t ioffset; h5tools_str_t buffer; /* string into which to render */ @@ -3379,7 +3423,6 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, size_t buf_size = 0; size_t ncols = 80; /* available output width */ h5tools_str_t buffer; /* string into which to render */ - hsize_t elmt_counter = 0;/* counts the # elements printed.*/ hsize_t curr_pos = ctx->sm_pos; /* total data element position */ /* pass to the prefix in h5tools_simple_prefix the total position * instead of the current stripmine position i; this is necessary @@ -3433,7 +3476,6 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, { h5tools_str_t buffer; /* string into which to render */ size_t ncols = 80; /* available output width */ - hsize_t elmt_counter = 0;/* counts the # elements printed.*/ hsize_t curr_pos = ctx->sm_pos; /* total data element position */ /* pass to the prefix in h5tools_simple_prefix the total position * instead of the current stripmine position i; this is necessary @@ -3812,9 +3854,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, ndims = H5Sget_simple_extent_dims(space, size, NULL); /* Check if we have VL data in the dataset's datatype */ - if (h5tools_detect_vlen_str(p_type) == TRUE) - vl_data = TRUE; - if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) + if (h5tools_detect_vlen(p_type) == TRUE) vl_data = TRUE; for (i = 0; i < ndims; i++) |