From: nu774 Date: Fri, 11 Jan 2013 08:33:54 +0000 (+0900) Subject: support for i686-pc-mingw32 (missing _vscprintf) X-Git-Tag: v0.1.0~2 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;ds=sidebyside;h=dac71de305ea729c539a007931878e4fd1a26e73;p=fdkaac.git support for i686-pc-mingw32 (missing _vscprintf) --- diff --git a/configure.ac b/configure.ac index 4685cca..e065b00 100644 --- a/configure.ac +++ b/configure.ac @@ -32,7 +32,7 @@ AC_CHECK_TYPES([ptrdiff_t]) AC_SYS_LARGEFILE AC_FUNC_FSEEKO -AC_CHECK_FUNCS([gettimeofday nl_langinfo strdup]) +AC_CHECK_FUNCS([gettimeofday nl_langinfo strdup _vscprintf]) AC_CHECK_FUNC(getopt_long) AM_CONDITIONAL([FDK_NO_GETOPT_LONG],[test "$ac_cv_func_getopt_long" != "yes"]) AC_SEARCH_LIBS([aacEncOpen],[fdk-aac],[],[],[]) diff --git a/src/compat_win32.c b/src/compat_win32.c index 6802730..25c13f0 100644 --- a/src/compat_win32.c +++ b/src/compat_win32.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -92,6 +93,20 @@ char *aacenc_to_utf8(const char *s) return _strdup(s); } +#if defined(__MINGW32__) && !defined(HAVE__VSCPRINTF) +int _vscprintf(const char *fmt, va_list ap) +{ + static int (*fp_vscprintf)(const char *, va_list) = 0; + if (!fp_vscprintf) { + HANDLE h = GetModuleHandleA("msvcrt.dll"); + FARPROC fp = GetProcAddress(h, "_vscprintf"); + InterlockedCompareExchangePointer(&fp_vscprintf, fp, 0); + } + assert(fp_vscprintf); + return fp_vscprintf(fmt, ap); +} +#endif + int aacenc_fprintf(FILE *fp, const char *fmt, ...) { va_list ap;