Mercurial > pidgin
comparison console/libgnt/gntentry.c @ 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 | 4c939ea15004 |
children | 27182f83b79b |
comparison
equal
deleted
inserted
replaced
14030:0e70bb6d32fd | 14031:942170284c55 |
---|---|
124 | 124 |
125 /* Reached the max? */ | 125 /* Reached the max? */ |
126 if (entry->max && g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->max) | 126 if (entry->max && g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->max) |
127 continue; | 127 continue; |
128 | 128 |
129 if (g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->buffer) | 129 if (entry->end - entry->start >= entry->buffer) |
130 { | 130 { |
131 char *tmp = g_strdup_printf(entry->start); | 131 char *tmp = g_strdup_printf(entry->start); |
132 gnt_entry_set_text(entry, tmp); | 132 gnt_entry_set_text(entry, tmp); |
133 g_free(tmp); | 133 g_free(tmp); |
134 } | 134 } |
253 | 253 |
254 g_free(entry->start); | 254 g_free(entry->start); |
255 | 255 |
256 if (text && text[0]) | 256 if (text && text[0]) |
257 { | 257 { |
258 len = g_utf8_strlen(text, -1); | 258 len = strlen(text); |
259 entry->buffer = len * 2; | |
260 } | 259 } |
261 else | 260 else |
262 { | 261 { |
263 entry->buffer = 128; | |
264 len = 0; | 262 len = 0; |
265 } | 263 } |
264 | |
265 entry->buffer = len + 128; | |
266 | 266 |
267 scroll = entry->scroll - entry->start; | 267 scroll = entry->scroll - entry->start; |
268 cursor = entry->end - entry->cursor; | 268 cursor = entry->end - entry->cursor; |
269 | 269 |
270 entry->start = g_new0(char, entry->buffer); | 270 entry->start = g_new0(char, entry->buffer); |