[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41189] trunk/blender/source/blender/ windowmanager/intern/wm_event_system.c: Fix for alt-tab in Windows.
Campbell Barton
ideasman42 at gmail.com
Sat Oct 22 14:46:24 CEST 2011
utf8_buf isnt a typical string, its a unicode value encoded into 6
bytes. and doesn't read past the length of the unicode character which
by definition cant be more than 6.
if we wanted we could have it 7 bytes long and always terminate the
7th but so far I don't think this is needed.
On Sat, Oct 22, 2011 at 4:50 PM, Dalai Felinto <dfelinto at gmail.com> wrote:
> Hi,
>
> Blender assumes '\0' terminated strings everywhere. So why not do the same
> with utf8?
> In other words, instead of changing here, why not to reinforce the '\0' in
> the GHOT_EventKey.h ?
>
> Or even in the GHOST_System* files?
>
> --
> Dalai
>
> 2011/10/21 Alexander Kuznetsov <kuzsasha at gmail.com>
>
>> Revision: 41189
>>
>> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41189
>> Author: alexk
>> Date: 2011-10-22 04:36:58 +0000 (Sat, 22 Oct 2011)
>> Log Message:
>> -----------
>> Fix for alt-tab in Windows.
>> utf8_buf can be not null terminated, plus not init as in this case. (I need
>> to investigate more)
>>
>> Modified Paths:
>> --------------
>> trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
>>
>> Modified:
>> trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
>> ===================================================================
>> --- trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
>> 2011-10-22 03:39:13 UTC (rev 41188)
>> +++ trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
>> 2011-10-22 04:36:58 UTC (rev 41189)
>> @@ -2611,7 +2611,7 @@
>> GHOST_TEventKeyData *kd= customdata;
>> event.type= convert_key(kd->key);
>> event.ascii= kd->ascii;
>> - strcpy(event.utf8_buf, kd->utf8_buf);
>> + memcpy(event.utf8_buf,
>> kd->utf8_buf,sizeof(event.utf8_buf));/* might be not null terminated*/
>> event.val=
>> (type==GHOST_kEventKeyDown)?KM_PRESS:KM_RELEASE;
>>
>> /* exclude arrow keys, esc, etc from text input */
>>
>> _______________________________________________
>> Bf-blender-cvs mailing list
>> Bf-blender-cvs at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>
--
- Campbell
More information about the Bf-committers
mailing list