diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-11-09 22:19:11 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-11-09 22:19:11 +0100 |
commit | c8573389de0cd20ebaf77db034fc45ec9cbf8534 (patch) | |
tree | a8f441060dded6654aaf9069b5d51cafd5708223 /src/euc_kr.c | |
parent | 5b8fb1cf086c9f74666eed66b2d01cdf21d73880 (diff) | |
parent | 81f65b49e828952d496c80a991397fdac96feea9 (diff) |
Merge tag 'upstream/6.1.2'
Upstream version 6.1.2
Diffstat (limited to 'src/euc_kr.c')
-rw-r--r-- | src/euc_kr.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/euc_kr.c b/src/euc_kr.c index 12803cd..450caf1 100644 --- a/src/euc_kr.c +++ b/src/euc_kr.c @@ -55,9 +55,27 @@ euckr_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_EUC_KR, 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 < 0xa1 || *p == 0xff) + return FALSE; + p++; + } + else + return FALSE; + } + + return TRUE; } static OnigCodePoint |