[glib: 1/2] gthread-win32: Fix conversion error from pointer to integer




commit 4f72d3bce7a00aace1126758d499bb7e7517f694
Author: Biswapriyo Nath <nathbappai gmail com>
Date:   Tue Sep 20 11:52:48 2022 +0530

    gthread-win32: Fix conversion error from pointer to integer
    
    glib/gthread-win32.c:359:16: error: incompatible integer to pointer conversion passing 'DWORD' (aka 
'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
              if (!g_atomic_pointer_compare_and_exchange (&key->p, NULL, impl))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    glib/gatomic.h:257:73: note: expanded from macro 'g_atomic_pointer_compare_and_exchange'
        __atomic_compare_exchange_n ((atomic), (void *) (&(gapcae_oldval)), (newval), FALSE, 
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ? TRUE : FALSE; \
                                                                            ^~~~~~~~

 glib/gthread-win32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c
index 8010520500..25fbe54db9 100644
--- a/glib/gthread-win32.c
+++ b/glib/gthread-win32.c
@@ -356,7 +356,7 @@ g_private_get_impl (GPrivate *key)
             }
 
           /* Ditto, due to the unlocked access on the fast path */
-          if (!g_atomic_pointer_compare_and_exchange (&key->p, NULL, impl))
+          if (!g_atomic_pointer_compare_and_exchange (&key->p, NULL, GUINT_TO_POINTER (impl)))
             g_thread_abort (0, "g_private_get_impl(2)");
         }
       LeaveCriticalSection (&g_private_lock);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]