]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Use size_t instead of Size in pg_waldump
authorAndrew Dunstan <andrew@dunslane.net>
Fri, 10 Apr 2026 13:29:00 +0000 (09:29 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Fri, 10 Apr 2026 13:29:00 +0000 (09:29 -0400)
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

src/bin/pg_waldump/archive_waldump.c
src/bin/pg_waldump/pg_waldump.h

index e4a4bf44a7eef840f7e69a4611d453e81a2aeaf0..78b03bc1f85c09d3b518836adf5e9967803db86e 100644 (file)
@@ -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
index bd46d14f3a88df2ae3e66b212853e78156348443..beb61ec5892ae5830a6b8f38608543aafc4ccbae 100644 (file)
@@ -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);