From: Sven Herzberg Date: Fri, 8 Aug 2008 15:30:22 +0000 (+0000) Subject: Bug 546549 : Better Type Checking reviewed by: mitch X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=1c60b85915c40ce7f1fbe4cf1318d7f7c8b0f6cb;p=~andy%2Fgtk Bug 546549 : Better Type Checking reviewed by: mitch 2008-08-08 Sven Herzberg Bug 546549 : Better Type Checking reviewed by: mitch * gdk-pixbuf-animation.c: check if a vfunc is implemented before trying to call into it svn path=/trunk/; revision=21047 --- diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index b965396b3..12135ba1a 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,11 @@ +2008-08-08 Sven Herzberg + + Bug 546549 : Better Type Checking + reviewed by: mitch + + * gdk-pixbuf-animation.c: check if a vfunc is implemented before + trying to call into it + 2008-08-06 Sven Herzberg Bug 546549 : Better Type Checking diff --git a/gdk-pixbuf/gdk-pixbuf-animation.c b/gdk-pixbuf/gdk-pixbuf-animation.c index 8431aa8e4..290630ef0 100644 --- a/gdk-pixbuf/gdk-pixbuf-animation.c +++ b/gdk-pixbuf/gdk-pixbuf-animation.c @@ -447,7 +447,7 @@ gdk_pixbuf_animation_iter_init (GdkPixbufAnimationIter *iter) /** * gdk_pixbuf_animation_iter_get_delay_time: * @iter: an animation iterator - * + * * Gets the number of milliseconds the current pixbuf should be displayed, * or -1 if the current pixbuf should be displayed forever. g_timeout_add() * conveniently takes a timeout in milliseconds, so you can use a timeout @@ -459,7 +459,8 @@ int gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter) { g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), -1); - + g_return_val_if_fail (GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_delay_time, -1); + return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_delay_time (iter); } @@ -485,7 +486,8 @@ GdkPixbuf* gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter) { g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), NULL); - + g_return_val_if_fail (GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_pixbuf, NULL); + return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_pixbuf (iter); } @@ -498,14 +500,15 @@ gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter) * for an area of the frame currently streaming in to the loader. So if * you're on the currently loading frame, you need to redraw the screen for * the updated area. - * + * * Return value: %TRUE if the frame we're on is partially loaded, or the last frame **/ gboolean gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter) { g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), FALSE); - + g_return_val_if_fail (GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->on_currently_loading_frame, FALSE); + return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->on_currently_loading_frame (iter); } @@ -516,7 +519,7 @@ gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *it * * Possibly advances an animation to a new frame. Chooses the frame based * on the start time passed to gdk_pixbuf_animation_get_iter(). - * + * * @current_time would normally come from g_get_current_time(), and * must be greater than or equal to the time passed to * gdk_pixbuf_animation_get_iter(), and must increase or remain @@ -542,14 +545,15 @@ gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter, const GTimeVal *current_time) { GTimeVal val; - + g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), FALSE); + g_return_val_if_fail (GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->advance, FALSE); if (current_time) val = *current_time; else g_get_current_time (&val); - + return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->advance (iter, &val); }