[macruby-changes] [3119] MacRuby/trunk/time.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 14 18:07:05 PST 2009


Revision: 3119
          http://trac.macosforge.org/projects/ruby/changeset/3119
Author:   lsansonetti at apple.com
Date:     2009-12-14 18:07:02 -0800 (Mon, 14 Dec 2009)
Log Message:
-----------
fixed Time marshalling (patch contributed by Jens Nockert)

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

Modified: MacRuby/trunk/time.c
===================================================================
--- MacRuby/trunk/time.c	2009-12-15 01:58:01 UTC (rev 3118)
+++ MacRuby/trunk/time.c	2009-12-15 02:07:02 UTC (rev 3119)
@@ -2137,7 +2137,7 @@
     struct time_object *tobj;
     struct tm *tm;
     unsigned long p, s;
-    char buf[8];
+    UInt8 buf[8];
     time_t t;
     int nsec;
     int i;
@@ -2171,7 +2171,7 @@
 	s = RSHIFT(s, 8);
     }
 
-    str = rb_str_new(buf, 8);
+    str = rb_bytestring_new_with_data(buf, 8);
     rb_copy_generic_ivar(str, time);
     if (nsec) {
         /*
@@ -2181,7 +2181,7 @@
          * However it can be longer.
          * Extra digits are ignored for loading.
          */
-        unsigned char buf[2];
+        UInt8 buf[2];
         int len = sizeof(buf);
         buf[1] = (nsec % 10) << 4;
         nsec /= 10;
@@ -2190,7 +2190,7 @@
         buf[0] |= (nsec % 10) << 4;
         if (buf[1] == 0)
             len = 1;
-        rb_ivar_set(str, id_submicro, rb_str_new((char *)buf, len));
+        rb_ivar_set(str, id_submicro, rb_bytestring_new_with_data(buf, len));
     }
     return str;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091214/40c137f2/attachment.html>


More information about the macruby-changes mailing list