diff options
| author | Peter Eisentraut <peter@eisentraut.org> | 2025-12-09 06:58:39 +0100 |
|---|---|---|
| committer | Peter Eisentraut <peter@eisentraut.org> | 2025-12-09 07:33:08 +0100 |
| commit | 2b117bb014d066549c319dcd73bd538e32b0c408 (patch) | |
| tree | 3241b0bd942cdcb6bbaac7b83dcb06aabb042e81 /src/bin | |
| parent | 0c3c5c3b06a37c13a811ea93044202e06523b705 (diff) | |
Remove unnecessary casts in printf format arguments (%zu/%zd)
Many of these are probably left over from before use of %zu/%zd was
portable.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/07fa29f9-42d7-4aac-8834-197918cbbab6%40eisentraut.org
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/pg_combinebackup/write_manifest.c | 4 | ||||
| -rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.c | 10 | ||||
| -rw-r--r-- | src/bin/pg_rewind/libpq_source.c | 2 | ||||
| -rw-r--r-- | src/bin/pg_rewind/local_source.c | 4 | ||||
| -rw-r--r-- | src/bin/pg_rewind/pg_rewind.c | 4 |
5 files changed, 11 insertions, 13 deletions
diff --git a/src/bin/pg_combinebackup/write_manifest.c b/src/bin/pg_combinebackup/write_manifest.c index 819a3fd0b7a..c845175a82c 100644 --- a/src/bin/pg_combinebackup/write_manifest.c +++ b/src/bin/pg_combinebackup/write_manifest.c @@ -259,8 +259,8 @@ flush_manifest(manifest_writer *mwriter) if (wb < 0) pg_fatal("could not write file \"%s\": %m", mwriter->pathname); else - pg_fatal("could not write file \"%s\": wrote %d of %d", - mwriter->pathname, (int) wb, mwriter->buf.len); + pg_fatal("could not write file \"%s\": wrote %zd of %d", + mwriter->pathname, wb, mwriter->buf.len); } if (mwriter->still_checksumming && diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index c84b017f21b..4a63f7392ae 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -1346,8 +1346,8 @@ PrintTOCSummary(Archive *AHX) ahprintf(AH, "; Dump Version: %d.%d-%d\n", ARCHIVE_MAJOR(AH->version), ARCHIVE_MINOR(AH->version), ARCHIVE_REV(AH->version)); ahprintf(AH, "; Format: %s\n", fmtName); - ahprintf(AH, "; Integer: %d bytes\n", (int) AH->intSize); - ahprintf(AH, "; Offset: %d bytes\n", (int) AH->offSize); + ahprintf(AH, "; Integer: %zu bytes\n", AH->intSize); + ahprintf(AH, "; Offset: %zu bytes\n", AH->offSize); if (AH->archiveRemoteVersion) ahprintf(AH, "; Dumped from database version: %s\n", AH->archiveRemoteVersion); @@ -2307,8 +2307,7 @@ _discoverArchiveFormat(ArchiveHandle *AH) if (ferror(fh)) pg_fatal("could not read input file: %m"); else - pg_fatal("input file is too short (read %lu, expected 5)", - (unsigned long) cnt); + pg_fatal("input file is too short (read %zu, expected 5)", cnt); } /* Save it, just in case we need it later */ @@ -4185,8 +4184,7 @@ ReadHead(ArchiveHandle *AH) AH->intSize = AH->ReadBytePtr(AH); if (AH->intSize > 32) - pg_fatal("sanity check on integer size (%lu) failed", - (unsigned long) AH->intSize); + pg_fatal("sanity check on integer size (%zu) failed", AH->intSize); if (AH->intSize > sizeof(int)) pg_log_warning("archive was made on a machine with larger integers, some operations might fail"); diff --git a/src/bin/pg_rewind/libpq_source.c b/src/bin/pg_rewind/libpq_source.c index e80edb7077e..575585357b7 100644 --- a/src/bin/pg_rewind/libpq_source.c +++ b/src/bin/pg_rewind/libpq_source.c @@ -459,7 +459,7 @@ process_queued_fetch_requests(libpq_source *src) appendArrayEscapedString(&src->paths, rq->path); appendStringInfo(&src->offsets, INT64_FORMAT, (int64) rq->offset); - appendStringInfo(&src->lengths, INT64_FORMAT, (int64) rq->length); + appendStringInfo(&src->lengths, "%zu", rq->length); } appendStringInfoChar(&src->paths, '}'); appendStringInfoChar(&src->offsets, '}'); diff --git a/src/bin/pg_rewind/local_source.c b/src/bin/pg_rewind/local_source.c index 5a6e805c158..8db1a8c44aa 100644 --- a/src/bin/pg_rewind/local_source.c +++ b/src/bin/pg_rewind/local_source.c @@ -112,8 +112,8 @@ local_queue_fetch_file(rewind_source *source, const char *path, size_t len) * check that the size of the file matches our earlier expectation. */ if (written_len != len) - pg_fatal("size of source file \"%s\" changed concurrently: %d bytes expected, %d copied", - srcpath, (int) len, (int) written_len); + pg_fatal("size of source file \"%s\" changed concurrently: %zu bytes expected, %zu copied", + srcpath, len, written_len); if (close(srcfd) != 0) pg_fatal("could not close file \"%s\": %m", srcpath); diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c index e9364d04f76..7837e01d83d 100644 --- a/src/bin/pg_rewind/pg_rewind.c +++ b/src/bin/pg_rewind/pg_rewind.c @@ -1035,8 +1035,8 @@ digestControlFile(ControlFileData *ControlFile, const char *content, size_t size) { if (size != PG_CONTROL_FILE_SIZE) - pg_fatal("unexpected control file size %d, expected %d", - (int) size, PG_CONTROL_FILE_SIZE); + pg_fatal("unexpected control file size %zu, expected %d", + size, PG_CONTROL_FILE_SIZE); memcpy(ControlFile, content, sizeof(ControlFileData)); |
