From: Peter Eisentraut Date: Tue, 7 Jul 2026 09:50:22 +0000 (+0200) Subject: Print off_t/pgoff_t consistently as %lld X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c22d2f7fd46c692c83152773387be6b731c1a4b9;p=thirdparty%2Fpostgresql.git Print off_t/pgoff_t consistently as %lld This was the dominant style already, but some places used %llu instead. Since off_t/pgoff_t are signed types, using %lld seems a better match, and it might handle obscure error conditions with negative values better. Reviewed-by: Heikki Linnakangas Reviewed-by: Chao Li Discussion: https://www.postgresql.org/message-id/flat/20ce62fa-47fc-457b-b504-12f3c1651726%40eisentraut.org --- diff --git a/src/bin/pg_combinebackup/reconstruct.c b/src/bin/pg_combinebackup/reconstruct.c index 986c6e99b9d..47ba962de90 100644 --- a/src/bin/pg_combinebackup/reconstruct.c +++ b/src/bin/pg_combinebackup/reconstruct.c @@ -421,10 +421,10 @@ debug_reconstruction(int n_source, rfile **sources, bool dry_run) if (fstat(s->fd, &sb) < 0) pg_fatal("could not stat file \"%s\": %m", s->filename); if (sb.st_size < s->highest_offset_read) - pg_fatal("file \"%s\" is too short: expected %llu, found %llu", + pg_fatal("file \"%s\" is too short: expected %lld, found %lld", s->filename, - (unsigned long long) s->highest_offset_read, - (unsigned long long) sb.st_size); + (long long) s->highest_offset_read, + (long long) sb.st_size); } } } @@ -788,7 +788,7 @@ read_block(rfile *s, off_t off, uint8 *buffer) if (rb < 0) pg_fatal("could not read from file \"%s\": %m", s->filename); else - pg_fatal("could not read from file \"%s\", offset %llu: read %d of %d", - s->filename, (unsigned long long) off, rb, BLCKSZ); + pg_fatal("could not read from file \"%s\", offset %lld: read %d of %d", + s->filename, (long long) off, rb, BLCKSZ); } } diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c index 9e9eaf0ba2a..542fdb453fb 100644 --- a/src/bin/pg_dump/pg_backup_tar.c +++ b/src/bin/pg_dump/pg_backup_tar.c @@ -1169,12 +1169,12 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th) len = read_tar_number(&h[TAR_OFFSET_SIZE], 12); - pg_log_debug("TOC Entry %s at %llu (length %llu, checksum %d)", - tag, (unsigned long long) hPos, (unsigned long long) len, sum); + pg_log_debug("TOC Entry %s at %lld (length %lld, checksum %d)", + tag, (long long) hPos, (long long) len, sum); if (chk != sum) - pg_fatal("corrupt tar header found in %s (expected %d, computed %d) file position %llu", - tag, sum, chk, (unsigned long long) ftello(ctx->tarFH)); + pg_fatal("corrupt tar header found in %s (expected %d, computed %d) file position %lld", + tag, sum, chk, (long long) ftello(ctx->tarFH)); th->targetFile = pg_strdup(tag); th->fileLen = len; diff --git a/src/bin/pg_rewind/libpq_source.c b/src/bin/pg_rewind/libpq_source.c index 6955bc575ea..216755b3ddb 100644 --- a/src/bin/pg_rewind/libpq_source.c +++ b/src/bin/pg_rewind/libpq_source.c @@ -458,7 +458,7 @@ process_queued_fetch_requests(libpq_source *src) } appendArrayEscapedString(&src->paths, rq->path); - appendStringInfo(&src->offsets, INT64_FORMAT, (int64) rq->offset); + appendStringInfo(&src->offsets, "%lld", (long long int) rq->offset); appendStringInfo(&src->lengths, "%zu", rq->length); } appendStringInfoChar(&src->paths, '}'); diff --git a/src/bin/pg_verifybackup/astreamer_verify.c b/src/bin/pg_verifybackup/astreamer_verify.c index 99bd69ce7c9..2578765b0ca 100644 --- a/src/bin/pg_verifybackup/astreamer_verify.c +++ b/src/bin/pg_verifybackup/astreamer_verify.c @@ -208,9 +208,9 @@ member_verify_header(astreamer *streamer, astreamer_member *member) if (m->size != member->size) { report_backup_error(mystreamer->context, - "file \"%s\" has size %llu in archive \"%s\" but size %" PRIu64 " in the manifest", + "file \"%s\" has size %lld in archive \"%s\" but size %" PRIu64 " in the manifest", member->pathname, - (unsigned long long) member->size, + (long long) member->size, mystreamer->archive_name, m->size); m->bad = true; diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c index f338fa22ca0..97f575944cd 100644 --- a/src/bin/pg_verifybackup/pg_verifybackup.c +++ b/src/bin/pg_verifybackup/pg_verifybackup.c @@ -735,9 +735,9 @@ verify_plain_backup_file(verifier_context *context, char *relpath, if (m->size != sb.st_size) { report_backup_error(context, - "\"%s\" has size %llu on disk but size %llu in the manifest", - relpath, (unsigned long long) sb.st_size, - (unsigned long long) m->size); + "\"%s\" has size %lld on disk but size %" PRIu64 " in the manifest", + relpath, (long long) sb.st_size, + m->size); m->bad = true; }