summaryrefslogtreecommitdiff
path: root/src/euc_jp.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-11-09 22:19:08 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-11-09 22:19:08 +0100
commit81f65b49e828952d496c80a991397fdac96feea9 (patch)
tree1256d7d214a97a3c130dc921323392a7f25c2c21 /src/euc_jp.c
parent4abcda3c3b7d9cb44036840ec0af01d5294dedc5 (diff)
New upstream version 6.1.2upstream/6.1.2
Diffstat (limited to 'src/euc_jp.c')
-rw-r--r--src/euc_jp.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/euc_jp.c b/src/euc_jp.c
index 19422ce..3b54e95 100644
--- a/src/euc_jp.c
+++ b/src/euc_jp.c
@@ -57,9 +57,39 @@ 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_JP, s, end);
+ while (p < end) {
+ if (*p < 0x80) {
+ p++;
+ }
+ else if (*p > 0xa0) {
+ if (*p == 0xff) return FALSE;
+ p++;
+ if (p >= end) return FALSE;
+ if (*p < 0xa1 || *p == 0xff) return FALSE;
+ p++;
+ }
+ else if (*p == 0x8e) {
+ p++;
+ if (p >= end) return FALSE;
+ if (*p < 0xa1 || *p > 0xdf) return FALSE;
+ p++;
+ }
+ else if (*p == 0x8f) {
+ p++;
+ if (p >= end) return FALSE;
+ if (*p < 0xa1 || *p == 0xff) return FALSE;
+ p++;
+ if (p >= end) return FALSE;
+ if (*p < 0xa1 || *p == 0xff) return FALSE;
+ p++;
+ }
+ else
+ return FALSE;
+ }
+
+ return TRUE;
}
static OnigCodePoint