1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (rb_str_succ): use wrapped character as a carry for

ASCII incompatible encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-01-30 05:29:37 +00:00
parent 44cfd58dc5
commit 84fe384383
3 changed files with 19 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Wed Jan 30 14:27:19 2008 Tanaka Akira <akr@fsij.org>
* string.c (rb_str_succ): use wrapped character as a carry for
ASCII incompatible encoding.
Wed Jan 30 12:26:59 2008 Tanaka Akira <akr@fsij.org> Wed Jan 30 12:26:59 2008 Tanaka Akira <akr@fsij.org>
* enc/utf_16be.c (UTF16_IS_SURROGATE_FIRST): avoid branch. * enc/utf_16be.c (UTF16_IS_SURROGATE_FIRST): avoid branch.
@ -12,7 +17,7 @@ Wed Jan 30 12:26:59 2008 Tanaka Akira <akr@fsij.org>
Wed Jan 30 12:06:43 2008 Tadayoshi Funaba <tadf@dotrb.org> Wed Jan 30 12:06:43 2008 Tadayoshi Funaba <tadf@dotrb.org>
* bignum.c (rb_cstr_to_inum): '0_2' is a valid representatin. * bignum.c (rb_cstr_to_inum): '0_2' is a valid representation.
Wed Jan 30 11:57:50 2008 NARUSE, Yui <naruse@ruby-lang.org> Wed Jan 30 11:57:50 2008 NARUSE, Yui <naruse@ruby-lang.org>
@ -141,7 +146,7 @@ Tue Jan 29 03:01:29 2008 NAKAMURA Usaku <usa@ruby-lang.org>
Tue Jan 29 01:38:02 2008 NAKAMURA Usaku <usa@ruby-lang.org> Tue Jan 29 01:38:02 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* common.mk ($(srcdir)/revision.h): no need to show ifchange execution * common.mk ($(srcdir)/revision.h): no need to show ifchange execution
because ifchange echos updated or unchaned. because ifchange echos updated or unchanged.
Tue Jan 29 01:26:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> Tue Jan 29 01:26:23 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>

View file

@ -2203,6 +2203,10 @@ rb_str_succ(VALUE orig)
/* wrapped to \0...\0. search next valid char. */ /* wrapped to \0...\0. search next valid char. */
enc_succ_char(s, l, enc); enc_succ_char(s, l, enc);
} }
if (!rb_enc_asciicompat(enc)) {
MEMCPY(carry, s, char, l);
carry_len = l;
}
carry_pos = s - sbeg; carry_pos = s - sbeg;
} }
} }

View file

@ -176,6 +176,14 @@ EOT
assert_str_equal(s, s.chomp, "#{encdump s}.chomp") assert_str_equal(s, s.chomp, "#{encdump s}.chomp")
end end
def test_succ
s = "\xff\xff".force_encoding("utf-16be")
assert(s.succ.valid_encoding?, "#{encdump s}.succ.valid_encoding?")
s = "\xdb\xff\xdf\xff".force_encoding("utf-16be")
assert(s.succ.valid_encoding?, "#{encdump s}.succ.valid_encoding?")
end
def test_regexp_union def test_regexp_union
enccall(Regexp, :union, "aa".force_encoding("utf-16be"), "bb".force_encoding("utf-16be")) enccall(Regexp, :union, "aa".force_encoding("utf-16be"), "bb".force_encoding("utf-16be"))
end end