diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-04-09 19:36:01 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-04-09 19:36:01 +0200 |
commit | f42b61800a1a1b360c5ac915ec1caf34bf1fb86b (patch) | |
tree | 89be88e0c37aeaa53e55de643586f9d5d4a3d5d2 /src/regerror.c | |
parent | cce716909e5236f1aa2971a4db45a007c7efe416 (diff) |
New upstream version 6.2.0upstream/6.2.0
Diffstat (limited to 'src/regerror.c')
-rw-r--r-- | src/regerror.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/regerror.c b/src/regerror.c index 05fc9d8..ee35b36 100644 --- a/src/regerror.c +++ b/src/regerror.c @@ -54,6 +54,8 @@ onig_error_code_to_format(int code) p = "fail to memory allocation"; break; case ONIGERR_MATCH_STACK_LIMIT_OVER: p = "match-stack limit over"; break; + case ONIGERR_PARSE_DEPTH_LIMIT_OVER: + p = "parse depth limit over"; break; case ONIGERR_TYPE_BUG: p = "undefined type (bug)"; break; case ONIGERR_PARSER_BUG: @@ -348,21 +350,12 @@ onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist) p = pat; while (p < pat_end) { - if (*p == '\\') { - *s++ = *p++; - len = enclen(enc, p); - while (len-- > 0) *s++ = *p++; - } - else if (*p == '/') { - *s++ = (unsigned char )'\\'; - *s++ = *p++; - } - else if (ONIGENC_IS_MBC_HEAD(enc, p)) { + if (ONIGENC_IS_MBC_HEAD(enc, p)) { len = enclen(enc, p); if (ONIGENC_MBC_MINLEN(enc) == 1) { while (len-- > 0) *s++ = *p++; } - else { /* for UTF16 */ + else { /* for UTF16/32 */ int blen; while (len-- > 0) { @@ -373,6 +366,15 @@ onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist) } } } + else if (*p == '\\') { + *s++ = *p++; + len = enclen(enc, p); + while (len-- > 0) *s++ = *p++; + } + else if (*p == '/') { + *s++ = (unsigned char )'\\'; + *s++ = *p++; + } else if (!ONIGENC_IS_CODE_PRINT(enc, *p) && !ONIGENC_IS_CODE_SPACE(enc, *p)) { sprint_byte_with_x((char* )bs, (unsigned int )(*p++)); |