Re: g_warnings in png loader



Matthias Clasen <maclas gmx de> writes:

> I stumbled over some g_warnings in io-png.c which can be triggered by
> bad/unexpected data. Examples are:
> 
> in png_text_to_pixbuf_option:
>  g_warning ("Couldn't convert PNG text chunk value to UTF-8.");
> 
> (I think it would be better to silently skip the bad text chunk here)
 
If the chunk is actually invalid, then warning is probably appropriate;
something is wrong and if we don't complain the problem has no chance
of ever getting fixed.
 
> in gdk_pixbuf__png_image_load:
>  g_warning ("Got multiple tEXt chunks for the same key.");
> 
> (This is not forbidden by the PNG spec - with 1.2 you can have localized
> itxt chunks, so there could be a "Description" for "de" and another one
> for "en". I think we should silently pick one of the chunks, either
> simply the first one, or try to be fancy and match the locale. I guess
> adding API for localized pixbuf options would be over the top)  
 
Well, if that warning is printed for itxt chunks it would indeed
be inappropriate (not least because it refers to tEXt chunks).
Whether matching the locale or picking something independent of the
locale is correct really depends on what people are using the
text chunk API for, which I don't have much feeling for. (It was
adding for thumbnailing information, as I recall, where locale 
is not relevant.)
 
> in gdk_pixbuf__png_image_save:
>  g_warning ("Bad option name '%s' passed to PNG saver", *kiter);
> 
> (This is a programming error which should be signalled by setting the
>  GError).

Programming errors are precisely the ones that should _never_ be
set in the GError, because you'd never want to write code to handle
a programming error. GTK+ should always g_warning() when it detects
a programming error.

Regards,
                                        Owen



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