[FFmpeg-devel] [PATCH] Implement av_strerror()

Michael Niedermayer michaelni
Thu Mar 18 00:46:35 CET 2010


On Wed, Mar 17, 2010 at 11:09:26PM +0000, M?ns Rullg?rd wrote:
> 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.

yes, sorry, this was my mistake
i read the manual installed on my system and assumed gnu would not be
that retarded to not only not document the standard function at all but
at the same time hijack the very same name for a incompatible gnu function
and describe that in its place

should we add something like 1*strerror_r() ?
just to make double sure we get the standard function or a easy to debug
compilation failure?

[...]


-- 
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: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100318/803640b0/attachment.pgp>



More information about the ffmpeg-devel mailing list