ruby-changes:18016
From: yugui <ko1@a...>
Date: Thu, 2 Dec 2010 17:06:59 +0900 (JST)
Subject: [ruby-changes:18016] Ruby:r30037 (ruby_1_9_2): merges r29445 from trunk into ruby_1_9_2.
yugui 2010-12-02 17:06:40 +0900 (Thu, 02 Dec 2010) New Revision: 30037 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30037 Log: merges r29445 from trunk into ruby_1_9_2. -- * numeric.c (int_chr): a codepoint of Ruby M17N must be 32bit unsigned int; GB18030 uses MSB. Also note that OnigCodePoint is defined as uisigned int. Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/numeric.c branches/ruby_1_9_2/test/ruby/test_m17n.rb branches/ruby_1_9_2/version.h Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 30036) +++ ruby_1_9_2/ChangeLog (revision 30037) @@ -1,3 +1,9 @@ +Tue Oct 12 14:04:41 2010 NARUSE, Yui <naruse@r...> + + * numeric.c (int_chr): a codepoint of Ruby M17N must be 32bit + unsigned int; GB18030 uses MSB. Also note that OnigCodePoint + is defined as uisigned int. + Mon Oct 11 20:20:23 2010 NARUSE, Yui <naruse@r...> * lib/net/http.rb (HTTP.get): specify ASCII-8BIT as the result Index: ruby_1_9_2/numeric.c =================================================================== --- ruby_1_9_2/numeric.c (revision 30036) +++ ruby_1_9_2/numeric.c (revision 30037) @@ -2055,7 +2055,7 @@ { char c; int n; - SIGNED_VALUE i = NUM2LONG(num); + uint32_t i = NUM2UINT(num); rb_encoding *enc; VALUE str; @@ -2089,9 +2089,9 @@ #if SIZEOF_INT < SIZEOF_VALUE if (i > UINT_MAX) goto out_of_range; #endif - if (i < 0 || (n = rb_enc_codelen((int)i, enc)) <= 0) goto out_of_range; + if (i < 0 || (n = rb_enc_codelen(i, enc)) <= 0) goto out_of_range; str = rb_enc_str_new(0, n, enc); - rb_enc_mbcput((int)i, RSTRING_PTR(str), enc); + rb_enc_mbcput(i, RSTRING_PTR(str), enc); return str; } Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 30036) +++ ruby_1_9_2/version.h (revision 30037) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 67 +#define RUBY_PATCHLEVEL 68 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 Index: ruby_1_9_2/test/ruby/test_m17n.rb =================================================================== --- ruby_1_9_2/test/ruby/test_m17n.rb (revision 30036) +++ ruby_1_9_2/test/ruby/test_m17n.rb (revision 30037) @@ -1139,6 +1139,7 @@ 0.upto(255) {|b| assert_equal([b].pack("C"), b.chr) } + assert_equal("\x84\x31\xA4\x39".force_encoding("GB18030"), 0x8431A439.chr("GB18030")) end def test_marshal -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/