From d4ff53b760f51d791860b25385f2f9716740d586 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 9 Jul 2013 06:21:45 +0000 Subject: fix [#36066] crash when Tab out text object the way Curve.len is used at the moment is really stupid, calculate string size on save for now, but should really store the length in bytes and total number of characters. --- source/blender/blenkernel/intern/text.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 296f25e303e..aec924e15b3 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -847,19 +847,6 @@ int txt_utf8_column_to_offset(const char *str, int column) return offset; } -/* returns the real number of characters in string */ -/* not the same as BLI_strlen_utf8, which returns length for wide characters */ -static int txt_utf8_len(const char *src) -{ - int len; - - for (len = 0; *src; len++) { - src += BLI_str_utf8_size(src); - } - - return len; -} - void txt_move_up(Text *text, short sel) { TextLine **linep; @@ -2059,7 +2046,7 @@ void txt_do_undo(Text *text) text->undo_pos--; } buf[i] = 0; - linep = txt_utf8_len(buf); + linep = BLI_strlen_utf8(buf); MEM_freeN(buf); /* skip over the length that was stored again */ -- cgit v1.2.3