@@ -38,7 +38,7 @@ InitLatch(volatile Latch *latch)
3838
3939 latch -> event = CreateEvent (NULL , TRUE, FALSE, NULL );
4040 if (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
6060 latch -> event = CreateEvent (& sa , TRUE, FALSE, NULL );
6161 if (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 */
152152 if (!ResetEvent (latchevent ))
153- elog (ERROR , "ResetEvent failed: error code %d" , ( int ) GetLastError ());
153+ elog (ERROR , "ResetEvent failed: error code %lu" , GetLastError ());
154154 if ((wakeEvents & WL_LATCH_SET ) && latch -> is_set )
155155 {
156156 result |= WL_LATCH_SET ;
@@ -164,7 +164,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
164164 rc = WaitForMultipleObjects (numevents , events , FALSE, timeout );
165165
166166 if (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 */
170170 else if (rc == WAIT_OBJECT_0 + 1 )
@@ -188,7 +188,7 @@ WaitLatchOrSocket(volatile Latch *latch, int wakeEvents, pgsocket sock,
188188 ZeroMemory (& resEvents , sizeof (resEvents ));
189189 if (WSAEnumNetworkEvents (sock , sockevent , & resEvents ) == SOCKET_ERROR )
190190 ereport (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
193193 if ((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 */
205205 else 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 }
208208 while (result == 0 );
209209
0 commit comments