From a2018b004b7d5b764a13018337cf599559f4b1b9 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 7 May 2004 08:48:30 +0000 Subject: * eval.c (rb_eval): too many line trace call. (ruby-bugs PR#1320) * numeric.c (flo_to_s): tweak output string based to preserve decimal point and to remove trailing zeros. [ruby-talk:97891] * string.c (rb_str_index_m): use unsigned comparison for T_FIXNUM search. [ruby-talk:97342] * hash.c (rb_hash_equal): returns true if two hashes have same set of key-value set. [ruby-talk:97559] * hash.c (rb_hash_eql): returns true if two hashes are equal and have same default values. * string.c (rb_str_equal): always returns true or false, never returns nil. [ruby-dev:23404] * io.c (rb_io_reopen): should use rb_io_check_io(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 8b55d7521..4bd5de968 100644 --- a/string.c +++ b/string.c @@ -889,7 +889,7 @@ rb_str_equal(str1, str2) if (str1 == str2) return Qtrue; if (TYPE(str2) != T_STRING) { if (!rb_respond_to(str2, rb_intern("to_str"))) { - return Qnil; + return Qfalse; } return rb_equal(str2, str1); } @@ -954,7 +954,7 @@ rb_str_cmp_m(str1, str2) if (TYPE(str2) != T_STRING) { if (!rb_respond_to(str2, rb_intern("to_str"))) { - return Qnil; + return Qfalse; } else if (!rb_respond_to(str2, rb_intern("<=>"))) { return Qnil; @@ -1081,7 +1081,7 @@ rb_str_index_m(argc, argv, str) { int c = FIX2INT(sub); long len = RSTRING(str)->len; - char *p = RSTRING(str)->ptr; + unsigned char *p = RSTRING(str)->ptr; for (;posptr + pos; - char *pbeg = RSTRING(str)->ptr; + unsigned char *p = RSTRING(str)->ptr + pos; + unsigned char *pbeg = RSTRING(str)->ptr; if (pos == RSTRING(str)->len) { if (pos == 0) return Qnil; --p; } while (pbeg <= p) { - if (*p == c) return LONG2NUM(p - RSTRING(str)->ptr); + if (*p == c) return LONG2NUM((char*)p - RSTRING(str)->ptr); p--; } return Qnil; -- cgit