]> iEval git - fdkaac.git/commitdiff
support for i686-pc-mingw32 (missing _vscprintf)
authornu774 <honeycomb77@gmail.com>
Fri, 11 Jan 2013 08:33:54 +0000 (17:33 +0900)
committernu774 <honeycomb77@gmail.com>
Fri, 11 Jan 2013 08:33:54 +0000 (17:33 +0900)
configure.ac
src/compat_win32.c

index 4685cca45e08b4e783005bbfae4d533603a602a9..e065b005093aa4fc8020eafde256c9ade118d803 100644 (file)
@@ -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],[],[],[])
index 6802730b0e41b1079d73cddd73d34b9dfa04f7a0..25c13f07f5266b0d59278e4bbd9a2431d4809c8b 100644 (file)
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
+#include <assert.h>
 #include <io.h>
 #include <fcntl.h>
 #include <sys/timeb.h>
@@ -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;
This page took 0.035321 seconds and 4 git commands to generate.