Revision
4553
Author
lsansonetti@apple.com
Date
2010-09-28 15:32:38 -0700 (Tue, 28 Sep 2010)

Log Message

fix a silly bug in String#setbyte

Modified Paths

Diff

Modified: MacRuby/trunk/string.c (4552 => 4553)


--- MacRuby/trunk/string.c	2010-09-28 22:32:14 UTC (rev 4552)
+++ MacRuby/trunk/string.c	2010-09-28 22:32:38 UTC (rev 4553)
@@ -1760,10 +1760,12 @@
  */
 
 static VALUE
-rstr_setbyte(VALUE self, SEL sel, VALUE index, VALUE value)
+rstr_setbyte(VALUE self, SEL sel, VALUE idx, VALUE value)
 {
     rstr_modify(self);
     str_make_data_binary(RSTR(self));
+
+    long index = NUM2LONG(idx);
     if ((index < -RSTR(self)->length_in_bytes)
 	    || (index >= RSTR(self)->length_in_bytes)) {
 	rb_raise(rb_eIndexError, "index %ld out of string", index);