[FFmpeg-devel] [PATCH] bprint: implement vsnprintf for win32.

Nicolas George nicolas.george at normalesup.org
Thu Jun 14 13:55:00 CEST 2012


Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavutil/bprint.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)


It seems to fix FATE, at least on what I have near at hand on Debian.


diff --git a/libavutil/bprint.c b/libavutil/bprint.c
index f9d5d6a..6e59f6b 100644
--- a/libavutil/bprint.c
+++ b/libavutil/bprint.c
@@ -26,6 +26,25 @@
 #include "error.h"
 #include "mem.h"
 
+#if defined(_WIN32)
+
+static int vsnprintf_fixed(char *s, size_t n, const char *format, va_list va)
+{
+    va_list va2;
+    int r;
+
+    va_copy(va2, va);
+    r = vsnprintf(s, n, format, va2);
+    va_end(va2);
+    if (r == -1)
+        r = _vscprintf(format, va);
+    return r;
+}
+
+#define vsnprintf vsnprintf_fixed
+
+#endif
+
 #define av_bprint_room(buf) ((buf)->size - FFMIN((buf)->len, (buf)->size))
 #define av_bprint_is_allocated(buf) ((buf)->str != (buf)->reserved_internal_buffer)
 
-- 
1.7.10



More information about the ffmpeg-devel mailing list