]> git.saurik.com Git - cycript.git/blobdiff - ObjectiveC/Library.mm
The iOS entitlements break execution on Mac OS X.
[cycript.git] / ObjectiveC / Library.mm
index 44307e2a05a9c4680c6ffba7bf1ad4e121e18890..3a34f3eea3d1abc9ef6243006d71b862d8b5954d 100644 (file)
@@ -32,7 +32,6 @@
 #ifdef __APPLE__
 #include <CoreFoundation/CoreFoundation.h>
 #include <JavaScriptCore/JSStringRefCF.h>
-#include <WebKit/WebScriptObject.h>
 #include <objc/runtime.h>
 #endif
 
@@ -185,15 +184,11 @@ Type_ CYPoolRelease(CYPool *pool, Type_ object) {
 /* }}} */
 /* Objective-C Strings {{{ */
 const char *CYPoolCString(CYPool &pool, JSContextRef context, NSString *value) {
-    if (pool == NULL)
-        return [value UTF8String];
-    else {
-        size_t size([value maximumLengthOfBytesUsingEncoding:NSUTF8StringEncoding] + 1);
-        char *string(new(pool) char[size]);
-        if (![value getCString:string maxLength:size encoding:NSUTF8StringEncoding])
-            throw CYJSError(context, "[NSString getCString:maxLength:encoding:] == NO");
-        return string;
-    }
+    size_t size([value maximumLengthOfBytesUsingEncoding:NSUTF8StringEncoding] + 1);
+    char *string(new(pool) char[size]);
+    if (![value getCString:string maxLength:size encoding:NSUTF8StringEncoding])
+        throw CYJSError(context, "[NSString getCString:maxLength:encoding:] == NO");
+    return string;
 }
 
 JSStringRef CYCopyJSString(JSContextRef context, NSString *value) {
@@ -574,7 +569,6 @@ struct PropertyAttributes {
 };
 #endif
 
-#ifndef __APPLE__
 @interface CYWebUndefined : NSObject {
 }
 
@@ -592,7 +586,6 @@ struct PropertyAttributes {
 @end
 
 #define WebUndefined CYWebUndefined
-#endif
 
 /* Bridge: CYJSObject {{{ */
 @interface CYJSObject : NSMutableDictionary {
@@ -2172,10 +2165,13 @@ static int struct_forward_array[] = {
 #define OBJC_MAX_STRUCT_BY_VALUE 1
 static int struct_forward_array[] = {
     0, 0 };
+#elif defined(__arm64__)
+#define CY_NO_STRET
 #else
 #error missing objc-runtime-info
 #endif
 
+#ifndef CY_NO_STRET
 static bool stret(ffi_type *ffi_type) {
     return ffi_type->type == FFI_TYPE_STRUCT && (
         ffi_type->size > OBJC_MAX_STRUCT_BY_VALUE ||
@@ -2183,6 +2179,7 @@ static bool stret(ffi_type *ffi_type) {
     );
 }
 #endif
+#endif
 
 JSValueRef CYSendMessage(CYPool &pool, JSContextRef context, id self, Class _class, SEL _cmd, size_t count, const JSValueRef arguments[], bool initialize, JSValueRef *exception) { CYTry {
     const char *type;
@@ -2238,9 +2235,11 @@ JSValueRef CYSendMessage(CYPool &pool, JSContextRef context, id self, Class _cla
 
     if (imp == NULL) {
 #ifdef __APPLE__
+#ifndef CY_NO_STRET
         if (stret(cif.rtype))
             imp = class_getMethodImplementation_stret(_class, _cmd);
         else
+#endif
             imp = class_getMethodImplementation(_class, _cmd);
 #else
         objc_super super = {self, _class};