Commit d98711df authored by Andrew Dunstan's avatar Andrew Dunstan

Silence a few compiler warnings from gcc on MinGW.

Most of these cast DWORD to int or unsigned int for printf type handling.
This is safe even on 64 bit architectures because a DWORD is always 32 bits.

In one case a variable is initialised to keep the compiler happy.
parent 970d8a39
...@@ -135,7 +135,8 @@ crashDumpHandler(struct _EXCEPTION_POINTERS * pExceptionInfo) ...@@ -135,7 +135,8 @@ crashDumpHandler(struct _EXCEPTION_POINTERS * pExceptionInfo)
systemTicks = GetTickCount(); systemTicks = GetTickCount();
snprintf(dumpPath, _MAX_PATH, snprintf(dumpPath, _MAX_PATH,
"crashdumps\\postgres-pid%0i-%0i.mdmp", selfPid, systemTicks); "crashdumps\\postgres-pid%0i-%0i.mdmp",
(int) selfPid, (int) systemTicks);
dumpPath[_MAX_PATH - 1] = '\0'; dumpPath[_MAX_PATH - 1] = '\0';
dumpFile = CreateFile(dumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, dumpFile = CreateFile(dumpPath, GENERIC_WRITE, FILE_SHARE_WRITE,
...@@ -143,8 +144,8 @@ crashDumpHandler(struct _EXCEPTION_POINTERS * pExceptionInfo) ...@@ -143,8 +144,8 @@ crashDumpHandler(struct _EXCEPTION_POINTERS * pExceptionInfo)
NULL); NULL);
if (dumpFile == INVALID_HANDLE_VALUE) if (dumpFile == INVALID_HANDLE_VALUE)
{ {
write_stderr("could not open crash dump file %s for writing: error code %d\n", write_stderr("could not open crash dump file %s for writing: error code %u\n",
dumpPath, GetLastError()); dumpPath, (unsigned int) GetLastError());
return EXCEPTION_CONTINUE_SEARCH; return EXCEPTION_CONTINUE_SEARCH;
} }
...@@ -153,7 +154,7 @@ crashDumpHandler(struct _EXCEPTION_POINTERS * pExceptionInfo) ...@@ -153,7 +154,7 @@ crashDumpHandler(struct _EXCEPTION_POINTERS * pExceptionInfo)
write_stderr("wrote crash dump to %s\n", dumpPath); write_stderr("wrote crash dump to %s\n", dumpPath);
else else
write_stderr("could not write crash dump to %s: error code %08x\n", write_stderr("could not write crash dump to %s: error code %08x\n",
dumpPath, GetLastError()); dumpPath, (unsigned int) GetLastError());
CloseHandle(dumpFile); CloseHandle(dumpFile);
} }
......
...@@ -94,7 +94,7 @@ WaitLatchOrSocket(volatile Latch *latch, SOCKET sock, bool forRead, ...@@ -94,7 +94,7 @@ WaitLatchOrSocket(volatile Latch *latch, SOCKET sock, bool forRead,
DWORD rc; DWORD rc;
HANDLE events[3]; HANDLE events[3];
HANDLE latchevent; HANDLE latchevent;
HANDLE sockevent; HANDLE sockevent = WSA_INVALID_EVENT; /* silence compiler */
int numevents; int numevents;
int result = 0; int result = 0;
...@@ -161,7 +161,7 @@ WaitLatchOrSocket(volatile Latch *latch, SOCKET sock, bool forRead, ...@@ -161,7 +161,7 @@ WaitLatchOrSocket(volatile Latch *latch, SOCKET sock, bool forRead,
break; break;
} }
else if (rc != WAIT_OBJECT_0) else if (rc != WAIT_OBJECT_0)
elog(ERROR, "unexpected return code from WaitForMultipleObjects(): %d", rc); elog(ERROR, "unexpected return code from WaitForMultipleObjects(): %d", (int) rc);
} }
/* Clean up the handle we created for the socket */ /* Clean up the handle we created for the socket */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment