* string.c (tr_trans): wrong encoding check for tree strings.
* test/ruby/test_m17n.rb (TestM17N::test_tr_s): "invalid mbstring sequence" is not an error to be tested. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5c04ed459b
commit
cfb91bc2f5
@ -1,3 +1,10 @@
|
|||||||
|
Fri Dec 21 00:26:39 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (tr_trans): wrong encoding check for tree strings.
|
||||||
|
|
||||||
|
* test/ruby/test_m17n.rb (TestM17N::test_tr_s): "invalid mbstring
|
||||||
|
sequence" is not an error to be tested.
|
||||||
|
|
||||||
Thu Dec 20 19:29:07 2007 Shugo Maeda <shugo@ruby-lang.org>
|
Thu Dec 20 19:29:07 2007 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* lib/net/imap.rb (initialize): the second argument is an option
|
* lib/net/imap.rb (initialize): the second argument is an option
|
||||||
|
12
string.c
12
string.c
@ -3453,7 +3453,7 @@ static VALUE
|
|||||||
tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
|
tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
|
||||||
{
|
{
|
||||||
SIGNED_VALUE trans[256];
|
SIGNED_VALUE trans[256];
|
||||||
rb_encoding *enc;
|
rb_encoding *enc, *e1, *e2;
|
||||||
struct tr trsrc, trrepl;
|
struct tr trsrc, trrepl;
|
||||||
int cflag = 0;
|
int cflag = 0;
|
||||||
int c, last = 0, modify = 0, i;
|
int c, last = 0, modify = 0, i;
|
||||||
@ -3471,9 +3471,13 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
|
|||||||
if (RSTRING_LEN(repl) == 0) {
|
if (RSTRING_LEN(repl) == 0) {
|
||||||
return rb_str_delete_bang(1, &src, str);
|
return rb_str_delete_bang(1, &src, str);
|
||||||
}
|
}
|
||||||
enc = rb_enc_check(str, src);
|
e1 = rb_enc_check(str, src);
|
||||||
if (rb_enc_check(str, repl) != enc) {
|
e2 = rb_enc_check(str, repl);
|
||||||
rb_raise(rb_eArgError, "character encodings differ");
|
if (e1 == e2) {
|
||||||
|
enc = e1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
enc = rb_enc_check(src, repl);
|
||||||
}
|
}
|
||||||
trrepl.p = RSTRING_PTR(repl);
|
trrepl.p = RSTRING_PTR(repl);
|
||||||
trrepl.pend = trrepl.p + RSTRING_LEN(repl);
|
trrepl.pend = trrepl.p + RSTRING_LEN(repl);
|
||||||
|
@ -1643,7 +1643,7 @@ class TestM17N < Test::Unit::TestCase
|
|||||||
#puts "#{encdump s1}.tr_s(#{encdump s2}, #{encdump s3})"
|
#puts "#{encdump s1}.tr_s(#{encdump s2}, #{encdump s3})"
|
||||||
t = s1.tr_s(s2, s3)
|
t = s1.tr_s(s2, s3)
|
||||||
rescue ArgumentError
|
rescue ArgumentError
|
||||||
e = $!
|
e = $! unless /mbstring sequence/ =~ $!.message
|
||||||
end
|
end
|
||||||
if e
|
if e
|
||||||
encs = []
|
encs = []
|
||||||
@ -1651,7 +1651,7 @@ class TestM17N < Test::Unit::TestCase
|
|||||||
encs << s2.encoding if !is_ascii_only?(s2)
|
encs << s2.encoding if !is_ascii_only?(s2)
|
||||||
encs << s3.encoding if !is_ascii_only?(s3)
|
encs << s3.encoding if !is_ascii_only?(s3)
|
||||||
encs.uniq!
|
encs.uniq!
|
||||||
#p e, encs
|
#p e, encs,
|
||||||
assert(1 < encs.length, "#{encdump s1}.tr_s(#{encdump s2}, #{encdump s3})")
|
assert(1 < encs.length, "#{encdump s1}.tr_s(#{encdump s2}, #{encdump s3})")
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#define RUBY_VERSION "1.9.0"
|
#define RUBY_VERSION "1.9.0"
|
||||||
#define RUBY_RELEASE_DATE "2007-12-20"
|
#define RUBY_RELEASE_DATE "2007-12-21"
|
||||||
#define RUBY_VERSION_CODE 190
|
#define RUBY_VERSION_CODE 190
|
||||||
#define RUBY_RELEASE_CODE 20071220
|
#define RUBY_RELEASE_CODE 20071221
|
||||||
#define RUBY_PATCHLEVEL 0
|
#define RUBY_PATCHLEVEL 0
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#define RUBY_VERSION_TEENY 0
|
#define RUBY_VERSION_TEENY 0
|
||||||
#define RUBY_RELEASE_YEAR 2007
|
#define RUBY_RELEASE_YEAR 2007
|
||||||
#define RUBY_RELEASE_MONTH 12
|
#define RUBY_RELEASE_MONTH 12
|
||||||
#define RUBY_RELEASE_DAY 20
|
#define RUBY_RELEASE_DAY 21
|
||||||
|
|
||||||
#ifdef RUBY_EXTERN
|
#ifdef RUBY_EXTERN
|
||||||
RUBY_EXTERN const char ruby_version[];
|
RUBY_EXTERN const char ruby_version[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user