ruby-changes:8509
From: mame <ko1@a...>
Date: Thu, 30 Oct 2008 01:30:33 +0900 (JST)
Subject: [ruby-changes:8509] Ruby:r20043 (trunk, ruby_1_9_1): * string.c (rb_str_cmp): fix condition which always returned true
mame 2008-10-30 01:30:02 +0900 (Thu, 30 Oct 2008) New Revision: 20043 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20043 Log: * string.c (rb_str_cmp): fix condition which always returned true because ENCODING_GET returns unsigned long. Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/string.c trunk/ChangeLog trunk/string.c Index: ChangeLog =================================================================== --- ChangeLog (revision 20042) +++ ChangeLog (revision 20043) @@ -1,3 +1,8 @@ +Thu Oct 30 01:24:55 2008 Yusuke Endoh <mame@t...> + + * 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 <mame@t...> * test/ruby/test_array (test_permutation): add a test that replaces Index: string.c =================================================================== --- string.c (revision 20042) +++ string.c (revision 20043) @@ -2073,7 +2073,7 @@ 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; } Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 20042) +++ ruby_1_9_1/ChangeLog (revision 20043) @@ -1,3 +1,8 @@ +Thu Oct 30 01:24:55 2008 Yusuke Endoh <mame@t...> + + * 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 <mame@t...> * test/ruby/test_array (test_permutation): add a test that replaces Index: ruby_1_9_1/string.c =================================================================== --- ruby_1_9_1/string.c (revision 20042) +++ ruby_1_9_1/string.c (revision 20043) @@ -2073,7 +2073,7 @@ 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; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/