From 28dcec03e1092c6a284c3bb437fe36d382f180df Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 9 May 2021 23:23:31 +0200 Subject: [PATCH 1/2] Fix cast from pointer to integer of different size warnings in glib/gthread-win32.c glib/gthread-win32.c: In function 'g_private_get_impl': glib/gthread-win32.c:310:16: warning: cast from pointer to integer of different size DWORD impl = (DWORD) key->p; ^ glib/gthread-win32.c:315:14: warning: cast from pointer to integer of different size impl = (DWORD) key->p; ^ glib/gthread-win32.c: In function 'SetThreadName': glib/gthread-win32.c:596:60: warning: passing argument 4 of 'RaiseException' from incompatible pointer type RaiseException (EXCEPTION_SET_THREAD_NAME, 0, infosize, (DWORD *) &info); ^~~~~~~~~~~~~~~ --- glib/gthread-win32.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c index 63e3cdd76..79e397820 100644 --- a/glib/gthread-win32.c +++ b/glib/gthread-win32.c @@ -307,12 +307,12 @@ static CRITICAL_SECTION g_private_lock; static DWORD g_private_get_impl (GPrivate *key) { - DWORD impl = (DWORD) key->p; + DWORD impl = (DWORD) GPOINTER_TO_UINT(key->p); if G_UNLIKELY (impl == 0) { EnterCriticalSection (&g_private_lock); - impl = (DWORD) key->p; + impl = (UINT_PTR) key->p; if (impl == 0) { GPrivateDestructor *destructor; @@ -603,7 +603,7 @@ SetThreadName (DWORD dwThreadID, if ((!IsDebuggerPresent ()) && (SetThreadName_VEH_handle == NULL)) return; - RaiseException (EXCEPTION_SET_THREAD_NAME, 0, infosize, (DWORD *) &info); + RaiseException (EXCEPTION_SET_THREAD_NAME, 0, infosize, (const ULONG_PTR *) &info); #endif } From 5e0bcbf8fef73ab1675f664c3a705794ad058a4c Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 13 May 2021 15:59:31 +0200 Subject: [PATCH 2/2] Fix signedness warning in glib/grand.c glib/grand.c:271:17: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'long long unsigned int' for (i = 0; i < G_N_ELEMENTS (seed); i++) ^ --- glib/grand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/grand.c b/glib/grand.c index 3d6dc60f7..a7f5f43fd 100644 --- a/glib/grand.c +++ b/glib/grand.c @@ -266,7 +266,7 @@ g_rand_new (void) * MinGW-w64 has a wrapper that will emulate rand_s() if it's not in msvcrt */ #if (defined(_MSC_VER) && _MSC_VER >= 1400) || defined(__MINGW64_VERSION_MAJOR) - gint i; + gsize i; for (i = 0; i < G_N_ELEMENTS (seed); i++) rand_s (&seed[i]);