mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
get_utf8_char() was buggy
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2450 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
0f39c504d1
commit
d0a9710bb8
@ -78,17 +78,17 @@ unichar get_utf8_char(const unsigned char **ptr, int len)
|
|||||||
|
|
||||||
mask = 0;
|
mask = 0;
|
||||||
UTF8_COMPUTE(**ptr, mask, chrlen);
|
UTF8_COMPUTE(**ptr, mask, chrlen);
|
||||||
if (len == -1)
|
if (chrlen == -1)
|
||||||
return (unichar) -2;
|
return (unichar) -2;
|
||||||
|
|
||||||
if (chrlen > len)
|
if (chrlen > len)
|
||||||
return (unichar) -1;
|
return (unichar) -1;
|
||||||
|
|
||||||
UTF8_GET(result, *ptr, i, mask, len);
|
UTF8_GET(result, *ptr, i, mask, chrlen);
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
return (unichar) -2;
|
return (unichar) -2;
|
||||||
|
|
||||||
*ptr += len-1;
|
*ptr += chrlen-1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user