[macruby-changes] [4311] MacRuby/trunk/objc.m
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jun 30 12:45:51 PDT 2010
Revision: 4311
http://trac.macosforge.org/projects/ruby/changeset/4311
Author: lsansonetti at apple.com
Date: 2010-06-30 12:45:48 -0700 (Wed, 30 Jun 2010)
Log Message:
-----------
fixed build on 10.5 (patch by Justin McPherson)
Modified Paths:
--------------
MacRuby/trunk/objc.m
Modified: MacRuby/trunk/objc.m
===================================================================
--- MacRuby/trunk/objc.m 2010-06-30 19:04:04 UTC (rev 4310)
+++ MacRuby/trunk/objc.m 2010-06-30 19:45:48 UTC (rev 4311)
@@ -739,12 +739,22 @@
VALUE bstr = rb_str_bstr(str);
NSData *data = [NSData dataWithBytes:rb_bstr_bytes(bstr)
length:rb_bstr_length(bstr)];
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+ NSString *errorString = nil;
+ id plist = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:0
+ format:NULL errorDescription:&errorString];
+#else
NSError *err = nil;
id plist = [NSPropertyListSerialization propertyListWithData:data options:0
format:NULL error:&err];
+#endif
if (plist == nil) {
rb_raise(rb_eArgError, "error loading property list: '%s'",
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+ [errorString UTF8String]);
+#else
[[err localizedDescription] UTF8String]);
+#endif
}
return OC2RB(plist);
}
@@ -775,12 +785,22 @@
}
id objc_obj = RB2OC(recv);
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+ NSString *errorString = nil;
+ NSData *data = [NSPropertyListSerialization dataFromPropertyList:objc_obj
+ format:NSPropertyListXMLFormat_v1_0 errorDescription:&errorString];
+#else
NSError *err = nil;
NSData *data = [NSPropertyListSerialization dataWithPropertyList:objc_obj
format:NSPropertyListXMLFormat_v1_0 options:0 error:&err];
+#endif
if (data == nil) {
rb_raise(rb_eArgError, "error serializing property list: '%s'",
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+ [errorString UTF8String]);
+#else
[[err localizedDescription] UTF8String]);
+#endif
}
const uint8_t* bytes = [data bytes];
const size_t len = [data length];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100630/fa64d91d/attachment.html>
More information about the macruby-changes
mailing list