summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2008-03-09 16:41:20 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2008-03-09 16:41:20 +0000
commitfee983d9fce89fbdcf7d12aed0caab2bd350c204 (patch)
treeebbc1e52efa146ab3cdbb5545890dbcea615bca5
parent72930e0be3a8841e8149b246542832128310c350 (diff)
downloadirssi-fee983d9fce89fbdcf7d12aed0caab2bd350c204.zip
Replace usage of get_utf8_char with g_utf8_get_char_validated.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4742 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-text/term-terminfo.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c
index 4b8d7938..f364e76b 100644
--- a/src/fe-text/term-terminfo.c
+++ b/src/fe-text/term-terminfo.c
@@ -555,18 +555,19 @@ void term_stop(void)
static int input_utf8(const unsigned char *buffer, int size, unichar *result)
{
- const unsigned char *end = buffer;
+ unichar c = g_utf8_get_char_validated(buffer, size);
- switch (get_utf8_char(&end, size, result)) {
- case -2:
+ switch (c) {
+ case (unichar)-1:
/* not UTF8 - fallback to 8bit ascii */
*result = *buffer;
return 1;
- case -1:
+ case (unichar)-2:
/* need more data */
return -1;
default:
- return (int) (end-buffer)+1;
+ *result = c;
+ return g_utf8_skip[*buffer];
}
}