Skip to content

Commit

Permalink
fix a silly bug in String#setbyte
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@4553 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information
lrz committed Sep 28, 2010
1 parent 18b0aba commit 13b16fa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion string.c
Expand Up @@ -1760,10 +1760,12 @@ rstr_getbyte(VALUE self, SEL sel, VALUE index)
*/

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);
Expand Down

0 comments on commit 13b16fa

Please sign in to comment.