From 405575168faaa80cc66ccfa9d9adefa0fbbc8a65 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 25 Apr 2008 16:46:17 +0200 Subject: [PATCH] winex11: Check if IsXExtensionPointer is defined before using it. --- dlls/winex11.drv/wintab.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c index b086e442430..4e3e9de8e2c 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@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); -- 2.11.4.GIT