From 4a8523e5dca7ec6e0ccfb9d85d35cf4cac209f55 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 15 Sep 2012 20:45:03 -0700 Subject: [PATCH] Use CYStringify in Type.toCYON to handle quotations. --- Execute.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Execute.cpp b/Execute.cpp index 0afd098..74f29f2 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -1214,13 +1214,9 @@ static JSValueRef Type_callAsFunction_toCYON(JSContextRef context, JSObjectRef o Type_privateData *internal(reinterpret_cast(JSObjectGetPrivate(_this))); CYPool pool; const char *type(sig::Unparse(pool, internal->type_)); - size_t size(strlen(type)); - char *cyon(new(pool) char[12 + size + 1]); - memcpy(cyon, "new Type(\"", 10); - cyon[12 + size] = '\0'; - cyon[12 + size - 2] = '"'; - cyon[12 + size - 1] = ')'; - memcpy(cyon + 10, type, size); + std::ostringstream str; + CYStringify(str, type, strlen(type)); + char *cyon(apr_pstrcat(pool, "new Type(", str.str().c_str(), ")", NULL)); return CYCastJSValue(context, CYJSString(cyon)); } CYCatch } -- 2.49.0