summaryrefslogtreecommitdiff
path: root/src/regenc.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2021-04-26 22:25:42 +0200
committerJörg Frings-Fürst <debian@jff.email>2021-04-26 22:25:42 +0200
commit5d5f76cad47d13dc0dd4328c2172ddc1d4b19d7b (patch)
treecd59a8ea003d6768af284fc913353983e2794a58 /src/regenc.c
parenteac65ba44805c402f894b700b602c2e891f92a84 (diff)
parent96b0c9871630512ec2c2e84072da0085d68d740f (diff)
Merge branch 'release/debian/6.9.7.1-1'debian/6.9.7.1-1
Diffstat (limited to 'src/regenc.c')
-rw-r--r--src/regenc.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/regenc.c b/src/regenc.c
index 27e4549..84afd1e 100644
--- a/src/regenc.c
+++ b/src/regenc.c
@@ -2,7 +2,7 @@
regenc.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2019 K.Kosako
+ * Copyright (c) 2002-2020 K.Kosako
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -569,6 +569,9 @@ onigenc_apply_all_case_fold_with_map(int map_size,
r = onigenc_ascii_apply_all_case_fold(flag, f, arg);
if (r != 0) return r;
+ if (CASE_FOLD_IS_ASCII_ONLY(flag))
+ return 0;
+
for (i = 0; i < map_size; i++) {
code = map[i].to;
r = (*f)(map[i].from, &code, 1, arg);
@@ -588,7 +591,7 @@ onigenc_apply_all_case_fold_with_map(int map_size,
extern int
onigenc_get_case_fold_codes_by_str_with_map(int map_size,
const OnigPairCaseFoldCodes map[],
- int ess_tsett_flag, OnigCaseFoldType flag ARG_UNUSED,
+ int ess_tsett_flag, OnigCaseFoldType flag,
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
{
int i, j, n;
@@ -596,7 +599,8 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
if (0x41 <= *p && *p <= 0x5a) { /* A - Z */
if (*p == LARGE_S && ess_tsett_flag != 0 && end > p + 1
- && (*(p+1) == LARGE_S || *(p+1) == SMALL_S)) { /* SS */
+ && (*(p+1) == LARGE_S || *(p+1) == SMALL_S) /* SS */
+ && CASE_FOLD_IS_NOT_ASCII_ONLY(flag)) {
ss_combination:
items[0].byte_len = 2;
items[0].code_len = 1;
@@ -625,7 +629,8 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
}
else if (0x61 <= *p && *p <= 0x7a) { /* a - z */
if (*p == SMALL_S && ess_tsett_flag != 0 && end > p + 1
- && (*(p+1) == SMALL_S || *(p+1) == LARGE_S)) {
+ && (*(p+1) == SMALL_S || *(p+1) == LARGE_S)
+ && CASE_FOLD_IS_NOT_ASCII_ONLY(flag)) {
goto ss_combination;
}
@@ -634,7 +639,8 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
items[0].code[0] = (OnigCodePoint )(*p - 0x20);
return 1;
}
- else if (*p == 0xdf && ess_tsett_flag != 0) {
+ else if (*p == 0xdf && ess_tsett_flag != 0
+ && CASE_FOLD_IS_NOT_ASCII_ONLY(flag)) {
items[0].byte_len = 1;
items[0].code_len = 2;
items[0].code[0] = (OnigCodePoint )'s';
@@ -660,6 +666,9 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
else {
int i;
+ if (CASE_FOLD_IS_ASCII_ONLY(flag))
+ return 0;
+
for (i = 0; i < map_size; i++) {
if (*p == map[i].from) {
items[0].byte_len = 1;