Re: [plugins v2] apple-trailers: handle bad formatted runtime tag



On Fri, Sep 03, 2010 at 01:37:29PM +0200, Iago Toral Quiroga wrote:
> El vie, 03-09-2010 a las 13:22 +0200, Víctor Manuel Jáquez Leal
> escribió:
> > Currently the returned xml file has a registry with runtime 2?18, instead of
> > the expected 2:18. And that bad formatting crashes the application.
> > 
> > Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez igalia com>
> > ---
> >  src/apple-trailers/grl-apple-trailers.c |    7 +++++--
> >  1 files changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/apple-trailers/grl-apple-trailers.c b/src/apple-trailers/grl-apple-trailers.c
> > index 58d00df..6aea9a9 100644
> > --- a/src/apple-trailers/grl-apple-trailers.c
> > +++ b/src/apple-trailers/grl-apple-trailers.c
> > @@ -201,9 +201,12 @@ runtime_to_seconds (const gchar *runtime)
> >      return 0;
> >    }
> >  
> > +  seconds = 0;
> >    items = g_strsplit (runtime, ":", -1);
> > -  seconds = 3600 * atoi (items[0]) + 60 * atoi (items[1]);
> > -  g_strfreev (items);
> > +  if (items && items[0] && items[1]) {
> 
> I think g_strsplit always returns a non-NULL array:
> 
> http://library.gnome.org/devel/glib/stable/glib-String-Utility-Functions.html#g-strsplit
> "Returns: a newly-allocated NULL-terminated array of strings. Use
> g_strfreev() to free it."

True. My bad.

vmjl

> 
> > +    seconds = 3600 * atoi (items[0]) + 60 * atoi (items[1]);
> > +    g_strfreev (items);
> > +  }
> >  
> >    return seconds;
> >  }
> 
> _______________________________________________
> grilo-list mailing list
> grilo-list gnome org
> http://mail.gnome.org/mailman/listinfo/grilo-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]