mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_comparable): fixed to keep transitivity.
[ruby-dev:32693] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7c92ab16a9
commit
37855698ff
3 changed files with 20 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Dec 24 11:32:44 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_comparable): fixed to keep transitivity.
|
||||
[ruby-dev:32693]
|
||||
|
||||
Mon Dec 24 11:20:31 2007 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* lib/rdoc/ri/ri_options.rb: Fix display of GEMDIRS, make command
|
||||
|
@ -20,8 +25,6 @@ Mon Dec 24 09:45:45 2007 Martin Duerst <duerst@it.aoyama.ac.jp>
|
|||
* transcode.c, transcode_data_one_byte.c, transcode_data_japanese.c:
|
||||
added rb_ prefix to external data symbols.
|
||||
|
||||
Mon Dec 24 06:36:00 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
Mon Dec 24 05:32:22 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* enum.c (enum_inject): updated documentation. a patch from Keita
|
||||
|
|
16
string.c
16
string.c
|
@ -1274,10 +1274,15 @@ rb_str_comparable(VALUE str1, VALUE str2)
|
|||
if (idx1 == idx2) return Qtrue;
|
||||
rc1 = rb_enc_str_coderange(str1);
|
||||
rc2 = rb_enc_str_coderange(str2);
|
||||
if (rc1 == ENC_CODERANGE_7BIT && rc2 == ENC_CODERANGE_7BIT)
|
||||
if (rc1 == ENC_CODERANGE_7BIT) {
|
||||
if (rc2 == ENC_CODERANGE_7BIT) return Qtrue;
|
||||
if (rb_enc_asciicompat(rb_enc_from_index(idx1)))
|
||||
return Qtrue;
|
||||
if (rc1 == ENC_CODERANGE_BROKEN) return Qtrue;
|
||||
if (rc2 == ENC_CODERANGE_BROKEN) return Qtrue;
|
||||
}
|
||||
if (rc2 == ENC_CODERANGE_7BIT) {
|
||||
if (rb_enc_asciicompat(rb_enc_from_index(idx2)))
|
||||
return Qtrue;
|
||||
}
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
|
@ -1293,6 +1298,11 @@ rb_str_cmp(VALUE str1, VALUE str2)
|
|||
retval = memcmp(RSTRING_PTR(str1), RSTRING_PTR(str2), len);
|
||||
if (retval == 0) {
|
||||
if (RSTRING_LEN(str1) == RSTRING_LEN(str2)) {
|
||||
if (!enc) {
|
||||
if (rb_enc_get(str1) - rb_enc_get(str2) > 0)
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (RSTRING_LEN(str1) > RSTRING_LEN(str2)) return 1;
|
||||
|
|
|
@ -23,6 +23,7 @@ class TestIO < Test::Unit::TestCase
|
|||
r, w = IO.pipe
|
||||
w.print "\377xyz"
|
||||
w.close
|
||||
r.binmode
|
||||
assert_equal("\377", r.gets("\377"), "[ruby-dev:24460]")
|
||||
r.close
|
||||
|
||||
|
|
Loading…
Reference in a new issue