[FFmpeg-devel] [PATCH] bprint: add av_bprint_bytes().
Michael Niedermayer
michaelni at gmx.at
Thu Jun 14 10:54:19 CEST 2012
On Thu, Jun 14, 2012 at 09:26:27AM +0200, Nicolas George wrote:
> Le septidi 27 prairial, an CCXX, Michael Niedermayer a écrit :
> > btw, a bit off topic but can someone look at
> > http://fate.ffmpeg.org/report.cgi?time=20120613204422&slot=x86_64-debian-mingw32-gcc-4.6
> > the bprintf test fails on mingw
>
> The short answer to that is that their snprintf implementation is bogus
> beyond repair:
>
> char buf[5];
> int n1 = snprintf(buf, sizeof(buf), "Hello world.\n");
> int n2 = snprintf(NULL, 0, "Hello world.\n");
> printf("n1=%d n2=%d errno=%d\n", n1, n2, errno);
>
> yields:
>
> n1=-1 n2=-1 errno=0
>
> The standard mandates: "The snprintf function returns the number of
> characters that would have been written had n been sufficiently large, not
> counting the terminating null character, or a negative value if an
> encoding error occurred."
>
> And the errno codes listed by single Unix make it clear that "encoding
> error" does not including buffer too small.
>
> I'll try to think about it. If someone has an idea...
maybe _scprintf() under #if
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- 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/20120614/888a4f87/attachment.asc>
More information about the ffmpeg-devel
mailing list