[macruby-changes] [4432] MacRuby/trunk/io.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 18 17:18:27 PDT 2010


Revision: 4432
          http://trac.macosforge.org/projects/ruby/changeset/4432
Author:   watson1978 at gmail.com
Date:     2010-08-18 17:18:24 -0700 (Wed, 18 Aug 2010)
Log Message:
-----------
Should set length 0 when rb_io_read_internal() returns 0.

Modified Paths:
--------------
    MacRuby/trunk/io.c

Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c	2010-08-17 03:26:35 UTC (rev 4431)
+++ MacRuby/trunk/io.c	2010-08-19 00:18:24 UTC (rev 4432)
@@ -1220,10 +1220,11 @@
     uint8_t *bytes = rb_bstr_bytes(outbuf);
 
     const long data_read = rb_io_read_internal(io_struct, bytes, size);
+    rb_bstr_set_length(outbuf, data_read);
+
     if (data_read == 0) {
 	return Qnil;
     }
-    rb_bstr_set_length(outbuf, data_read);
 
     return outbuf;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100818/773e1546/attachment.html>


More information about the macruby-changes mailing list