summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/h5tools_dump.c')
-rw-r--r--tools/lib/h5tools_dump.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index c2add9a..c68c699 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -30,10 +30,6 @@
#include "h5tools_utils.h"
#include "H5private.h"
-#define SANITY_CHECK
-
-#define ALIGN(A,Z) ((((A) + (Z) - 1) / (Z)) * (Z))
-
h5tool_format_t h5tools_dataformat = {
0, /*raw */
@@ -214,6 +210,12 @@ hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
hsize_t *curr_pos/*total data element position*/,
size_t ncols, hsize_t region_elmt_counter/*element counter*/,
hsize_t elmt_counter);
+
+void h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims);
+
+void h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info,
+ h5tools_context_t *ctx, struct subset_t *sset, int dims);
+
void
h5tools_dump_init(void)
{
@@ -627,7 +629,11 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL)
- HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+{
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+ HGOTO_DONE(dimension_break);
+ //HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+}
H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t);
if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
@@ -688,7 +694,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
h5tools_str_reset(buffer);
h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin);
- h5tools_print_dataspace(stream, buffer, info, ctx, region_space);
+ h5tools_print_dataspace(buffer, region_space);
if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) {
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
@@ -1007,7 +1013,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
ctx->need_prefix = TRUE;
h5tools_str_append(buffer, "%s ", h5tools_dump_header_format->dataspacebegin);
- h5tools_print_dataspace(stream, buffer, info, ctx, region_space);
+ h5tools_print_dataspace(buffer, region_space);
if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) {
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
@@ -2211,7 +2217,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
/* Check C variable-length string first. Are the two types equal? */
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_C_S1;");
- goto done;
+ goto found_string_type;
}
/* Change the endianness and see if they're equal. */
@@ -2223,7 +2229,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_C_S1;");
- goto done;
+ goto found_string_type;
}
/* If not equal to C variable-length string, check Fortran type. */
@@ -2238,7 +2244,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
/* Are the two types equal? */
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_FORTRAN_S1;");
- goto done;
+ goto found_string_type;
}
/* Change the endianness and see if they're equal. */
@@ -2250,13 +2256,13 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
if (H5Tequal(tmp_type, str_type)) {
h5tools_str_append(buffer, "H5T_FORTRAN_S1;");
- goto done;
+ goto found_string_type;
}
/* Type doesn't match any of above. */
h5tools_str_append(buffer, "unknown_one_character_type;");
- done:
+ found_string_type:
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0);
ctx->indent_level--;
@@ -2307,7 +2313,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0);
ctx->indent_level++;
{
- char *ttag = H5Tget_tag(type);
+ char *ttag;
+
+ if(NULL == (ttag = H5Tget_tag(type)))
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed");
ctx->need_prefix = TRUE;
h5tools_simple_prefix(stream, info, ctx, 0, 0);
@@ -2316,8 +2325,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag);
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, ncols, 0, 0);
- if (ttag)
- HDfree(ttag);
+ HDfree(ttag);
}
ctx->indent_level--;
@@ -2478,8 +2486,7 @@ CATCH
*-------------------------------------------------------------------------
*/
int
-h5tools_print_dataspace(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info,
- h5tools_context_t *ctx, hid_t space)
+h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
{
HERR_INIT(int, SUCCEED)
hsize_t size[H5TOOLS_DUMP_MAX_RANK];
@@ -2769,7 +2776,7 @@ h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info,
h5tools_str_append(&buffer, "%s ",
h5tools_dump_header_format->dataspacebegin);
- h5tools_print_dataspace(stream, &buffer, info, ctx, type);
+ h5tools_print_dataspace(&buffer, type);
if (HDstrlen(h5tools_dump_header_format->dataspaceblockend)) {
h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->dataspaceblockend);
@@ -2841,7 +2848,6 @@ h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t
{
size_t size;
hid_t n_type;
- hsize_t nelmts = 1;
void *buf = NULL;
n_type = h5tools_get_native_type(type_id);
@@ -3563,7 +3569,8 @@ h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims)
for (i = 0; i < dims; i++) {
h5tools_str_append(buffer, HSIZE_T_FORMAT, s[i]);
- if (i + 1 != dims) h5tools_str_append(buffer, ", ");
+ if (i + 1 != dims)
+ h5tools_str_append(buffer, ", ");
}
}
@@ -3866,7 +3873,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info,
buf = HDmalloc((size_t)alloc_size);
HDassert(buf);
- if (H5Aread(obj_id, p_type, buf) >= 0)
+ if (H5Aread(obj_id, p_type, buf) >= 0) {
if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) {
/*
* Print 1-byte integer data as an ASCII character string
@@ -3895,6 +3902,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info,
}
else
datactx.need_prefix = TRUE;
+ }
status = h5tools_dump_mem(stream, info, &datactx, obj_id, p_type, space, buf);
if (display_char && H5Tget_size(type) == 1 && H5Tget_class(type) == H5T_INTEGER) {