Alexandre Julliard : winex11: Check if IsXExtensionPointer is defined before using it.

Alexandre Julliard julliard at winehq.org
Fri Apr 25 09:46:47 CDT 2008


Module: wine
Branch: master
Commit: 405575168faaa80cc66ccfa9d9adefa0fbbc8a65
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=405575168faaa80cc66ccfa9d9adefa0fbbc8a65

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Apr 25 16:46:17 2008 +0200

winex11: Check if IsXExtensionPointer is defined before using it.

---

 dlls/winex11.drv/wintab.c |   35 ++++++++++++++---------------------
 1 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c
index b086e44..4e3e9de 100644
--- a/dlls/winex11.drv/wintab.c
+++ b/dlls/winex11.drv/wintab.c
@@ -523,21 +523,18 @@ void X11DRV_LoadTabletInfo(HWND hwnddefault)
     {
         int class_loop;
         char *device_type = devices[loop].type ? XGetAtomName(data->display, devices[loop].type) : NULL;
+        LPWTI_CURSORS_INFO cursor;
 
-        TRACE("Device %i:  [id %d|name %s|type %s|num_classes %d|use %s]\n",
+        TRACE("Device %i:  [id %d|name %s|type %s|num_classes %d|use %d]\n",
                 loop, (int) devices[loop].id, devices[loop].name, device_type ? device_type : "",
-                devices[loop].num_classes,
-                devices[loop].use == IsXKeyboard ? "IsXKeyboard" :
-                    devices[loop].use == IsXPointer ? "IsXPointer" :
-                    devices[loop].use == IsXExtensionDevice ? "IsXExtensionDevice" :
-                    devices[loop].use == IsXExtensionPointer ? "IsXExtensionPointer" :
-                    "Unknown"
-                );
-
-        if ((devices[loop].use == IsXExtensionDevice) || (devices[loop].use == IsXExtensionPointer))
-        {
-            LPWTI_CURSORS_INFO cursor;
+                devices[loop].num_classes, devices[loop].use );
 
+        switch (devices[loop].use)
+        {
+        case IsXExtensionDevice:
+#ifdef IsXExtensionPointer
+        case IsXExtensionPointer:
+#endif
             TRACE("Is XExtension%s\n", (devices[loop].use == IsXExtensionDevice)? "Device":"Pointer");
             cursor_target++;
             target = &devices[loop];
@@ -547,8 +544,7 @@ void X11DRV_LoadTabletInfo(HWND hwnddefault)
             {
                 ERR("Input device '%s' name too long - skipping\n", wine_dbgstr_a(target->name));
                 cursor_target--;
-                XFree(device_type);
-                continue;
+                break;
             }
 
             X11DRV_expect_error(data->display, Tablet_ErrorHandler, NULL);
@@ -566,8 +562,7 @@ void X11DRV_LoadTabletInfo(HWND hwnddefault)
                     TRACE("No buttons, Non Tablet Device\n");
                     pXCloseDevice(data->display, opendevice);
                     cursor_target --;
-                    XFree(device_type);
-                    continue;
+                    break;
                 }
 
                 for (i=0; i< cursor->BUTTONS; i++,shft++)
@@ -581,8 +576,7 @@ void X11DRV_LoadTabletInfo(HWND hwnddefault)
             {
                 WARN("Unable to open device %s\n",target->name);
                 cursor_target --;
-                XFree(device_type);
-                continue;
+                break;
             }
             MultiByteToWideChar(CP_UNIXCP, 0, target->name, -1, cursor->NAME, WT_MAX_NAME_LEN);
 
@@ -590,9 +584,8 @@ void X11DRV_LoadTabletInfo(HWND hwnddefault)
             {
                 WARN("Skipping device %d [name %s|type %s]; not apparently a tablet cursor type device.  If this is wrong, please report it to wine-devel at winehq.org\n",
                      loop, devices[loop].name, device_type ? device_type : "");
-                XFree(device_type);
                 cursor_target --;
-                continue;
+                break;
             }
 
             cursor->ACTIVE = 1;
@@ -727,10 +720,10 @@ void X11DRV_LoadTabletInfo(HWND hwnddefault)
                 }
                 any = (XAnyClassPtr) ((char*) any + any->length);
             }
+            break;
         }
 
         XFree(device_type);
-
     }
     pXFreeDeviceList(devices);
 




More information about the wine-cvs mailing list