@@ -38,7 +38,7 @@ InitLatch(volatile Latch *latch)
3838
3939latch -> event = CreateEvent (NULL , TRUE, FALSE,NULL );
4040if (latch -> event == NULL )
41- elog (ERROR ,"CreateEvent failed: error code %d" , ( int ) GetLastError ());
41+ elog (ERROR ,"CreateEvent failed: error code %lu" , GetLastError ());
4242}
4343
4444void
@@ -59,7 +59,7 @@ InitSharedLatch(volatile Latch *latch)
5959
6060latch -> event = CreateEvent (& sa , TRUE, FALSE,NULL );
6161if (latch -> event == NULL )
62- elog (ERROR ,"CreateEvent failed: error code %d" , ( int ) GetLastError ());
62+ elog (ERROR ,"CreateEvent failed: error code %lu" , GetLastError ());
6363}
6464
6565void
@@ -150,7 +150,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
150150 * will return immediately.
151151 */
152152if (!ResetEvent (latchevent ))
153- elog (ERROR ,"ResetEvent failed: error code %d" , ( int ) GetLastError ());
153+ elog (ERROR ,"ResetEvent failed: error code %lu" , GetLastError ());
154154if ((wakeEvents & WL_LATCH_SET )&& latch -> is_set )
155155{
156156result |=WL_LATCH_SET ;
@@ -164,7 +164,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
164164rc = WaitForMultipleObjects (numevents ,events , FALSE,timeout );
165165
166166if (rc == WAIT_FAILED )
167- elog (ERROR ,"WaitForMultipleObjects() failed: error code %d" , ( int ) GetLastError ());
167+ elog (ERROR ,"WaitForMultipleObjects() failed: error code %lu" , GetLastError ());
168168
169169/* Participate in Windows signal emulation */
170170else if (rc == WAIT_OBJECT_0 + 1 )
@@ -188,7 +188,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
188188ZeroMemory (& resEvents ,sizeof (resEvents ));
189189if (WSAEnumNetworkEvents (sock ,sockevent ,& resEvents )== SOCKET_ERROR )
190190ereport (FATAL ,
191- (errmsg_internal ("failed to enumerate network events:%d" , ( int ) GetLastError ())));
191+ (errmsg_internal ("failed to enumerate network events:error code %lu" , GetLastError ())));
192192
193193if ((wakeEvents & WL_SOCKET_READABLE )&&
194194(resEvents .lNetworkEvents & FD_READ ))
@@ -203,7 +203,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
203203}
204204/* Otherwise it must be the latch event */
205205else if (rc != WAIT_OBJECT_0 )
206- elog (ERROR ,"unexpected return code from WaitForMultipleObjects(): %d" , ( int ) rc );
206+ elog (ERROR ,"unexpected return code from WaitForMultipleObjects(): %lu" , rc );
207207}
208208while (result == 0 );
209209