Commit 16105494 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

fixed stray bug with utf8 support and symbolatom (thanks to Roman for a...

fixed stray bug with utf8 support and symbolatom (thanks to Roman for a report). See http://sourceforge.net/tracker/?func=detail&atid=478072&aid=3160982&group_id=55736 for additional info.
parent 9d0ba2bb
......@@ -18,6 +18,8 @@
#include "g_undo.h"
#include "x_preset.h"
#include "s_utf8.h"
t_class *text_class;
t_class *message_class;
static t_class *gatom_class;
......@@ -868,8 +870,22 @@ static void gatom_key(void *z, t_floatarg f)
(c >= '0' && c <= '9' || c == '.' || c == '-'
|| c == 'e' || c == 'E'))
{
x->a_buf[len] = c;
x->a_buf[len+1] = 0;
/* the wchar could expand to up to 4 bytes, which
* which might overrun our a_buf;
* therefore we first expand into a temporary buffer,
* and only if the resulting utf8 string fits into a_buf
* we apply it
*/
char utf8[UTF8_MAXBYTES];
int utf8len = u8_wc_toutf8(utf8, c);
if((len+utf8len) < (ATOMBUFSIZE-1))
{
int j=0;
for(j=0; j<utf8len; j++)
x->a_buf[len+j] = utf8[j];
x->a_buf[len+utf8len] = 0;
}
goto redraw;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment