Mercurial > pidgin.yaz
changeset 15335:fa49e24d24f3
[gaim-migrate @ 18126]
It's safer to use the utf8 version of strlen.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Mon, 15 Jan 2007 01:10:55 +0000 |
parents | 2086755211a5 |
children | a09936753f2f |
files | console/libgnt/gnttextview.c |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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);