diff options
author | David Young <dyoung@hdfgroup.org> | 2019-11-27 19:58:43 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-07-07 15:49:55 (GMT) |
commit | 307cb5da4863b3d29fc5d1b97bc01034fc5161dd (patch) | |
tree | 96b5af3113c27f46fc24a929ac074dda752b5283 /src | |
parent | d52b27ad1d8142945a92310b79ab79171e76a3c3 (diff) | |
download | hdf5-307cb5da4863b3d29fc5d1b97bc01034fc5161dd.zip hdf5-307cb5da4863b3d29fc5d1b97bc01034fc5161dd.tar.gz hdf5-307cb5da4863b3d29fc5d1b97bc01034fc5161dd.tar.bz2 |
Squash my changes on branch `fprintf-experiment` into one commit for
reapplication to my new warnings branch, `warnings-again`. These
changes are included:
commit 915551b7bf64e777dd2007386ec77b1d117770da
Merge: 63858c2 a8892bb
Author: David Young <dyoung@hdfgroup.org>
Date: Mon Nov 25 17:39:49 2019 -0600
Merge remote-tracking branch 'hdf5/develop' into fprintf-experiment
commit a8892bb42d6f6e4fbc30fae0eb2b957f81c938b9
Merge: 5c911d8 f907b51
Author: David Young <dyoung@hdfgroup.org>
Date: Mon Nov 25 17:33:54 2019 -0600
Merge pull request #2055 in HDFFV/hdf5 from ~DYOUNG/vchoi_fork:add-werror-and-squash-some to develop
* commit 'f907b511d06612dafc7814a7c30f2f3d2b76d52b':
Oops, remove more C99 designated initializers for VS 2010 compatibility.
commit 63858c22e168acaec0af8ced6641f26102cc6bb0
Merge: 20ae787 5c911d8
Author: David Young <dyoung@hdfgroup.org>
Date: Mon Nov 25 17:04:42 2019 -0600
Merge remote-tracking branch 'hdf5/develop' into fprintf-experiment
commit 5c911d8baf3ee7fe654269088eebdf07f59a8192
Merge: b8a5671 62208b0
Author: David Young <dyoung@hdfgroup.org>
Date: Mon Nov 25 16:58:27 2019 -0600
Merge pull request #2030 in HDFFV/hdf5 from ~DYOUNG/vchoi_fork:add-werror-and-squash-some to develop
* commit '62208b056a09c01855fbac7f75146be58ad6bfe5': (44 commits)
Add an #include to get a function declaration.
Don't use C99 designated initializers, they're not compatible with Visual Studio 2010.
Quiet some more maybe-uninitialized warnings---each is a false positive, *sigh*. This is more code that may not compile with VS2010, *sigh sigh*.
Always warn on maybe-uninitialized. -Wincompatible-pointer-types was not available until GCC 5, so enable it only if that's the GCC version we're using.
Only promote maybe-uninitialized warnings to errors on GCC 8. Even on GCC 8, there may be false positives at low optimization levels? I need to check.
Only use -Werror=cast-function-type with GCC 8 and later.
Put all of the -W options back into the order I found them in so that it's easier to compare old and new config/gnu-flags.
Add new source files to CMakeLists.txt.
Mention the -Werror= flags in libhdf5.settings.in.
free -> HDfree
Promote decleration-after-statement warnings to errors.
Quiet decleration-after-statement warnings.
Move a statement under some declarations since some vintages of Visual Studio don't like declarations after statements.
Document H5D__chunk_mem_xfree_wrapper().
Undo accidental test deletion.
Oops, delete a debug printf that snuck in here.
Undo my changes to the HD macros, hadn't really intended those to be on this branch....
Make errors of some more warnings. Move disabled warnings to DEVELOPER_WARNING_CFLAGS. Put just one warning option on a line, and sort some of the options.
Cast to the parameter type, H5VL_token_t *, instead of to unsigned char *.
Change hdset_reg_ref_t and H5R_ref_t from arrays of unsigned char to structs containing those arrays. Encapsulating the arrays in this way makes it easier to write and think about pointers to these types, casts to/from these types, etc.
...
commit 20ae7877e33931b95e8c3502b027d6c3fe94a11f
Merge: 46f8c61 edd5297
Author: David Young <dyoung@hdfgroup.org>
Date: Fri Nov 22 15:34:09 2019 -0600
Merge remote-tracking branch 'origin/add-werror-and-squash-some' into fprintf-experiment
commit 46f8c613d5117a8be5bc8385a072daa0b4262f06
Author: David Young <dyoung@hdfgroup.org>
Date: Fri Nov 22 15:29:00 2019 -0600
GCC really wants us to use `ll` to format `long long`, so try to make that work
before any other format modifier. Seems like we're not compiling the autoconf
test program with -Werror=format ? Probably should.
commit eee35b8ef3759c391327cd48a9b3c56b6f8abc99
Author: David Young <dyoung@hdfgroup.org>
Date: Fri Nov 22 15:28:05 2019 -0600
It's hard to know just how wide an HDoff_t will be, and I don't think POSIX or
C standards provide a PRI macro for it, so cast to intmax_t and format using
PRIdMAX.
commit 86eab12df7a89b546a38e99f8178dd2adbcb3433
Author: David Young <dyoung@hdfgroup.org>
Date: Fri Nov 22 15:26:25 2019 -0600
URemove some casts.se the right format string for the argument. Here and there
stop casting a printf argument.
commit f722f7cbecbaa99449941484b014426f62f1bed5
Merge: 58e3743 6d5ec83
Author: David Young <dyoung@hdfgroup.org>
Date: Fri Nov 22 14:44:16 2019 -0600
Merge branch 'add-werror-and-squash-some' into fprintf-experiment
commit 58e3743b7faa9836606ee91798fe80dfc0040da7
Author: David Young <dyoung@hdfgroup.org>
Date: Wed Nov 20 21:07:21 2019 -0600
Remove custom HDfprintf implementation, using the standard library's,
instead. Take a swipe at repairing fprintf format strings, mainly
replacing "%Hu" with "%" PRIuHSIZE, "%a" with "%" PRIuHADDR, "%Zu" with
"%zu".
Here and there remove an awkward cast of a printf argument to `long
long` and use PRI[doux]8, PRI[doux]32, or PRI[doux]64, instead.
Change occurrences of "%t" to "%s" and perform a suitable change of
argument, `cond` -> `cond ? "TRUE" : "FALSE"`.
Some occurrences of %Hu, %a, and %t remain, they just weren't flagged by
the compiler because of #ifdef'age.
commit d4366909293fa970c23512ac80e5d865d76cddbf
Author: David Young <dyoung@hdfgroup.org>
Date: Wed Nov 20 20:54:32 2019 -0600
Promote format-string warnigns to errors.
Diffstat (limited to 'src')
56 files changed, 445 insertions, 852 deletions
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 3377aa2..01f9058 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -381,9 +381,9 @@ H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u, %08lx}\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u, %08" PRIx32 "}\n", indent, "", fwidth, "Record:", - (hsize_t)nrecord->id.val, (unsigned)nrecord->flags, (unsigned)nrecord->corder, (unsigned long)nrecord->hash); + nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder, nrecord->hash); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__dense_btree2_name_debug() */ @@ -538,9 +538,9 @@ H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u}\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u}\n", indent, "", fwidth, "Record:", - (hsize_t)nrecord->id.val, (unsigned)nrecord->flags, (unsigned)nrecord->corder); + nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__dense_btree2_corder_debug() */ diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index b5b1c03..40f9006 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -134,13 +134,13 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Depth:", hdr->depth); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of records in tree:", hdr->root.all_nrec); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of records in root node:", hdr->root.node_nrec); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of root node:", hdr->root.addr); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, @@ -247,7 +247,7 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, for(u = 0; u < internal->nrec; u++) { /* Print node pointer */ HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); - HDfprintf(stream, "%*s%-*s (%Hu/%u/%a)\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, @@ -263,7 +263,7 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Print final node pointer */ HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); - HDfprintf(stream, "%*s%-*s (%Hu/%u/%a)\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, diff --git a/src/H5B2test.c b/src/H5B2test.c index 7affd49..0f1b4e3 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -323,7 +323,7 @@ H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, HDassert(record); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Record:", + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Record:", *(const hsize_t *)record); FUNC_LEAVE_NOAPI(SUCCEED) @@ -460,7 +460,7 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, HDassert(record); - HDfprintf(stream, "%*s%-*s (%Hu, %Hu)\n", indent, "", fwidth, "Record:", + HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE ", %" PRIuHSIZE ")\n", indent, "", fwidth, "Record:", ((const H5B2_test_rec_t *)record)->key, ((const H5B2_test_rec_t *)record)->val); diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index 665e826..37a94f4 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -100,10 +100,10 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, "Tree type ID:", ((shared->type->id) == H5B_SNODE_ID ? "H5B_SNODE_ID" : ((shared->type->id) == H5B_CHUNK_ID ? "H5B_CHUNK_ID" : "Unknown!"))); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of node:", shared->sizeof_rnode); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of raw (disk) key:", shared->sizeof_rkey); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, @@ -112,10 +112,10 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Level:", bt->level); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of left sibling:", bt->left); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of right sibling:", bt->right); HDfprintf(stream, "%*s%-*s %u (%u)\n", indent, "", fwidth, @@ -127,7 +127,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, */ for(u = 0; u < bt->nchildren; u++) { HDfprintf(stream, "%*sChild %d...\n", indent, "", u); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3), "Address:", bt->child[u]); /* If there is a key debugging routine, use it to display the left & right keys */ @@ -555,7 +555,7 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, (cache_ptr->resize_ctl).lower_hr_threshold); HDfprintf(stdout, - "%s cache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n", + "%s cache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, old_max_cache_size, old_min_clean_size, @@ -567,13 +567,13 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, HDassert( old_max_cache_size < new_max_cache_size ); HDfprintf(stdout, - "%sflash cache resize(%d) -- size threshold = %Zu.\n", + "%sflash cache resize(%d) -- size threshold = %zu.\n", cache_ptr->prefix, (int)((cache_ptr->resize_ctl).flash_incr_mode), cache_ptr->flash_size_increase_threshold); HDfprintf(stdout, - "%s cache size increased from (%Zu/%Zu) to (%Zu/%Zu).\n", + "%s cache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, old_max_cache_size, old_min_clean_size, @@ -629,7 +629,7 @@ H5C_def_auto_resize_rpt_fcn(H5C_t * cache_ptr, } HDfprintf(stdout, - "%s cache size decreased from (%Zu/%Zu) to (%Zu/%Zu).\n", + "%s cache size decreased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, old_max_cache_size, old_min_clean_size, @@ -873,7 +873,7 @@ H5C_dest(H5F_t * f) #ifndef NDEBUG #if H5C_DO_SANITY_CHECKS if(cache_ptr->get_entry_ptr_from_addr_counter > 0) - HDfprintf(stdout, "*** %ld calls to H5C_get_entry_ptr_from_add(). ***\n", + HDfprintf(stdout, "*** %" PRId64 " calls to H5C_get_entry_ptr_from_add(). ***\n", cache_ptr->get_entry_ptr_from_addr_counter); #endif /* H5C_DO_SANITY_CHECKS */ diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index d5599f2..55220a5 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -310,17 +310,17 @@ H5C_dump_cache_skip_list(H5C_t * cache_ptr, char * calling_fcn) HDassert( entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC ); HDfprintf(stdout, - "%s%d 0x%016llx %4lld %d/%d %d %s\n", + "%s%d 0x%016" PRIxHADDR " %4zu %d/%d %d %s\n", cache_ptr->prefix, i, - (long long)(entry_ptr->addr), - (long long)(entry_ptr->size), + entry_ptr->addr, + entry_ptr->size, (int)(entry_ptr->is_protected), (int)(entry_ptr->is_pinned), (int)(entry_ptr->is_dirty), entry_ptr->type->name); HDfprintf(stdout, " node_ptr = %p, item = %p\n", - node_ptr, H5SL_item(node_ptr)); + (void *)node_ptr, H5SL_item(node_ptr)); /* increment node_ptr before we delete its target */ node_ptr = H5SL_next(node_ptr); @@ -806,7 +806,7 @@ H5C_stats(H5C_t * cache_ptr, (long long)(cache_ptr->index_scan_restarts)); HDfprintf(stdout, - "%s cache image creations/reads/loads/size = %d / %d /%d / %Hu\n", + "%s cache image creations/reads/loads/size = %d / %d /%d / %" PRIuHSIZE "\n", cache_ptr->prefix, cache_ptr->images_created, cache_ptr->images_read, @@ -1147,7 +1147,7 @@ H5C__dump_entry(H5C_t *cache_ptr, const H5C_cache_entry_t *entry_ptr, HDassert(cache_ptr); HDassert(entry_ptr); - HDfprintf(stderr, "%*s%s: entry_ptr = (%a, '%s', %a, %t, %u, %u/%u)\n", indent, "", prefix, entry_ptr->addr, entry_ptr->type->name, entry_ptr->tag_info ? entry_ptr->tag_info->tag : HADDR_UNDEF, entry_ptr->is_dirty, entry_ptr->flush_dep_nparents, entry_ptr->flush_dep_nchildren, entry_ptr->flush_dep_ndirty_children); + HDfprintf(stderr, "%*s%s: entry_ptr = (%" PRIuHADDR ", '%s', %" PRIuHADDR ", %s, %u, %u/%u)\n", indent, "", prefix, entry_ptr->addr, entry_ptr->type->name, entry_ptr->tag_info ? entry_ptr->tag_info->tag : HADDR_UNDEF, (entry_ptr->is_dirty) ? "TRUE" : "FALSE", entry_ptr->flush_dep_nparents, entry_ptr->flush_dep_nchildren, entry_ptr->flush_dep_ndirty_children); if(dump_parents && entry_ptr->flush_dep_nparents) H5C__dump_parents(cache_ptr, entry_ptr, "Parent", indent); if(entry_ptr->flush_dep_nchildren) diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 098e01b..f23538a 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -774,7 +774,7 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", key->filter_mask); HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for(u = 0; u < udata->ndims; u++) - HDfprintf(stream, "%s%Hd", u?", ":"", (key->scaled[u] * udata->common.layout->dim[u])); + HDfprintf(stream, "%s%" PRIuHSIZE, u?", ":"", (key->scaled[u] * udata->common.layout->dim[u])); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) @@ -1421,7 +1421,7 @@ H5D__btree_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__btree_idx_dump() */ diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index ae98654..11bde2d 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -459,11 +459,11 @@ H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, HDassert(ctx->chunk_size == record->nbytes); HDassert(0 == record->filter_mask); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for(u = 0; u < ctx->ndims; u++) - HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * ctx->dim[u]); + HDfprintf(stream, "%s%" PRIuHSIZE, u?", ":"", record->scaled[u] * ctx->dim[u]); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) @@ -577,13 +577,13 @@ H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, HDassert(H5F_addr_defined(record->chunk_addr)); HDassert(0 != record->nbytes); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)record->nbytes); HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", record->filter_mask); HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for(u = 0; u < ctx->ndims; u++) - HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * ctx->dim[u]); + HDfprintf(stream, "%s%" PRIuHSIZE, u?", ":"", record->scaled[u] * ctx->dim[u]); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) @@ -1511,7 +1511,7 @@ H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__bt2_idx_dump() */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 5fda3c0..21b114e 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -6571,9 +6571,9 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) } /* end if */ /* Print information about this chunk */ - HDfprintf(udata->stream, " 0x%08x %8Zu %10a [", chunk_rec->filter_mask, chunk_rec->nbytes, chunk_rec->chunk_addr); + HDfprintf(udata->stream, " 0x%08x %8" PRIu32 " %10" PRIuHADDR " [", chunk_rec->filter_mask, chunk_rec->nbytes, chunk_rec->chunk_addr); for(u = 0; u < udata->ndims; u++) - HDfprintf(udata->stream, "%s%Hu", (u ? ", " : ""), (chunk_rec->scaled[u] * udata->chunk_dim[u])); + HDfprintf(udata->stream, "%s%" PRIuHSIZE, (u ? ", " : ""), (chunk_rec->scaled[u] * udata->chunk_dim[u])); HDfputs("]\n", udata->stream); } /* end if */ diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index d11a5d8..8725bd3 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -87,7 +87,7 @@ H5Ddebug(hid_t dset_id) if(H5D_CHUNKED == dset->shared->layout.type) (void)H5D__chunk_dump_index(dset, stdout); else if(H5D_CONTIGUOUS == dset->shared->layout.type) - HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); + HDfprintf(stdout, " %-10s %" PRIuHADDR "\n", "Address:", dset->shared->layout.storage.u.contig.addr); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Dearray.c b/src/H5Dearray.c index eaa8c46..fbd3b04 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -438,8 +438,8 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str, + HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); FUNC_LEAVE_NOAPI(SUCCEED) @@ -597,8 +597,8 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); - HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str, + HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx); + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, elmt->nbytes, elmt->filter_mask); FUNC_LEAVE_NOAPI(SUCCEED) @@ -1773,7 +1773,7 @@ H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__earray_idx_dump() */ diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c index 4eedf04..348aeb3 100644 --- a/src/H5Dfarray.c +++ b/src/H5Dfarray.c @@ -434,8 +434,8 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str, + HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); FUNC_LEAVE_NOAPI(SUCCEED) @@ -699,8 +699,8 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, HDassert(elmt); /* Print element */ - HDsprintf(temp_str, "Element #%llu:", (unsigned long long)idx); - HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str, + HDsprintf(temp_str, "Element #%" PRIuHSIZE ":", idx); + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, elmt->nbytes, elmt->filter_mask); FUNC_LEAVE_NOAPI(SUCCEED) @@ -1624,7 +1624,7 @@ H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__farray_idx_dump() */ diff --git a/src/H5Dnone.c b/src/H5Dnone.c index 40ddcb8..93265c4 100644 --- a/src/H5Dnone.c +++ b/src/H5Dnone.c @@ -489,7 +489,7 @@ H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__none_idx_dump() */ diff --git a/src/H5Dsingle.c b/src/H5Dsingle.c index 33274bb..cd0ed16 100644 --- a/src/H5Dsingle.c +++ b/src/H5Dsingle.c @@ -546,7 +546,7 @@ H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) HDassert(storage); HDassert(stream); - HDfprintf(stream, " Address: %a\n", storage->idx_addr); + HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__single_idx_dump() */ @@ -1356,10 +1356,6 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, { va_list ap; /* Varargs info */ H5E_t *estack; /* Pointer to error stack to modify */ -#ifndef H5_HAVE_VASPRINTF - int tmp_len; /* Current size of description buffer */ - int desc_len; /* Actual length of description when formatted */ -#endif /* H5_HAVE_VASPRINTF */ char *tmp = NULL; /* Buffer to place formatted description in */ hbool_t va_started = FALSE; /* Whether the variable argument list is open */ herr_t ret_value=SUCCEED; /* Return value */ @@ -1389,31 +1385,9 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, HDva_start(ap, fmt); va_started = TRUE; -#ifdef H5_HAVE_VASPRINTF /* Use the vasprintf() routine, since it does what we're trying to do below */ if(HDvasprintf(&tmp, fmt, ap) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") -#else /* H5_HAVE_VASPRINTF */ - /* Allocate space for the formatted description buffer */ - tmp_len = 128; - if(NULL == (tmp = H5MM_malloc((size_t)tmp_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - /* If the description doesn't fit into the initial buffer size, allocate more space and try again */ - while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) { - /* shutdown & restart the va_list */ - HDva_end(ap); - HDva_start(ap, fmt); - - /* Release the previous description, it's too small */ - H5MM_xfree(tmp); - - /* Allocate a description of the appropriate length */ - tmp_len = desc_len + 1; - if(NULL == (tmp = H5MM_malloc((size_t)tmp_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - } /* end while */ -#endif /* H5_HAVE_VASPRINTF */ /* Push the error on the stack */ if(H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0) @@ -1422,16 +1396,11 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, done: if(va_started) HDva_end(ap); -#ifdef H5_HAVE_VASPRINTF /* Memory was allocated with HDvasprintf so it needs to be freed * with HDfree */ if(tmp) HDfree(tmp); -#else /* H5_HAVE_VASPRINTF */ - if(tmp) - H5MM_xfree(tmp); -#endif /* H5_HAVE_VASPRINTF */ FUNC_LEAVE_API(ret_value) } /* end H5Epush2() */ diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 3d6c2ed..49bb447 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -125,13 +125,13 @@ H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, @@ -149,19 +149,19 @@ H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Log2(Max. # of elements in data block page):", (unsigned)hdr->cparam.max_dblk_page_nelmts_bits); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Highest element index stored (+1):", hdr->stats.stored.max_idx_set); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of super blocks created:", hdr->stats.stored.nsuper_blks); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of data blocks created:", hdr->stats.stored.ndata_blks); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of elements 'realized':", hdr->stats.stored.nelmts); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Index Block Address:", hdr->idx_blk_addr); @@ -230,13 +230,13 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Index Block size:", iblock->size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "# of data block addresses in index block:", iblock->ndblk_addrs); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "# of super block addresses in index block:", iblock->nsblk_addrs); @@ -265,7 +265,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde for(u = 0; u < iblock->ndblk_addrs; u++) { /* Print address */ HDsprintf(temp_str, "Address #%u:", u); - HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, iblock->dblk_addrs[u]); } /* end for */ @@ -281,7 +281,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde for(u = 0; u < iblock->nsblk_addrs; u++) { /* Print address */ HDsprintf(temp_str, "Address #%u:", u); - HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, iblock->sblk_addrs[u]); } /* end for */ @@ -352,13 +352,13 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Super Block size:", sblock->size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "# of data block addresses in super block:", sblock->ndblks); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "# of elements in data blocks from this super block:", sblock->dblk_nelmts); @@ -372,7 +372,7 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, for(u = 0; u < sblock->ndblks; u++) { /* Print address */ HDsprintf(temp_str, "Address #%u:", u); - HDfprintf(stream, "%*s%-*s %a\n", (indent + 3), "", MAX(0, (fwidth - 3)), + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, sblock->dblk_addrs[u]); } /* end for */ @@ -437,7 +437,7 @@ H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Protect data block */ /* (Note: setting parent of data block to 'hdr' for this operation should be OK -QAK) */ if(NULL == (dblock = H5EA__dblock_protect(hdr, hdr, addr, dblk_nelmts, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %llu", (unsigned long long)addr) + H5E_THROW(H5E_CANTPROTECT, "unable to protect extensible array data block, address = %" PRIuHADDR, addr) /* Print opening message */ HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, ""); @@ -445,7 +445,7 @@ H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data Block size:", dblock->size); diff --git a/src/H5Eint.c b/src/H5Eint.c index fe72449..52fe3c9 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -672,10 +672,6 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...) { va_list ap; /* Varargs info */ -#ifndef H5_HAVE_VASPRINTF - int tmp_len; /* Current size of description buffer */ - int desc_len; /* Actual length of description when formatted */ -#endif /* H5_HAVE_VASPRINTF */ char *tmp = NULL; /* Buffer to place formatted description in */ hbool_t va_started = FALSE; /* Whether the variable argument list is open */ herr_t ret_value = SUCCEED; /* Return value */ @@ -704,31 +700,9 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin HDva_start(ap, fmt); va_started = TRUE; -#ifdef H5_HAVE_VASPRINTF /* Use the vasprintf() routine, since it does what we're trying to do below */ if(HDvasprintf(&tmp, fmt, ap) < 0) HGOTO_DONE(FAIL) -#else /* H5_HAVE_VASPRINTF */ - /* Allocate space for the formatted description buffer */ - tmp_len = 128; - if(NULL == (tmp = H5MM_malloc((size_t)tmp_len))) - HGOTO_DONE(FAIL) - - /* If the description doesn't fit into the initial buffer size, allocate more space and try again */ - while((desc_len = HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap)) > (tmp_len - 1)) { - /* shutdown & restart the va_list */ - HDva_end(ap); - HDva_start(ap, fmt); - - /* Release the previous description, it's too small */ - H5MM_xfree(tmp); - - /* Allocate a description of the appropriate length */ - tmp_len = desc_len + 1; - if(NULL == (tmp = H5MM_malloc((size_t)tmp_len))) - HGOTO_DONE(FAIL) - } /* end while */ -#endif /* H5_HAVE_VASPRINTF */ /* Push the error on the stack */ if(H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0) @@ -737,16 +711,11 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin done: if(va_started) HDva_end(ap); -#ifdef H5_HAVE_VASPRINTF /* Memory was allocated with HDvasprintf so it needs to be freed * with HDfree */ if(tmp) HDfree(tmp); -#else /* H5_HAVE_VASPRINTF */ - if(tmp) - H5MM_xfree(tmp); -#endif /* H5_HAVE_VASPRINTF */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_printf_stack() */ diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index b578cf2..af4616c 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -123,13 +123,13 @@ H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); @@ -138,10 +138,10 @@ H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, "Max. # of elements in data block page:", (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of elements in Fixed Array:", hdr->stats.nelmts); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Fixed Array Data Block Address:", hdr->dblk_addr); CATCH @@ -207,13 +207,13 @@ H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of Data Block:", dblock->addr); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data Block size:", dblock->size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of Data Block:", dblock->addr); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Data Block size:", dblock->size); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of elements in Data Block:", hdr->cparam.nelmts); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Number of pages in Data Block:", dblock->npages); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Number of elements per Data Block page:", dblock->dblk_page_nelmts); if(dblock->npages) { /* paging */ @@ -230,8 +230,8 @@ H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Read and print each page's elements in the data block */ for(page_idx = 0; page_idx < dblock->npages; page_idx++) { if(!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { - HDfprintf(stream, "%*s%-*s %Hu %s\n", indent, "", fwidth, - "Page %Zu:", page_idx, "empty"); + HDfprintf(stream, "%*s%-*s %zu %s\n", indent, "", fwidth, + "Page %zu:", page_idx, "empty"); } /* end if */ else { /* get the page */ @@ -245,7 +245,7 @@ H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, if(NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, H5AC__READ_ONLY_FLAG))) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr) - HDfprintf(stream, "%*sElements in page %Zu:\n", indent, "", page_idx); + HDfprintf(stream, "%*sElements in page %zu:\n", indent, "", page_idx); for(u = 0; u < dblk_page_nelmts; u++) { /* Call the class's 'debug' callback */ if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 78b7742..80a5d03 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -732,13 +732,13 @@ H5FD_log_close(H5FD_t *_file) addr = 1; while(addr < file->eoa) { if(file->nwrite[addr] != last_val) { - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) written to %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); last_val = file->nwrite[addr]; last_addr = addr; } /* end if */ addr++; } /* end while */ - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) written to %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); } /* end if */ /* Dump the read I/O information */ @@ -749,13 +749,13 @@ H5FD_log_close(H5FD_t *_file) addr = 1; while(addr < file->eoa) { if(file->nread[addr] != last_val) { - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) read from %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); last_val = file->nread[addr]; last_addr = addr; } /* end if */ addr++; } /* end while */ - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) read from %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); } /* end if */ /* Dump the I/O flavor information */ @@ -766,13 +766,13 @@ H5FD_log_close(H5FD_t *_file) addr = 1; while(addr < file->eoa) { if(file->flavor[addr] != last_val) { - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) flavor is %s\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); + HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); last_val = file->flavor[addr]; last_addr = addr; } /* end if */ addr++; } /* end while */ - HDfprintf(file->logfp, "\tAddr %10a-%10a (%10lu bytes) flavor is %s\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); + HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n", last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); } /* end if */ /* Free the logging information */ @@ -930,7 +930,7 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hsi } /* end if */ if(file->fa.flags & H5FD_LOG_ALLOC) - HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Allocated\n", addr, (addr + size) - 1, size, flavors[type]); + HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", addr, (addr + size) - 1, size, flavors[type]); } /* end if */ /* Set return value */ @@ -970,7 +970,7 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, /* Log the file memory freed */ if(file->fa.flags & H5FD_LOG_FREE) - HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Freed\n", addr, (addr + size) - 1, size, flavors[type]); + HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n", addr, (addr + size) - 1, size, flavors[type]); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -1038,7 +1038,7 @@ H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) /* Log the extension like an allocation */ if(file->fa.flags & H5FD_LOG_ALLOC) - HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Allocated\n", file->eoa, addr, size, flavors[type]); + HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", file->eoa, addr, size, flavors[type]); } /* end if */ /* Check for decreasing file size */ @@ -1054,7 +1054,7 @@ H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) /* Log the shrink like a free */ if(file->fa.flags & H5FD_LOG_FREE) - HDfprintf(file->logfp, "%10a-%10a (%10Hu bytes) (%s) Freed\n", file->eoa, addr, size, flavors[type]); + HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n", file->eoa, addr, size, flavors[type]); } /* end if */ } /* end if */ @@ -1206,7 +1206,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd /* Emit log string if we're tracking individual seek events. */ if(file->fa.flags & H5FD_LOG_LOC_SEEK) { - HDfprintf(file->logfp, "Seek: From %10a To %10a", file->pos, addr); + HDfprintf(file->logfp, "Seek: From %10" PRIuHADDR " To %10" PRIuHADDR, file->pos, addr); /* Add the seek time, if we're tracking that. * Note that the seek time is NOT emitted for when just H5FD_LOG_TIME_SEEK @@ -1259,7 +1259,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); if(file->fa.flags & H5FD_LOG_LOC_READ) - HDfprintf(file->logfp, "Error! Reading: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); + HDfprintf(file->logfp, "Error! Reading: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset); } /* end if */ @@ -1295,7 +1295,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd /* Log information about the read */ if(file->fa.flags & H5FD_LOG_LOC_READ) { - HDfprintf(file->logfp, "%10a-%10a (%10Zu bytes) (%s) Read", orig_addr, (orig_addr + orig_size) - 1, orig_size, flavors[type]); + HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes) (%s) Read", orig_addr, (orig_addr + orig_size) - 1, orig_size, flavors[type]); /* Verify that we are reading in the type of data we allocated in this location */ if(file->flavor) { @@ -1415,7 +1415,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had /* Emit log string if we're tracking individual seek events. */ if(file->fa.flags & H5FD_LOG_LOC_SEEK) { - HDfprintf(file->logfp, "Seek: From %10a To %10a", file->pos, addr); + HDfprintf(file->logfp, "Seek: From %10" PRIuHADDR " To %10" PRIuHADDR, file->pos, addr); /* Add the seek time, if we're tracking that. * Note that the seek time is NOT emitted for when just H5FD_LOG_TIME_SEEK @@ -1468,7 +1468,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); if(file->fa.flags & H5FD_LOG_LOC_WRITE) - HDfprintf(file->logfp, "Error! Writing: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); + HDfprintf(file->logfp, "Error! Writing: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size); HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ @@ -1497,7 +1497,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had /* Log information about the write */ if(file->fa.flags & H5FD_LOG_LOC_WRITE) { - HDfprintf(file->logfp, "%10a-%10a (%10Zu bytes) (%s) Written", orig_addr, (orig_addr + orig_size) - 1, orig_size, flavors[type]); + HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes) (%s) Written", orig_addr, (orig_addr + orig_size) - 1, orig_size, flavors[type]); /* Check if this is the first write into a "default" section, grabbed by the metadata agregation algorithm */ if(file->fa.flags & H5FD_LOG_FLAVOR) { @@ -1617,7 +1617,7 @@ H5FD_log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_U /* Emit log string if we're tracking individual truncate events. */ if(file->fa.flags & H5FD_LOG_TRUNCATE) { - HDfprintf(file->logfp, "Truncate: To %10a", file->eoa); + HDfprintf(file->logfp, "Truncate: To %10" PRIuHADDR, file->eoa); /* Add the truncate time, if we're tracking that. * Note that the truncate time is NOT emitted for when just H5FD_LOG_TIME_TRUNCATE diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index d9d4c88..6ecc007 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -1496,7 +1496,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, } ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), - "bytes="H5_PRINTF_HADDR_FMT"-"H5_PRINTF_HADDR_FMT, + "bytes=%" PRIuHADDR "-%" PRIuHADDR, offset, offset + len - 1); if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) @@ -1511,7 +1511,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, } ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), - "bytes="H5_PRINTF_HADDR_FMT"-", + "bytes=%" PRIuHADDR "-", offset); if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index c615b68..dada9b1 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -129,16 +129,16 @@ H5FS_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) "Free space client:", (fspace->client == H5FS_CLIENT_FHEAP_ID ? "Fractal heap" : (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown"))); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Total free space tracked:", fspace->tot_space); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Total number of free space sections tracked:", fspace->tot_sect_count); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of serializable free space sections tracked:", fspace->serial_sect_count); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of ghost free space sections tracked:", fspace->ghost_sect_count); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, @@ -153,16 +153,16 @@ H5FS_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "# of bits for section address space:", fspace->max_sect_addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Maximum section size:", fspace->max_sect_size); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Serialized sections address:", fspace->sect_addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Serialized sections size used:", fspace->sect_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Serialized sections size allocated:", fspace->alloc_sect_size); diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 535b43d..7b61e33 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -78,9 +78,9 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) "File access flags", f->shared->flags); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "File open reference count:", f->shared->nrefs); - HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (abs)\n", indent, "", fwidth, "Address of super block:", f->shared->sblock->base_addr); - HDfprintf(stream, "%*s%-*s %Hu bytes\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " bytes\n", indent, "", fwidth, "Size of userblock:", userblock_size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, @@ -106,16 +106,16 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) "Indexed storage internal node 1/2 rank:", f->shared->sblock->btree_k[H5B_CHUNK_ID]); HDfprintf(stream, "%*s%-*s 0x%02x\n", indent, "", fwidth, "File status flags:", (unsigned)(f->shared->sblock->status_flags)); - HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, "Superblock extension address:", f->shared->sblock->ext_addr); - HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, "Shared object header message table address:", f->shared->sohm_addr); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Shared object header message version number:", (unsigned) f->shared->sohm_vers); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of shared object header message indexes:", (unsigned) f->shared->sohm_nindexes); - HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, "Address of driver information block:", f->shared->sblock->driver_addr); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, diff --git a/src/H5Gent.c b/src/H5Gent.c index 19aef10..4852dde 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -552,7 +552,7 @@ H5G__ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, "Name offset into private heap:", (unsigned long) (ent->name_off)); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object header address:", ent->header); HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, @@ -567,10 +567,10 @@ H5G__ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Cached entry information:"); - HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", nested_indent, "", nested_fwidth, "B-tree address:", ent->cache.stab.btree_addr); - HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", nested_indent, "", nested_fwidth, "Heap address:", ent->cache.stab.heap_addr); break; diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index 479c2bd..5485b75 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -454,7 +454,7 @@ H5HF__huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%a, %Hu, %Hu}\n", indent, "", fwidth, "Record:", + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %" PRIuHSIZE "}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) @@ -661,7 +661,7 @@ H5HF__huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu, %Hu}\n", indent, "", fwidth, "Record:", + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %x, %" PRIuHSIZE ", %" PRIuHSIZE "}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size, nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) @@ -848,7 +848,7 @@ H5HF__huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%a, %Hu}\n", indent, "", fwidth, "Record:", + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE "}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len); FUNC_LEAVE_NOAPI(SUCCEED) @@ -1064,7 +1064,7 @@ H5HF__huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, FUNC_ENTER_STATIC_NOERR - HDfprintf(stream, "%*s%-*s {%a, %Hu, %x, %Hu}\n", indent, "", fwidth, "Record:", + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %x, %" PRIuHSIZE "}\n", indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index 22de0c4..dd544f0 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -162,7 +162,7 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve heap ID length") /* Display the heap ID */ - HDfprintf(stream, "%*s%-*s (%c, %Hu, %Zu)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s (%c, %" PRIuHSIZE" , %zu)\n", indent, "", fwidth, "Heap ID info: (type, offset, length)", id_type, obj_off, obj_len); @@ -204,10 +204,10 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Doubling table width:", dtable->cparam.width); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Starting block size:", dtable->cparam.start_block_size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Max. direct block size:", dtable->cparam.max_direct_size); HDfprintf(stream, "%*s%-*s %u (bits)\n", indent, "", fwidth, @@ -218,7 +218,7 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi dtable->cparam.start_root_rows); /* Run-time varying parameter values */ - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Table's root address:", dtable->table_addr); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, @@ -235,7 +235,7 @@ H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fwi HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "# of bits for IDs in first row:", dtable->first_row_bits); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "# of IDs in first row:", dtable->num_id_first_row); @@ -278,52 +278,52 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Heap is:", hdr->man_dtable.curr_root_rows > 0 ? "Indirect" : "Direct"); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Objects stored in 'debugging' format:", - hdr->debug_objs); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, + hdr->debug_objs ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "'Write once' flag:", - hdr->write_once); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, + hdr->write_once ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "'Huge' object IDs have wrapped:", - hdr->huge_ids_wrapped); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + hdr->huge_ids_wrapped ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "Free space in managed blocks:", hdr->total_man_free); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "Managed space data block size:", hdr->man_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "Total managed space allocated:", hdr->man_alloc_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "Offset of managed space iterator:", hdr->man_iter_off); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "Number of managed objects in heap:", hdr->man_nobjs); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of free space manager for managed blocks:", hdr->fs_addr); HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Max. size of managed object:", (unsigned long)hdr->max_man_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "'Huge' object space used:", hdr->huge_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "Number of 'huge' objects in heap:", hdr->huge_nobjs); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "ID of next 'huge' object:", hdr->huge_next_id); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of v2 B-tree for 'huge' objects:", hdr->huge_bt2_addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "'Tiny' object space used:", hdr->tiny_size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "Number of 'tiny' objects in heap:", hdr->tiny_nobjs); @@ -334,7 +334,7 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i if(hdr->filter_len > 0) { HDfprintf(stream, "%*sI/O filter Info...\n", indent, ""); if(hdr->man_dtable.curr_root_rows == 0) { - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Compressed size of root direct block:", hdr->pline_root_direct_size); HDfprintf(stream, "%*s%-*s %x\n", indent + 3, "", MAX(0, fwidth - 3), @@ -354,7 +354,7 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i hdr->root_iblock_flags); HDfprintf(stream, "%*s%-*s %p\n", indent + 3, "", MAX(0, fwidth - 3), "Root indirect block pointer:", - hdr->root_iblock); + (void *)hdr->root_iblock); if(hdr->root_iblock) H5HF_iblock_print(hdr->root_iblock, dump_internal, stream, indent + 3, fwidth); } /* end if */ @@ -468,7 +468,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) len = end - start; HDsnprintf(temp_str, sizeof(temp_str), "Section #%u:", (unsigned)udata->sect_count); - HDfprintf(udata->stream, "%*s%-*s %8Zu, %8Zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9), + HDfprintf(udata->stream, "%*s%-*s %8zu, %8zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9), temp_str, start, len); udata->sect_count++; @@ -545,14 +545,14 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of fractal heap that owns this block:", hdr->heap_addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "Offset of direct block in heap:", dblock->block_off); blk_prefix_size = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of block header:", blk_prefix_size); @@ -660,13 +660,13 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of fractal heap that owns this block:", hdr->heap_addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE" \n", indent, "", fwidth, "Offset of indirect block in heap:", iblock->block_off); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of indirect block:", iblock->size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, @@ -693,13 +693,13 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); if(hdr->filter_len > 0) - HDfprintf(stream, "%*s%-*s %9a/%6Zu/%x\n", indent + 6, "", MAX(0, fwidth - 6), + HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "/%6zu/%x\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, iblock->ents[off].addr, iblock->filt_ents[off].size, iblock->filt_ents[off].filter_mask); else - HDfprintf(stream, "%*s%-*s %9a\n", indent + 6, "", MAX(0, fwidth - 6), + HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, iblock->ents[off].addr); } /* end for */ @@ -720,7 +720,7 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, size_t off = (u * hdr->man_dtable.cparam.width) + v; HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); - HDfprintf(stream, "%*s%-*s %9a\n", indent + 6, "", MAX(0, fwidth - 6), + HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, iblock->ents[off].addr); } /* end for */ @@ -735,14 +735,14 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, HDfprintf(stream, "%*sFractal Indirect Block Internal Information:\n", indent, ""); /* Print general information */ - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Reference count:", iblock->rc); /* Print parent's information */ HDfprintf(stream, "%*s%-*s %p\n", indent + 3, "", MAX(0, fwidth - 3), "Parent indirect block address:", - iblock->parent); + (void *)iblock->parent); if(iblock->parent) H5HF_iblock_print(iblock->parent, TRUE, stream, indent + 6, fwidth); } /* end if */ @@ -843,10 +843,10 @@ H5HF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) (sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE ? "single" : (sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW ? "first row" : (sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW ? "normal row" : "unknown")))); - HDfprintf(udata->stream, "%*s%-*s %a\n", udata->indent, "", udata->fwidth, + HDfprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth, "Section address:", sect->sect_info.addr); - HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth, + HDfprintf(udata->stream, "%*s%-*s %" PRIuHSIZE "\n", udata->indent, "", udata->fwidth, "Section size:", sect->sect_info.size); #ifdef QAK diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index a6560e2..b5567f0 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -405,7 +405,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, /* Check for skipping over blocks */ if(min_dblock_size > next_size) { -HDfprintf(stderr, "%s: Skipping direct block sizes not supported, min_dblock_size = %Zu, next_size = %Zu\n", FUNC, min_dblock_size, next_size); +HDfprintf(stderr, "%s: Skipping direct block sizes not supported, min_dblock_size = %zu, next_size = %zu\n", FUNC, min_dblock_size, next_size); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not supported yet") } /* end if */ diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index edb0261..a299e47 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -69,10 +69,10 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth)) HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Header size (in bytes):", (unsigned long)h->prfx_size); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of heap data:", h->dblk_addr); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data bytes allocated for heap:", h->dblk_size); @@ -88,7 +88,7 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, int fwidth)) char temp_str[32]; HDsnprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block); - HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent+3, "", MAX(0,fwidth-9), temp_str, freelist->offset, freelist->size); + HDfprintf(stream, "%*s%-*s %8zu, %8zu\n", indent+3, "", MAX(0,fwidth-9), temp_str, freelist->offset, freelist->size); if((freelist->offset + freelist->size) > h->dblk_size) HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); else { diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 43e2305..557843e 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -118,13 +118,13 @@ H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) (sect->sect_info.type == H5MF_FSPACE_SECT_SIMPLE ? "simple" : (sect->sect_info.type == H5MF_FSPACE_SECT_SMALL ? "small" : (sect->sect_info.type == H5MF_FSPACE_SECT_LARGE ? "large" : "unknown")))); - HDfprintf(udata->stream, "%*s%-*s %a\n", udata->indent, "", udata->fwidth, + HDfprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth, "Section address:", sect->sect_info.addr); - HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth, + HDfprintf(udata->stream, "%*s%-*s %" PRIuHSIZE "\n", udata->indent, "", udata->fwidth, "Section size:", sect->sect_info.size); - HDfprintf(udata->stream, "%*s%-*s %Hu\n", udata->indent, "", udata->fwidth, + HDfprintf(udata->stream, "%*s%-*s %" PRIuHSIZE "\n", udata->indent, "", udata->fwidth, "End of section:", (haddr_t)((sect->sect_info.addr + sect->sect_info.size) - 1)); HDfprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth, @@ -237,7 +237,7 @@ HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") #ifdef H5MF_ALLOC_DEBUG -HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); +HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %" PRIuHADDR "\n", FUNC, eoa); #endif /* H5MF_ALLOC_DEBUG */ if(H5F_PAGED_AGGR(f)) { /* File space paging */ @@ -279,13 +279,13 @@ HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); /* Retrieve metadata aggregator info, if available */ H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); #ifdef H5MF_ALLOC_DEBUG -HDfprintf(stderr, "%s: ma_addr = %a, ma_size = %Hu, end of ma = %a\n", FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); +HDfprintf(stderr, "%s: ma_addr = %" PRIuHADDR ", ma_size = %" PRIuHSIZE ", end of ma = %" PRIuHADDR "\n", FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Retrieve 'small data' aggregator info, if available */ H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size); #ifdef H5MF_ALLOC_DEBUG -HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); +HDfprintf(stderr, "%s: sda_addr = %" PRIuHADDR ", sda_size = %" PRIuHSIZE ", end of sda = %" PRIuHADDR "\n", FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Iterate over all the free space types that have managers and dump each free list's space */ @@ -298,7 +298,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, /* Retrieve the 'eoa' for this file memory type */ if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, atype))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), "eoa:", eoa); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3), "eoa:", eoa); /* Print header for sections */ HDfprintf(stream, "%*sSections:\n", indent + 3, ""); diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index 2d95ee9..203a55b 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -519,19 +519,19 @@ H5O__ainfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream, HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of attributes:", ainfo->nattrs); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "Track creation order of attributes:", ainfo->track_corder); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "Index creation order of attributes:", ainfo->index_corder); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Track creation order of attributes:", ainfo->track_corder ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Index creation order of attributes:", ainfo->index_corder ? "TRUE" : "FALSE"); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. creation index value:", (unsigned)ainfo->max_crt_idx); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' attribute storage fractal heap address:", ainfo->fheap_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' attribute storage name index v2 B-tree address:", ainfo->name_bt2_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' attribute storage creation order index v2 B-tree address:", ainfo->corder_bt2_addr); diff --git a/src/H5Oattr.c b/src/H5Oattr.c index e38ef5c..83a0c21 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -852,10 +852,10 @@ H5O__attr_debug(H5F_t *f, const void *_mesg, FILE * stream, int indent, int fwid HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set of Name:", s); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Object opened:", - mesg->obj_opened); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + mesg->obj_opened ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object:", mesg->oloc.addr); diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c index 6ac04c8..dad0c9c 100644 --- a/src/H5Ocache_image.c +++ b/src/H5Ocache_image.c @@ -374,10 +374,10 @@ H5O__mdci_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Metadata Cache Image Block address:", mdci->addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Metadata Cache Image Block size in bytes:", mdci->size); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Ocont.c b/src/H5Ocont.c index ad54272..2fbd89b 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -273,7 +273,7 @@ H5O__cont_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Continuation address:", cont->addr); HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, diff --git a/src/H5Odbg.c b/src/H5Odbg.c index 3c91cae..f1d1ad9 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -303,9 +303,9 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int /* debug */ HDfprintf(stream, "%*sObject Header...\n", indent, ""); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty:", - oh->cache_info.is_dirty); + oh->cache_info.is_dirty ? "TRUE" : "FALSE"); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", oh->version); @@ -370,10 +370,10 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int } /* end if */ } /* end if */ - HDfprintf(stream, "%*s%-*s %Zu (%Zu)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu (%zu)\n", indent, "", fwidth, "Number of messages (allocated):", oh->nmesgs, oh->alloc_nmesgs); - HDfprintf(stream, "%*s%-*s %Zu (%Zu)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu (%zu)\n", indent, "", fwidth, "Number of chunks (allocated):", oh->nchunks, oh->alloc_nchunks); @@ -383,7 +383,7 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int HDfprintf(stream, "%*sChunk %d...\n", indent, "", i); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3), "Address:", oh->chunk[i].addr); @@ -400,11 +400,11 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int chunk_total += chunk_size; gap_total += oh->chunk[i].gap; - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Size in bytes:", chunk_size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Gap:", oh->chunk[i].gap); } /* end for */ @@ -438,9 +438,9 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int (unsigned) (oh->mesg[i].type->id), oh->mesg[i].type->name, sequence[oh->mesg[i].type->id]++); - HDfprintf(stream, "%*s%-*s %t\n", indent + 3, "", MAX (0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", MAX (0, fwidth - 3), "Dirty:", - oh->mesg[i].dirty); + oh->mesg[i].dirty ? "TRUE" : "FALSE"); HDfprintf(stream, "%*s%-*s ", indent + 3, "", MAX (0, fwidth - 3), "Message flags:"); if(oh->mesg[i].flags) { @@ -499,7 +499,7 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int chunkno = oh->mesg[i].chunkno; if(chunkno >= oh->nchunks) HDfprintf(stream, "*** BAD CHUNK NUMBER\n"); - HDfprintf(stream, "%*s%-*s (%Zu, %Zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s (%zu, %zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3), "Raw message data (offset, size) in chunk:", (size_t)(oh->mesg[i].raw - oh->chunk[chunkno].image), oh->mesg[i].raw_size); diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index eb678e4..0f51646 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -305,7 +305,7 @@ H5O__drvinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Driver name:", mesg->name); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Buffer size:", mesg->len); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Oefl.c b/src/H5Oefl.c index b18d819..f4673dc 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -542,34 +542,34 @@ H5O__efl_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream, HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Heap address:", mesg->heap_addr); - HDfprintf(stream, "%*s%-*s %u/%u\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu/%zu\n", indent, "", fwidth, "Slots used/allocated:", mesg->nused, mesg->nalloc); for(u = 0; u < mesg->nused; u++) { char buf[64]; - HDsnprintf(buf, sizeof(buf), "File %u", (unsigned)u); + HDsnprintf(buf, sizeof(buf), "File %zu", u); HDfprintf(stream, "%*s%s:\n", indent, "", buf); HDfprintf(stream, "%*s%-*s \"%s\"\n", indent+3, "", MAX (fwidth-3, 0), "Name:", mesg->slot[u].name); - HDfprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0), + HDfprintf(stream, "%*s%-*s %zu\n", indent+3, "", MAX (fwidth-3, 0), "Name offset:", - (unsigned long)(mesg->slot[u].name_offset)); + mesg->slot[u].name_offset); - HDfprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0), + HDfprintf(stream, "%*s%-*s %" PRIdMAX "\n", indent+3, "", MAX (fwidth-3, 0), "Offset of data in file:", - (unsigned long)(mesg->slot[u].offset)); + (intmax_t)(mesg->slot[u].offset)); - HDfprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX (fwidth-3, 0), + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent+3, "", MAX (fwidth-3, 0), "Bytes reserved for data:", - (unsigned long)(mesg->slot[u].size)); + (mesg->slot[u].size)); } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5Ofill.c b/src/H5Ofill.c index cb75bc3..8a8d5c7 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -950,7 +950,7 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream, break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %Zd\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zd\n", indent, "", fwidth, "Size:", fill->size); HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:"); if(fill->type) { diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 78e8e19..dcfb1fe 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -464,24 +464,24 @@ H5O__fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream, HDfprintf(stream, "%s\n", "unknown"); } /* end switch */ - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "Free-space persist:", fsinfo->persist); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Free-space persist:", fsinfo->persist ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Free-space section threshold:", fsinfo->threshold); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "File space page size:", fsinfo->page_size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Page end metadata threshold:", fsinfo->pgend_meta_thres); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc); if(fsinfo->persist) { for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Free space manager address:", fsinfo->fs_addr[ptype-1]); } /* end if */ diff --git a/src/H5Oint.c b/src/H5Oint.c index 04220af..9816661 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -598,7 +598,7 @@ H5O_open(H5O_loc_t *loc) #ifdef H5O_DEBUG if(H5DEBUG(O)) - HDfprintf(H5DEBUG(O), "> %a\n", loc->addr); + HDfprintf(H5DEBUG(O), "> %" PRIuHADDR "\n", loc->addr); #endif /* Turn off the variable for holding file or increment open-lock counters */ @@ -834,9 +834,9 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/) #ifdef H5O_DEBUG if(H5DEBUG(O)) { if(FALSE == H5F_ID_EXISTS(loc->file) && 1 == H5F_NREFS(loc->file)) - HDfprintf(H5DEBUG(O), "< %a auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file)); + HDfprintf(H5DEBUG(O), "< %" PRIuHADDR " auto %lu remaining\n", loc->addr, (unsigned long)H5F_NOPEN_OBJS(loc->file)); else - HDfprintf(H5DEBUG(O), "< %a\n", loc->addr); + HDfprintf(H5DEBUG(O), "< %" PRIuHADDR "\n", loc->addr); } #endif diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 8e6e204..c265db1 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -1172,35 +1172,35 @@ H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, "Index Type:", "Unknown", (unsigned)mesg->u.chunk.idx_type); break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Index address:", mesg->storage.u.chunk.idx_addr); break; case H5D_CONTIGUOUS: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Contiguous"); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Data address:", mesg->storage.u.contig.addr); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Data Size:", mesg->storage.u.contig.size); break; case H5D_COMPACT: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Compact"); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data Size:", mesg->storage.u.compact.size); break; case H5D_VIRTUAL: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Virtual"); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Global heap address:", mesg->storage.u.virt.serial_list_hobjid.addr); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Global heap index:", mesg->storage.u.virt.serial_list_hobjid.idx); for(u = 0; u < mesg->storage.u.virt.list_nused; u++) { - HDfprintf(stream, "%*sMapping %u:\n", indent, "", u); + HDfprintf(stream, "%*sMapping %zu:\n", indent, "", u); HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, "Virtual selection:", "<Not yet implemented>"); HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c index a2f88d9..bb09b76 100644 --- a/src/H5Olinfo.c +++ b/src/H5Olinfo.c @@ -568,19 +568,19 @@ H5O__linfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream, HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "Track creation order of links:", linfo->track_corder); - HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth, - "Index creation order of links:", linfo->index_corder); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Track creation order of links:", linfo->track_corder ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Index creation order of links:", linfo->index_corder ? "TRUE" : "FALSE"); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of links:", linfo->nlinks); - HDfprintf(stream, "%*s%-*s %Hd\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRId64 "\n", indent, "", fwidth, "Max. creation order value:", linfo->max_corder); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' link storage fractal heap address:", linfo->fheap_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' link storage name index v2 B-tree address:", linfo->name_bt2_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "'Dense' link storage creation order index v2 B-tree address:", linfo->corder_bt2_addr); diff --git a/src/H5Olink.c b/src/H5Olink.c index 1f0c6c7..f052a53 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -822,7 +822,7 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, (lnk->type >= H5L_TYPE_UD_MIN ? "User-defined" : "Unknown"))))); if(lnk->corder_valid) - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Creation Order:", lnk->corder); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, @@ -834,7 +834,7 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, /* Display link-specific information */ switch(lnk->type) { case H5L_TYPE_HARD: - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object address:", lnk->u.hard.addr); break; @@ -852,12 +852,13 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, const char *objname = (const char *)lnk->u.ud.udata + (HDstrlen((const char *)lnk->u.ud.udata) + 1); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "External File Name:", lnk->u.ud.udata); + "External File Name:", + (const char *)lnk->u.ud.udata); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "External Object Name:", objname); } /* end if */ else { - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "User-Defined Link Size:", lnk->u.ud.size); } /* end else */ } /* end if */ diff --git a/src/H5Opline.c b/src/H5Opline.c index a956725..d886c74 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -656,7 +656,7 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %Zu/%Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu/%zu\n", indent, "", fwidth, "Number of filters:", pline->nused, pline->nalloc); @@ -680,7 +680,7 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), "Flags:", pline->filter[i].flags); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", MAX(0, fwidth - 3), + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Num CD values:", pline->filter[i].cd_nelmts); diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 33310dc..2d9361e 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -521,7 +521,7 @@ H5O__sdspace_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE * stream, HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:"); for(u = 0; u < sdim->rank; u++) - HDfprintf (stream, "%s%Hu", u?", ":"", sdim->size[u]); + HDfprintf (stream, "%s%" PRIuHSIZE, u?", ":"", sdim->size[u]); HDfprintf (stream, "}\n"); HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:"); @@ -531,7 +531,7 @@ H5O__sdspace_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE * stream, if(H5S_UNLIMITED==sdim->max[u]) HDfprintf (stream, "%sUNLIM", u?", ":""); else - HDfprintf (stream, "%s%Hu", u?", ":"", sdim->max[u]); + HDfprintf (stream, "%s%" PRIuHSIZE, u?", ":"", sdim->max[u]); } /* end for */ HDfprintf (stream, "}\n"); } /* end if */ diff --git a/src/H5Oshared.c b/src/H5Oshared.c index b49e501..6922ce3 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -733,7 +733,7 @@ H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Obj Hdr"); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object address:", mesg->u.loc.oh_addr); break; diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c index 136268a..b33a6db 100644 --- a/src/H5Oshmesg.c +++ b/src/H5Oshmesg.c @@ -238,7 +238,7 @@ H5O__shmesg_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", mesg->version); - HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, "Shared message table address:", mesg->addr); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of indexes:", mesg->nindexes); diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 0f14a4b..9432f4f 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -437,10 +437,10 @@ H5O__stab_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream, HDassert(indent >= 0); HDassert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "B-tree address:", stab->btree_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Name heap address:", stab->heap_addr); FUNC_LEAVE_NOAPI(SUCCEED) @@ -2587,19 +2587,19 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, (table->indexes[x].index_type == H5SM_LIST ? "List" : (table->indexes[x].index_type == H5SM_BTREE ? "B-Tree" : "Unknown"))); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, "Address of index:", table->indexes[x].index_addr); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, "Address of index's heap:", table->indexes[x].heap_addr); HDfprintf(stream, "%*s%-*s 0x%08x\n", indent + 3, "", fwidth, "Message type flags:", table->indexes[x].mesg_types); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, "Minimum size of messages:", table->indexes[x].min_mesg_size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, "Number of messages:", table->indexes[x].num_messages); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, "Maximum list size:", table->indexes[x].list_max); - HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, "Minimum B-tree size:", table->indexes[x].btree_min); } /* end for */ @@ -2687,17 +2687,17 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "in heap"); - HDfprintf(stream, "%*s%-*s 0x%Zx\n", indent + 3, "", fwidth, - "Heap ID:", list->messages[x].u.heap_loc.fheap_id); - HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s 0x%" PRIx64 "\n", indent + 3, "", fwidth, + "Heap ID:", list->messages[x].u.heap_loc.fheap_id.val); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent + 3, "", fwidth, "Reference count:", list->messages[x].u.heap_loc.ref_count); } /* end if */ else if(list->messages[x].location == H5SM_IN_OH) { HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "in object header"); - HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, "Object header address:", list->messages[x].u.mesg_loc.oh_addr); - HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, "Message creation index:", list->messages[x].u.mesg_loc.oh_addr); HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth, "Message type ID:", list->messages[x].msg_type_id); diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index 7f6c804..e6dc76e 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -199,12 +199,12 @@ H5SM__bt2_debug(FILE *stream, int indent, int fwidth, FUNC_ENTER_STATIC_NOERR if(sohm->location == H5SM_IN_HEAP) - HDfprintf(stream, "%*s%-*s {%a, %lo, %Hx}\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s {%" PRIu64 ", %" PRIo32 ", %" PRIxHSIZE "}\n", indent, "", fwidth, "Shared Message in heap:", - sohm->u.heap_loc.fheap_id, sohm->hash, sohm->u.heap_loc.ref_count); + sohm->u.heap_loc.fheap_id.val, sohm->hash, sohm->u.heap_loc.ref_count); else { HDassert(sohm->location == H5SM_IN_OH); - HDfprintf(stream, "%*s%-*s {%a, %lo, %Hx, %Hx}\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIo32 ", %x, %" PRIx32 "}\n", indent, "", fwidth, "Shared Message in OH:", sohm->u.mesg_loc.oh_addr, sohm->hash, sohm->msg_type_id, sohm->u.mesg_loc.index); } /* end else */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 06eb44e..db76543 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -911,15 +911,15 @@ done: \ # define CI_PRINT_STATS(STYPE,DTYPE) { \ if (H5DEBUG(T) && ((H5T_conv_hw_t *)cdata->priv)->s_aligned) { \ HDfprintf(H5DEBUG(T), \ - " %Hu src elements aligned on %lu-byte boundaries\n", \ + " %zu src elements aligned on %zu-byte boundaries\n", \ ((H5T_conv_hw_t *)cdata->priv)->s_aligned, \ - (unsigned long)H5T_NATIVE_##STYPE##_ALIGN_g); \ + H5T_NATIVE_##STYPE##_ALIGN_g); \ } \ if (H5DEBUG(T) && ((H5T_conv_hw_t *)cdata->priv)->d_aligned) { \ HDfprintf(H5DEBUG(T), \ - " %Hu dst elements aligned on %lu-byte boundaries\n", \ + " %zu dst elements aligned on %zu-byte boundaries\n", \ ((H5T_conv_hw_t *)cdata->priv)->d_aligned, \ - (unsigned long)H5T_NATIVE_##DTYPE##_ALIGN_g); \ + H5T_NATIVE_##DTYPE##_ALIGN_g); \ } \ } diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index 7af736a..6172611 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -101,16 +101,25 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/* if(H5DEBUG(T) && path->stats.ncalls > 0) { hsize_t nbytes; char bandwidth[32]; - - if(nprint && 0 == (*nprint)++) { - HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", - "Conversion", "Elmts", "Calls", "User", - "System", "Elapsed", "Bandwidth"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", - "----------", "-----", "-----", "----", - "------", "-------", "---------"); - } /* end if */ + struct { + char *user; + char *system; + char *elapsed; + } timestrs = { + H5_timer_get_time_string(path->stats.times.user), + H5_timer_get_time_string(path->stats.times.system), + H5_timer_get_time_string(path->stats.times.elapsed) + }; + + if(nprint && 0 == (*nprint)++) { + HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); + HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", + "Conversion", "Elmts", "Calls", "User", + "System", "Elapsed", "Bandwidth"); + HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", + "----------", "-----", "-----", "----", + "------", "-------", "---------"); + } /* end if */ if(path->src && path->dst) nbytes = MAX(H5T_get_size(path->src), H5T_get_size(path->dst)); @@ -120,18 +129,15 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED * path, int H5_ATTR_UNUSED * nprint/* nbytes = H5T_get_size(path->dst); else nbytes = 0; - - nbytes *= path->stats.nelmts; + nbytes *= path->stats.nelmts; H5_bandwidth(bandwidth, (double)nbytes, path->stats.times.elapsed); - HDfprintf(H5DEBUG(T), " %-16s %10Hd %10d %8T %8T %8T %10s\n", - path->name, - path->stats.nelmts, - path->stats.ncalls, - path->stats.times.user, - path->stats.times.system, - path->stats.times.elapsed, - bandwidth); - } /* end if */ + HDfprintf(H5DEBUG(T), " %-16s %10" PRIdHSIZE " %10u %8s %8s %8s %10s\n", + path->name, path->stats.nelmts, path->stats.ncalls, + timestrs.user, timestrs.system, timestrs.elapsed, bandwidth); + free(timestrs.user); + free(timestrs.system); + free(timestrs.elapsed); + } #endif FUNC_LEAVE_NOAPI(SUCCEED) @@ -137,48 +137,61 @@ H5Z_term_package(void) size_t i; if(H5DEBUG(Z)) { - for(i = 0; i < H5Z_table_used_g; i++) { - for(dir = 0; dir<2; dir++) { - if(0 == H5Z_stat_table_g[i].stats[dir].total) - continue; - - if(0 == nprint++) { - /* Print column headers */ - HDfprintf(H5DEBUG(Z), "H5Z: filter statistics " - "accumulated over life of library:\n"); - HDfprintf(H5DEBUG(Z), - " %-16s %10s %10s %8s %8s %8s %10s\n", - "Filter", "Total", "Errors", "User", - "System", "Elapsed", "Bandwidth"); - HDfprintf(H5DEBUG(Z), - " %-16s %10s %10s %8s %8s %8s %10s\n", - "------", "-----", "------", "----", - "------", "-------", "---------"); - } /* end if */ - - /* Truncate the comment to fit in the field */ - HDstrncpy(comment, H5Z_table_g[i].name, sizeof comment); - comment[sizeof(comment) - 1] = '\0'; - - /* - * Format bandwidth to have four significant digits and - * units of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or - * the word `Inf' if the elapsed time is zero. - */ - H5_bandwidth(bandwidth, (double)(H5Z_stat_table_g[i].stats[dir].total), - H5Z_stat_table_g[i].stats[dir].times.elapsed); - - /* Print the statistics */ - HDfprintf(H5DEBUG(Z), " %s%-15s %10Hd %10Hd %8T %8T %8T %10s\n", - (dir ? "<" : ">"), comment, - H5Z_stat_table_g[i].stats[dir].total, - H5Z_stat_table_g[i].stats[dir].errors, - H5Z_stat_table_g[i].stats[dir].times.user, - H5Z_stat_table_g[i].stats[dir].times.system, - H5Z_stat_table_g[i].stats[dir].times.elapsed, - bandwidth); - } /* end for */ - } /* end for */ + for(i = 0; i < H5Z_table_used_g; i++) for (dir = 0; dir<2; dir++) { + struct { + char *user; + char *system; + char *elapsed; + } timestrs = { + H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.user), + H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.system), + H5_timer_get_time_string(H5Z_stat_table_g[i].stats[dir].times.elapsed) + }; + if(0 == H5Z_stat_table_g[i].stats[dir].total) + goto next; + + if(0 == nprint++) { + /* Print column headers */ + HDfprintf(H5DEBUG(Z), "H5Z: filter statistics " + "accumulated over life of library:\n"); + HDfprintf(H5DEBUG(Z), + " %-16s %10s %10s %8s %8s %8s %10s\n", + "Filter", "Total", "Errors", "User", + "System", "Elapsed", "Bandwidth"); + HDfprintf(H5DEBUG(Z), + " %-16s %10s %10s %8s %8s %8s %10s\n", + "------", "-----", "------", "----", + "------", "-------", "---------"); + } /* end if */ + + /* Truncate the comment to fit in the field */ + HDstrncpy(comment, H5Z_table_g[i].name, sizeof comment); + comment[sizeof(comment) - 1] = '\0'; + + /* + * Format bandwidth to have four significant digits and + * units of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or + * the word `Inf' if the elapsed time is zero. + */ + H5_bandwidth(bandwidth, (double)(H5Z_stat_table_g[i].stats[dir].total), + H5Z_stat_table_g[i].stats[dir].times.elapsed); + + /* Print the statistics */ + HDfprintf(H5DEBUG(Z), + " %s%-15s %10" PRIdHSIZE " %10" PRIdHSIZE + " %8s %8s %8s %10s\n", + (dir ? "<" : ">"), comment, + H5Z_stat_table_g[i].stats[dir].total, + H5Z_stat_table_g[i].stats[dir].errors, + timestrs.user, + timestrs.system, + timestrs.elapsed, + bandwidth); +next: + free(timestrs.user); + free(timestrs.system); + free(timestrs.elapsed); + } /* end for */ } /* end if */ #endif /* H5Z_DEBUG */ diff --git a/src/H5dbg.c b/src/H5dbg.c index 4939bca..4878884 100644 --- a/src/H5dbg.c +++ b/src/H5dbg.c @@ -100,7 +100,7 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, for(u = 0; u < buf_size; u += 16) { uint8_t c; - HDfprintf(stream, "%*s %8d: ", indent, "", u + buf_offset); + HDfprintf(stream, "%*s %8zu: ", indent, "", u + buf_offset); /* Print the hex values */ for(v = 0; v < 16; v++) { diff --git a/src/H5private.h b/src/H5private.h index 836d7d5..3c21d3e 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -687,6 +687,11 @@ typedef struct { #ifndef HDacos #define HDacos(X) acos(X) #endif /* HDacos */ +#ifndef HDvasprintf +# ifdef H5_HAVE_VASPRINTF +# define HDvasprintf(RET,FMT,A) vasprintf(RET,FMT,A) +# endif /* H5_HAVE_VASPRINTF */ +#endif /* HDvasprintf */ #ifndef HDalarm #ifdef H5_HAVE_ALARM #define HDalarm(N) alarm(N) @@ -912,10 +917,12 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDfork #define HDfork() fork() #endif /* HDfork */ +#ifndef HDfprintf +#define HDfprintf fprintf +#endif #ifndef HDfpathconf #define HDfpathconf(F,N) fpathconf(F,N) #endif /* HDfpathconf */ -H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #ifndef HDfputc #define HDfputc(C,F) fputc(C,F) #endif /* HDfputc */ @@ -1248,7 +1255,7 @@ typedef off_t h5_stat_size_t; #define HDpread(F,B,C,O) pread(F,B,C,O) #endif /* HDpread */ #ifndef HDprintf - #define HDprintf(...) HDfprintf(stdout, __VA_ARGS__) + #define HDprintf printf #endif /* HDprintf */ #ifndef HDputc #define HDputc(C,F) putc(C,F) @@ -1610,9 +1617,6 @@ typedef off_t h5_stat_size_t; #ifndef HDva_start #define HDva_start(A,P) va_start(A,P) #endif /* HDva_start */ -#ifndef HDvasprintf - #define HDvasprintf(RET,FMT,A) vasprintf(RET,FMT,A) -#endif /* HDvasprintf */ #ifndef HDvfprintf #define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A) #endif /* HDvfprintf */ diff --git a/src/H5public.h b/src/H5public.h index 93cb2ea..68f6e02 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -177,42 +177,82 @@ typedef long long ssize_t; #endif #endif +/* int64_t type is used for creation order field for links. It may be + * defined in Posix.1g, otherwise it is defined here. + */ +#if H5_SIZEOF_INT64_T>=8 +#elif H5_SIZEOF_INT>=8 + typedef int int64_t; +# undef H5_SIZEOF_INT64_T +# define H5_SIZEOF_INT64_T H5_SIZEOF_INT +#elif H5_SIZEOF_LONG>=8 + typedef long int64_t; +# undef H5_SIZEOF_INT64_T +# define H5_SIZEOF_INT64_T H5_SIZEOF_LONG +#elif H5_SIZEOF_LONG_LONG>=8 + typedef long long int64_t; +# undef H5_SIZEOF_INT64_T +# define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG +#else +# error "nothing appropriate for int64_t" +#endif + +/* uint64_t type is used for fields for H5O_info_t. It may be + * defined in Posix.1g, otherwise it is defined here. + */ +#if H5_SIZEOF_UINT64_T>=8 +#elif H5_SIZEOF_INT>=8 + typedef unsigned uint64_t; +# undef H5_SIZEOF_UINT64_T +# define H5_SIZEOF_UINT64_T H5_SIZEOF_INT +#elif H5_SIZEOF_LONG>=8 + typedef unsigned long uint64_t; +# undef H5_SIZEOF_UINT64_T +# define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG +#elif H5_SIZEOF_LONG_LONG>=8 + typedef unsigned long long uint64_t; +# undef H5_SIZEOF_UINT64_T +# define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG +#else +# error "nothing appropriate for uint64_t" +#endif + /* * The sizes of file objects have their own types defined here, use a 64-bit * type. */ -#if H5_SIZEOF_LONG_LONG >= 8 -H5_GCC_DIAG_OFF(long-long) -typedef unsigned long long hsize_t; -typedef signed long long hssize_t; -H5_GCC_DIAG_ON(long-long) -# define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG -# define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG -#else -# error "nothing appropriate for hsize_t" -#endif -#define HSIZE_UNDEF ((hsize_t)(hssize_t)(-1)) +typedef uint64_t hsize_t; +typedef int64_t hssize_t; +#define PRIXHSIZE PRIX64 +#define PRIdHSIZE PRId64 +#define PRIiHSIZE PRIi64 +#define PRIoHSIZE PRIo64 +#define PRIuHSIZE PRIu64 +#define PRIxHSIZE PRIx64 +#define H5_SIZEOF_HSIZE_T H5_SIZEOF_UINT64_T +#define H5_SIZEOF_HSSIZE_T H5_SIZEOF_INT64_T +#define HSIZE_UNDEF UINT64_MAX /* * File addresses have their own types. */ #if H5_SIZEOF_INT >= 8 typedef unsigned haddr_t; -# define HADDR_UNDEF ((haddr_t)(-1)) +# define HADDR_UNDEF UINT_MAX # define H5_SIZEOF_HADDR_T H5_SIZEOF_INT # ifdef H5_HAVE_PARALLEL # define HADDR_AS_MPI_TYPE MPI_UNSIGNED # endif /* H5_HAVE_PARALLEL */ #elif H5_SIZEOF_LONG >= 8 typedef unsigned long haddr_t; -# define HADDR_UNDEF ((haddr_t)(long)(-1)) +# define HADDR_UNDEF ULONG_MAX # define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG # ifdef H5_HAVE_PARALLEL # define HADDR_AS_MPI_TYPE MPI_UNSIGNED_LONG # endif /* H5_HAVE_PARALLEL */ #elif H5_SIZEOF_LONG_LONG >= 8 typedef unsigned long long haddr_t; -# define HADDR_UNDEF ((haddr_t)(long long)(-1)) +# define HADDR_UNDEF ULLONG_MAX # define H5_SIZEOF_HADDR_T H5_SIZEOF_LONG_LONG # ifdef H5_HAVE_PARALLEL # define HADDR_AS_MPI_TYPE MPI_LONG_LONG_INT @@ -221,14 +261,24 @@ H5_GCC_DIAG_ON(long-long) # error "nothing appropriate for haddr_t" #endif #if H5_SIZEOF_HADDR_T == H5_SIZEOF_INT -# define H5_PRINTF_HADDR_FMT "%u" +# define PRIXHADDR "X" +# define PRIoHADDR "o" +# define PRIuHADDR "u" +# define PRIxHADDR "x" #elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG -# define H5_PRINTF_HADDR_FMT "%lu" +# define PRIXHADDR "lX" +# define PRIoHADDR "lo" +# define PRIuHADDR "lu" +# define PRIxHADDR "lx" #elif H5_SIZEOF_HADDR_T == H5_SIZEOF_LONG_LONG -# define H5_PRINTF_HADDR_FMT "%" H5_PRINTF_LL_WIDTH "u" +# define PRIXHADDR H5_PRINTF_LL_WIDTH "X" +# define PRIoHADDR H5_PRINTF_LL_WIDTH "o" +# define PRIuHADDR H5_PRINTF_LL_WIDTH "u" +# define PRIxHADDR H5_PRINTF_LL_WIDTH "x" #else # error "nothing appropriate for H5_PRINTF_HADDR_FMT" #endif +#define H5_PRINTF_HADDR_FMT "%" PRIuHADDR #define HADDR_MAX (HADDR_UNDEF-1) /* uint32_t type is used for creation order field for messages. It may be @@ -251,46 +301,6 @@ H5_GCC_DIAG_ON(long-long) # error "nothing appropriate for uint32_t" #endif -/* int64_t type is used for creation order field for links. It may be - * defined in Posix.1g, otherwise it is defined here. - */ -#if H5_SIZEOF_INT64_T>=8 -#elif H5_SIZEOF_INT>=8 - typedef int int64_t; -# undef H5_SIZEOF_INT64_T -# define H5_SIZEOF_INT64_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG>=8 - typedef long int64_t; -# undef H5_SIZEOF_INT64_T -# define H5_SIZEOF_INT64_T H5_SIZEOF_LONG -#elif H5_SIZEOF_LONG_LONG>=8 - typedef long long int64_t; -# undef H5_SIZEOF_INT64_T -# define H5_SIZEOF_INT64_T H5_SIZEOF_LONG_LONG -#else -# error "nothing appropriate for int64_t" -#endif - -/* uint64_t type is used for fields for H5O_info_t. It may be - * defined in Posix.1g, otherwise it is defined here. - */ -#if H5_SIZEOF_UINT64_T>=8 -#elif H5_SIZEOF_INT>=8 - typedef unsigned uint64_t; -# undef H5_SIZEOF_UINT64_T -# define H5_SIZEOF_UINT64_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG>=8 - typedef unsigned long uint64_t; -# undef H5_SIZEOF_UINT64_T -# define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG -#elif H5_SIZEOF_LONG_LONG>=8 - typedef unsigned long long uint64_t; -# undef H5_SIZEOF_UINT64_T -# define H5_SIZEOF_UINT64_T H5_SIZEOF_LONG_LONG -#else -# error "nothing appropriate for uint64_t" -#endif - /* Common iteration orders */ typedef enum { H5_ITER_UNKNOWN = -1, /* Unknown order */ diff --git a/src/H5system.c b/src/H5system.c index b3db39c..f5c3fae 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -73,407 +73,28 @@ /* Track whether tzset routine was called */ static hbool_t H5_ntzset = FALSE; - -/*------------------------------------------------------------------------- - * Function: HDfprintf - * - * Purpose: Prints the optional arguments under the control of the format - * string FMT to the stream STREAM. This function takes the - * same format as fprintf(3c) with a few added features: - * - * The conversion modifier `H' refers to the size of an - * `hsize_t' or `hssize_t' type. For instance, "0x%018Hx" - * prints an `hsize_t' value as a hex number right justified and - * zero filled in an 18-character field. - * - * The conversion 'a' refers to an haddr_t type. - * - * The conversion 't' refers to an htri_t type. - * - * The conversion 'k' refers to an H5O_token_t type. - * - * Return: Success: Number of characters printed - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Thursday, April 9, 1998 - * - *------------------------------------------------------------------------- +/* HDvasprintf provides vasprintf-like function on targets where it is + * unavailable. */ -/* Disable warning for "format not a string literal" here -QAK */ -/* - * This pragma only needs to surround the fprintf() calls with - * format_templ in the code below, but early (4.4.7, at least) gcc only - * allows diagnostic pragmas to be toggled outside of functions. - */ -H5_GCC_DIAG_OFF(format-nonliteral) int -HDfprintf(FILE *stream, const char *fmt, ...) +HDvasprintf(char **bufp, const char *fmt, va_list ap) { - int n=0, nout = 0; - int fwidth, prec; - int zerofill; - int leftjust; - int plussign; - int ldspace; - int prefix; - char modifier[8]; - int conv; - char *rest, format_templ[128]; - int len; - const char *s; - va_list ap; - - HDassert(stream); - HDassert(fmt); - - HDva_start (ap, fmt); - while (*fmt) { - fwidth = prec = 0; - zerofill = 0; - leftjust = 0; - plussign = 0; - prefix = 0; - ldspace = 0; - modifier[0] = '\0'; - - if ('%'==fmt[0] && '%'==fmt[1]) { - HDputc ('%', stream); - fmt += 2; - nout++; - } else if ('%'==fmt[0]) { - s = fmt + 1; - - /* Flags */ - while(HDstrchr("-+ #", *s)) { - switch(*s) { - case '-': - leftjust = 1; - break; - - case '+': - plussign = 1; - break; - - case ' ': - ldspace = 1; - break; - - case '#': - prefix = 1; - break; - - default: - HDassert(0 && "Unknown format flag"); - } /* end switch */ /*lint !e744 Switch statement doesn't _need_ default */ - s++; - } /* end while */ - - /* Field width */ - if(HDisdigit(*s)) { - zerofill = ('0' == *s); - fwidth = (int)HDstrtol (s, &rest, 10); - s = rest; - } /* end if */ - else if ('*'==*s) { - fwidth = HDva_arg(ap, int); - if(fwidth < 0) { - leftjust = 1; - fwidth = -fwidth; - } - s++; - } - - /* Precision */ - if('.'==*s) { - s++; - if(HDisdigit(*s)) { - prec = (int)HDstrtol(s, &rest, 10); - s = rest; - } else if('*'==*s) { - prec = HDva_arg(ap, int); - s++; - } - if(prec < 1) - prec = 1; - } - - /* Extra type modifiers */ - if(HDstrchr("zZHhlqLI", *s)) { - switch(*s) { - /*lint --e{506} Don't issue warnings about constant value booleans */ - /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */ - case 'H': - if(sizeof(hsize_t) < sizeof(long)) - modifier[0] = '\0'; - else if(sizeof(hsize_t) == sizeof(long)) { - HDstrncpy(modifier, "l", sizeof(modifier)); - modifier[sizeof(modifier) - 1] = '\0'; - } /* end if */ - else { - HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, sizeof(modifier)); - modifier[sizeof(modifier) - 1] = '\0'; - } /* end else */ - break; - - case 'Z': - case 'z': - if(sizeof(size_t) < sizeof(long)) - modifier[0] = '\0'; - else if(sizeof(size_t) == sizeof(long)) { - HDstrncpy(modifier, "l", sizeof(modifier)); - modifier[sizeof(modifier) - 1] = '\0'; - } /* end if */ - else { - HDstrncpy(modifier, H5_PRINTF_LL_WIDTH, sizeof(modifier)); - modifier[sizeof(modifier) - 1] = '\0'; - } /* end else */ - break; - - default: - /* Handle 'I64' modifier for Microsoft's "__int64" type */ - if(*s=='I' && *(s+1)=='6' && *(s+2)=='4') { - modifier[0] = *s; - modifier[1] = *(s+1); - modifier[2] = *(s+2); - modifier[3] = '\0'; - s += 2; /* Increment over 'I6', the '4' is taken care of below */ - } /* end if */ - else { - /* Handle 'll' for long long types */ - if(*s=='l' && *(s+1)=='l') { - modifier[0] = *s; - modifier[1] = *s; - modifier[2] = '\0'; - s++; /* Increment over first 'l', second is taken care of below */ - } /* end if */ - else { - modifier[0] = *s; - modifier[1] = '\0'; - } /* end else */ - } /* end else */ - break; - } - s++; - } - - /* Conversion */ - conv = *s++; - - /* Create the format template */ - len = 0; - len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)), "%%%s%s%s%s%s", (leftjust ? "-" : ""), - (plussign ? "+" : ""), (ldspace ? " " : ""), - (prefix ? "#" : ""), (zerofill ? "0" : "")); - if(fwidth > 0) - len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth); - if(prec > 0) - len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), ".%d", prec); - if(*modifier) - len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%s", modifier); - HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%c", conv); - - /* Conversion */ - switch (conv) { - case 'd': - case 'i': - if(!HDstrcmp(modifier, "h")) { - short x = (short)HDva_arg(ap, int); - n = fprintf(stream, format_templ, x); - } else if(!*modifier) { - int x = HDva_arg(ap, int); - n = fprintf(stream, format_templ, x); - } else if(!HDstrcmp(modifier, "l")) { - long x = HDva_arg(ap, long); - n = fprintf(stream, format_templ, x); - } else { - int64_t x = HDva_arg(ap, int64_t); - n = fprintf(stream, format_templ, x); - } - break; - - case 'o': - case 'u': - case 'x': - case 'X': - if(!HDstrcmp(modifier, "h")) { - unsigned short x = (unsigned short)HDva_arg(ap, unsigned int); - n = fprintf(stream, format_templ, x); - } else if(!*modifier) { - unsigned int x = HDva_arg(ap, unsigned int); - n = fprintf(stream, format_templ, x); - } else if(!HDstrcmp(modifier, "l")) { - unsigned long x = HDva_arg(ap, unsigned long); - n = fprintf(stream, format_templ, x); - } else { - uint64_t x = HDva_arg(ap, uint64_t); - n = fprintf(stream, format_templ, x); - } - break; - - case 'f': - case 'e': - case 'E': - case 'g': - case 'G': - if(!HDstrcmp(modifier, "h")) { - float x = (float)HDva_arg(ap, double); - n = fprintf(stream, format_templ, (double)x); - } else if(!*modifier || !HDstrcmp(modifier, "l")) { - double x = HDva_arg(ap, double); - n = fprintf(stream, format_templ, x); - } else { - /* - * Some compilers complain when `long double' and - * `double' are the same thing. - */ -#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE - long double x = HDva_arg(ap, long double); - n = fprintf(stream, format_templ, x); -#else - double x = HDva_arg(ap, double); - n = fprintf(stream, format_templ, x); -#endif - } - break; - - case 'a': - { - haddr_t x = HDva_arg(ap, haddr_t); - - if(H5F_addr_defined(x)) { - len = 0; - len += HDsnprintf(format_templ, (sizeof(format_templ) - (size_t)(len + 1)), "%%%s%s%s%s%s", - (leftjust ? "-" : ""), (plussign ? "+" : ""), - (ldspace ? " " : ""), (prefix ? "#" : ""), - (zerofill ? "0" : "")); - if(fwidth > 0) - len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth); - - /*lint --e{506} Don't issue warnings about constant value booleans */ - /*lint --e{774} Don't issue warnings boolean within 'if' always evaluates false/true */ - if(sizeof(x) == H5_SIZEOF_INT) { - HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1))); - len++; - } /* end if */ - else if(sizeof(x) == H5_SIZEOF_LONG) { - HDstrncat(format_templ, "lu", (sizeof(format_templ) - (size_t)(len + 1))); - len++; - } /* end if */ - else if(sizeof(x) == H5_SIZEOF_LONG_LONG) { - HDstrncat(format_templ, H5_PRINTF_LL_WIDTH, (sizeof(format_templ) - (size_t)(len + 1))); - len += (int)sizeof(H5_PRINTF_LL_WIDTH); - HDstrncat(format_templ, "u", (sizeof(format_templ) - (size_t)(len + 1))); - len++; - } - n = fprintf(stream, format_templ, x); - } else { - len = 0; - HDstrncpy(format_templ, "%", (sizeof(format_templ) - (size_t)(len + 1))); - len++; - if(leftjust) { - HDstrncat(format_templ, "-", (sizeof(format_templ) - (size_t)(len + 1))); - len++; - } /* end if */ - if(fwidth) - len += HDsnprintf(format_templ + len, (sizeof(format_templ) - (size_t)(len + 1)), "%d", fwidth); - HDstrncat(format_templ, "s", (sizeof(format_templ) - (size_t)(len + 1))); - n = fprintf(stream, format_templ, "UNDEF"); - } - } - break; - - case 'c': - { - char x = (char)HDva_arg(ap, int); - n = fprintf(stream, format_templ, x); - } - break; - - case 's': - case 'p': - { - char *x = HDva_arg(ap, char*); - n = fprintf(stream, format_templ, x); - } - break; - - case 'n': - format_templ[HDstrlen(format_templ) - 1] = 'u'; - n = fprintf(stream, format_templ, nout); - break; - - case 't': - { - htri_t tri_var = HDva_arg(ap, htri_t); - - if(tri_var > 0) - n = fprintf(stream, "TRUE"); - else if(!tri_var) - n = fprintf(stream, "FALSE"); - else - n = fprintf(stream, "FAIL(%d)", (int)tri_var); - } - break; - - case 'T': /* Elapsed time, in seconds */ - { - double seconds = HDva_arg(ap, double); - char *time_string = H5_timer_get_time_string(seconds); - - if(time_string) { - n = fprintf(stream, format_templ, time_string); - HDfree(time_string); - } /* end if */ - else - n = fprintf(stream, format_templ, "(error)"); - } - break; - - case 'k': - { - H5O_token_t token = HDva_arg(ap, H5O_token_t); - - /* Print the raw token. */ - n = fprintf(stream, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", - (unsigned char)token.__data[15], - (unsigned char)token.__data[14], - (unsigned char)token.__data[13], - (unsigned char)token.__data[12], - (unsigned char)token.__data[11], - (unsigned char)token.__data[10], - (unsigned char)token.__data[9], - (unsigned char)token.__data[8], - (unsigned char)token.__data[7], - (unsigned char)token.__data[6], - (unsigned char)token.__data[5], - (unsigned char)token.__data[4], - (unsigned char)token.__data[3], - (unsigned char)token.__data[2], - (unsigned char)token.__data[1], - (unsigned char)token.__data[0] - ); - } - break; - - default: - HDfputs(format_templ, stream); - n = (int)HDstrlen(format_templ); - break; - } - nout += n; - fmt = s; - } else { - HDputc(*fmt, stream); - fmt++; - nout++; + char *buf; /* buffer to receive formatted string */ + size_t bufsz; /* size of buffer to allocate */ + + for (bufsz = 32; (buf = HDmalloc(bufsz)) != NULL; ) { + const int ret = HDvsnprintf(buf, bufsz, fmt, ap); + if (ret >= 0 && (size_t)ret < bufsz) { + *bufp = buf; + return ret; } + HDfree(buf); + if (ret < 0) + return ret; + bufsz = (size_t)ret + 1; } - HDva_end(ap); - return nout; -} /* end HDfprintf() */ -H5_GCC_DIAG_ON(format-nonliteral) + return -1; +} /*------------------------------------------------------------------------- diff --git a/src/H5trace.c b/src/H5trace.c index 91019a4..ba8ba94 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -269,7 +269,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { haddr_t addr = HDva_arg(ap, haddr_t); - HDfprintf(out, "%a", addr); + HDfprintf(out, "%" PRIuHADDR, addr); } /* end else */ break; @@ -1179,7 +1179,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if(H5S_UNLIMITED == p[i]) HDfprintf(out, "%sH5S_UNLIMITED", (i ? ", " : "")); else - HDfprintf(out, "%s%Hu", (i ? ", " : ""), p[i]); + HDfprintf(out, "%s%" PRIuHSIZE, (i ? ", " : ""), p[i]); } /* end for */ HDfprintf(out, "}"); } /* end if */ @@ -1193,7 +1193,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if(H5S_UNLIMITED == hsize) HDfprintf(out, "H5S_UNLIMITED"); else { - HDfprintf(out, "%Hu", hsize); + HDfprintf(out, "%" PRIuHSIZE, hsize); asize[argno] = (hssize_t)hsize; } /* end else */ } /* end else */ @@ -1210,7 +1210,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, " {"); for(i = 0; i < asize[asize_idx]; i++) - HDfprintf(out, "%s%Hd", (i ? ", " : ""), p[i]); + HDfprintf(out, "%s%" PRIdHSIZE, (i ? ", " : ""), p[i]); HDfprintf(out, "}"); } /* end if */ } /* end if */ @@ -1220,7 +1220,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { hssize_t hssize = HDva_arg(ap, hssize_t); - HDfprintf(out, "%Hd", hssize); + HDfprintf(out, "%" PRIdHSIZE, hssize); asize[argno] = (hssize_t)hssize; } /* end else */ break; @@ -1899,7 +1899,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { hobj_ref_t ref = HDva_arg(ap, hobj_ref_t); - HDfprintf(out, "Reference Object=%a", ref); + HDfprintf(out, "Reference Object=%" PRIuHADDR, ref); } /* end else */ break; @@ -3562,7 +3562,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, " {"); for(i = 0; i < asize[asize_idx]; i++) - HDfprintf(out, "%s%Zu", (i ? ", " : ""), p[i]); + HDfprintf(out, "%s%zu", (i ? ", " : ""), p[i]); HDfprintf(out, "}"); } /* end if */ } /* end if */ @@ -3572,7 +3572,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { size_t size = HDva_arg(ap, size_t); - HDfprintf(out, "%Zu", size); + HDfprintf(out, "%zu", size); asize[argno] = (hssize_t)size; } /* end else */ break; @@ -3668,7 +3668,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, " {"); for(i = 0; i < asize[asize_idx]; i++) - HDfprintf(out, "%s%Zd", (i ? ", " : ""), p[i]); + HDfprintf(out, "%s%zd", (i ? ", " : ""), p[i]); HDfprintf(out, "}"); } /* end if */ } /* end if */ @@ -3678,7 +3678,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) else { ssize_t ssize = HDva_arg(ap, ssize_t); - HDfprintf(out, "%Zd", ssize); + HDfprintf(out, "%zd", ssize); asize[argno] = (hssize_t)ssize; } /* end else */ break; |