diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-11-09 22:19:08 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-11-09 22:19:08 +0100 |
commit | 81f65b49e828952d496c80a991397fdac96feea9 (patch) | |
tree | 1256d7d214a97a3c130dc921323392a7f25c2c21 /src/big5.c | |
parent | 4abcda3c3b7d9cb44036840ec0af01d5294dedc5 (diff) |
New upstream version 6.1.2upstream/6.1.2
Diffstat (limited to 'src/big5.c')
-rw-r--r-- | src/big5.c | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -55,9 +55,28 @@ big5_mbc_enc_len(const UChar* p) } static int -is_valid_mbc_string(const UChar* s, const UChar* end) +is_valid_mbc_string(const UChar* p, const UChar* end) { - return onigenc_length_check_is_valid_mbc_string(ONIG_ENCODING_BIG5, s, end); + while (p < end) { + if (*p < 0x80) { + p++; + } + else if (*p < 0xa1) { + return FALSE; + } + else if (*p < 0xff) { + p++; + if (p >= end) return FALSE; + if (*p < 0x40) return FALSE; + if (*p > 0x7e && *p < 0xa1) return FALSE; + if (*p == 0xff) return FALSE; + p++; + } + else + return FALSE; + } + + return TRUE; } static OnigCodePoint |