[前][次][番号順一覧][スレッド一覧]

ruby-changes:39940

From: naruse <ko1@a...>
Date: Sun, 4 Oct 2015 16:26:04 +0900 (JST)
Subject: [ruby-changes:39940] naruse:r52021 (trunk): refix through 52016, 52017, 52019, 52020 [Bug #11486]

naruse	2015-10-04 16:25:56 +0900 (Sun, 04 Oct 2015)

  New Revision: 52021

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52021

  Log:
    refix through 52016,52017,52019,52020 [Bug #11486]

  Modified files:
    trunk/enc/euc_jp.c
    trunk/test/ruby/test_m17n_comb.rb
Index: enc/euc_jp.c
===================================================================
--- enc/euc_jp.c	(revision 52020)
+++ enc/euc_jp.c	(revision 52021)
@@ -378,12 +378,13 @@ mbc_case_fold(OnigCaseFoldType flag, https://github.com/ruby/ruby/blob/trunk/enc/euc_jp.c#L378
     return 1;
   }
   else {
+    OnigCodePoint code;
     int len;
 
     len = mbc_enc_len(p, end, enc);
-    if (len <= 0) return 1;
-    get_lower_case(mbc_to_code(p, end, enc));
-    /* assuming case folding in euc-jp doesn't change length */
+    code = get_lower_case(mbc_to_code(p, end, enc));
+    len = code_to_mbc(code, lower, enc);
+    if (len == ONIGERR_INVALID_CODE_POINT_VALUE) len = 1;
     (*pp) += len;
     return len; /* return byte length of converted char to lower */
   }
Index: test/ruby/test_m17n_comb.rb
===================================================================
--- test/ruby/test_m17n_comb.rb	(revision 52020)
+++ test/ruby/test_m17n_comb.rb	(revision 52021)
@@ -1637,6 +1637,7 @@ class TestM17NComb < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_m17n_comb.rb#L1637
 
   def test_bug11486
     bug11486 = '[Bug #11486]'
-    assert_nil ("\u3042"*19+"\r"*19+"\u3042"*20+"\r"*20).encode("euc-jp").gsub!(/xxx/i, ""), bug11486
+    assert_nil ("\u3042"*19+"\r"*19+"\u3042"*20+"\r"*20).encode(Encoding::EUC_JP).gsub!(/xxx/i, ""), bug11486
+    assert_match Regexp.new("ABC\uff41".encode(Encoding::EUC_JP), Regexp::IGNORECASE), "abc\uFF21".encode(Encoding::EUC_JP), bug11486
   end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]