From d2a377d747c707bed4c2fb880fe4147807801e08 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 15 Jan 2008 09:47:58 +0000 Subject: [PATCH] * enc/utf_8.c: remove use of ONIG_ENCODING_UTF8 altogether; use enc argument instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ enc/utf_8.c | 44 +++----------------------------------------- 2 files changed, 8 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index b03850227d..400be9ab65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jan 15 18:44:46 2008 Yukihiro Matsumoto + + * enc/utf_8.c: remove use of ONIG_ENCODING_UTF8 altogether; use + enc argument instead. + Tue Jan 15 18:05:26 2008 NAKAMURA Usaku * enc/utf_8.c (ONIG_ENCODING_UTF8): reverted. diff --git a/enc/utf_8.c b/enc/utf_8.c index 458cf54cee..81b8cd2d3e 100644 --- a/enc/utf_8.c +++ b/enc/utf_8.c @@ -272,7 +272,7 @@ mbc_to_code(const UChar* p, const UChar* end, OnigEncoding enc) int c, len; OnigCodePoint n; - len = enclen(ONIG_ENCODING_UTF8, p, end); + len = enclen(enc, p, end); c = *p++; if (len > 1) { len--; @@ -390,47 +390,10 @@ mbc_case_fold(OnigCaseFoldType flag, const UChar** pp, return 1; /* return byte length of converted char to lower */ } else { - return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF8, flag, - pp, end, fold); + return onigenc_unicode_mbc_case_fold(enc, flag, pp, end, fold); } } -#if 0 -static int -is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end) -{ - const UChar* p = *pp; - - if (ONIGENC_IS_MBC_ASCII(p)) { - (*pp)++; - return ONIGENC_IS_ASCII_CODE_CASE_AMBIG(*p); - } - else { - (*pp) += enclen(ONIG_ENCODING_UTF8, p); - - if (*p == 0xc3) { - int c = *(p + 1); - if (c >= 0x80) { - if (c <= (UChar )0x9e) { /* upper */ - if (c == (UChar )0x97) return FALSE; - return TRUE; - } - else if (c >= (UChar )0xa0 && c <= (UChar )0xbe) { /* lower */ - if (c == (UChar )'\267') return FALSE; - return TRUE; - } - else if (c == (UChar )0x9f && - (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) { - return TRUE; - } - } - } - } - - return FALSE; -} -#endif - static int get_ctype_code_range(OnigCtype ctype, OnigCodePoint *sb_out, @@ -458,8 +421,7 @@ get_case_fold_codes_by_str(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[], OnigEncoding enc) { - return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF8, - flag, p, end, items); + return onigenc_unicode_get_case_fold_codes_by_str(enc, flag, p, end, items); } OnigEncodingDefine(utf8, UTF8) = {