[FFmpeg-devel] [PATCH] bprint: add av_bprint_bytes().

Nicolas George nicolas.george at normalesup.org
Thu Jun 14 09:26:27 CEST 2012

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);


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...


  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/20120614/02fb6b73/attachment.asc>

More information about the ffmpeg-devel mailing list