Jacek Caban : winex11: Use wcsicmp for string comparison.
Alexandre Julliard
julliard at winehq.org
Fri May 6 15:38:40 CDT 2022
Module: wine
Branch: master
Commit: 6dd08c34dccd491add3528b29726ae684b6be264
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6dd08c34dccd491add3528b29726ae684b6be264
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sun May 1 23:55:41 2022 +0200
winex11: Use wcsicmp for string comparison.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winex11.drv/desktop.c | 4 ++--
dlls/winex11.drv/keyboard.c | 2 +-
dlls/winex11.drv/settings.c | 8 ++++----
dlls/winex11.drv/x11drv.h | 2 ++
dlls/winex11.drv/xrandr.c | 2 +-
dlls/winex11.drv/xvidmode.c | 2 +-
6 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c
index c335bc5ba2b..20f4063c343 100644
--- a/dlls/winex11.drv/desktop.c
+++ b/dlls/winex11.drv/desktop.c
@@ -90,7 +90,7 @@ static BOOL X11DRV_desktop_get_id( const WCHAR *device_name, ULONG_PTR *id )
{
WCHAR primary_adapter[CCHDEVICENAME];
- if (!get_primary_adapter( primary_adapter ) || lstrcmpiW( primary_adapter, device_name ))
+ if (!get_primary_adapter( primary_adapter ) || wcsicmp( primary_adapter, device_name ))
return FALSE;
*id = 0;
@@ -342,7 +342,7 @@ NTSTATUS x11drv_create_desktop( void *arg )
TRACE( "%s %ux%u\n", debugstr_w(name), params->width, params->height );
/* magic: desktop "root" means use the root window */
- if (!lstrcmpiW( name, rootW )) return FALSE;
+ if (!wcsicmp( name, rootW )) return FALSE;
/* Create window */
win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | EnterWindowMask |
diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index 6b876c3bee9..ff43939a858 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -2203,7 +2203,7 @@ INT X11DRV_GetKeyNameText( LONG lParam, LPWSTR lpBuffer, INT nSize )
if (name && (vkey == VK_SHIFT || vkey == VK_CONTROL || vkey == VK_MENU))
{
char* idx = strrchr(name, '_');
- if (idx && (_strnicmp(idx, "_r", -1) == 0 || _strnicmp(idx, "_l", -1) == 0))
+ if (idx && (idx[1] == 'r' || idx[1] == 'R' || idx[1] == 'l' || idx[1] == 'L') && !idx[2])
{
pthread_mutex_unlock( &kbd_mutex );
TRACE("found scan=%04x keyc=%u keysym=%lx modified_string=%s\n",
diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c
index 1e8868acc6c..3e83e467c63 100644
--- a/dlls/winex11.drv/settings.c
+++ b/dlls/winex11.drv/settings.c
@@ -91,7 +91,7 @@ static BOOL nores_get_id(const WCHAR *device_name, ULONG_PTR *id)
if (!get_primary_adapter( primary_adapter ))
return FALSE;
- *id = !lstrcmpiW( device_name, primary_adapter ) ? 1 : 0;
+ *id = !wcsicmp( device_name, primary_adapter ) ? 1 : 0;
return TRUE;
}
@@ -500,7 +500,7 @@ BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DW
}
pthread_mutex_lock( &settings_mutex );
- if (n == 0 || lstrcmpiW(cached_device_name, name) || cached_flags != flags)
+ if (n == 0 || wcsicmp(cached_device_name, name) || cached_flags != flags)
{
if (!handler.get_id(name, &id) || !handler.get_modes(id, flags, &modes, &mode_count))
{
@@ -654,7 +654,7 @@ static LONG get_display_settings(struct x11drv_display_setting **new_displays,
displays[display_idx].desired_mode = registry_mode;
}
- else if (!lstrcmpiW(dev_name, display_device.DeviceName))
+ else if (!wcsicmp(dev_name, display_device.DeviceName))
{
displays[display_idx].desired_mode = *dev_mode;
if (!(dev_mode->dmFields & DM_POSITION))
@@ -950,7 +950,7 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
{
for (display_idx = 0; display_idx < display_count; ++display_idx)
{
- if (!lstrcmpiW(displays[display_idx].desired_mode.dmDeviceName, devname))
+ if (!wcsicmp(displays[display_idx].desired_mode.dmDeviceName, devname))
{
full_mode = get_full_mode(displays[display_idx].id, &displays[display_idx].desired_mode);
if (!full_mode)
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 42d9e39b082..5540a6ebbb5 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -949,4 +949,6 @@ static inline int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DW
return WideCharToMultiByte( CP_UNIXCP, 0, src, srclen, dst, dstlen, NULL, NULL );
}
+#define wcsicmp lstrcmpiW
+
#endif /* __WINE_X11DRV_H */
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index 6ede776d76b..eec7a81a4cb 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -151,7 +151,7 @@ static BOOL xrandr10_get_id( const WCHAR *device_name, ULONG_PTR *id )
/* RandR 1.0 only supports changing the primary adapter settings.
* For non-primary adapters, an id is still provided but getting
* and changing non-primary adapters' settings will be ignored. */
- *id = !lstrcmpiW( device_name, primary_adapter ) ? 1 : 0;
+ *id = !wcsicmp( device_name, primary_adapter ) ? 1 : 0;
return TRUE;
}
diff --git a/dlls/winex11.drv/xvidmode.c b/dlls/winex11.drv/xvidmode.c
index 126e2bf2a69..a51ded9fe4a 100644
--- a/dlls/winex11.drv/xvidmode.c
+++ b/dlls/winex11.drv/xvidmode.c
@@ -91,7 +91,7 @@ static BOOL xf86vm_get_id(const WCHAR *device_name, ULONG_PTR *id)
/* XVidMode only supports changing the primary adapter settings.
* For non-primary adapters, an id is still provided but getting
* and changing non-primary adapters' settings will be ignored. */
- *id = !lstrcmpiW( device_name, primary_adapter ) ? 1 : 0;
+ *id = !wcsicmp( device_name, primary_adapter ) ? 1 : 0;
return TRUE;
}
More information about the wine-cvs
mailing list