[FFmpeg-devel] [PATCH] mingw: Use avprive_vsnprintf in bprint

Nicolas George nicolas.george at normalesup.org
Thu Sep 20 18:51:15 CEST 2012


Le jour de la Vertu, an CCXX, Derek Buitenhuis a écrit :
> MinGW versions prior to r4663 (w64) have a buggy vsnprintf
> implemenation.
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  compat/msvcrt/snprintf.c |    7 +++++++
>  libavutil/bprint.c       |    6 ++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/compat/msvcrt/snprintf.c b/compat/msvcrt/snprintf.c
> index 6787aad..30dc1f9 100644
> --- a/compat/msvcrt/snprintf.c
> +++ b/compat/msvcrt/snprintf.c
> @@ -27,6 +27,13 @@
>  #include "compat/va_copy.h"
>  #include "libavutil/error.h"
>  
> +#if defined(__MINGW32__)
> +#define EOVERFLOW EFBIG
> +
> +int avpriv_snprintf(char *s, size_t n, const char *fmt, ...);
> +int avpriv_vsnprintf(char *s, size_t n, const char *fmt, va_list ap);
> +#endif
> +
>  int avpriv_snprintf(char *s, size_t n, const char *fmt, ...)
>  {
>      va_list ap;
> diff --git a/libavutil/bprint.c b/libavutil/bprint.c
> index 373a492..9d3b408 100644
> --- a/libavutil/bprint.c
> +++ b/libavutil/bprint.c
> @@ -27,6 +27,12 @@
>  #include "error.h"
>  #include "mem.h"
>  
> +#if defined(__MINGW32__)
> +#include "compat/msvcrt/snprintf.c"
> +#undef vsnprintf
> +#define vsnprintf avpriv_vsnprintf
> +#endif

This looks strange: why do you not proceed the same way as for the basic
version of this file, i.e.

OBJS-$(HAVE_MINGW32) += ../compat/msvcrt/snprintf.o

bprint is not the only place where vsnprintf is used. If mingw's
implementation is bogus, it may be better to get the fixed version used by
the whole library.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120920/665173ba/attachment.asc>


More information about the ffmpeg-devel mailing list