-#ifdef WIN32
-# include <string.h>
-# include <stdlib.h>
-/**
- * vlc_fix_format_string:
- * @format: address of format string to fix (format string is not modified)
- *
- * Windows' printf doesn't support %z size modifiers.
- * Fix a *printf format string to make it safe for mingw/MSVCRT run times:
- * %z* (not supported in MSVCRT) -> either %I64* or %I32.
- *
- * Returns: 1 if *format must be free()d; 0 otherwise
- */
-static inline int vlc_fix_format_string (const char **format)
-{
- int n = 0;
- const char *tmp = *format;
- while ((tmp = strstr (tmp, "%z")) != NULL)
- {
- n++;
- tmp += 2;
- }
- if (!n)
- return 0;
-
- char *dst = (char*)malloc (strlen (*format) + 2*n + 1);
- if (!dst)
- {
- *format = "vlc_fix_format_string: due to malloc failure, unable to fix unsafe string";
- return 0;
- }
-
- const char *src = *format;
- *format = dst;
- while ((tmp = strstr (src, "%z")) != NULL)
- {
- /* NB, don't use %l*, as this is buggy in mingw*/
- size_t d = tmp - src;
- memcpy (dst, src, d);
- dst += d;
- *dst++ = '%';
-# ifdef WIN64
- *dst++ = 'I';
- *dst++ = '6';
- *dst++ = '4';
-# else /* ie: WIN32 */
- /* on win32, since the default size is 32bit, dont specify
- * a modifer. (I32 isn't on wince, l doesn't work on mingw) */
-# endif
- src = tmp + 2;
- }
- strcpy (dst, src);
- return 1;
-}
-
-# include <stdio.h>
-# include <stdarg.h>
-
-static inline int vlc_vprintf (const char *format, va_list ap)
-{
- int must_free = vlc_fix_format_string (&format);
- int ret = vprintf (format, ap);
- if (must_free) free ((char *)format);
- return ret;
-}
-# define vprintf vlc_vprintf
-
-static inline int vlc_vfprintf (FILE *stream, const char *format, va_list ap)