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.c69
1 files changed, 34 insertions, 35 deletions
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index cb4f9d2..78dd3ff 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -478,7 +478,7 @@ done:
* This is a special case subfunction to print the data in a region reference of type blocks.
*
* Return:
- * The function returns FAIL if there was an error, otherwise SUCEED
+ * The function returns FAIL if there was an error, otherwise SUCCEED
*
* Parameters Description:
* h5tools_str_t *buffer is the string into which to render
@@ -500,7 +500,7 @@ h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_for
hsize_t * count = NULL;
hsize_t blkndx;
hsize_t total_size[H5S_MAX_RANK];
- hsize_t elmtno; /* elemnt index */
+ hsize_t elmtno; /* element index */
hsize_t curr_pos = 0;
unsigned int region_flags; /* buffer extent flags */
hsize_t numelem;
@@ -745,11 +745,11 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *strea
/* Start coordinates and opposite corner */
for (loop_indx = 0; loop_indx < ndims; loop_indx++)
- h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, loop_indx ? "," : "(",
+ h5tools_str_append(buffer, "%s%" PRIuHSIZE, loop_indx ? "," : "(",
ptdata[indx * 2 * ndims + loop_indx]);
for (loop_indx = 0; loop_indx < ndims; loop_indx++)
- h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, loop_indx ? "," : ")-(",
+ h5tools_str_append(buffer, "%s%" PRIuHSIZE, loop_indx ? "," : ")-(",
ptdata[indx * 2 * ndims + loop_indx + ndims]);
h5tools_str_append(buffer, ")");
@@ -896,7 +896,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stre
{
hbool_t dimension_break = TRUE;
hsize_t * dims1 = NULL;
- hsize_t elmtno; /* elemnt index */
+ hsize_t elmtno; /* element index */
hsize_t curr_pos = 0;
hsize_t total_size[H5S_MAX_RANK];
hsize_t jndx;
@@ -1101,7 +1101,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, FILE *strea
(unsigned long)indx);
for (loop_indx = 0; loop_indx < ndims; loop_indx++)
- h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, loop_indx ? "," : "(",
+ h5tools_str_append(buffer, "%s%" PRIuHSIZE, loop_indx ? "," : "(",
ptdata[indx * ndims + loop_indx]);
h5tools_str_append(buffer, ")");
@@ -1286,7 +1286,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
H5TOOLS_START_DEBUG(" ");
if ((size_t)ctx->ndims > NELMTS(sm_size))
- H5TOOLS_THROW(FAIL, "ndims and sm_size comparision failed");
+ H5TOOLS_THROW(FAIL, "ndims and sm_size comparison failed");
size_row_block = ctx->sset->block.data[row_dim];
@@ -2486,7 +2486,7 @@ found_string_type:
ctx->need_prefix = TRUE;
h5tools_str_reset(buffer);
- h5tools_str_append(buffer, "OPAQUE_SIZE \"%s\";", size);
+ h5tools_str_append(buffer, "OPAQUE_SIZE \"%zu\";", size);
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
(hsize_t)0);
}
@@ -2608,7 +2608,7 @@ found_string_type:
if (H5Tget_array_dims2(type, dims) >= 0) {
/* Print array dimensions */
for (i = 0; i < ndims; i++)
- h5tools_str_append(buffer, "[" HSIZE_T_FORMAT "]", dims[i]);
+ h5tools_str_append(buffer, "[%" PRIuHSIZE "]", dims[i]);
h5tools_str_append(buffer, " ");
}
@@ -2683,12 +2683,12 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
case H5S_SIMPLE:
/* simple dataspace */
- h5tools_str_append(buffer, "%s %s { %s " HSIZE_T_FORMAT,
+ h5tools_str_append(buffer, "%s %s { %s %" PRIuHSIZE,
h5tools_dump_header_format->dataspacedescriptionbegin, S_SIMPLE,
h5tools_dump_header_format->dataspacedimbegin, size[0]);
for (i = 1; i < ndims; i++)
- h5tools_str_append(buffer, ", " HSIZE_T_FORMAT, size[i]);
+ h5tools_str_append(buffer, ", %" PRIuHSIZE, size[i]);
h5tools_str_append(buffer, " %s / ", h5tools_dump_header_format->dataspacedimend);
@@ -2696,14 +2696,14 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
h5tools_str_append(buffer, "%s %s", h5tools_dump_header_format->dataspacedimbegin,
"H5S_UNLIMITED");
else
- h5tools_str_append(buffer, "%s " HSIZE_T_FORMAT,
- h5tools_dump_header_format->dataspacedimbegin, maxsize[0]);
+ h5tools_str_append(buffer, "%s %" PRIuHSIZE, h5tools_dump_header_format->dataspacedimbegin,
+ maxsize[0]);
for (i = 1; i < ndims; i++)
if (maxsize[i] == H5S_UNLIMITED)
h5tools_str_append(buffer, ", %s", "H5S_UNLIMITED");
else
- h5tools_str_append(buffer, ", " HSIZE_T_FORMAT, maxsize[i]);
+ h5tools_str_append(buffer, ", %" PRIuHSIZE, maxsize[i]);
h5tools_str_append(buffer, " %s }", h5tools_dump_header_format->dataspacedimend);
break;
@@ -2742,7 +2742,6 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
{
char ** name = NULL; /*member names */
unsigned char *value = NULL; /*value array */
- unsigned char *copy = NULL; /*a pointer to value array */
unsigned i;
unsigned nmembs = 0; /*number of members */
int snmembs;
@@ -2834,16 +2833,16 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
h5tools_str_append(buffer, "%02x", value[i * dst_size + j]);
}
else if (H5T_SGN_NONE == H5Tget_sign(native)) {
- /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
- *strangely, unless use another pointer "copy".*/
- copy = value + i * dst_size;
- h5tools_str_append(buffer, HSIZE_T_FORMAT, *((unsigned long long *)((void *)copy)));
+ unsigned long long copy;
+
+ HDmemcpy(&copy, value + i * dst_size, sizeof(copy));
+ h5tools_str_append(buffer, "%llu", copy);
}
else {
- /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size"
- *strangely, unless use another pointer "copy".*/
- copy = value + i * dst_size;
- h5tools_str_append(buffer, "%" H5_PRINTF_LL_WIDTH "d", *((long long *)((void *)copy)));
+ long long copy;
+
+ HDmemcpy(&copy, value + i * dst_size, sizeof(copy));
+ h5tools_str_append(buffer, "%lld", copy);
}
h5tools_str_append(buffer, ";");
@@ -2996,7 +2995,7 @@ h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "%s %s %d %s", OBJID, BEGIN, oid, END);
+ h5tools_str_append(&buffer, "%s %s %" PRId64 " %s", OBJID, BEGIN, oid, END);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
h5tools_str_close(&buffer);
@@ -3174,10 +3173,10 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
h5tools_str_append(&buffer, "%s ", CHUNKED);
rank = H5Pget_chunk(dcpl_id, (int)NELMTS(chsize), chsize);
- h5tools_str_append(&buffer, "%s " HSIZE_T_FORMAT, h5tools_dump_header_format->dataspacedimbegin,
+ h5tools_str_append(&buffer, "%s %" PRIuHSIZE, h5tools_dump_header_format->dataspacedimbegin,
chsize[0]);
for (i = 1; i < rank; i++)
- h5tools_str_append(&buffer, ", " HSIZE_T_FORMAT, chsize[i]);
+ h5tools_str_append(&buffer, ", %" PRIuHSIZE, chsize[i]);
h5tools_str_append(&buffer, " %s", h5tools_dump_header_format->dataspacedimend);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
(hsize_t)0);
@@ -3219,17 +3218,17 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
if (storage_size != 0)
ratio = (double)uncomp_size / (double)storage_size;
- h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT " (%.3f:1 COMPRESSION)", storage_size,
+ h5tools_str_append(&buffer, "SIZE %" PRIuHSIZE " (%.3f:1 COMPRESSION)", storage_size,
ratio);
}
else
- h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size);
+ h5tools_str_append(&buffer, "SIZE %" PRIuHSIZE, storage_size);
H5Sclose(sid);
H5Tclose(tid);
}
else {
- h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size);
+ h5tools_str_append(&buffer, "SIZE %" PRIuHSIZE, storage_size);
}
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
(hsize_t)0);
@@ -3247,7 +3246,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size);
+ h5tools_str_append(&buffer, "SIZE %" PRIuHSIZE, storage_size);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
(hsize_t)0);
ctx->indent_level--;
@@ -3283,7 +3282,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "FILENAME %s SIZE " HSIZE_T_FORMAT, name, size);
+ h5tools_str_append(&buffer, "FILENAME %s SIZE %" PRIuHSIZE, name, size);
h5tools_str_append(&buffer, " OFFSET %ld", offset);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
(hsize_t)0);
@@ -3313,7 +3312,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
ctx->need_prefix = TRUE;
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "SIZE " HSIZE_T_FORMAT, storage_size);
+ h5tools_str_append(&buffer, "SIZE %" PRIuHSIZE, storage_size);
h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0,
(hsize_t)0);
@@ -3340,7 +3339,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
} break;
case H5D_VIRTUAL: {
- char dsetname[256]; /* virtual datset name */
+ char dsetname[256]; /* virtual dataset name */
size_t n_vmaps;
H5Pget_virtual_count(dcpl_id, &n_vmaps);
@@ -3909,7 +3908,7 @@ h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims)
int i;
for (i = 0; i < dims; i++) {
- h5tools_str_append(buffer, HSIZE_T_FORMAT, s[i]);
+ h5tools_str_append(buffer, "%" PRIuHSIZE, s[i]);
if (i + 1 != dims)
h5tools_str_append(buffer, ", ");
@@ -4330,7 +4329,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
if (string_dataformat.pindex) {
string_dataformat.idx_fmt = "(%s): ";
- string_dataformat.idx_n_fmt = HSIZE_T_FORMAT;
+ string_dataformat.idx_n_fmt = "%" PRIuHSIZE;
string_dataformat.idx_sep = ",";
string_dataformat.line_pre = "%s";
}