diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-17 05:01:47 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-17 05:01:47 +0000 |
commit | df44ade694ffa28e8c72c7f8b699e3aa0af2c9a3 (patch) | |
tree | f18d0dd53e1e51d02dac1c133cb2e43e1f60de8e /string.c | |
parent | 4df82154b3dbfdc0b4c1bd9f358a1bb5d005d5ab (diff) | |
download | ruby-df44ade694ffa28e8c72c7f8b699e3aa0af2c9a3.tar.gz ruby-df44ade694ffa28e8c72c7f8b699e3aa0af2c9a3.tar.xz ruby-df44ade694ffa28e8c72c7f8b699e3aa0af2c9a3.zip |
* string.c (tr_find): wrong condition fixed.
* sprintf.c (rb_str_format): check encoding based on result, not
the format string.
* string.c (rb_str_upto): add encoding check.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1945,6 +1945,7 @@ rb_str_upto(int argc, VALUE *argv, VALUE beg) int n, excl; rb_scan_args(argc, argv, "11", &end, &exclusive); + rb_enc_check(beg, end); excl = RTEST(exclusive); succ = rb_intern("succ"); StringValue(end); @@ -3741,11 +3742,12 @@ tr_find(int c, char table[256], VALUE del, VALUE nodel) else { VALUE v = INT2NUM(c); - if ((!del || !NIL_P(rb_hash_lookup(del, v))) && - (!nodel || NIL_P(rb_hash_lookup(nodel, v)))) { - return Qtrue; + if (!del || NIL_P(rb_hash_lookup(del, v))) { + return Qfalse; } - return Qfalse; + if (nodel && NIL_P(rb_hash_lookup(nodel, v))) + return Qfalse; + return Qtrue; } } |