changeset 14031:942170284c55

[gaim-migrate @ 16633] Do not crash. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 05 Aug 2006 03:20:14 +0000
parents 0e70bb6d32fd
children 49e020487c82
files console/libgnt/gntentry.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/gntentry.c	Sat Aug 05 02:56:18 2006 +0000
+++ b/console/libgnt/gntentry.c	Sat Aug 05 03:20:14 2006 +0000
@@ -126,7 +126,7 @@
 				if (entry->max && g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->max)
 					continue;
 
-				if (g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->buffer)
+				if (entry->end - entry->start >= entry->buffer)
 				{
 					char *tmp = g_strdup_printf(entry->start);
 					gnt_entry_set_text(entry, tmp);
@@ -255,15 +255,15 @@
 
 	if (text && text[0])
 	{
-		len = g_utf8_strlen(text, -1);
-		entry->buffer = len * 2;
+		len = strlen(text);
 	}
 	else
 	{
-		entry->buffer = 128;
 		len = 0;
 	}
 
+	entry->buffer = len + 128;
+
 	scroll = entry->scroll - entry->start;
 	cursor = entry->end - entry->cursor;