diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-02 08:06:40 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-02 08:06:40 +0000 |
| commit | 55eecb54e79260379480dacb13272b10699ec5a8 (patch) | |
| tree | 743165f1b1c1a116dc2e39cb608a6a4c0871d82d | |
| parent | f099a11c2a55d4a00338bb494cb072bbf5f3c299 (diff) | |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 6 | ||||
| -rw-r--r-- | numeric.c | 6 | ||||
| -rw-r--r-- | test/ruby/test_m17n.rb | 1 | ||||
| -rw-r--r-- | version.h | 2 |
4 files changed, 11 insertions, 4 deletions
@@ -1,3 +1,9 @@ +Tue Oct 12 14:04:41 2010 NARUSE, Yui <naruse@ruby-lang.org> + + * 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@ruby-lang.org> * lib/net/http.rb (HTTP.get): specify ASCII-8BIT as the result @@ -2055,7 +2055,7 @@ int_chr(int argc, VALUE *argv, VALUE num) { char c; int n; - SIGNED_VALUE i = NUM2LONG(num); + uint32_t i = NUM2UINT(num); rb_encoding *enc; VALUE str; @@ -2089,9 +2089,9 @@ int_chr(int argc, VALUE *argv, VALUE num) #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; } diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 07cda751d1..9f1419df7d 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1139,6 +1139,7 @@ class TestM17N < Test::Unit::TestCase 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 @@ -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 |
