diff --git a/ChangeLog b/ChangeLog index 18fde3b21e..4c58e22890 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Oct 30 01:24:55 2008 Yusuke Endoh + + * string.c (rb_str_cmp): fix condition which always returned true + because ENCODING_GET returns unsigned long. + Thu Oct 30 01:10:32 2008 Yusuke Endoh * test/ruby/test_array (test_permutation): add a test that replaces diff --git a/string.c b/string.c index 16382b5304..ea7b04f335 100644 --- a/string.c +++ b/string.c @@ -2073,7 +2073,7 @@ rb_str_cmp(VALUE str1, VALUE str2) if (retval == 0) { if (RSTRING_LEN(str1) == RSTRING_LEN(str2)) { if (!rb_str_comparable(str1, str2)) { - if (ENCODING_GET(str1) - ENCODING_GET(str2) > 0) + if (ENCODING_GET(str1) > ENCODING_GET(str2)) return 1; return -1; }