From 81f65b49e828952d496c80a991397fdac96feea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 9 Nov 2016 22:19:08 +0100 Subject: New upstream version 6.1.2 --- src/big5.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/big5.c') diff --git a/src/big5.c b/src/big5.c index 3d44975..bc713ab 100644 --- a/src/big5.c +++ b/src/big5.c @@ -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 -- cgit v1.2.3