]> git.saurik.com Git - cycript.git/commitdiff
CYONify pointers as the address of their values.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 19 Jan 2014 20:14:58 +0000 (12:14 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 19 Jan 2014 20:14:58 +0000 (12:14 -0800)
Execute.cpp
JavaScript.hpp

index be05f7b468ca1deee3a04284f1135141ba87e831..7b39bb94622f05f37dbbbf381021749de4537e1d 100644 (file)
@@ -127,6 +127,7 @@ static JSClassRef Struct_;
 
 JSStringRef Array_s;
 JSStringRef cy_s;
+JSStringRef cyi_s;
 JSStringRef length_s;
 JSStringRef message_s;
 JSStringRef name_s;
@@ -1244,7 +1245,10 @@ static JSValueRef Pointer_callAsFunction_toCYON(JSContextRef context, JSObjectRe
         JSObjectRef Array(CYGetCachedObject(context, CYJSString("Array_prototype")));
         JSObjectRef toCYON(CYCastJSObject(context, CYGetProperty(context, Array, toCYON_s)));
         return CYCallAsFunction(context, toCYON, _this, count, arguments);
-    } else {
+    } else try {
+        CYPool pool;
+        return CYCastJSValue(context, pool.strcat("&", CYPoolCCYON(pool, context, CYGetProperty(context, _this, cyi_s)), NULL));
+    } catch (const CYException &e) {
         char string[32];
         sprintf(string, "%p", internal->value_);
         return CYCastJSValue(context, string);
@@ -1473,6 +1477,7 @@ void CYInitializeDynamic() {
 
     Array_s = JSStringCreateWithUTF8CString("Array");
     cy_s = JSStringCreateWithUTF8CString("$cy");
+    cyi_s = JSStringCreateWithUTF8CString("$cyi");
     length_s = JSStringCreateWithUTF8CString("length");
     message_s = JSStringCreateWithUTF8CString("message");
     name_s = JSStringCreateWithUTF8CString("name");
index 70887c49b42bd683dc4c332a6594afef113231e5..4ce43b68f86292211a4a3a34185cc50e9f1ac9ca 100644 (file)
@@ -39,6 +39,7 @@
 
 extern JSStringRef Array_s;
 extern JSStringRef cy_s;
+extern JSStringRef cyi_s;
 extern JSStringRef length_s;
 extern JSStringRef message_s;
 extern JSStringRef name_s;