X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/a2b8d7ada7c9b527d46e781a217292603379e9e0..8f41509fd52c574f447fe0e40555530de3fda431:/Library.cpp?ds=sidebyside diff --git a/Library.cpp b/Library.cpp index 5be04f4..816dab6 100644 --- a/Library.cpp +++ b/Library.cpp @@ -191,9 +191,8 @@ double CYCastDouble(const char *value) { return CYCastDouble(value, strlen(value)); } -CYUTF8String CYPoolCode(CYPool &pool, CYUTF8String code) { +CYUTF8String CYPoolCode(CYPool &pool, std::istream &stream) { CYLocalPool local; - CYStream stream(code.data, code.data + code.size); CYDriver driver(stream); cy::parser parser(driver); @@ -210,28 +209,6 @@ CYUTF8String CYPoolCode(CYPool &pool, CYUTF8String code) { return $pool.strdup(str.str().c_str()); } -extern "C" bool CydgetMemoryParse(const uint16_t **data, size_t *size) { - CYPool pool; - - CYUTF8String utf8(CYPoolUTF8String(pool, CYUTF16String(*data, *size))); - try { - utf8 = CYPoolCode(pool, utf8); - } catch (const CYException &) { - *data = NULL; - *size = 0; - return false; - } - - CYUTF16String utf16(CYPoolUTF16String(pool, CYUTF8String(utf8.data, utf8.size))); - size_t bytes(utf16.size * sizeof(uint16_t)); - uint16_t *copy(reinterpret_cast(malloc(bytes))); - memcpy(copy, utf16.data, bytes); - - *data = copy; - *size = utf16.size; - return true; -} - CYPool &CYGetGlobalPool() { static CYPool pool; return pool;