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
This commit is contained in:
kichik 2013-03-24 06:11:36 +00:00
parent ae0b6f6f62
commit 5f235e0325

View file

@ -30,6 +30,8 @@
# include <unistd.h> # include <unistd.h>
#endif #endif
#include <stdarg.h>
// these are the standard pause-before-quit stuff. // these are the standard pause-before-quit stuff.
extern int g_dopause; extern int g_dopause;
@ -114,9 +116,9 @@ inline void PrintColorFmtMsg_ERR(const TCHAR *fmtstr, ...)
// iconv const inconsistency workaround by Alexandre Oliva // iconv const inconsistency workaround by Alexandre Oliva
template <typename T> template <typename T>
inline size_t nsis_iconv_adaptor inline size_t nsis_iconv_adaptor
(size_t (*iconv_func)(iconv_t, T, size_t *, TCHAR**,size_t*), (size_t (*iconv_func)(iconv_t, T, size_t *, char**,size_t*),
iconv_t cd, TCHAR **inbuf, size_t *inbytesleft, iconv_t cd, char **inbuf, size_t *inbytesleft,
TCHAR **outbuf, size_t *outbytesleft) char **outbuf, size_t *outbytesleft)
{ {
return iconv_func (cd, (T)inbuf, inbytesleft, outbuf, outbytesleft); return iconv_func (cd, (T)inbuf, inbytesleft, outbuf, outbytesleft);
} }
@ -143,8 +145,8 @@ public:
{ {
char *in = (char*) inbuf, *out = (char*) outbuf; char *in = (char*) inbuf, *out = (char*) outbuf;
size_t orgOutLeft = outLeft; size_t orgOutLeft = outLeft;
size_t ret = nsis_iconv_adaptor(iconv, *this, &in, &out, &outLeft); size_t ret = nsis_iconv_adaptor(iconv, *this, &in, pInLeft, &out, &outLeft);
if (-1 == ret) if ((size_t)(-1) == ret)
ret = 0, *pInLeft = 1; ret = 0, *pInLeft = 1;
else else
ret = orgOutLeft - outLeft; ret = orgOutLeft - outLeft;
@ -154,7 +156,7 @@ public:
operator iconv_t() const { return m_cd; } operator iconv_t() const { return m_cd; }
static const char* GetHostEndianUCS4Code() { return "UCS-4-INTERNAL"; } static const char* GetHostEndianUCS4Code() { return "UCS-4-INTERNAL"; }
} };
TCHAR *CharPrev(const TCHAR *s, const TCHAR *p); TCHAR *CharPrev(const TCHAR *s, const TCHAR *p);
char *CharNextA(const char *s); char *CharNextA(const char *s);