Change log level at g_log_remove_handler
[platform/upstream/glib.git] / glib / gpoll.c
index 2681d91..5afc759 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright 1998 Owen Taylor
  * Copyright 2008 Red Hat, Inc.
  *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -135,7 +137,7 @@ poll_rest (GPollFD *msg_fd,
            HANDLE  *handles,
            GPollFD *handle_to_fd[],
            gint     nhandles,
-           gint     timeout_ms)
+           DWORD    timeout_ms)
 {
   DWORD ready;
   GPollFD *f;
@@ -147,7 +149,7 @@ poll_rest (GPollFD *msg_fd,
        * -> Use MsgWaitForMultipleObjectsEx
        */
       if (_g_main_poll_debug)
-       g_print ("  MsgWaitForMultipleObjectsEx(%d, %d)\n", nhandles, timeout_ms);
+       g_print ("  MsgWaitForMultipleObjectsEx(%d, %lu)\n", nhandles, timeout_ms);
 
       ready = MsgWaitForMultipleObjectsEx (nhandles, handles, timeout_ms,
                                           QS_ALLINPUT, MWMO_ALERTABLE);
@@ -177,7 +179,7 @@ poll_rest (GPollFD *msg_fd,
        * -> Use WaitForMultipleObjectsEx
        */
       if (_g_main_poll_debug)
-       g_print ("  WaitForMultipleObjectsEx(%d, %d)\n", nhandles, timeout_ms);
+       g_print ("  WaitForMultipleObjectsEx(%d, %lu)\n", nhandles, timeout_ms);
 
       ready = WaitForMultipleObjectsEx (nhandles, handles, FALSE, timeout_ms, TRUE);
       if (ready == WAIT_FAILED)
@@ -216,7 +218,7 @@ poll_rest (GPollFD *msg_fd,
       recursed_result = poll_rest (NULL, stop_fd, handles, handle_to_fd, nhandles, 0);
       return (recursed_result == -1) ? -1 : 1 + recursed_result;
     }
-  else if (ready >= WAIT_OBJECT_0 && ready < WAIT_OBJECT_0 + nhandles)
+  else if (ready < WAIT_OBJECT_0 + nhandles)
     {
       int retval;
 
@@ -258,7 +260,7 @@ typedef struct
   GPollFD *msg_fd;
   GPollFD *stop_fd;
   gint nhandles;
-  gint timeout_ms;
+  DWORD    timeout_ms;
 } GWin32PollThreadData;
 
 static gint
@@ -295,7 +297,7 @@ poll_single_thread (GWin32PollThreadData *data)
 static void
 fill_poll_thread_data (GPollFD              *fds,
                        guint                 nfds,
-                       gint                  timeout_ms,
+                       DWORD                 timeout_ms,
                        GPollFD              *stop_fd,
                        GWin32PollThreadData *data)
 {
@@ -474,7 +476,7 @@ g_poll (GPollFD *fds,
   for (i = 0; i < nthreads; i++)
     {
       if (GetExitCodeThread (thread_handles[i], &thread_retval))
-        retval = retval == -1 ? -1 : thread_retval == -1 ? -1 : retval + thread_retval;
+        retval = (retval == -1) ? -1 : ((thread_retval == (DWORD) -1) ? -1 : (int) (retval + thread_retval));
 
       CloseHandle (thread_handles[i]);
     }