Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2328bf

Browse files
committed
Fix some assorted compiler warnings on Windows.
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
1 parent 41c912c commit b2328bf

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/backend/replication/basebackup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ sendFile(const char *readfilename, const char *tarfilename, struct stat *statbuf
13611361
char buf[TAR_SEND_SIZE];
13621362
uint16 checksum;
13631363
int checksum_failures = 0;
1364-
size_t cnt;
1364+
off_t cnt;
13651365
int i;
13661366
pgoff_t len = 0;
13671367
char *page;

src/bin/pgbench/pgbench.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#define FNV_PRIME UINT64CONST(0x100000001b3)
6868
#define FNV_OFFSET_BASIS UINT64CONST(0xcbf29ce484222325)
6969
#define MM2_MUL UINT64CONST(0xc6a4a7935bd1e995)
70+
#define MM2_MUL_TIMES_8 UINT64CONST(0x35253c9ade8f4ca8)
7071
#define MM2_ROT 47
7172

7273
/*
@@ -968,7 +969,7 @@ getHashFnv1a(int64 val, uint64 seed)
968969
static int64
969970
getHashMurmur2(int64 val, uint64 seed)
970971
{
971-
uint64 result = seed ^ (sizeof(int64) * MM2_MUL);
972+
uint64 result = seed ^ MM2_MUL_TIMES_8; /* sizeof(int64) */
972973
uint64 k = (uint64) val;
973974

974975
k *= MM2_MUL;

src/include/pg_config.h.win32

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@
357357
#define HAVE_SSL_GET_CURRENT_COMPRESSION 1
358358

359359
/* Define to 1 if stdbool.h conforms to C99. */
360-
/* #undef HAVE_STDBOOL_H */
360+
#if (_MSC_VER >= 1800)
361+
#define HAVE_STDBOOL_H 1
362+
#endif
361363

362364
/* Define to 1 if you have the <stdint.h> header file. */
363365
/* #undef HAVE_STDINT_H */

0 commit comments

Comments
 (0)