]> granicus.if.org Git - postgresql/commitdiff
Fix some assorted compiler warnings on Windows.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 1 May 2018 23:38:26 +0000 (19:38 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 1 May 2018 23:38:26 +0000 (19:38 -0400)
Don't overflow the result type of constant expressions.  Don't negate
unsigned types.  Define HAVE_STDBOOL_H for Visual C++ 2013 and later.

Thomas Munro
Reviewed-By: Michael Paquier and Tom Lane
Discussion: https://postgr.es/m/CAEepm%3D3%3DTDYEXUEcHpEx%2BTwc31wo7PA0oBAiNt6sWmq93MW02A%40mail.gmail.com

src/backend/replication/basebackup.c
src/bin/pgbench/pgbench.c
src/include/pg_config.h.win32

index bc9f585b85bdcbb46fe7292de61f57db67bcbec9..5688cbe2e9ae60c2ce791514adafdb9c2e61e01d 100644 (file)
@@ -1361,7 +1361,7 @@ sendFile(const char *readfilename, const char *tarfilename, struct stat *statbuf
        char            buf[TAR_SEND_SIZE];
        uint16          checksum;
        int                     checksum_failures = 0;
-       size_t          cnt;
+       off_t           cnt;
        int                     i;
        pgoff_t         len = 0;
        char       *page;
index 21a52c2020f3f97ea542639f8ab7a490f874974a..c36556c497f2a4460d0cddc1a935b188c1d37031 100644 (file)
@@ -67,6 +67,7 @@
 #define FNV_PRIME                      UINT64CONST(0x100000001b3)
 #define FNV_OFFSET_BASIS       UINT64CONST(0xcbf29ce484222325)
 #define MM2_MUL                                UINT64CONST(0xc6a4a7935bd1e995)
+#define MM2_MUL_TIMES_8                UINT64CONST(0x35253c9ade8f4ca8)
 #define MM2_ROT                                47
 
 /*
@@ -968,7 +969,7 @@ getHashFnv1a(int64 val, uint64 seed)
 static int64
 getHashMurmur2(int64 val, uint64 seed)
 {
-       uint64          result = seed ^ (sizeof(int64) * MM2_MUL);
+       uint64          result = seed ^ MM2_MUL_TIMES_8;        /* sizeof(int64) */
        uint64          k = (uint64) val;
 
        k *= MM2_MUL;
index bc437b08f0cc1c52ef08331527b720b3732a5f8f..e776b34f223ee831fad91cf60adb32e879f9e657 100644 (file)
 #define HAVE_SSL_GET_CURRENT_COMPRESSION 1
 
 /* Define to 1 if stdbool.h conforms to C99. */
-/* #undef HAVE_STDBOOL_H */
+#if (_MSC_VER >= 1800)
+#define HAVE_STDBOOL_H 1
+#endif
 
 /* Define to 1 if you have the <stdint.h> header file. */
 /* #undef HAVE_STDINT_H */