Modified: MacRuby/trunk/io.c (4154 => 4155)
--- MacRuby/trunk/io.c 2010-05-26 01:15:56 UTC (rev 4154)
+++ MacRuby/trunk/io.c 2010-05-26 01:44:37 UTC (rev 4155)
@@ -1123,6 +1123,11 @@
outbuf = rb_bstr_new();
outbuf_created = true;
}
+ else {
+ StringValue(outbuf);
+ outbuf = rb_str_bstr(outbuf);
+ rb_str_set_len(outbuf, 0);
+ }
if (NIL_P(len)) {
rb_io_read_all(io_struct, outbuf);
@@ -1144,7 +1149,6 @@
rb_raise(rb_eArgError, "given size `%ld' is too big", size);
}
- outbuf = rb_str_bstr(outbuf);
rb_bstr_resize(outbuf, size);
uint8_t *bytes = rb_bstr_bytes(outbuf);