From: Jay Freeman (saurik) Date: Wed, 28 Oct 2009 04:52:34 +0000 (+0000) Subject: Worked around a stupid spec issue with iconv(). X-Git-Tag: v0.9.432~238 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/93760f3fd5327f82ab4f6651d65002dfc040e505 Worked around a stupid spec issue with iconv(). --- diff --git a/Library.cpp b/Library.cpp index 80a17f7..aee85fa 100644 --- a/Library.cpp +++ b/Library.cpp @@ -140,6 +140,11 @@ static CYUTF16String CYCastUTF16String(JSStringRef value) { return CYUTF16String(JSStringGetCharactersPtr(value), JSStringGetLength(value)); } +template +_finline size_t iconv_(size_t (*iconv)(iconv_t, Type_, size_t *, char **, size_t *), iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { + return iconv(cd, const_cast(inbuf), inbytesleft, outbuf, outbytesleft); +} + static CYUTF8String CYPoolUTF8String(apr_pool_t *pool, JSContextRef context, JSStringRef value) { _assert(pool != NULL); @@ -157,7 +162,7 @@ static CYUTF8String CYPoolUTF8String(apr_pool_t *pool, JSContextRef context, JSS CYUTF8String utf8(out, size); size = utf16.size * 2; - _syscall(iconv(conversion, const_cast(&in), &size, &out, &utf8.size)); + _syscall(iconv_(&iconv, conversion, const_cast(&in), &size, &out, &utf8.size)); *out = '\0'; utf8.size = out - utf8.data;