diff options
author | Sadrul Habib Chowdhury <sadrul@pidgin.im> | 2007-01-15 01:10:55 +0000 |
---|---|---|
committer | Sadrul Habib Chowdhury <sadrul@pidgin.im> | 2007-01-15 01:10:55 +0000 |
commit | 9062da8c71467a25455d93f870393f7a012dc681 (patch) | |
tree | 97872a801ca5ec809b146cd63168823a64bf4149 | |
parent | 7824a33fdcc5de646500106073b26903fb5f0cc6 (diff) | |
download | pidgin-9062da8c71467a25455d93f870393f7a012dc681.tar.gz |
[gaim-migrate @ 18126]
It's safer to use the utf8 version of strlen.
-rw-r--r-- | console/libgnt/gnttextview.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/console/libgnt/gnttextview.c b/console/libgnt/gnttextview.c index e15f8e9564..8b836fe0df 100644 --- a/console/libgnt/gnttextview.c +++ b/console/libgnt/gnttextview.c @@ -509,6 +509,7 @@ int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *te { 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 @@ int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *te 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); |