[FFmpeg-devel] [PATCH] Make cmdutils.c:print_error() use strerror() if av_strerror() fails (e.g. if strerror_r() is not defined)

Stefano Sabatini stefano.sabatini-lala
Wed May 5 23:45:30 CEST 2010


On date Wednesday 2010-05-05 02:16:47 +0200, Michael Niedermayer encoded:
> On Wed, May 05, 2010 at 12:32:15AM +0200, Stefano Sabatini wrote:
> > On date Tuesday 2010-05-04 17:12:24 +0200, Michael Niedermayer encoded:
> > > On Tue, May 04, 2010 at 03:41:46PM +0200, Stefano Sabatini wrote:
> > [...]
> > > >  libavutil/error.c |    4 +++-
> > > >  1 files changed, 3 insertions(+), 1 deletions(-)
> > > > 
> > > > diff --git a/libavutil/error.c b/libavutil/error.c
> > > > index 3dd38a3..b6d6019 100644
> > > > --- a/libavutil/error.c
> > > > +++ b/libavutil/error.c
> > > > @@ -36,8 +36,10 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
> > > >      } else {
> > > >  #if HAVE_STRERROR_R
> > > >          ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
> > > > +#else
> > > > +        ret = -1;
> > > >  #endif
> > > > -        if (!HAVE_STRERROR_R || ret < 0)
> > > > +        if (ret < 0)
> > > >              snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
> > > >      }
> > > 
> > > you need to document the -1 case as well
> > 
> > Documentation clarified.
> > 
> > Regards.
> > -- 
> > FFmpeg = Fiendish Fascinating Martial Powerful Erudite Game
> 
> >  error.c |    4 +++-
> >  error.h |    3 ++-
> >  2 files changed, 5 insertions(+), 2 deletions(-)
> > 2910c94117675e3419db293a48d6f173e436c7cf  0001-Make-av_strerror-return-1-even-in-the-case-when-av_s.patch
> > >From a023fd7499ce901557ac89415d3f22d8cf2f465a Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> > Date: Mon, 3 May 2010 23:28:01 +0200
> > Subject: [PATCH 1/6] Make av_strerror() return -1 even in the case when av_strerror_r() is
> >  not defined.
> > 
> > This allows applications to check if av_strerror() cannot provide a
> > meaningful representation for the provided error code, without to
> > actually check the filled string.
> > ---
> >  libavutil/error.c |    4 +++-
> >  libavutil/error.h |    3 ++-
> >  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> looks ok now (i always assume you test your patches ...)

Applied.
-- 
FFmpeg = Free Fundamental Mystic Practical Enhanced Game



More information about the ffmpeg-devel mailing list