From 5f235e0325655d5b018ed3b34810bc64e3d3c2d8 Mon Sep 17 00:00:00 2001 From: kichik Date: Sun, 24 Mar 2013 06:11:36 +0000 Subject: [PATCH] iconv doesn't do TCHAR, only char and we need stdarg.h for va_arg and friends git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6316 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/util.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/util.h b/Source/util.h index 7234dddd..a9be61d6 100644 --- a/Source/util.h +++ b/Source/util.h @@ -30,6 +30,8 @@ # include #endif + #include + // these are the standard pause-before-quit stuff. extern int g_dopause; @@ -114,9 +116,9 @@ inline void PrintColorFmtMsg_ERR(const TCHAR *fmtstr, ...) // iconv const inconsistency workaround by Alexandre Oliva template inline size_t nsis_iconv_adaptor - (size_t (*iconv_func)(iconv_t, T, size_t *, TCHAR**,size_t*), - iconv_t cd, TCHAR **inbuf, size_t *inbytesleft, - TCHAR **outbuf, size_t *outbytesleft) + (size_t (*iconv_func)(iconv_t, T, size_t *, char**,size_t*), + iconv_t cd, char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) { return iconv_func (cd, (T)inbuf, inbytesleft, outbuf, outbytesleft); } @@ -143,8 +145,8 @@ public: { char *in = (char*) inbuf, *out = (char*) outbuf; size_t orgOutLeft = outLeft; - size_t ret = nsis_iconv_adaptor(iconv, *this, &in, &out, &outLeft); - if (-1 == ret) + size_t ret = nsis_iconv_adaptor(iconv, *this, &in, pInLeft, &out, &outLeft); + if ((size_t)(-1) == ret) ret = 0, *pInLeft = 1; else ret = orgOutLeft - outLeft; @@ -154,7 +156,7 @@ public: operator iconv_t() const { return m_cd; } static const char* GetHostEndianUCS4Code() { return "UCS-4-INTERNAL"; } -} +}; TCHAR *CharPrev(const TCHAR *s, const TCHAR *p); char *CharNextA(const char *s);