mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
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
This commit is contained in:
parent
72930e0be3
commit
fee983d9fc
@ -555,18 +555,19 @@ void term_stop(void)
|
|||||||
|
|
||||||
static int input_utf8(const unsigned char *buffer, int size, unichar *result)
|
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)) {
|
switch (c) {
|
||||||
case -2:
|
case (unichar)-1:
|
||||||
/* not UTF8 - fallback to 8bit ascii */
|
/* not UTF8 - fallback to 8bit ascii */
|
||||||
*result = *buffer;
|
*result = *buffer;
|
||||||
return 1;
|
return 1;
|
||||||
case -1:
|
case (unichar)-2:
|
||||||
/* need more data */
|
/* need more data */
|
||||||
return -1;
|
return -1;
|
||||||
default:
|
default:
|
||||||
return (int) (end-buffer)+1;
|
*result = c;
|
||||||
|
return g_utf8_skip[*buffer];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user