Fix more portability issues with casts to Size when using off_t
authorMichael Paquier <[email protected]>
Wed, 18 Jul 2018 00:51:53 +0000 (09:51 +0900)
committerMichael Paquier <[email protected]>
Wed, 18 Jul 2018 00:51:53 +0000 (09:51 +0900)
This should tame the beast, as there are no other places where off_t is
used in the new error messages.

Reported again by longfin, which complained about walsender.c while I
spotted the other two ones while double-checking.

src/backend/replication/logical/snapbuild.c
src/backend/replication/slot.c
src/backend/replication/walsender.c

index 61bc9e8f147e1b5e005a933a4e71aa8da1e298b5..7bd969b0a1cf418b7afaca41eddffd69d899dcc3 100644 (file)
@@ -1737,7 +1737,8 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
        else
            ereport(ERROR,
                    (errmsg("could not read file \"%s\": read %d of %zu",
-                           path, readBytes, SnapBuildOnDiskConstantSize)));
+                           path, readBytes,
+                           (Size) SnapBuildOnDiskConstantSize)));
    }
 
    if (ondisk.magic != SNAPBUILD_MAGIC)
index afbaf8c80d80e5960e4ce5329f80dab959e40bef..271af08572add1bc0bb1985995c6d6e0130a877c 100644 (file)
@@ -1422,7 +1422,7 @@ RestoreSlotFromDisk(const char *name)
            ereport(PANIC,
                    (errmsg("could not read file \"%s\": read %d of %zu",
                            path, readBytes,
-                           ReplicationSlotOnDiskConstantSize)));
+                           (Size) ReplicationSlotOnDiskConstantSize)));
    }
 
    /* verify magic */
index e3df5495c33f134aea3832d7bc7395062c66f26e..76954831cee09ef2078db40cddc0d68d86eabbca 100644 (file)
@@ -509,7 +509,7 @@ SendTimeLineHistory(TimeLineHistoryCmd *cmd)
        else if (nread == 0)
            ereport(ERROR,
                    (errmsg("could not read file \"%s\": read %d of %zu",
-                           path, nread, bytesleft)));
+                           path, nread, (Size) bytesleft)));
 
        pq_sendbytes(&buf, rbuf, nread);
        bytesleft -= nread;