Fix some cases when 'keysym' might be left uninitialized

Dmitry Timoshkov dmitry at baikal.ru
Mon Oct 13 09:29:47 CDT 2003


Hello,

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Fix some cases when 'keysym' might be left uninitialized.

--- cvs/hq/wine/dlls/x11drv/keyboard.c	Sat Oct  4 15:30:08 2003
+++ wine/dlls/x11drv/keyboard.c	Mon Oct 13 23:20:50 2003
@@ -850,7 +850,7 @@ static const WORD nonchar_key_scan[256] 
 /* x11 lock must be held */
 static WORD EVENT_event_to_vkey( XIC xic, XKeyEvent *e)
 {
-    KeySym keysym;
+    KeySym keysym = 0;
 
     if (xic)
         XmbLookupString(xic, e, NULL, 0, &keysym, NULL);
@@ -995,7 +995,7 @@ void X11DRV_KeymapNotify( HWND hwnd, XKe
 void X11DRV_KeyEvent( HWND hwnd, XKeyEvent *event )
 {
     char Str[24];
-    KeySym keysym;
+    KeySym keysym = 0;
     WORD vkey = 0, bScan;
     DWORD dwFlags;
     int ascii_chars;
@@ -1010,9 +1010,8 @@ void X11DRV_KeyEvent( HWND hwnd, XKeyEve
     wine_tsx11_unlock();
 
     /* Ignore some unwanted events */
-    if (ascii_chars &&
-        ((keysym >= XK_ISO_Lock && keysym <= XK_ISO_Last_Group_Lock) ||
-         keysym == XK_Mode_switch))
+    if ((keysym >= XK_ISO_Lock && keysym <= XK_ISO_Last_Group_Lock) ||
+         keysym == XK_Mode_switch)
     {
         TRACE("Ignoring %s keyboard event\n", TSXKeysymToString(keysym));
         return;
@@ -1271,6 +1270,7 @@ void X11DRV_InitKeyboard( BYTE *key_stat
     OEMvkey = VK_OEM_7; /* next is available.  */
     for (keyc = min_keycode; keyc <= max_keycode; keyc++)
     {
+        keysym = 0;
         e2.keycode = (KeyCode)keyc;
         XLookupString(&e2, NULL, 0, &keysym, NULL);
         vkey = 0; scan = 0;
@@ -1771,7 +1771,7 @@ INT X11DRV_ToUnicode(UINT virtKey, UINT 
 {
     Display *display = thread_display();
     XKeyEvent e;
-    KeySym keysym;
+    KeySym keysym = 0;
     INT ret;
     int keyc;
     char lpChar[10];






More information about the wine-patches mailing list