# HG changeset patch # User Sadrul Habib Chowdhury # Date 1168823455 0 # Node ID fa49e24d24f32c1fbce28470ee3353af17787ed3 # Parent 2086755211a5af293e53d4ba3f11196106507bff [gaim-migrate @ 18126] It's safer to use the utf8 version of strlen. committer: Tailor Script diff -r 2086755211a5 -r fa49e24d24f3 console/libgnt/gnttextview.c --- a/console/libgnt/gnttextview.c Sun Jan 14 20:38:18 2007 +0000 +++ b/console/libgnt/gnttextview.c Mon Jan 15 01:10:55 2007 +0000 @@ -509,6 +509,7 @@ { GList *alllines = g_list_first(view->list); GList *list, *next, *iter, *inext; + const int text_length = text ? g_utf8_strlen(text, -1) : 0; int count = 0; for (list = view->tags; list; list = next) { GntTextTag *tag = list->data; @@ -521,7 +522,7 @@ before = g_strndup(view->string->str, tag->start); after = g_strdup(view->string->str + tag->end); - change = (tag->end - tag->start) - (text ? strlen(text) : 0); + change = (tag->end - tag->start) - text_length; g_string_printf(view->string, "%s%s%s", before, text ? text : "", after); g_free(before);