[PATCH 11/11] winemac: Don't use unicode.h.

Jacek Caban wine at gitlab.winehq.org
Thu Jun 2 19:51:26 CDT 2022


From: Jacek Caban <jacek at codeweavers.com>

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
---
 dlls/winemac.drv/clipboard.c   |  9 ++++-----
 dlls/winemac.drv/display.c     |  1 -
 dlls/winemac.drv/keyboard.c    |  7 +++----
 dlls/winemac.drv/macdrv_main.c |  3 ---
 dlls/winemac.drv/mouse.c       | 13 +++++--------
 dlls/winemac.drv/window.c      |  6 ++----
 6 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c
index 0f7bace1050..af8d99b59a3 100644
--- a/dlls/winemac.drv/clipboard.c
+++ b/dlls/winemac.drv/clipboard.c
@@ -36,7 +36,6 @@
 #include "shlobj.h"
 #include "wine/list.h"
 #include "wine/server.h"
-#include "wine/unicode.h"
 
 
 WINE_DEFAULT_DEBUG_CHANNEL(clipboard);
@@ -766,7 +765,7 @@ static void *import_nsfilenames_to_hdrop(CFDataRef data, size_t *ret_size)
 
     len = 1; /* for the terminating null */
     for (i = 0; i < count; i++)
-        len += strlenW(paths[i]) + 1;
+        len += wcslen(paths[i]) + 1;
 
     *ret_size = sizeof(*dropfiles) + len * sizeof(WCHAR);
     if (!(dropfiles = malloc(*ret_size)))
@@ -784,8 +783,8 @@ static void *import_nsfilenames_to_hdrop(CFDataRef data, size_t *ret_size)
     p = (WCHAR*)(dropfiles + 1);
     for (i = 0; i < count; i++)
     {
-        strcpyW(p, paths[i]);
-        p += strlenW(p) + 1;
+        wcscpy(p, paths[i]);
+        p += wcslen(p) + 1;
     }
     *p = 0;
 
@@ -994,7 +993,7 @@ static CFDataRef export_hdrop_to_filenames(void *data, size_t size)
         }
 
         if (dropfiles->fWide)
-            p = (WCHAR*)p + strlenW(p) + 1;
+            p = (WCHAR*)p + wcslen(p) + 1;
         else
             p = (char*)p + strlen(p) + 1;
 
diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c
index 2e126b384d1..19b9a9cdd9d 100644
--- a/dlls/winemac.drv/display.c
+++ b/dlls/winemac.drv/display.c
@@ -31,7 +31,6 @@
 #include "ddrawi.h"
 #define WIN32_NO_STATUS
 #include "winternl.h"
-#include "wine/unicode.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(display);
 
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c
index 102f945e79c..824addad78b 100644
--- a/dlls/winemac.drv/keyboard.c
+++ b/dlls/winemac.drv/keyboard.c
@@ -32,7 +32,6 @@
 
 #include "macdrv.h"
 #include "winuser.h"
-#include "wine/unicode.h"
 #include "wine/server.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(keyboard);
@@ -403,7 +402,7 @@ static BOOL char_matches_string(WCHAR wchar, UniChar *string, BOOL ignore_diacri
 {
     BOOL ret;
     CFStringRef s1 = CFStringCreateWithCharactersNoCopy(NULL, (UniChar*)&wchar, 1, kCFAllocatorNull);
-    CFStringRef s2 = CFStringCreateWithCharactersNoCopy(NULL, string, strlenW(string), kCFAllocatorNull);
+    CFStringRef s2 = CFStringCreateWithCharactersNoCopy(NULL, string, wcslen(string), kCFAllocatorNull);
     CFStringCompareFlags flags = kCFCompareCaseInsensitive | kCFCompareNonliteral | kCFCompareWidthInsensitive;
     if (ignore_diacritics)
         flags |= kCFCompareDiacriticInsensitive;
@@ -1366,7 +1365,7 @@ INT macdrv_GetKeyNameText(LONG lparam, LPWSTR buffer, INT size)
             if (status == noErr && deadKeyState)
             {
                 lstrcpynW(buffer + len, dead, size - len);
-                len = strlenW(buffer);
+                len = wcslen(buffer);
             }
 
             TRACE("lparam 0x%08x -> %s\n", lparam, debugstr_w(buffer));
@@ -1526,7 +1525,7 @@ UINT macdrv_MapVirtualKeyEx(UINT wCode, UINT wMapType, HKL hkl)
             }
 
             if (status == noErr && len)
-                ret = toupperW(s[0]) | (deadKey ? 0x80000000 : 0);
+                ret = RtlUpcaseUnicodeChar(s[0]) | (deadKey ? 0x80000000 : 0);
 
             break;
         }
diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c
index 6ed0fdb7730..e1fd7b2d331 100644
--- a/dlls/winemac.drv/macdrv_main.c
+++ b/dlls/winemac.drv/macdrv_main.c
@@ -32,10 +32,7 @@
 #include "ntstatus.h"
 #define WIN32_NO_STATUS
 #include "macdrv.h"
-#include "winuser.h"
-#include "winreg.h"
 #include "wine/server.h"
-#include "wine/unicode.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(macdrv);
 
diff --git a/dlls/winemac.drv/mouse.c b/dlls/winemac.drv/mouse.c
index fcdd1d1be1a..3f79dda2073 100644
--- a/dlls/winemac.drv/mouse.c
+++ b/dlls/winemac.drv/mouse.c
@@ -28,10 +28,7 @@
 
 #define OEMRESOURCE
 #include "macdrv.h"
-#include "winuser.h"
-#include "winreg.h"
 #include "wine/server.h"
-#include "wine/unicode.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(cursor);
 
@@ -182,11 +179,11 @@ CFStringRef copy_system_cursor_name(ICONINFOEXW *info)
 
     if (!info->szModName[0]) return NULL;
 
-    p = strrchrW(info->szModName, '\\');
-    strcpyW(name, p ? p + 1 : info->szModName);
-    p = name + strlenW(name);
+    p = wcsrchr(info->szModName, '\\');
+    wcscpy(name, p ? p + 1 : info->szModName);
+    p = name + wcslen(name);
     *p++ = ',';
-    if (info->szResName[0]) strcpyW(p, info->szResName);
+    if (info->szResName[0]) wcscpy(p, info->szResName);
     else
     {
         char buf[16];
@@ -212,7 +209,7 @@ CFStringRef copy_system_cursor_name(ICONINFOEXW *info)
                 return NULL; /* force standard cursor */
             }
 
-            cursor_name = CFStringCreateWithCharacters(NULL, value, strlenW(value));
+            cursor_name = CFStringCreateWithCharacters(NULL, value, wcslen(value));
             if (!cursor_name)
             {
                 WARN("CFStringCreateWithCharacters failed for %s\n", debugstr_w(value));
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c
index f533f1d6310..9d778f427b0 100644
--- a/dlls/winemac.drv/window.c
+++ b/dlls/winemac.drv/window.c
@@ -35,8 +35,6 @@
 #undef LoadResource
 
 #include "macdrv.h"
-#include "winuser.h"
-#include "wine/unicode.h"
 #include "wine/server.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(macdrv);
@@ -715,7 +713,7 @@ static void create_cocoa_window(struct macdrv_win_data *data)
 
     /* set the window text */
     if (!NtUserInternalGetWindowText(data->hwnd, text, ARRAY_SIZE(text))) text[0] = 0;
-    macdrv_set_cocoa_window_title(data->cocoa_window, text, strlenW(text));
+    macdrv_set_cocoa_window_title(data->cocoa_window, text, wcslen(text));
 
     /* set the window region */
     if (win_rgn || IsRectEmpty(&data->window_rect)) sync_window_region(data, win_rgn);
@@ -1773,7 +1771,7 @@ void macdrv_SetWindowText(HWND hwnd, LPCWSTR text)
     TRACE("%p, %s\n", hwnd, debugstr_w(text));
 
     if ((win = macdrv_get_cocoa_window(hwnd, FALSE)))
-        macdrv_set_cocoa_window_title(win, text, strlenW(text));
+        macdrv_set_cocoa_window_title(win, text, wcslen(text));
 }
 
 
-- 
GitLab

https://gitlab.winehq.org/wine/wine/-/merge_requests/177



More information about the wine-devel mailing list