summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2022-02-21 21:31:57 (GMT)
committerGitHub <noreply@github.com>2022-02-21 21:31:57 (GMT)
commitc302773438a4db0b56d32eaf9cf8a92b56848c0a (patch)
treec8be334db0a2f136ccfdacbadc3df0c1781a2628 /tools
parent705ba09e76d0bb4af88b7b7cde1f90c64c9e3753 (diff)
downloadhdf5-c302773438a4db0b56d32eaf9cf8a92b56848c0a.zip
hdf5-c302773438a4db0b56d32eaf9cf8a92b56848c0a.tar.gz
hdf5-c302773438a4db0b56d32eaf9cf8a92b56848c0a.tar.bz2
Sprinkle H5_ATTR_FORMAT over printf(3)-like functions in tools and fix issues (#1423)
* Correct some conversion specifications. * Replace many "%lld" occurrences with "%" PRIuHSIZE except for a few instances where PRIdHSIZE was appropriate. Remove a couple of casts and use correct format strings, instead. * Copy values from a possibly unaligned buffer to aligned local variables instead of casting and dereferencing pointers into the buffer. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff_array.c94
-rw-r--r--tools/lib/h5diff_util.c4
-rw-r--r--tools/lib/h5tools.h3
-rw-r--r--tools/lib/h5tools_dump.c55
-rw-r--r--tools/lib/h5tools_str.c23
-rw-r--r--tools/lib/h5tools_str.h2
-rw-r--r--tools/lib/h5tools_utils.h6
-rw-r--r--tools/lib/h5trav.c7
-rw-r--r--tools/src/h5dump/h5dump_xml.c33
-rw-r--r--tools/src/h5format_convert/h5format_convert.c2
-rw-r--r--tools/src/h5ls/h5ls.c50
-rw-r--r--tools/src/h5perf/pio_perf.c2
-rw-r--r--tools/src/h5repack/h5repack_main.c4
13 files changed, 139 insertions, 146 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index e8cfacb..a7156b5 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -204,7 +204,8 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_
mcomp_t members;
H5T_class_t type_class;
- H5TOOLS_START_DEBUG(" - rank:%d hs_nelmts:%lld errstat:%d", opts->rank, opts->hs_nelmts, opts->err_stat);
+ H5TOOLS_START_DEBUG(" - rank:%d hs_nelmts:%" PRIuHSIZE " errstat:%d", opts->rank, opts->hs_nelmts,
+ opts->err_stat);
opts->print_header = 1; /* enable print header */
/* get the size. */
@@ -388,7 +389,8 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_
HDmemset(&members, 0, sizeof(mcomp_t));
get_member_types(opts->m_tid, &members);
for (i = 0; i < opts->hs_nelmts; i++) {
- H5TOOLS_DEBUG("opts->pos[%lld]:%lld - nelmts:%lld", i, opts->pos[i], opts->hs_nelmts);
+ H5TOOLS_DEBUG("opts->pos[%" PRIuHSIZE "]:%" PRIuHSIZE " - nelmts:%" PRIuHSIZE, i,
+ opts->pos[i], opts->hs_nelmts);
nfound += diff_datum(mem1 + i * size, mem2 + i * size, i, opts, container1_id, container2_id,
&members);
if (opts->count_bool && nfound >= opts->count)
@@ -396,7 +398,7 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_
} /* i */
close_member_types(&members);
} /* switch */
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -452,7 +454,8 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co
hsize_t nfound = 0; /* differences found */
diff_err_t ret_value = opts->err_stat;
- H5TOOLS_START_DEBUG("ph:%d elemtno:%lld - errstat:%d", opts->print_header, elemtno, opts->err_stat);
+ H5TOOLS_START_DEBUG("ph:%d elemtno:%" PRIuHSIZE " - errstat:%d", opts->print_header, elemtno,
+ opts->err_stat);
type_size = H5Tget_size(opts->m_tid);
type_class = H5Tget_class(opts->m_tid);
@@ -702,8 +705,8 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co
H5TOOLS_DEBUG("H5T_ARRAY ph=%d", opts->print_header);
arr_opts = *opts;
- H5TOOLS_DEBUG("Check opts: hs_nelmts:%lld to %lld rank:%d to %d", opts->hs_nelmts,
- arr_opts.hs_nelmts, opts->rank, arr_opts.rank);
+ H5TOOLS_DEBUG("Check opts: hs_nelmts:%" PRIuHSIZE " to %" PRIuHSIZE " rank:%d to %d",
+ opts->hs_nelmts, arr_opts.hs_nelmts, opts->rank, arr_opts.rank);
/* get the array's base datatype for each element */
arr_opts.m_tid = H5Tget_super(opts->m_tid);
size = H5Tget_size(arr_opts.m_tid);
@@ -1051,8 +1054,8 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co
H5TOOLS_INFO("H5Rdestroy H5R_OBJECT1 failed");
if (H5Rdestroy(ref1_buf) < 0)
H5TOOLS_INFO("H5Rdestroy H5R_OBJECT1 failed");
- H5TOOLS_DEBUG("H5T_REFERENCE - H5T_STD_REF complete nfound:%lld - errstat:%d", nfound,
- ref_opts.err_stat);
+ H5TOOLS_DEBUG("H5T_REFERENCE - H5T_STD_REF complete nfound:%" PRIuHSIZE " - errstat:%d",
+ nfound, ref_opts.err_stat);
}
/*-------------------------------------------------------------------------
* H5T_STD_REF_DSETREG
@@ -1263,7 +1266,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co
done:
opts->err_stat = opts->err_stat | ret_value;
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -1374,8 +1377,8 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di
npoints2 = H5Sget_select_elem_npoints(region2_id);
}
H5E_END_TRY;
- H5TOOLS_DEBUG("blocks: 1=%lld-2=%lld", nblocks1, nblocks2);
- H5TOOLS_DEBUG("points: 1=%lld-2=%lld", npoints1, npoints2);
+ H5TOOLS_DEBUG("blocks: 1=%" PRIdHSIZE "-2=%" PRIdHSIZE, nblocks1, nblocks2);
+ H5TOOLS_DEBUG("points: 1=%" PRIdHSIZE "-2=%" PRIdHSIZE, npoints1, npoints2);
if (nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) {
opts->not_cmp = 1;
@@ -1518,10 +1521,10 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di
#if defined(H5DIFF_DEBUG)
for (i = 0; i < npoints1; i++) {
- parallel_print("%sPt%lu: ", i ? "," : "", (unsigned long)i);
+ parallel_print("%sPt%d: ", i ? "," : "", i);
for (j = 0; j < ndims1; j++)
- parallel_print("%s%lu", j ? "," : "(", (unsigned long)(ptdata1[i * ndims1 + j]));
+ parallel_print("%s%" PRIuHSIZE, j ? "," : "(", ptdata1[i * ndims1 + j]);
parallel_print(")");
}
@@ -1538,7 +1541,7 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di
ret_value = nfound_p + nfound_b;
done:
- H5TOOLS_ENDDEBUG(" with diffs:%lld", ret_value);
+ H5TOOLS_ENDDEBUG(" with diffs:%" PRIuHSIZE, ret_value);
return ret_value;
}
@@ -1575,7 +1578,7 @@ character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t
}
nfound++;
}
- H5TOOLS_ENDDEBUG(": %lld", nfound);
+ H5TOOLS_ENDDEBUG(": %" PRIuHSIZE, nfound);
return nfound;
}
@@ -1649,7 +1652,7 @@ character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno,
nfound++;
}
- H5TOOLS_ENDDEBUG(": %lld zero:%d", nfound, both_zero);
+ H5TOOLS_ENDDEBUG(": %" PRIuHSIZE " zero:%d", nfound, both_zero);
return nfound;
}
@@ -1830,7 +1833,7 @@ diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d
}
}
- H5TOOLS_ENDDEBUG(": %lld zero:%d", nfound, both_zero);
+ H5TOOLS_ENDDEBUG(": %" PRIuHSIZE " zero:%d", nfound, both_zero);
return nfound;
}
@@ -2001,7 +2004,7 @@ diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
nfound++;
}
}
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2175,7 +2178,7 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
nfound++;
}
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2263,7 +2266,7 @@ diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d
nfound++;
}
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2351,7 +2354,7 @@ diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d
nfound++;
}
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2439,7 +2442,7 @@ diff_short_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d
nfound++;
}
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2531,7 +2534,7 @@ diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
nfound++;
}
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2619,7 +2622,7 @@ diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, dif
nfound++;
}
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2707,7 +2710,7 @@ diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, di
nfound++;
}
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2795,7 +2798,7 @@ diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, di
nfound++;
}
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2885,7 +2888,7 @@ diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d
nfound++;
}
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -2978,7 +2981,7 @@ diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d
}
}
- H5TOOLS_ENDDEBUG(":%lld - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%" PRIuHSIZE " - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -3078,7 +3081,7 @@ diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
}
}
- H5TOOLS_ENDDEBUG(": %lld zero:%d", nfound, both_zero);
+ H5TOOLS_ENDDEBUG(": %" PRIuHSIZE " zero:%d", nfound, both_zero);
return nfound;
}
@@ -3323,7 +3326,7 @@ print_header(diff_opt_t *opts)
static void
print_pos(diff_opt_t *opts, hsize_t idx, size_t u)
{
- H5TOOLS_START_DEBUG(" -- idx:%lld", idx);
+ H5TOOLS_START_DEBUG(" -- idx:%" PRIuHSIZE, idx);
if (print_data(opts)) {
hsize_t curr_pos = idx;
@@ -3336,8 +3339,8 @@ print_pos(diff_opt_t *opts, hsize_t idx, size_t u)
H5TOOLS_DEBUG("rank=%d", opts->rank);
if (opts->rank > 0) {
parallel_print("[ ");
- H5TOOLS_DEBUG("do calc_acc_pos[%lld] nelmts:%lld - errstat:%d", idx, opts->hs_nelmts,
- opts->err_stat);
+ H5TOOLS_DEBUG("do calc_acc_pos[%" PRIuHSIZE "] nelmts:%" PRIuHSIZE " - errstat:%d", idx,
+ opts->hs_nelmts, opts->err_stat);
if (opts->sset[0] != NULL) {
/* Subsetting is used - calculate total position */
hsize_t curr_idx = 0; /* current pos in the selection space for each dimension */
@@ -3364,33 +3367,36 @@ print_pos(diff_opt_t *opts, hsize_t idx, size_t u)
j = opts->rank - i - 1;
prev_total_dim_size *= prev_dim_size;
dim_size = opts->dims[j];
- H5TOOLS_DEBUG("j=%d, dim_size=%lld, prev_dim_size=%lld, total_dim_size=%lld, "
- "prev_total_dim_size=%lld",
+ H5TOOLS_DEBUG("j=%d, dim_size=%" PRIuHSIZE ", prev_dim_size=%" PRIuHSIZE
+ ", total_dim_size=%" PRIuHSIZE ", "
+ "prev_total_dim_size=%" PRIuHSIZE,
j, dim_size, prev_dim_size, total_dim_size, prev_total_dim_size);
count = opts->sset[0]->count.data[j];
block = opts->sset[0]->block.data[j];
stride = opts->sset[0]->stride.data[j];
- H5TOOLS_DEBUG("stride=%lld, count=%lld, block=%lld", stride, count, block);
+ H5TOOLS_DEBUG("stride=%" PRIuHSIZE ", count=%" PRIuHSIZE ", block=%" PRIuHSIZE,
+ stride, count, block);
tmp = count * block;
k0 = curr_idx / tmp;
k1 = curr_idx % tmp;
curr_pos += k1 * stride * prev_total_dim_size;
- H5TOOLS_DEBUG("curr_idx=%lld, k0=%lld, k1=%lld, curr_pos=%lld", curr_idx, k0, k1,
- curr_pos);
+ H5TOOLS_DEBUG("curr_idx=%" PRIuHSIZE ", k0=%" PRIuHSIZE ", k1=%" PRIuHSIZE
+ ", curr_pos=%" PRIuHSIZE,
+ curr_idx, k0, k1, curr_pos);
if (k0 > 0)
curr_idx = k0 * total_dim_size;
- H5TOOLS_DEBUG("curr_idx=%lld, tmp=%lld", curr_idx, tmp);
+ H5TOOLS_DEBUG("curr_idx=%" PRIuHSIZE ", tmp=%" PRIuHSIZE, curr_idx, tmp);
total_dim_size *= dim_size;
/* if last calculation exists within in current dimension */
if (k0 == 0)
break;
- H5TOOLS_DEBUG("j=%d, curr_pos=%lld", j, curr_pos);
+ H5TOOLS_DEBUG("j=%d, curr_pos=%" PRIuHSIZE, j, curr_pos);
prev_dim_size = dim_size;
}
/* check if there is a final calculation needed for slowest changing dimension */
if (k0 > 0)
curr_pos += k0 * stride * prev_total_dim_size;
- H5TOOLS_DEBUG("4:curr_idx=%lld, curr_pos=%lld", curr_idx, curr_pos);
+ H5TOOLS_DEBUG("4:curr_idx=%" PRIuHSIZE ", curr_pos=%" PRIuHSIZE, curr_idx, curr_pos);
}
}
/*
@@ -3400,11 +3406,11 @@ print_pos(diff_opt_t *opts, hsize_t idx, size_t u)
calc_acc_pos((unsigned)opts->rank, curr_pos, opts->acc, opts->pos);
for (int i = 0; i < opts->rank; i++) {
- H5TOOLS_DEBUG("pos loop:%d with opts->pos=%lld opts->sm_pos=%lld", i, opts->pos[i],
- opts->sm_pos[i]);
+ H5TOOLS_DEBUG("pos loop:%d with opts->pos=%" PRIuHSIZE " opts->sm_pos=%" PRIuHSIZE, i,
+ opts->pos[i], opts->sm_pos[i]);
opts->pos[i] += (unsigned long)opts->sm_pos[i];
- H5TOOLS_DEBUG("pos loop:%d with opts->pos=%lld", i, opts->pos[i]);
- parallel_print(HSIZE_T_FORMAT, (unsigned long long)opts->pos[i]);
+ H5TOOLS_DEBUG("pos loop:%d with opts->pos=%" PRIuHSIZE, i, opts->pos[i]);
+ parallel_print("%" PRIuHSIZE, opts->pos[i]);
parallel_print(" ");
}
parallel_print("]");
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index c40de9d..05f380a 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -39,11 +39,11 @@ print_dimensions(int rank, hsize_t *dims)
else {
parallel_print("[");
for (i = 0; i < rank - 1; i++) {
- parallel_print(HSIZE_T_FORMAT, dims[i]);
+ parallel_print("%" PRIuHSIZE, dims[i]);
parallel_print("x");
}
- parallel_print(HSIZE_T_FORMAT, dims[rank - 1]);
+ parallel_print("%" PRIuHSIZE, dims[rank - 1]);
parallel_print("]");
}
}
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index cc6183a..d3501b3 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -29,9 +29,6 @@
#define START_OF_DATA 0x0001
#define END_OF_DATA 0x0002
-/* format for hsize_t */
-#define HSIZE_T_FORMAT "%" H5_PRINTF_LL_WIDTH "u"
-
#define H5TOOLS_DUMP_MAX_RANK H5S_MAX_RANK
/* Stream macros */
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index b8c9a19..78dd3ff 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -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, ")");
@@ -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, ")");
@@ -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, ";");
@@ -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);
@@ -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";
}
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 4e8dcc1..1fb2c68 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -300,11 +300,11 @@ h5tools_str_prefix(h5tools_str_t *str /*in,out*/, const h5tool_format_t *info, h
if (i)
h5tools_str_append(str, "%s", OPT(info->idx_sep, ","));
- h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)ctx->pos[i]);
+ h5tools_str_append(str, OPT(info->idx_n_fmt, "%" PRIuHSIZE), (hsize_t)ctx->pos[i]);
}
}
else /* Scalar */
- h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)elmtno);
+ h5tools_str_append(str, OPT(info->idx_n_fmt, "%" PRIuHSIZE), (hsize_t)elmtno);
H5TOOLS_DEBUG("str=%s", str->s);
H5TOOLS_ENDDEBUG(" ");
@@ -341,11 +341,11 @@ h5tools_str_region_prefix(h5tools_str_t *str /*in,out*/, const h5tool_format_t *
if (i)
h5tools_str_append(str, "%s", OPT(info->idx_sep, ","));
- h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)ctx->pos[i]);
+ h5tools_str_append(str, OPT(info->idx_n_fmt, "%" PRIuHSIZE), (hsize_t)ctx->pos[i]);
}
}
else /* Scalar */
- h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)0);
+ h5tools_str_append(str, OPT(info->idx_n_fmt, "%" PRIuHSIZE), (hsize_t)0);
H5TOOLS_DEBUG("str=%s", str->s);
H5TOOLS_ENDDEBUG(" ");
@@ -385,7 +385,7 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, const h5tool_form
/* Start coordinates */
h5tools_str_append(str, "%s%s ", info->line_indent, START);
for (j = 0; j < ndims; j++)
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", start[j]);
+ h5tools_str_append(str, "%s%" PRIuHSIZE, j ? "," : "(", start[j]);
h5tools_str_append(str, ")");
h5tools_str_append(str, "%s", "\n");
h5tools_str_indent(str, info, ctx);
@@ -393,7 +393,7 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, const h5tool_form
/* Stride coordinates */
h5tools_str_append(str, "%s ", STRIDE);
for (j = 0; j < ndims; j++)
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", stride[j]);
+ h5tools_str_append(str, "%s%" PRIuHSIZE, j ? "," : "(", stride[j]);
h5tools_str_append(str, ")");
h5tools_str_append(str, "%s", "\n");
h5tools_str_indent(str, info, ctx);
@@ -404,7 +404,7 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, const h5tool_form
if (count[j] == H5S_UNLIMITED)
h5tools_str_append(str, "%s%s", j ? "," : "(", "H5S_UNLIMITED");
else
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", count[j]);
+ h5tools_str_append(str, "%s%" PRIuHSIZE, j ? "," : "(", count[j]);
}
h5tools_str_append(str, ")");
h5tools_str_append(str, "%s", "\n");
@@ -416,7 +416,7 @@ h5tools_str_dump_space_slabs(h5tools_str_t *str, hid_t rspace, const h5tool_form
if (block[j] == H5S_UNLIMITED)
h5tools_str_append(str, "%s%s", j ? "," : "(", "H5S_UNLIMITED");
else
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", block[j]);
+ h5tools_str_append(str, "%s%" PRIuHSIZE, j ? "," : "(", block[j]);
}
h5tools_str_append(str, ")");
}
@@ -468,11 +468,10 @@ h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace, const h5tool_for
/* Start coordinates and opposite corner */
for (v = 0; v < ndims; v++)
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(", ptdata[u * 2 * ndims + v]);
+ h5tools_str_append(str, "%s%" PRIuHSIZE, v ? "," : "(", ptdata[u * 2 * ndims + v]);
for (v = 0; v < ndims; v++)
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : ")-(",
- ptdata[u * 2 * ndims + v + ndims]);
+ h5tools_str_append(str, "%s%" PRIuHSIZE, v ? "," : ")-(", ptdata[u * 2 * ndims + v + ndims]);
h5tools_str_append(str, ")");
}
@@ -527,7 +526,7 @@ h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace, const h5tool_for
(unsigned long)u);
for (v = 0; v < ndims; v++)
- h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(", (ptdata[u * ndims + v]));
+ h5tools_str_append(str, "%s%" PRIuHSIZE, v ? "," : "(", (ptdata[u * ndims + v]));
h5tools_str_append(str, ")");
}
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index eee87c9..f4610f0 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -26,7 +26,7 @@ typedef struct h5tools_str_t {
H5TOOLS_DLL void h5tools_str_close(h5tools_str_t *str);
H5TOOLS_DLL size_t h5tools_str_len(h5tools_str_t *str);
-H5TOOLS_DLL char * h5tools_str_append(h5tools_str_t *str, const char *fmt, ...);
+H5TOOLS_DLL char * h5tools_str_append(h5tools_str_t *str, const char *fmt, ...) H5_ATTR_FORMAT(printf, 2, 3);
H5TOOLS_DLL char * h5tools_str_reset(h5tools_str_t *str);
H5TOOLS_DLL char * h5tools_str_trunc(h5tools_str_t *str, size_t size);
H5TOOLS_DLL char * h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fmt);
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index 3733742..4cf4e40 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -70,11 +70,11 @@ H5TOOLS_DLLVAR unsigned h5tools_nCols; /*max number of columns for outputting *
/* Definitions of useful routines */
H5TOOLS_DLL void indentation(unsigned);
H5TOOLS_DLL void print_version(const char *progname);
-H5TOOLS_DLL void parallel_print(const char *format, ...);
+H5TOOLS_DLL void parallel_print(const char *format, ...) H5_ATTR_FORMAT(printf, 1, 2);
H5TOOLS_DLL herr_t parse_tuple(const char *start, int sep, char **cpy_out, unsigned *nelems,
char ***ptrs_out);
-H5TOOLS_DLL void error_msg(const char *fmt, ...);
-H5TOOLS_DLL void warn_msg(const char *fmt, ...);
+H5TOOLS_DLL void error_msg(const char *fmt, ...) H5_ATTR_FORMAT(printf, 1, 2);
+H5TOOLS_DLL void warn_msg(const char *fmt, ...) H5_ATTR_FORMAT(printf, 1, 2);
H5TOOLS_DLL void help_ref_msg(FILE *output);
H5TOOLS_DLL void free_table(table_t *table);
#ifdef H5DUMP_DEBUG
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 1f4b0d6..cca36e4 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -53,11 +53,6 @@ typedef struct trav_path_op_data_t {
const char *path;
} trav_path_op_data_t;
-/* format for hsize_t */
-#ifdef H5TRAV_PRINT_SPACE
-#define HSIZE_T_FORMAT "%" H5_PRINTF_LL_WIDTH "u"
-#endif /* H5TRAV_PRINT_SPACE */
-
/*-------------------------------------------------------------------------
* local functions
*-------------------------------------------------------------------------
@@ -856,7 +851,7 @@ trav_attr(hid_t
/* simple dataspace */
HDprintf(" {");
for (i = 0; i < ndims; i++) {
- HDprintf("%s" HSIZE_T_FORMAT, i ? ", " : "", size[i]);
+ HDprintf("%s%" PRIuHSIZE, i ? ", " : "", size[i]);
}
HDprintf("}\n");
break;
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 5f64d6c..827daf3 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -1779,8 +1779,7 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer,
- "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
- "u\" MaxDimSize=\"UNLIMITED\"/>",
+ "<%sDimension DimSize=\"%" PRIuHSIZE "\" MaxDimSize=\"UNLIMITED\"/>",
xmlnsprefix, size[i]);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
(size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
@@ -1790,10 +1789,9 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer,
- "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
- "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
- xmlnsprefix, size[i], size[i]);
+ h5tools_str_append(
+ &buffer, "<%sDimension DimSize=\"%" PRIuHSIZE "\" MaxDimSize=\"%" PRIuHSIZE "\"/>",
+ xmlnsprefix, size[i], size[i]);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
(size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
@@ -1802,10 +1800,9 @@ xml_dump_dataspace(hid_t space)
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer,
- "<%sDimension DimSize=\"%" H5_PRINTF_LL_WIDTH
- "u\" MaxDimSize=\"%" H5_PRINTF_LL_WIDTH "u\"/>",
- xmlnsprefix, size[i], maxsize[i]);
+ h5tools_str_append(
+ &buffer, "<%sDimension DimSize=\"%" PRIuHSIZE "\" MaxDimSize=\"%" PRIuHSIZE "\"/>",
+ xmlnsprefix, size[i], maxsize[i]);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
(size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
@@ -3897,8 +3894,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
/* Render the element */
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" H5_PRINTF_LL_WIDTH "u\" />",
- xmlnsprefix, chsize[i]);
+ h5tools_str_append(&buffer, "<%sChunkDimension DimSize=\"%" PRIuHSIZE "\" />", xmlnsprefix,
+ chsize[i]);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
(size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
@@ -4529,12 +4526,16 @@ xml_print_enum(hid_t type)
h5tools_str_append(&buffer, "%02x", value[i * dst_size + j]);
}
else if (H5T_SGN_NONE == H5Tget_sign(native)) {
- h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "u",
- *((unsigned long long *)((void *)(value + i * dst_size))));
+ unsigned long long copy;
+
+ HDmemcpy(&copy, value + i * dst_size, sizeof(copy));
+ h5tools_str_append(&buffer, "%llu", copy);
}
else {
- h5tools_str_append(&buffer, "%" H5_PRINTF_LL_WIDTH "d",
- *((long long *)((void *)(value + i * dst_size))));
+ long long copy;
+
+ HDmemcpy(&copy, value + i * dst_size, sizeof(copy));
+ h5tools_str_append(&buffer, "%lld", copy);
}
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos,
(size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c
index b9572fe..50d0f5d 100644
--- a/tools/src/h5format_convert/h5format_convert.c
+++ b/tools/src/h5format_convert/h5format_convert.c
@@ -127,7 +127,7 @@ parse_command_line(int argc, const char *const *argv)
dname_g = HDstrdup(H5_optarg);
if (dname_g == NULL) {
h5tools_setstatus(EXIT_FAILURE);
- error_msg("No dataset name\n", H5_optarg);
+ error_msg("No dataset name `%s`\n", H5_optarg);
usage(h5tools_getprogname());
goto error;
}
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 0d34574..a27a8cc 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -78,9 +78,9 @@ static h5tool_format_t ls_dataformat = {
",", /*elmt_suf1 */
" ", /*elmt_suf2 */
- HSIZE_T_FORMAT, /*idx_n_fmt */
- ",", /*idx_sep */
- "(%s)", /*idx_fmt */
+ "%" PRIuHSIZE, /*idx_n_fmt */
+ ",", /*idx_sep */
+ "(%s)", /*idx_fmt */
65535,
/*line_ncols */ /*standard default columns */
@@ -942,8 +942,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print members */
for (i = 0; i < (unsigned)nmembs; i++) {
- unsigned char *copy; /* a pointer to value array */
- int nchars; /* number of output characters */
+ int nchars; /* number of output characters */
h5tools_str_append(buffer, "\n%*s", ind + 4, "");
nchars = print_string(buffer, name[i], TRUE);
@@ -957,16 +956,16 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
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, "%lld", *((long long *)((void *)copy)));
+ long long copy;
+
+ HDmemcpy(&copy, value + i * dst_size, sizeof(copy));
+ h5tools_str_append(buffer, "%lld", copy);
}
}
@@ -1185,13 +1184,13 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Print dimensions */
for (i = 0; i < ndims; i++)
- h5tools_str_append(buffer, "%s" HSIZE_T_FORMAT, i ? "," : "[", dims[i]);
+ h5tools_str_append(buffer, "%s%" PRIuHSIZE, i ? "," : "[", dims[i]);
h5tools_str_append(buffer, "]");
HDfree(dims);
}
else
- h5tools_str_append(buffer, " [SCALAR]\n", rawoutstream);
+ h5tools_str_append(buffer, " [SCALAR]\n");
/* Print parent type */
h5tools_str_append(buffer, " ");
@@ -1701,7 +1700,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
/* simple dataspace */
h5tools_str_append(&buffer, " {");
for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", size[i]);
+ h5tools_str_append(&buffer, "%s%" PRIuHSIZE, i ? ", " : "", size[i]);
nelmts *= size[i];
}
h5tools_str_append(&buffer, "}\n");
@@ -1789,12 +1788,12 @@ dataset_list1(hid_t dset)
ndims = H5Sget_simple_extent_dims(space, cur_size, max_size);
h5tools_str_append(&buffer, " {");
for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", cur_size[i]);
+ h5tools_str_append(&buffer, "%s%" PRIuHSIZE, i ? ", " : "", cur_size[i]);
if (max_size[i] == H5S_UNLIMITED) {
h5tools_str_append(&buffer, "/%s", "Inf");
}
else if (max_size[i] != cur_size[i] || verbose_g > 0) {
- h5tools_str_append(&buffer, "/" HSIZE_T_FORMAT, max_size[i]);
+ h5tools_str_append(&buffer, "/%" PRIuHSIZE, max_size[i]);
}
}
if (space_type == H5S_SCALAR)
@@ -1868,10 +1867,10 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
h5tools_str_append(&buffer, " %-10s {", "Chunks:");
total = H5Tget_size(type);
for (i = 0; i < ndims; i++) {
- h5tools_str_append(&buffer, "%s" HSIZE_T_FORMAT, i ? ", " : "", chsize[i]);
+ h5tools_str_append(&buffer, "%s%" PRIuHSIZE, i ? ", " : "", chsize[i]);
total *= chsize[i];
}
- h5tools_str_append(&buffer, "} " HSIZE_T_FORMAT " bytes\n", total);
+ h5tools_str_append(&buffer, "} %" PRIuHSIZE " bytes\n", total);
} break;
case H5D_COMPACT:
break;
@@ -1897,15 +1896,13 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, &f_offset, &f_size) <
0) {
h5tools_str_append(
- &buffer,
- " #%03d %10" H5_PRINTF_LL_WIDTH "u %10s %10s ***ERROR*** %s\n", i,
+ &buffer, " #%03d %10" PRIuHSIZE " %10s %10s ***ERROR*** %s\n", i,
total, "", "", i + 1 < nf ? "Following addresses are incorrect" : "");
}
else if (H5S_UNLIMITED == f_size) {
h5tools_str_append(&buffer,
- " #%03d %10" H5_PRINTF_LL_WIDTH
- "u %10" H5_PRINTF_LL_WIDTH "u %10s ",
- i, total, (hsize_t)f_offset, "INF");
+ " #%03d %10" PRIuHSIZE " %10" PRIuHSIZE " %10s ", i,
+ total, (hsize_t)f_offset, "INF");
print_string(&buffer, f_name, TRUE);
}
else {
@@ -1985,8 +1982,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
case H5T_ARRAY:
case H5T_NCLASSES:
default:
- h5tools_str_append(&buffer,
- HSIZE_T_FORMAT " logical byte%s, " HSIZE_T_FORMAT " allocated byte%s",
+ h5tools_str_append(&buffer, "%" PRIuHSIZE " logical byte%s, %" PRIuHSIZE " allocated byte%s",
total, 1 == total ? "" : "s", used, 1 == used ? "" : "s");
if (used > 0) {
utilization = ((double)total * 100.0) / (double)used;
diff --git a/tools/src/h5perf/pio_perf.c b/tools/src/h5perf/pio_perf.c
index c233684..7e12bed 100644
--- a/tools/src/h5perf/pio_perf.c
+++ b/tools/src/h5perf/pio_perf.c
@@ -199,7 +199,7 @@ static int destroy_comm_world(void);
static void output_results(const struct options *options, const char *name, minmax *table, int table_size,
off_t data_size);
static void output_times(const struct options *options, const char *name, minmax *table, int table_size);
-static void output_report(const char *fmt, ...);
+static void output_report(const char *fmt, ...) H5_ATTR_FORMAT(printf, 1, 2);
static void print_indent(register int indent);
static void usage(const char *prog);
static void report_parameters(struct options *opts);
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 68e37fd..4c88bd7 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -701,7 +701,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
case 'a':
options->alignment = HDstrtoull(H5_optarg, NULL, 0);
if (options->alignment < 1) {
- error_msg("invalid alignment size\n", H5_optarg);
+ error_msg("invalid alignment size `%s`\n", H5_optarg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;
@@ -721,7 +721,7 @@ parse_command_line(int argc, const char *const *argv, pack_opt_t *options)
else if (!HDstrcmp(strategy, "NONE"))
options->fs_strategy = H5F_FSPACE_STRATEGY_NONE;
else {
- error_msg("invalid file space management strategy\n", H5_optarg);
+ error_msg("invalid file space management strategy `%s`\n", H5_optarg);
h5tools_setstatus(EXIT_FAILURE);
ret_value = -1;
goto done;