[libav-devel] [PATCH 1/2] avconv_opt: fix avio_open2() return code check

wm4 nfxjfg at googlemail.com
Sun Mar 30 11:23:35 CEST 2014


On Sun, 30 Mar 2014 10:20:17 +0200
Vittorio Giovara <vittorio.giovara at gmail.com> wrote:

> On Sat, Mar 29, 2014 at 10:59 PM, Timothy Gu <timothygu99 at gmail.com> wrote:
> > avio_open2() only return < 0 when error.
> >
> > Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
> 
> you can drop the sign-offs here, as it generally mean that the code
> was modified by the person signing it ;)

It also tracks authorship and contributions. I mean, that's why the tag
exists.

> > ---
> >  avconv_opt.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/avconv_opt.c b/avconv_opt.c
> > index 7bc41c9..fc57f6b 100644
> > --- a/avconv_opt.c
> > +++ b/avconv_opt.c
> > @@ -819,14 +819,14 @@ static uint8_t *get_line(AVIOContext *s)
> >
> >  static int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s)
> >  {
> > -    int i, ret = 1;
> > +    int i, ret = -1;
> >      char filename[1000];
> >      const char *base[3] = { getenv("AVCONV_DATADIR"),
> >                              getenv("HOME"),
> >                              AVCONV_DATADIR,
> >                              };
> >
> > -    for (i = 0; i < FF_ARRAY_ELEMS(base) && ret; i++) {
> > +    for (i = 0; i < FF_ARRAY_ELEMS(base) && ret < 0; i++) {
> >          if (!base[i])
> >              continue;
> >          if (codec_name) {
> > @@ -834,7 +834,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
> >                       i != 1 ? "" : "/.avconv", codec_name, preset_name);
> >              ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
> >          }
> > -        if (ret) {
> > +        if (ret < 0) {
> >              snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i],
> >                       i != 1 ? "" : "/.avconv", preset_name);
> >              ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
> 
> It makes sense, thanks for the patch.
> 



More information about the libav-devel mailing list