From f42b61800a1a1b360c5ac915ec1caf34bf1fb86b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 9 Apr 2017 19:36:01 +0200 Subject: New upstream version 6.2.0 --- src/regerror.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/regerror.c') 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++)); -- cgit v1.2.3