From: Jay Freeman (saurik) Date: Tue, 5 Jan 2016 08:42:16 +0000 (-0800) Subject: Allow a * on a CString to get the first character. X-Git-Tag: v0.9.590~55 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/3e3acd8b6cb59a34b7819f6887e5386f6b8a30c6?hp=5b4dabb2071e2e09cd70a156beed03b12bec477a Allow a * on a CString to get the first character. --- diff --git a/Execute.cpp b/Execute.cpp index 310ddf6..78aaf1b 100644 --- a/Execute.cpp +++ b/Execute.cpp @@ -985,7 +985,9 @@ static JSValueRef CString_getProperty(JSContextRef context, JSObjectRef object, CString *internal(reinterpret_cast(JSObjectGetPrivate(object))); ssize_t offset; - if (!CYGetOffset(pool, context, property, offset)) + if (JSStringIsEqualToUTF8CString(property, "$cyi")) + offset = 0; + else if (!CYGetOffset(pool, context, property, offset)) return NULL; return CYCastJSValue(context, CYJSString(CYUTF8String(&internal->value_[offset], 1))); @@ -996,7 +998,9 @@ static bool CString_setProperty(JSContextRef context, JSObjectRef object, JSStri CString *internal(reinterpret_cast(JSObjectGetPrivate(object))); ssize_t offset; - if (!CYGetOffset(pool, context, property, offset)) + if (JSStringIsEqualToUTF8CString(property, "$cyi")) + offset = 0; + else if (!CYGetOffset(pool, context, property, offset)) return false; const char *data(CYPoolCString(pool, context, value));