From: Andrew Dunstan Date: Fri, 10 Apr 2026 13:29:00 +0000 (-0400) Subject: Use size_t instead of Size in pg_waldump X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3f8913f683ba99e7135d374541f52c626fcc6eec;p=thirdparty%2Fpostgresql.git Use size_t instead of Size in pg_waldump In commit b15c1513984 I missed the memo about not using Size in new code. Per complaint from Thomas Munro Discussion: https://postgr.es/m/CA+hUKGJkeTVuq5u5WKJm6xkwmW577UuQ7fA=PyBCSR3h9g2GtQ@mail.gmail.com --- diff --git a/src/bin/pg_waldump/archive_waldump.c b/src/bin/pg_waldump/archive_waldump.c index e4a4bf44a7e..78b03bc1f85 100644 --- a/src/bin/pg_waldump/archive_waldump.c +++ b/src/bin/pg_waldump/archive_waldump.c @@ -299,10 +299,10 @@ free_archive_reader(XLogDumpPrivate *privateInfo) */ int read_archive_wal_page(XLogDumpPrivate *privateInfo, XLogRecPtr targetPagePtr, - Size count, char *readBuff) + size_t count, char *readBuff) { char *p = readBuff; - Size nbytes = count; + size_t nbytes = count; XLogRecPtr recptr = targetPagePtr; int segsize = privateInfo->segsize; XLogSegNo segno; @@ -364,15 +364,13 @@ read_archive_wal_page(XLogDumpPrivate *privateInfo, XLogRecPtr targetPagePtr, * archive reached EOF. */ if (privateInfo->cur_file != entry) - pg_fatal("WAL segment \"%s\" in archive \"%s\" is too short: read %lld of %lld bytes", + pg_fatal("WAL segment \"%s\" in archive \"%s\" is too short: read %zu of %zu bytes", fname, privateInfo->archive_name, - (long long int) (count - nbytes), - (long long int) count); + (count - nbytes), count); if (!read_archive_file(privateInfo)) - pg_fatal("unexpected end of archive \"%s\" while reading \"%s\": read %lld of %lld bytes", + pg_fatal("unexpected end of archive \"%s\" while reading \"%s\": read %zu of %zu bytes", privateInfo->archive_name, fname, - (long long int) (count - nbytes), - (long long int) count); + (count - nbytes), count); /* * Loading more data may have moved hash table entries, so we must diff --git a/src/bin/pg_waldump/pg_waldump.h b/src/bin/pg_waldump/pg_waldump.h index bd46d14f3a8..beb61ec5892 100644 --- a/src/bin/pg_waldump/pg_waldump.h +++ b/src/bin/pg_waldump/pg_waldump.h @@ -39,7 +39,7 @@ typedef struct XLogDumpPrivate astreamer *archive_streamer; char *archive_read_buf; /* Reusable read buffer for archive I/O */ - Size archive_read_buf_size; + size_t archive_read_buf_size; /* * The buffer for the WAL file the archive streamer is currently reading, @@ -75,7 +75,7 @@ extern void init_archive_reader(XLogDumpPrivate *privateInfo, extern void free_archive_reader(XLogDumpPrivate *privateInfo); extern int read_archive_wal_page(XLogDumpPrivate *privateInfo, XLogRecPtr targetPagePtr, - Size count, char *readBuff); + size_t count, char *readBuff); extern void free_archive_wal_entry(const char *fname, XLogDumpPrivate *privateInfo);