winex11.drv/wintab32[3/5]: make wintab strings in winex11.drv Unicode, implement WTInfoW

Alexandre Julliard julliard at winehq.org
Thu Sep 20 09:47:14 CDT 2007


"Mikolaj Zalewski" <mikolajz at google.com> writes:

> @@ -305,8 +312,8 @@ void X11DRV_LoadTabletInfo(HWND hwnddefault)
>      hwndTabletDefault = hwnddefault;
>  
>      /* Do base initializaion */
> -    strcpy(gSysContext.lcName, "Wine Tablet Context");
> -    strcpy(gSysDevice.NAME,"Wine Tablet Device");
> +    MultiByteToWideChar(CP_UTF8, 0, "Wine Tablet Context", -1, gSysContext.lcName, WT_MAX_NAME_LEN);
> +    MultiByteToWideChar(CP_UTF8, 0, "Wine Tablet Device", -1, gSysDevice.NAME, WT_MAX_NAME_LEN);

You should define Unicode constants directly, there's no need to
convert at run-time.

> @@ -695,10 +716,12 @@ int X11DRV_AttachEventQueueToTablet(HWND hOwner)
>      X11DRV_expect_error(data->display,Tablet_ErrorHandler,NULL);
>      for (cur_loop=0; cur_loop < gNumCursors; cur_loop++)
>      {
> +        char   cursorNameA[WT_MAX_NAME_LEN];
>          int    event_number=0;
>  
> +        WideCharToMultiByte(CP_UNIXCP, 0, gSysCursor[cur_loop].NAME, -1, cursorNameA, WT_MAX_NAME_LEN, NULL, NULL);
>          for (loop=0; loop < num_devices; loop ++)
> -            if (strcmp(devices[loop].name,gSysCursor[cur_loop].NAME)==0)
> +            if (strncmp(devices[loop].name, cursorNameA, WT_MAX_NAME_LEN)==0)

This doesn't look right; if the name overflows the buffer we shouldn't
simply match against a truncated string.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list