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

Stefano Sabatini stefano.sabatini-lala
Tue Mar 16 20:41:00 CET 2010


On date Monday 2010-03-15 14:17:49 +0000, M?ns Rullg?rd encoded:
> Michael Niedermayer <michaelni at gmx.at> writes:
> 
> > On Sun, Mar 14, 2010 at 10:08:46PM +0100, Stefano Sabatini wrote:
> >> On date Sunday 2010-03-14 19:22:19 +0100, Michael Niedermayer encoded:
> >> > On Sun, Mar 14, 2010 at 07:12:07PM +0100, Stefano Sabatini wrote:
> >> > > On date Sunday 2010-03-14 15:52:41 +0000, M?ns Rullg?rd encoded:
> >> > > > Stefano Sabatini <stefano.sabatini-lala at poste.it> writes:
> >> > [...]
> >> > > +
> >> > > +int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
> >> > > +{
> >> > > +    int ret = 0;
> >> > > +    const char *errstr = NULL;
> >> > > +    *errbuf = 0;
> >> > > +
> >> > > +    switch (errnum) {
> >> > 
> >> > > +#if LIBAVUTIL_VERSION_MAJOR < 51
> >> > > +    case AVERROR_IO:           errstr = "I/O error"; break;
> >> > > +    case AVERROR_NOENT:        errstr = "No such file or directory"; break;
> >> > > +    case AVERROR_NOMEM:        errstr = "Not enough memory"; break;
> >> > > +#endif
> >> > 
> >> > Is that what strerror_r() prints not good?
> >> 
> >> Updated.
> >> 
> >> I added also a test program (see the output as attachment), let me
> >> know if I have to keep it in the commit.
> >
> > i think the test prog can be droped
> >
> > [...]
> >
> >> +    *errbuf = 0;
> >
> > is this needed?
> 
> No.

If the error is unknown by strerror_r this won't be set, and the old
content in errbuf will be printed. But I don't care, so removed.

I'm keeping the test program just for my convenience, I'll remove it
when committing.

Regards.
-- 
FFmpeg = Fierce & Fundamentalist Merciful Practical Enhanced Geisha



More information about the ffmpeg-devel mailing list