summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2021-09-15 07:19:01 +0000
committerPeter Eisentraut2021-09-15 07:19:01 +0000
commite03b807e12bbb72d53ed53502dfb2c1e063e467c (patch)
treeeaf2b7dae7e45b0c876c3d42f69a890875ca3c6f
parentf7e56f1f540fbef204a03094b97ddfe908c44070 (diff)
Fix incorrect format placeholders
Also remove obsolete comments about why the 64-bit integers need to be printed in a separate buffer. The reason used to be portability, but now the remaining reason is that we need the string lengths for the progress displays. That is evident by looking at the code right below, so a new comment doesn't seem necessary.
-rw-r--r--src/bin/pg_amcheck/pg_amcheck.c13
-rw-r--r--src/bin/pg_basebackup/pg_basebackup.c9
-rw-r--r--src/bin/pg_rewind/pg_rewind.c9
3 files changed, 8 insertions, 23 deletions
diff --git a/src/bin/pg_amcheck/pg_amcheck.c b/src/bin/pg_amcheck/pg_amcheck.c
index f4b1ef95e9..9b6ab24810 100644
--- a/src/bin/pg_amcheck/pg_amcheck.c
+++ b/src/bin/pg_amcheck/pg_amcheck.c
@@ -1226,15 +1226,10 @@ progress_report(uint64 relations_total, uint64 relations_checked,
if (relpages_total)
percent_pages = (int) (relpages_checked * 100 / relpages_total);
- /*
- * Separate step to keep platform-dependent format code out of fprintf
- * calls. We only test for INT64_FORMAT availability in snprintf, not
- * fprintf.
- */
- snprintf(checked_rel, sizeof(checked_rel), INT64_FORMAT, relations_checked);
- snprintf(total_rel, sizeof(total_rel), INT64_FORMAT, relations_total);
- snprintf(checked_pages, sizeof(checked_pages), INT64_FORMAT, relpages_checked);
- snprintf(total_pages, sizeof(total_pages), INT64_FORMAT, relpages_total);
+ snprintf(checked_rel, sizeof(checked_rel), UINT64_FORMAT, relations_checked);
+ snprintf(total_rel, sizeof(total_rel), UINT64_FORMAT, relations_total);
+ snprintf(checked_pages, sizeof(checked_pages), UINT64_FORMAT, relpages_checked);
+ snprintf(total_pages, sizeof(total_pages), UINT64_FORMAT, relpages_total);
#define VERBOSE_DATNAME_LENGTH 35
if (opts.verbose)
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c
index 7296eb97d0..669aa207a3 100644
--- a/src/bin/pg_basebackup/pg_basebackup.c
+++ b/src/bin/pg_basebackup/pg_basebackup.c
@@ -804,14 +804,9 @@ progress_report(int tablespacenum, const char *filename,
if (totaldone / 1024 > totalsize_kb)
totalsize_kb = totaldone / 1024;
- /*
- * Separate step to keep platform-dependent format code out of
- * translatable strings. And we only test for INT64_FORMAT availability
- * in snprintf, not fprintf.
- */
- snprintf(totaldone_str, sizeof(totaldone_str), INT64_FORMAT,
+ snprintf(totaldone_str, sizeof(totaldone_str), UINT64_FORMAT,
totaldone / 1024);
- snprintf(totalsize_str, sizeof(totalsize_str), INT64_FORMAT, totalsize_kb);
+ snprintf(totalsize_str, sizeof(totalsize_str), UINT64_FORMAT, totalsize_kb);
#define VERBOSE_FILENAME_LENGTH 35
if (verbose)
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 2ac4910778..69ea214337 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -759,14 +759,9 @@ progress_report(bool finished)
if (fetch_done > fetch_size)
fetch_size = fetch_done;
- /*
- * Separate step to keep platform-dependent format code out of
- * translatable strings. And we only test for INT64_FORMAT availability
- * in snprintf, not fprintf.
- */
- snprintf(fetch_done_str, sizeof(fetch_done_str), INT64_FORMAT,
+ snprintf(fetch_done_str, sizeof(fetch_done_str), UINT64_FORMAT,
fetch_done / 1024);
- snprintf(fetch_size_str, sizeof(fetch_size_str), INT64_FORMAT,
+ snprintf(fetch_size_str, sizeof(fetch_size_str), UINT64_FORMAT,
fetch_size / 1024);
fprintf(stderr, _("%*s/%s kB (%d%%) copied"),