Re: gdk_pixbuf_loader_write and short files



----- Original Message -----
From: "Havoc Pennington" <hp redhat com>
To: "Matthias Clasen" <matthiasc poet de>
Cc: <gtk-devel-list gnome org>
Sent: Wednesday, August 29, 2001 12:01 AM
Subject: Re: gdk_pixbuf_loader_write and short files


>
> "Matthias Clasen" <matthiasc poet de> writes:
> > So it seems that both ways of checking load_module errors are
acceptable.
> > Tell
> > me which style you prefer and I'll adjust my patch.
> >
>
> Either is fine, assuming 0 is never a valid return. (i.e. assuming if
> 0 is returned we can g_assert (err != NULL)). I probably wrote the tmp
> != NULL one, because I was too lazy to figure that out. ;-)
>

Actually, looking closely at the control flow, you can come out of
gtk_pixbuf_loader_load_module
with a return value of 0 and still not set an error - if you go in with
priv->header_buf_offset == 0.

The call of gdk_pixbuf_loader_load_module inside
gdk_pixbuf_loader_eat_header_write seems fine though,
since priv->heder_buf_offset > 0 is a precondition:

if (priv->header_buf_offset >= LOADER_HEADER_SIZE)
  {
    if (gdk_pixbuf_loader_load_module (loader, NULL, error) == 0)
      return 0;
    }

So I will go with the auxiliary GError approach.

Matthias





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