summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2001-06-08 20:15:49 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-06-08 20:15:49 +0000
commit30d3e85d96550d9cc305757673b5a37948ad44c2 (patch)
treec25440df049ae76f458ff8c90fd0b3d0adfdbc3c
parent7009511a224b15f26e91d4fbf42ce9bbf5f013d1 (diff)
downloadgdk-pixbuf-30d3e85d96550d9cc305757673b5a37948ad44c2.tar.gz
remove bogus g_return_if_fail
2001-06-08 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module): remove bogus g_return_if_fail * io-gif.c (gif_get_lzw): if delay time is 0 or smaller than likely timeout resolution, set it to an arbitrarily-chosen short delay. Fixes bug #55953 from warmenhoven@yahoo.com
-rw-r--r--gdk-pixbuf/ChangeLog10
-rw-r--r--gdk-pixbuf/gdk-pixbuf-loader.c1
-rw-r--r--gdk-pixbuf/io-gif-animation.c6
-rw-r--r--gdk-pixbuf/io-gif.c11
4 files changed, 23 insertions, 5 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index 0bccb2498..4e44e8b17 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -1,3 +1,13 @@
+2001-06-08 Havoc Pennington <hp@redhat.com>
+
+ * gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module): remove
+ bogus g_return_if_fail
+
+ * io-gif.c (gif_get_lzw): if delay time is 0 or smaller than
+ likely timeout resolution, set it to an arbitrarily-chosen short
+ delay.
+ Fixes bug #55953 from warmenhoven@yahoo.com
+
2001-06-07 Havoc Pennington <hp@redhat.com>
* Makefile.am: use Owen's new way of doing stampfiles/generated
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c
index cb167e64a..a147e8b85 100644
--- a/gdk-pixbuf/gdk-pixbuf-loader.c
+++ b/gdk-pixbuf/gdk-pixbuf-loader.c
@@ -226,7 +226,6 @@ gdk_pixbuf_loader_load_module (GdkPixbufLoader *loader,
}
else
{
- g_return_val_if_fail (priv->header_buf_offset > 0, 0);
priv->image_module = _gdk_pixbuf_get_module (priv->header_buf,
priv->header_buf_offset,
NULL,
diff --git a/gdk-pixbuf/io-gif-animation.c b/gdk-pixbuf/io-gif-animation.c
index fe164a095..d334cc421 100644
--- a/gdk-pixbuf/io-gif-animation.c
+++ b/gdk-pixbuf/io-gif-animation.c
@@ -272,7 +272,7 @@ gdk_pixbuf_gif_anim_iter_advance (GdkPixbufAnimationIter *anim_iter,
elapsed =
(((iter->current_time.tv_sec - iter->start_time.tv_sec) * G_USEC_PER_SEC +
iter->current_time.tv_usec - iter->start_time.tv_usec)) / 1000;
-
+
if (elapsed < 0) {
/* Try to compensate; probably the system clock
* was set backwards
@@ -280,14 +280,14 @@ gdk_pixbuf_gif_anim_iter_advance (GdkPixbufAnimationIter *anim_iter,
iter->start_time = iter->current_time;
elapsed = 0;
}
+
+ g_assert (iter->gif_anim->total_time > 0);
/* See how many times we've already played the full animation,
* and subtract time for that.
*/
elapsed = elapsed % iter->gif_anim->total_time;
- g_assert (elapsed < iter->gif_anim->total_time);
-
iter->position = elapsed;
/* Now move to the proper frame */
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c
index 0a710ab11..68dcaa430 100644
--- a/gdk-pixbuf/io-gif.c
+++ b/gdk-pixbuf/io-gif.c
@@ -753,8 +753,17 @@ gif_get_lzw (GifContext *context)
/* GIF delay is in hundredths, we want thousandths */
context->frame->delay_time = context->gif89.delay_time * 10;
+
+ /* Some GIFs apparently have delay time of 0,
+ * that crashes everything so set it to "fast".
+ * Also, timeouts less than 20 or so just lock up
+ * the app or make the animation choppy, so fix them.
+ */
+ if (context->frame->delay_time < 20)
+ context->frame->delay_time = 20; /* 20 = "fast" */
+
context->frame->elapsed = context->animation->total_time;
- context->animation->total_time += context->frame->delay_time;
+ context->animation->total_time += context->frame->delay_time;
switch (context->gif89.disposal) {
case 0: