From dd9b7bd53d9d1aa73d07cb4a5c30555bc35e45be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aida=20Jonikien=C4=97?= <aidas957@gmail.com>
Date: Sun, 21 Jan 2024 18:21:32 +0200
Subject: [PATCH 1/6] Fix warnings in various patchsets (part 1)

This covers everything except warnings introduced by Compiler_Warnings
patchset (I'm not sure why it even exists though)

Some warnings are kind of hacky to fix though (so hopefully nothing gets
broken by this commit)
---
 ...9_36-Implement-D3DXDisassembleShader.patch | 36 +++++++++----------
 ...eventfd-based-objects-for-semaphores.patch |  4 +--
 ...4-ntdll-Implement-NtReleaseSemaphore.patch |  4 +--
 .../0005-ntdll-Implement-NtClose.patch        |  2 +-
 ...l-Implement-NtWaitForMultipleObjects.patch | 14 ++++----
 ...ntdll-server-Implement-NtCreateEvent.patch |  2 +-
 ...lement-waiting-on-server-bound-objec.patch |  4 +--
 ...o-avoid-poll-for-uncontended-objects.patch |  2 +-
 ...ry-to-avoid-poll-for-signaled-events.patch |  8 ++---
 .../0002-gdi32-fix-for-rotated-ellipse.patch  |  2 +-
 ...efcount-midihdr-to-work-around-buggy.patch |  2 +-
 ...d-support-for-reading-reparse-points.patch |  2 +-
 ...-version-when-creating-driver-enviro.patch |  2 +-
 ...-to-implement-priority-levels-throug.patch |  5 ++-
 ...Generate-icons-from-available-icons-.patch |  2 +-
 ...vent-a-recursive-loop-with-the-activ.patch |  3 +-
 ...y-use-xdg-email-if-available-enablin.patch |  4 +--
 ...missing-thread-data-in-X11DRV_get_ic.patch |  8 ++---
 18 files changed, 54 insertions(+), 52 deletions(-)

diff --git a/patches/d3dx9_36-D3DXDisassembleShader/0004-d3dx9_36-Implement-D3DXDisassembleShader.patch b/patches/d3dx9_36-D3DXDisassembleShader/0004-d3dx9_36-Implement-D3DXDisassembleShader.patch
index 32a96821..1fea6ea5 100644
--- a/patches/d3dx9_36-D3DXDisassembleShader/0004-d3dx9_36-Implement-D3DXDisassembleShader.patch
+++ b/patches/d3dx9_36-D3DXDisassembleShader/0004-d3dx9_36-Implement-D3DXDisassembleShader.patch
@@ -67,25 +67,25 @@ index 1aa75d64dc5..d98345e2288 100644
 +    DWORD reg_num = param & D3DSP_REGNUM_MASK;
 +
 +    if (reg_type == D3DSPR_INPUT)
-+        buf += sprintf(buf, "v%d", reg_num);
++        buf += sprintf(buf, "v%ld", reg_num);
 +    else if (reg_type == D3DSPR_CONST)
-+        buf += sprintf(buf, "c%d", reg_num);
++        buf += sprintf(buf, "c%ld", reg_num);
 +    else if (reg_type == D3DSPR_TEMP)
-+        buf += sprintf(buf, "r%d", reg_num);
++        buf += sprintf(buf, "r%ld", reg_num);
 +    else if (reg_type == D3DSPR_ADDR)
-+        buf += sprintf(buf, "%s%d", ps ? "t" : "a", reg_num);
++        buf += sprintf(buf, "%s%ld", ps ? "t" : "a", reg_num);
 +    else if (reg_type == D3DSPR_SAMPLER)
-+        buf += sprintf(buf, "s%d", reg_num);
++        buf += sprintf(buf, "s%ld", reg_num);
 +    else if (reg_type == D3DSPR_RASTOUT)
 +        buf += sprintf(buf, "oPos");
 +    else if (reg_type == D3DSPR_COLOROUT)
-+        buf += sprintf(buf, "oC%d", reg_num);
++        buf += sprintf(buf, "oC%ld", reg_num);
 +    else if (reg_type == D3DSPR_TEXCRDOUT)
-+        buf += sprintf(buf, "oT%d", reg_num);
++        buf += sprintf(buf, "oT%ld", reg_num);
 +    else if (reg_type == D3DSPR_ATTROUT)
-+        buf += sprintf(buf, "oD%d", reg_num);
++        buf += sprintf(buf, "oD%ld", reg_num);
 +    else
-+        buf += sprintf(buf, "? (%d)", reg_type);
++        buf += sprintf(buf, "? (%ld)", reg_type);
 +
 +    if (dst)
 +    {
@@ -105,12 +105,12 @@ index 1aa75d64dc5..d98345e2288 100644
 +                 ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_Y | D3DVS_Y_Y | D3DVS_Z_Y | D3DVS_W_Y)) ||
 +                 ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_Z | D3DVS_Y_Z | D3DVS_Z_Z | D3DVS_W_Z)) ||
 +                 ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_W | D3DVS_Y_W | D3DVS_Z_W | D3DVS_W_W)) )
-+                buf += sprintf(buf, ".%c", 'w' + (((param >> D3DVS_SWIZZLE_SHIFT) + 1) & 0x3));
++                buf += sprintf(buf, ".%c", 'w' + (int) (((param >> D3DVS_SWIZZLE_SHIFT) + 1) & 0x3));
 +            else
-+                buf += sprintf(buf, ".%c%c%c%c", 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+0)) + 1) & 0x3),
-+                                                 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+2)) + 1) & 0x3),
-+                                                 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+4)) + 1) & 0x3),
-+                                                 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+6)) + 1) & 0x3));
++                buf += sprintf(buf, ".%c%c%c%c", 'w' + (int) (((param >> (D3DVS_SWIZZLE_SHIFT+0)) + 1) & 0x3),
++                                                 'w' + (int) (((param >> (D3DVS_SWIZZLE_SHIFT+2)) + 1) & 0x3),
++                                                 'w' + (int) (((param >> (D3DVS_SWIZZLE_SHIFT+4)) + 1) & 0x3),
++                                                 'w' + (int) (((param >> (D3DVS_SWIZZLE_SHIFT+6)) + 1) & 0x3));
 +        }
 +    }
 +
@@ -135,7 +135,7 @@ index 1aa75d64dc5..d98345e2288 100644
 +
 +static int instr_def(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps)
 +{
-+    int len = sprintf(buffer, "    def c%d, %g, %g, %g, %g\n", *(*ptr+1) & D3DSP_REGNUM_MASK,
++    int len = sprintf(buffer, "    def c%ld, %g, %g, %g, %g\n", *(*ptr+1) & D3DSP_REGNUM_MASK,
 +                      (double)*(float*)(*ptr+2), (double)*(float*)(*ptr+3),
 +                      (double)*(float*)(*ptr+4), (double)*(float*)(*ptr+5));
 +    *ptr += 6;
@@ -161,7 +161,7 @@ index 1aa75d64dc5..d98345e2288 100644
 +    {
 +        buf += sprintf(buf, "_%s", (usage <= D3DDECLUSAGE_COLOR) ? decl_usage[usage] : "???");
 +        if (usage_index)
-+            buf += sprintf(buf, "%d", usage_index);
++            buf += sprintf(buf, "%ld", usage_index);
 +    }
 +
 +    buf += add_modifier(buf, param2);
@@ -324,7 +324,7 @@ index 1aa75d64dc5..d98345e2288 100644
 +
 +    ps = (*ptr >> 16) & 1;
 +    version = *ptr & 0xFFFF;
-+    buf += sprintf(buf, "    %s_%d_%d\n", ps ? "ps" : "vs", D3DSHADER_VERSION_MAJOR(*ptr), D3DSHADER_VERSION_MINOR(*ptr));
++    buf += sprintf(buf, "    %s_%ld_%ld\n", ps ? "ps" : "vs", D3DSHADER_VERSION_MAJOR(*ptr), D3DSHADER_VERSION_MINOR(*ptr));
 +    ptr++;
 +
 +    while (*ptr != D3DSIO_END)
@@ -356,7 +356,7 @@ index 1aa75d64dc5..d98345e2288 100644
 +        }
 +        else
 +        {
-+            buf += sprintf(buf, "    ??? (Unknown opcode %x)\n", *ptr);
++            buf += sprintf(buf, "    ??? (Unknown opcode %lx)\n", *ptr);
 +            while (*++ptr & (1u << 31));
 +        }
 +    }
diff --git a/patches/eventfd_synchronization/0003-ntdll-Create-eventfd-based-objects-for-semaphores.patch b/patches/eventfd_synchronization/0003-ntdll-Create-eventfd-based-objects-for-semaphores.patch
index 672ba499..f64fcf58 100644
--- a/patches/eventfd_synchronization/0003-ntdll-Create-eventfd-based-objects-for-semaphores.patch
+++ b/patches/eventfd_synchronization/0003-ntdll-Create-eventfd-based-objects-for-semaphores.patch
@@ -197,7 +197,7 @@ index 00000000000..7be4e03fa34
 +        }
 +    }
 +
-+    if (!InterlockedCompareExchange( (int *)&esync_list[entry][idx].type, type, 0 ))
++    if (!InterlockedCompareExchange( (LONG *)&esync_list[entry][idx].type, type, 0 ))
 +    {
 +        esync_list[entry][idx].fd = fd;
 +        esync_list[entry][idx].shm = shm;
@@ -255,7 +255,7 @@ index 00000000000..7be4e03fa34
 +    const OBJECT_ATTRIBUTES *attr, LONG initial, LONG max)
 +{
 +    TRACE("name %s, initial %d, max %d.\n",
-+        attr ? debugstr_us(attr->ObjectName) : "<no name>", initial, max);
++        attr ? debugstr_us(attr->ObjectName) : "<no name>", (int)initial, (int)max);
 +
 +    return create_esync( ESYNC_SEMAPHORE, handle, access, attr, initial, max );
 +}
diff --git a/patches/eventfd_synchronization/0004-ntdll-Implement-NtReleaseSemaphore.patch b/patches/eventfd_synchronization/0004-ntdll-Implement-NtReleaseSemaphore.patch
index 6ef0b197..36f1cf98 100644
--- a/patches/eventfd_synchronization/0004-ntdll-Implement-NtReleaseSemaphore.patch
+++ b/patches/eventfd_synchronization/0004-ntdll-Implement-NtReleaseSemaphore.patch
@@ -49,7 +49,7 @@ index 7be4e03fa34..e8da4bd311b 100644
 +    uint64_t count64 = count;
 +    ULONG current;
 +
-+    TRACE("%p, %d, %p.\n", handle, count, prev);
++    TRACE("%p, %d, %p.\n", handle, (int)count, prev);
 +
 +    if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE;
 +    semaphore = obj->shm;
@@ -60,7 +60,7 @@ index 7be4e03fa34..e8da4bd311b 100644
 +
 +        if (count + current > semaphore->max)
 +            return STATUS_SEMAPHORE_LIMIT_EXCEEDED;
-+    } while (InterlockedCompareExchange( &semaphore->count, count + current, current ) != current);
++    } while (InterlockedCompareExchange( (LONG *)&semaphore->count, count + current, current ) != current);
 +
 +    if (prev) *prev = current;
 +
diff --git a/patches/eventfd_synchronization/0005-ntdll-Implement-NtClose.patch b/patches/eventfd_synchronization/0005-ntdll-Implement-NtClose.patch
index 14ae0de0..418424c1 100644
--- a/patches/eventfd_synchronization/0005-ntdll-Implement-NtClose.patch
+++ b/patches/eventfd_synchronization/0005-ntdll-Implement-NtClose.patch
@@ -25,7 +25,7 @@ index e8da4bd311b..e031e9cb94f 100644
 +
 +    if (entry < ESYNC_LIST_ENTRIES && esync_list[entry])
 +    {
-+        if (InterlockedExchange((int *)&esync_list[entry][idx].type, 0))
++        if (InterlockedExchange((LONG *)&esync_list[entry][idx].type, 0))
 +        {
 +            close( esync_list[entry][idx].fd );
 +            return STATUS_SUCCESS;
diff --git a/patches/eventfd_synchronization/0006-ntdll-Implement-NtWaitForMultipleObjects.patch b/patches/eventfd_synchronization/0006-ntdll-Implement-NtWaitForMultipleObjects.patch
index f7597b4b..eae71021 100644
--- a/patches/eventfd_synchronization/0006-ntdll-Implement-NtWaitForMultipleObjects.patch
+++ b/patches/eventfd_synchronization/0006-ntdll-Implement-NtWaitForMultipleObjects.patch
@@ -13,13 +13,15 @@ diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c
 index e031e9cb94f..75ceb95bc66 100644
 --- a/dlls/ntdll/unix/esync.c
 +++ b/dlls/ntdll/unix/esync.c
-@@ -22,6 +22,8 @@
+@@ -22,6 +22,10 @@
  #pragma makedep unix
  #endif
  
-+#define _GNU_SOURCE
-+
  #include "config.h"
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE
++#endif
  
  #include <assert.h>
 @@ -34,6 +36,12 @@
@@ -35,7 +37,7 @@ index e031e9cb94f..75ceb95bc66 100644
  #include <sys/types.h>
  #include <unistd.h>
  
-@@ -286,6 +294,168 @@ NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev )
+@@ -286,6 +296,168 @@ NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev )
      return STATUS_SUCCESS;
  }
  
@@ -82,7 +84,7 @@ index e031e9cb94f..75ceb95bc66 100644
 +         * fact that we were able to grab it at all means the count is nonzero,
 +         * and if someone else grabbed it then the count must have been >= 2,
 +         * etc. */
-+        InterlockedExchangeAdd( &semaphore->count, -1 );
++        InterlockedExchangeAdd( (LONG *)&semaphore->count, -1 );
 +    }
 +}
 +
@@ -125,7 +127,7 @@ index e031e9cb94f..75ceb95bc66 100644
 +
 +    if (TRACE_ON(esync))
 +    {
-+        TRACE("Waiting for %s of %d handles:", wait_any ? "any" : "all", count);
++        TRACE("Waiting for %s of %d handles:", wait_any ? "any" : "all", (int)count);
 +        for (i = 0; i < count; i++)
 +            TRACE(" %p", handles[i]);
 +
diff --git a/patches/eventfd_synchronization/0007-ntdll-server-Implement-NtCreateEvent.patch b/patches/eventfd_synchronization/0007-ntdll-server-Implement-NtCreateEvent.patch
index a6ef5475..3fc18706 100644
--- a/patches/eventfd_synchronization/0007-ntdll-server-Implement-NtCreateEvent.patch
+++ b/patches/eventfd_synchronization/0007-ntdll-server-Implement-NtCreateEvent.patch
@@ -49,7 +49,7 @@ index 75ceb95bc66..06842f0c8f5 100644
  
 @@ -339,6 +358,14 @@ static void update_grabbed_object( struct esync *obj )
           * etc. */
-         InterlockedExchangeAdd( &semaphore->count, -1 );
+         InterlockedExchangeAdd( (LONG *)&semaphore->count, -1 );
      }
 +    else if (obj->type == ESYNC_AUTO_EVENT)
 +    {
diff --git a/patches/eventfd_synchronization/0014-ntdll-server-Implement-waiting-on-server-bound-objec.patch b/patches/eventfd_synchronization/0014-ntdll-server-Implement-waiting-on-server-bound-objec.patch
index 13df89b0..f492ee70 100644
--- a/patches/eventfd_synchronization/0014-ntdll-server-Implement-waiting-on-server-bound-objec.patch
+++ b/patches/eventfd_synchronization/0014-ntdll-server-Implement-waiting-on-server-bound-objec.patch
@@ -82,7 +82,7 @@ index 4f993689e0d..6fd195df759 100644
 +
 +    if (ret)
 +    {
-+        WARN("Failed to retrieve fd for handle %p, status %#x.\n", handle, ret);
++        WARN("Failed to retrieve fd for handle %p, status %#x.\n", handle, (int)ret);
 +        *obj = NULL;
 +        return ret;
 +    }
@@ -102,7 +102,7 @@ index 4f993689e0d..6fd195df759 100644
      ULONG current;
 +    NTSTATUS ret;
  
-     TRACE("%p, %d, %p.\n", handle, count, prev);
+     TRACE("%p, %d, %p.\n", handle, (int)count, prev);
  
 -    if (!(obj = get_cached_object( handle ))) return STATUS_INVALID_HANDLE;
 +    if ((ret = get_object( handle, &obj))) return ret;
diff --git a/patches/eventfd_synchronization/0049-ntdll-Try-to-avoid-poll-for-uncontended-objects.patch b/patches/eventfd_synchronization/0049-ntdll-Try-to-avoid-poll-for-uncontended-objects.patch
index 56e30604..038060b4 100644
--- a/patches/eventfd_synchronization/0049-ntdll-Try-to-avoid-poll-for-uncontended-objects.patch
+++ b/patches/eventfd_synchronization/0049-ntdll-Try-to-avoid-poll-for-uncontended-objects.patch
@@ -68,7 +68,7 @@ index 13cdaf4f73e..a306826e2da 100644
 +                        if ((size = read( obj->fd, &value, sizeof(value) )) == sizeof(value))
 +                        {
 +                            TRACE("Woken up by handle %p [%d].\n", handles[i], i);
-+                            InterlockedDecrement( &semaphore->count );
++                            InterlockedDecrement( (LONG *)&semaphore->count );
 +                            return i;
 +                        }
 +                    }
diff --git a/patches/eventfd_synchronization/0050-ntdll-server-Try-to-avoid-poll-for-signaled-events.patch b/patches/eventfd_synchronization/0050-ntdll-server-Try-to-avoid-poll-for-signaled-events.patch
index 79f99c8d..f564efd0 100644
--- a/patches/eventfd_synchronization/0050-ntdll-server-Try-to-avoid-poll-for-signaled-events.patch
+++ b/patches/eventfd_synchronization/0050-ntdll-server-Try-to-avoid-poll-for-signaled-events.patch
@@ -90,7 +90,7 @@ index a306826e2da..91a85253a83 100644
 +    if (obj->type == ESYNC_MANUAL_EVENT)
 +    {
 +        /* Acquire the spinlock. */
-+        while (InterlockedCompareExchange( &event->locked, 1, 0 ))
++        while (InterlockedCompareExchange( (LONG *)&event->locked, 1, 0 ))
 +            small_pause();
 +    }
 +
@@ -103,7 +103,7 @@ index a306826e2da..91a85253a83 100644
 +     * eventfd is unsignaled (i.e. reset shm, set shm, set fd, reset fd), we
 +     * *must* signal the fd now, or any waiting threads will never wake up. */
 +
-+    if (!InterlockedExchange( &event->signaled, 1 ) || obj->type == ESYNC_AUTO_EVENT)
++    if (!InterlockedExchange( (LONG *)&event->signaled, 1 ) || obj->type == ESYNC_AUTO_EVENT)
 +    {
 +        if (write( obj->fd, &value, sizeof(value) ) == -1)
 +            ERR("write: %s\n", strerror(errno));
@@ -137,7 +137,7 @@ index a306826e2da..91a85253a83 100644
 +    if (obj->type == ESYNC_MANUAL_EVENT)
 +    {
 +        /* Acquire the spinlock. */
-+        while (InterlockedCompareExchange( &event->locked, 1, 0 ))
++        while (InterlockedCompareExchange( (LONG *)&event->locked, 1, 0 ))
 +            small_pause();
 +    }
 +
@@ -147,7 +147,7 @@ index a306826e2da..91a85253a83 100644
 +     * For auto-reset events, we have no guarantee that the previous "signaled"
 +     * state is actually correct. We need to leave both states unsignaled after
 +     * leaving this function, so we always have to read(). */
-+    if (InterlockedExchange( &event->signaled, 0 ) || obj->type == ESYNC_AUTO_EVENT)
++    if (InterlockedExchange( (LONG *)&event->signaled, 0 ) || obj->type == ESYNC_AUTO_EVENT)
 +    {
 +        if (read( obj->fd, &value, sizeof(value) ) == -1 && errno != EWOULDBLOCK && errno != EAGAIN)
 +        {
diff --git a/patches/gdi32-rotation/0002-gdi32-fix-for-rotated-ellipse.patch b/patches/gdi32-rotation/0002-gdi32-fix-for-rotated-ellipse.patch
index f2900a9c..1e63dd9e 100644
--- a/patches/gdi32-rotation/0002-gdi32-fix-for-rotated-ellipse.patch
+++ b/patches/gdi32-rotation/0002-gdi32-fix-for-rotated-ellipse.patch
@@ -74,7 +74,7 @@ index 3a6f8184009..b5231636261 100644
 +    }
 +
 +    if (pdev->brush.style != BS_NULL &&
-+        !(interior = ULongToHandle(NtGdiPolyPolyDraw( ULongToHandle(ALTERNATE), points, (const UINT *)&count, 1, NtGdiPolyPolygonRgn ))))
++        !(interior = ULongToHandle(NtGdiPolyPolyDraw( ULongToHandle(ALTERNATE), points, (const ULONG *)&count, 1, NtGdiPolyPolygonRgn ))))
 +    {
 +        free( points );
 +        if (outline) NtGdiDeleteObjectApp( outline );
diff --git a/patches/mmsystem.dll16-MIDIHDR_Refcount/0001-mmsystem.dll16-Refcount-midihdr-to-work-around-buggy.patch b/patches/mmsystem.dll16-MIDIHDR_Refcount/0001-mmsystem.dll16-Refcount-midihdr-to-work-around-buggy.patch
index 4aa138cf..8c9ca0b9 100644
--- a/patches/mmsystem.dll16-MIDIHDR_Refcount/0001-mmsystem.dll16-Refcount-midihdr-to-work-around-buggy.patch
+++ b/patches/mmsystem.dll16-MIDIHDR_Refcount/0001-mmsystem.dll16-Refcount-midihdr-to-work-around-buggy.patch
@@ -114,7 +114,7 @@ index 5a722bb6691..a6816920dae 100644
 +        /* dwBufferLength can be reduced between prepare & write */
 +        if (wMsg == MODM_LONGDATA && mh32->hdr.dwBufferLength < mh16->dwBufferLength)
 +        {
-+            ERR("Size of buffer has been increased from %d to %d, keeping initial value\n",
++            ERR("Size of buffer has been increased from %ld to %ld, keeping initial value\n",
 +                mh32->hdr.dwBufferLength, mh16->dwBufferLength);
 +        }
 +        else
diff --git a/patches/ntdll-Junction_Points/0002-ntdll-Add-support-for-reading-reparse-points.patch b/patches/ntdll-Junction_Points/0002-ntdll-Add-support-for-reading-reparse-points.patch
index 36c56f26..7dc2b0b6 100644
--- a/patches/ntdll-Junction_Points/0002-ntdll-Add-support-for-reading-reparse-points.patch
+++ b/patches/ntdll-Junction_Points/0002-ntdll-Add-support-for-reading-reparse-points.patch
@@ -262,7 +262,7 @@ index 52b85cfc6d1..0967b3b9392 100644
 +    if (buffer_len != *size)
 +    {
 +        status = STATUS_IO_REPARSE_DATA_INVALID;
-+        ERR("Size mismatch decoding reparse point buffer (%d != %d)\n", *size, buffer_len);
++        ERR("Size mismatch decoding reparse point buffer (%d != %d)\n", (int)*size, buffer_len);
 +    }
 +
 +cleanup:
diff --git a/patches/odbc-remove-unixodbc/0039-odbc32-Pass-ODBC-version-when-creating-driver-enviro.patch b/patches/odbc-remove-unixodbc/0039-odbc32-Pass-ODBC-version-when-creating-driver-enviro.patch
index cadc7996..a49bb094 100644
--- a/patches/odbc-remove-unixodbc/0039-odbc32-Pass-ODBC-version-when-creating-driver-enviro.patch
+++ b/patches/odbc-remove-unixodbc/0039-odbc32-Pass-ODBC-version-when-creating-driver-enviro.patch
@@ -19,7 +19,7 @@ index 46872add8b0..851d2535ca1 100644
 +
 +        if (connection->pSQLSetEnvAttr)
 +            connection->pSQLSetEnvAttr(connection->driver_env, SQL_ATTR_ODBC_VERSION,
-+                                        (SQLPOINTER)connection->environment->version, 0);
++                                        (void *)(ULONG_PTR)connection->environment->version, 0);
 +
          connection->pSQLAllocHandle(SQL_HANDLE_DBC, connection->driver_env, &connection->driver_hdbc);
      }
diff --git a/patches/server-Realtime_Priority/0001-wineserver-Draft-to-implement-priority-levels-throug.patch b/patches/server-Realtime_Priority/0001-wineserver-Draft-to-implement-priority-levels-throug.patch
index b4b6f458..45cdc4c0 100644
--- a/patches/server-Realtime_Priority/0001-wineserver-Draft-to-implement-priority-levels-throug.patch
+++ b/patches/server-Realtime_Priority/0001-wineserver-Draft-to-implement-priority-levels-throug.patch
@@ -47,7 +47,7 @@ new file mode 100644
 index 00000000000..4a5d82b208d
 --- /dev/null
 +++ b/server/scheduler.c
-@@ -0,0 +1,166 @@
+@@ -0,0 +1,169 @@
 +/*
 + * Scheduler priority management
 + *
@@ -71,7 +71,10 @@ index 00000000000..4a5d82b208d
 +
 +#include "config.h"
 +
++#ifndef _GNU_SOURCE
 +#define _GNU_SOURCE  /* for SCHED_BATCH, SCHED_IDLE */
++#endif
++
 +#include <assert.h>
 +#include <stdio.h>
 +#include <stdarg.h>
diff --git a/patches/shell32-IconCache/0001-shell32-iconcache-Generate-icons-from-available-icons-.patch b/patches/shell32-IconCache/0001-shell32-iconcache-Generate-icons-from-available-icons-.patch
index 1d7bd3e8..18f11546 100644
--- a/patches/shell32-IconCache/0001-shell32-iconcache-Generate-icons-from-available-icons-.patch
+++ b/patches/shell32-IconCache/0001-shell32-iconcache-Generate-icons-from-available-icons-.patch
@@ -67,7 +67,7 @@ index 1c61374a732..a1c91f4785e 100644
 -        if (!get_imagelist_icon_size( i, &size ) ||
 -            !PrivateExtractIconsW( sourcefile, index, size.cx, size.cy, &hicons[i], 0, 1, 0 ))
 -            WARN("Failed to load icon %d from %s.\n", index, debugstr_w(sourcefile));
-+        ImageList_GetIconSize(shell_imagelists[i], &size[i].cx, &size[i].cy);
++        ImageList_GetIconSize(shell_imagelists[i], (INT *)&size[i].cx, (INT *)&size[i].cy);
 +        PrivateExtractIconsW(sourcefile, index, size[i].cx, size[i].cy, &hicons[i], 0, 1, 0);
 +    }
 +
diff --git a/patches/user32-recursive-activation/0001-user32-focus-Prevent-a-recursive-loop-with-the-activ.patch b/patches/user32-recursive-activation/0001-user32-focus-Prevent-a-recursive-loop-with-the-activ.patch
index 159bcf8b..351ae5a4 100644
--- a/patches/user32-recursive-activation/0001-user32-focus-Prevent-a-recursive-loop-with-the-activ.patch
+++ b/patches/user32-recursive-activation/0001-user32-focus-Prevent-a-recursive-loop-with-the-activ.patch
@@ -26,8 +26,9 @@ index cbdd4b195d3..241d07cefd2 100644
 @@ -1810,7 +1810,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
  {
      HWND previous = get_active_window();
-     BOOL ret;
+-    BOOL ret;
 -    DWORD old_thread, new_thread;
++    BOOL ret = FALSE;
 +    DWORD winflags, old_thread, new_thread;
      CBTACTIVATESTRUCT cbt;
  
diff --git a/patches/winemapi-user-xdg-mail/0001-winemapi-Directly-use-xdg-email-if-available-enablin.patch b/patches/winemapi-user-xdg-mail/0001-winemapi-Directly-use-xdg-email-if-available-enablin.patch
index bec8c082..2a6a9853 100644
--- a/patches/winemapi-user-xdg-mail/0001-winemapi-Directly-use-xdg-email-if-available-enablin.patch
+++ b/patches/winemapi-user-xdg-mail/0001-winemapi-Directly-use-xdg-email-if-available-enablin.patch
@@ -94,7 +94,7 @@ index 1bd3908ef6d..053d39b009d 100644
 +ULONG WINAPI MAPISendMail(LHANDLE session, ULONG_PTR uiparam,
 +    lpMapiMessage message, FLAGS flags, ULONG reserved)
 +{
-+    TRACE("(0x%I64xx 0x%I64xx %p 0x%08lx 0x%08lx)\n", session, uiparam,
++    TRACE("(0x%Ix 0x%Ix %p 0x%08lx 0x%08lx)\n", session, uiparam,
 +           message, flags, reserved);
 +
 +    if (XDGMailAvailable())
@@ -329,7 +329,7 @@ index 00000000000..a92f8ca079a
 +    char **argv = NULL;
 +    ULONG ret = MAPI_E_FAILURE;
 +
-+    TRACE("(0x%08lx 0x%08lx %p 0x%08x 0x%08x)\n", session, uiparam, message, flags, reserved);
++    TRACE("(0x%08Ix 0x%08Ix %p 0x%08lx 0x%08lx)\n", session, uiparam, message, flags, reserved);
 +
 +    if (!message)
 +        return MAPI_E_FAILURE;
diff --git a/patches/winex11-ime-check-thread-data/0001-winex11.drv-handle-missing-thread-data-in-X11DRV_get_ic.patch b/patches/winex11-ime-check-thread-data/0001-winex11.drv-handle-missing-thread-data-in-X11DRV_get_ic.patch
index 50bc1eb2..eb193d8c 100644
--- a/patches/winex11-ime-check-thread-data/0001-winex11.drv-handle-missing-thread-data-in-X11DRV_get_ic.patch
+++ b/patches/winex11-ime-check-thread-data/0001-winex11.drv-handle-missing-thread-data-in-X11DRV_get_ic.patch
@@ -45,15 +45,11 @@ diff --git a/dlls/winex11.drv/xim.c b/dlls/winex11.drv/xim.c
 index 51fb6bdff62..c6d6882735f 100644
 --- a/dlls/winex11.drv/xim.c
 +++ b/dlls/winex11.drv/xim.c
-@@ -564,6 +564,11 @@ XIC X11DRV_get_ic( HWND hwnd )
+@@ -564,6 +564,7 @@ XIC X11DRV_get_ic( HWND hwnd )
      XIM xim;
      XIC ret;
  
-+    if (!x11drv_thread_data())
-+    {
-+        release_win_data( data );
-+        return NULL;
-+    }
++    if (!x11drv_thread_data()) return 0;
      if (!(data = get_win_data( hwnd ))) return 0;
      x11drv_thread_data()->last_xic_hwnd = hwnd;
      if (!(ret = data->xic) && (xim = x11drv_thread_data()->xim))
-- 
2.43.0

