X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/579301290fa12f6d54af8d840e8740c8aaefe954..58321c0afd977fa7a47f5d81ee0674ca7582c309:/Library.cpp diff --git a/Library.cpp b/Library.cpp index 28f9395..74df502 100644 --- a/Library.cpp +++ b/Library.cpp @@ -204,32 +204,10 @@ CYUTF8String CYPoolCode(CYPool &pool, CYUTF8String code) { CYContext context(options); driver.program_->Replace(context); - std::ostringstream &str(pool.object()); + std::ostringstream str; CYOutput out(str, options); out << *driver.program_; - return 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; + return $pool.strdup(str.str().c_str()); } CYPool &CYGetGlobalPool() {