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

source_changes at macosforge.org source_changes at macosforge.org
Thu May 21 16:11:53 PDT 2009


Revision: 1585
          http://trac.macosforge.org/projects/ruby/changeset/1585
Author:   pthomson at apple.com
Date:     2009-05-21 16:11:48 -0700 (Thu, 21 May 2009)
Log Message:
-----------
Got the IO,pos spec working; fixed a non-conformant part of the implementation.

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

Modified: MacRuby/branches/experimental/io.c
===================================================================
--- MacRuby/branches/experimental/io.c	2009-05-21 10:01:53 UTC (rev 1584)
+++ MacRuby/branches/experimental/io.c	2009-05-21 23:11:48 UTC (rev 1585)
@@ -511,23 +511,23 @@
  *     f.pos    #=> 17
  */
 
-static inline long
+static inline long long
 rb_io_read_stream_get_offset(CFReadStreamRef stream)
 {
-    long result = 0L;
+    long long result = 0LL;
 
     CFNumberRef pos = CFReadStreamCopyProperty(stream,
 	    kCFStreamPropertyFileCurrentOffset);
-    CFNumberGetValue(pos, kCFNumberSInt32Type, &result);
+    CFNumberGetValue(pos, kCFNumberLongLongType, &result);
     CFRelease(pos);
 
     return result;
 }
 
 static inline void
-rb_io_read_stream_set_offset(CFReadStreamRef stream, long offset)
+rb_io_read_stream_set_offset(CFReadStreamRef stream, long long offset)
 {
-    CFNumberRef pos = CFNumberCreate(NULL, kCFNumberSInt32Type, &offset);
+    CFNumberRef pos = CFNumberCreate(NULL, kCFNumberLongLongType, &offset);
     CFReadStreamSetProperty(stream, kCFStreamPropertyFileCurrentOffset, pos);
     CFRelease(pos);
 }
@@ -538,7 +538,7 @@
     rb_io_t *io_struct = ExtractIOStruct(io);
     rb_io_assert_readable(io_struct);
 
-    return LONG2FIX(rb_io_read_stream_get_offset(io_struct->readStream)); 
+    return LL2NUM(rb_io_read_stream_get_offset(io_struct->readStream)); 
 }
 
 static VALUE
@@ -548,7 +548,7 @@
     rb_io_assert_readable(io_struct); 
 
     // TODO: make this work with IO::SEEK_CUR, SEEK_END, etc.
-    rb_io_read_stream_set_offset(io_struct->readStream, FIX2LONG(offset));
+    rb_io_read_stream_set_offset(io_struct->readStream, NUM2LL(offset));
 
     return INT2FIX(0); // is this right?
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090521/91ed439e/attachment.html>


More information about the macruby-changes mailing list