From: Jay Freeman (saurik) Date: Sat, 19 Dec 2015 14:29:16 +0000 (-0800) Subject: Include type in toCYON for opaque Pointer address. X-Git-Tag: v0.9.590~172 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/d8704ce45722442cb7eb741e49a6dca230a5ac47 Include type in toCYON for opaque Pointer address. --- diff --git a/Execute.cpp b/Execute.cpp index db347d9..1f40626 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -1515,9 +1515,24 @@ static JSValueRef Pointer_callAsFunction_toCYON(JSContextRef context, JSObjectRe JSObjectRef toCYON(CYCastJSObject(context, CYGetProperty(context, Array, toCYON_s))); return CYCallAsFunction(context, toCYON, _this, count, arguments); } else if (internal->type_->type_ == NULL) pointer: { - char string[32]; - sprintf(string, "%p", internal->value_); - return CYCastJSValue(context, string); + CYLocalPool pool; + std::ostringstream str; + + sig::Type type; + type.name = NULL; + type.flags = 0; + + type.primitive = sig::pointer_P; + type.data.data.type = internal->type_->type_; + type.data.data.size = 0; + + CYOptions options; + CYOutput output(*str.rdbuf(), options); + (new(pool) CYTypeExpression(Decode(pool, &type)))->Output(output, CYNoFlags); + + str << "(" << internal->value_ << ")"; + std::string value(str.str()); + return CYCastJSValue(context, CYJSString(CYUTF8String(value.c_str(), value.size()))); } else try { JSValueRef value(CYGetProperty(context, _this, cyi_s)); if (JSValueIsUndefined(context, value))