Re: [libav-devel] [PATCH] compat/vsnprintf: return number of bytes required on truncation.

2012-09-11 Thread Måns Rullgård
Måns Rullgård writes: > Derek Buitenhuis writes: > >> On 11/09/2012 4:43 PM, Måns Rullgård wrote: >>> Accessing the va_list after passing it to another function is undefined. >>> You need to either reinitialise it (not possible since it was received >>> as an argument) or make a copy before acce

Re: [libav-devel] [PATCH] compat/vsnprintf: return number of bytes required on truncation.

2012-09-11 Thread Måns Rullgård
Derek Buitenhuis writes: > On 11/09/2012 4:43 PM, Måns Rullgård wrote: >> Accessing the va_list after passing it to another function is undefined. >> You need to either reinitialise it (not possible since it was received >> as an argument) or make a copy before accessing it (also not possible >>

Re: [libav-devel] [PATCH] compat/vsnprintf: return number of bytes required on truncation.

2012-09-11 Thread Derek Buitenhuis
On 11/09/2012 6:07 PM, Ronald S. Bultje wrote: > Add a configure check for va_copy and if it isn't there, add it in > libavutil as a #define va_copy(a, b) { a = b; }? You could even move > that to compat/va_copy.h and force-include that if you want to be > super-clean. It's not safe to do that. It

Re: [libav-devel] [PATCH] compat/vsnprintf: return number of bytes required on truncation.

2012-09-11 Thread Måns Rullgård
"Ronald S. Bultje" writes: > Hi, > > On Tue, Sep 11, 2012 at 2:53 PM, Derek Buitenhuis > wrote: >> On 11/09/2012 4:43 PM, Måns Rullgård wrote: >>> Accessing the va_list after passing it to another function is undefined. >>> You need to either reinitialise it (not possible since it was received >

Re: [libav-devel] [PATCH] compat/vsnprintf: return number of bytes required on truncation.

2012-09-11 Thread Ronald S. Bultje
Hi, On Tue, Sep 11, 2012 at 2:53 PM, Derek Buitenhuis wrote: > On 11/09/2012 4:43 PM, Måns Rullgård wrote: >> Accessing the va_list after passing it to another function is undefined. >> You need to either reinitialise it (not possible since it was received >> as an argument) or make a copy before

Re: [libav-devel] [PATCH] compat/vsnprintf: return number of bytes required on truncation.

2012-09-11 Thread Derek Buitenhuis
On 11/09/2012 4:43 PM, Måns Rullgård wrote: > Accessing the va_list after passing it to another function is undefined. > You need to either reinitialise it (not possible since it was received > as an argument) or make a copy before accessing it (also not possible > since msvc doesn't have va_copy).

Re: [libav-devel] [PATCH] compat/vsnprintf: return number of bytes required on truncation.

2012-09-11 Thread Måns Rullgård
"Ronald S. Bultje" writes: > @@ -57,7 +57,7 @@ int avpriv_vsnprintf(char *s, size_t n, const char *fmt, > memset(s, 0, n); > ret = _vsnprintf(s, n - 1, fmt, ap); > if (ret == -1) > -ret = n; > +ret = _vscprintf(fmt, ap); Accessing the va_list after passing it to an

Re: [libav-devel] [PATCH] compat/vsnprintf: return number of bytes required on truncation.

2012-09-11 Thread Nicolas George
Le sextidi 26 fructidor, an CCXX, Ronald S. Bultje a écrit : > @@ -57,7 +57,7 @@ int avpriv_vsnprintf(char *s, size_t n, const char *fmt, > memset(s, 0, n); > ret = _vsnprintf(s, n - 1, fmt, ap); > if (ret == -1) > -ret = n; > +ret = _vscprintf(fmt, ap); Don't you ne

[libav-devel] [PATCH] compat/vsnprintf: return number of bytes required on truncation.

2012-09-11 Thread Ronald S. Bultje
From: "Ronald S. Bultje" This conforms to C99, but requires Windows >= XP. --- compat/msvcrt/snprintf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compat/msvcrt/snprintf.c b/compat/msvcrt/snprintf.c index 2cdec74..b9c1619 100644 --- a/compat/msvcrt/snprintf.c +++ b/c