diff --git a/euc_jp.c b/euc_jp.c index 848016ba5a..79c1dca454 100644 --- a/euc_jp.c +++ b/euc_jp.c @@ -45,20 +45,20 @@ eucjp_code_to_mbc_first(OnigCodePoint code) first = (code >> 16) & 0xff; /* if (enc_len(ONIG_ENCODING_EUC_JP, first) != 3) - return ONIGERR_INVALID_WIDE_CHAR_VALUE; + return ONIGENCERR_INVALID_WIDE_CHAR_VALUE; */ } else if ((code & 0xff00) != 0) { first = (code >> 8) & 0xff; /* if (enc_len(ONIG_ENCODING_EUC_JP, first) != 2) - return ONIGERR_INVALID_WIDE_CHAR_VALUE; + return ONIGENCERR_INVALID_WIDE_CHAR_VALUE; */ } else { /* if (enc_len(ONIG_ENCODING_EUC_JP, code) != 1) - return ONIGERR_INVALID_WIDE_CHAR_VALUE; + return ONIGENCERR_INVALID_WIDE_CHAR_VALUE; */ return (int )code; } @@ -76,7 +76,7 @@ eucjp_code_to_mbc(OnigCodePoint code, UChar *buf) #if 1 if (enc_len(ONIG_ENCODING_EUC_JP, buf[0]) != (p - buf)) - return ONIGERR_INVALID_WIDE_CHAR_VALUE; + return ONIGENCERR_INVALID_WIDE_CHAR_VALUE; #endif return p - buf; } @@ -127,8 +127,8 @@ eucjp_code_is_ctype(OnigCodePoint code, unsigned int ctype) static UChar* eucjp_left_adjust_char_head(UChar* start, UChar* s) { - /* Assumed in this encoding, - mb-trail bytes don't mix with single bytes. + /* In this encoding + mb-trail bytes doesn't mix with single bytes. */ UChar *p; int len; diff --git a/regenc.c b/regenc.c index 21598ca7c7..b1ce664667 100644 --- a/regenc.c +++ b/regenc.c @@ -361,7 +361,7 @@ onigenc_mb2_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf) #if 1 if (enc_len(enc, buf[0]) != (p - buf)) - return ONIGERR_INVALID_WIDE_CHAR_VALUE; + return ONIGENCERR_INVALID_WIDE_CHAR_VALUE; #endif return p - buf; } @@ -384,7 +384,7 @@ onigenc_mb4_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf) #if 1 if (enc_len(enc, buf[0]) != (p - buf)) - return ONIGERR_INVALID_WIDE_CHAR_VALUE; + return ONIGENCERR_INVALID_WIDE_CHAR_VALUE; #endif return p - buf; } diff --git a/regenc.h b/regenc.h index e0c6211d32..e5749fe51d 100644 --- a/regenc.h +++ b/regenc.h @@ -26,12 +26,10 @@ #endif /* error codes */ -/* internal error */ -#define ONIGERR_MEMORY -5 -#define ONIGERR_TYPE_BUG -6 -/* syntax error [-400, -999] */ -#define ONIGERR_INVALID_WIDE_CHAR_VALUE -400 -#define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE -401 +#define ONIGENCERR_MEMORY -5 +#define ONIGENCERR_TYPE_BUG -6 +#define ONIGENCERR_INVALID_WIDE_CHAR_VALUE -400 +#define ONIGENCERR_TOO_BIG_WIDE_CHAR_VALUE -401 #define ONIG_NEWLINE '\n' #define ONIG_IS_NEWLINE(c) ((c) == ONIG_NEWLINE) diff --git a/regerror.c b/regerror.c index 5a6c31b82e..c7a2a7b7ea 100644 --- a/regerror.c +++ b/regerror.c @@ -145,7 +145,7 @@ onig_error_code_to_format(int code) case ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY: p = "group number is too big for capture history"; break; case ONIGERR_INVALID_CHAR_PROPERTY_NAME: - p = "invalid character property name"; break; + p = "invalid character property name {%n}"; break; case ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT: p = "over thread pass limit count"; break; @@ -184,6 +184,7 @@ onig_error_code_to_str(s, code, va_alist) case ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL: case ONIGERR_INVALID_GROUP_NAME: case ONIGERR_INVALID_CHAR_IN_GROUP_NAME: + case ONIGERR_INVALID_CHAR_PROPERTY_NAME: einfo = va_arg(vargs, OnigErrorInfo*); len = einfo->par_end - einfo->par; q = onig_error_code_to_format(code); diff --git a/regint.h b/regint.h index 35736b6dcb..dacc0400be 100644 --- a/regint.h +++ b/regint.h @@ -85,7 +85,7 @@ #define xmemset memset #define xmemcpy memcpy #define xmemmove memmove -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__GNUC__) #define xalloca _alloca #ifdef NOT_RUBY #define vsnprintf _vsnprintf diff --git a/utf8.c b/utf8.c index 604cfac2ef..e1cbda45d4 100644 --- a/utf8.c +++ b/utf8.c @@ -82,7 +82,7 @@ utf8_code_to_mbclen(OnigCodePoint code) else if ((code & 0xfc000000) == 0) return 5; else if ((code & 0x80000000) == 0) return 6; else - return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE; + return ONIGENCERR_TOO_BIG_WIDE_CHAR_VALUE; } #if 0 @@ -103,7 +103,7 @@ utf8_code_to_mbc_first(OnigCodePoint code) else if ((code & 0x80000000) == 0) return ((code>>30) & 0x01) | 0xfc; else { - return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE; + return ONIGENCERR_TOO_BIG_WIDE_CHAR_VALUE; } } } @@ -148,7 +148,7 @@ utf8_code_to_mbc(OnigCodePoint code, UChar *buf) *p++ = UTF8_TRAILS(code, 6); } else { - return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE; + return ONIGENCERR_TOO_BIG_WIDE_CHAR_VALUE; } *p++ = UTF8_TRAIL0(code); @@ -417,7 +417,7 @@ utf8_get_ctype_code_range(int ctype, int* nsb, int* nmb, break; default: - return ONIGERR_TYPE_BUG; + return ONIGENCERR_TYPE_BUG; break; }