[FFmpeg-devel] [PATCH] Implement av_strerror()
Måns Rullgård
mans
Thu Mar 18 00:09:26 CET 2010
Stefano Sabatini <stefano.sabatini-lala at poste.it> writes:
> On date Wednesday 2010-03-17 15:48:08 +0100, Michael Niedermayer encoded:
>> On Tue, Mar 16, 2010 at 08:41:00PM +0100, Stefano Sabatini wrote:
>> > +#if HAVE_STRERROR_R
>> > + ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
>>
>> this code is wrong, read the manual again
>> or look at the compiler warnings
>
> From /usr/include/string.h:
>
> __BEGIN_NAMESPACE_STD
> /* Return a string describing the meaning of the `errno' code in ERRNUM. */
> extern char *strerror (int __errnum) __THROW;
> __END_NAMESPACE_STD
> #if defined __USE_XOPEN2K || defined __USE_MISC
> /* Reentrant version of `strerror'.
> There are 2 flavors of `strerror_r', GNU which returns the string
> and may or may not use the supplied temporary buffer and POSIX one
> which fills the string into the buffer.
> To use the POSIX version, -D_XOPEN_SOURCE=600 or -D_POSIX_C_SOURCE=200112L
> without -D_GNU_SOURCE is needed, otherwise the GNU version is
> preferred. */
> # if defined __USE_XOPEN2K && !defined __USE_GNU
> /* Fill BUF with a string describing the meaning of the `errno' code in
> ERRNUM. */
> # ifdef __REDIRECT_NTH
> extern int __REDIRECT_NTH (strerror_r,
> (int __errnum, char *__buf, size_t __buflen),
> __xpg_strerror_r) __nonnull ((2));
>
> Thanks to Knuth we're using the standard flavour, that's why I don't
> see compilation warnings, while the GNU libc manual miserably fails at
> describing the only version which is worth to use (I mean the POSIX
> one).
We use the aforementioned -D_POSIX_C_SOURCE=200112L flag, so we have
the standard version. I don't see a problem.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list