[macruby-changes] [932] MacRuby/branches/experimental/io.c

source_changes at macosforge.org source_changes at macosforge.org
Sun Mar 15 20:27:34 PDT 2009


Revision: 932
          http://trac.macosforge.org/projects/ruby/changeset/932
Author:   lsansonetti at apple.com
Date:     2009-03-15 20:27:34 -0700 (Sun, 15 Mar 2009)
Log Message:
-----------
fixed a bug when increasing the io_gets buffer

Modified Paths:
--------------
    MacRuby/branches/experimental/io.c

Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c	2009-03-16 03:12:00 UTC (rev 931)
+++ MacRuby/branches/experimental/io.c	2009-03-16 03:27:34 UTC (rev 932)
@@ -1645,8 +1645,8 @@
     VALUE outbuf = rb_bytestring_new();
     CFMutableDataRef data = rb_bytestring_wrapped_data(outbuf);
 
-    long s = 128;
-    CFDataIncreaseLength(data, s);
+    long s = 512;
+    CFDataSetLength(data, s);
     UInt8 *buf = CFDataGetMutableBytePtr(data);
 
     // FIXME this is a very naive implementation
@@ -1658,9 +1658,9 @@
 	    break;
 	}
 
-	if (data_read > s) {
+	if (data_read >= s) {
 	    s += s;
-	    CFDataIncreaseLength(data, s);
+	    CFDataSetLength(data, s);
 	    buf = CFDataGetMutableBytePtr(data);
 	}
 	buf[data_read++] = byte;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090315/540ba2c0/attachment.html>


More information about the macruby-changes mailing list