[gdk-pixbuf/wip/otte/tga: 3/17] tga: Don't care about extra data at end of file



commit 8e5756e832540721083d59c290d56831ab01b7f9
Author: Benjamin Otte <otte redhat com>
Date:   Sun Sep 20 07:55:39 2015 +0200

    tga: Don't care about extra data at end of file
    
    It's called the "extension area" and people are free to put random stuff
    there. So don't error out if they do.

 gdk-pixbuf/io-tga.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)
---
diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c
index df80864..3596737 100644
--- a/gdk-pixbuf/io-tga.c
+++ b/gdk-pixbuf/io-tga.c
@@ -112,7 +112,6 @@ struct _TGAColormap {
 struct _TGAContext {
        TGAHeader *hdr;
        guint rowstride;
-       guint completed_lines;
        gboolean run_length_encoded;
 
        TGAColormap *cmap;
@@ -303,7 +302,6 @@ static gboolean fill_in_context(TGAContext *ctx, GError **err)
        else if (ctx->hdr->type == TGA_TYPE_TRUECOLOR)
                ctx->rowstride = ctx->pbuf->rowstride;
 
-       ctx->completed_lines = 0;
        return TRUE;
 }
 
@@ -881,14 +879,8 @@ static gboolean gdk_pixbuf__tga_load_increment(gpointer data,
        if (ctx->run_length_encoded) {
                parse_rle_data (ctx);
        } else {
-               while (gdk_pixbuf_buffer_queue_get_size (ctx->input) >= ctx->rowstride) {
-                       if (ctx->completed_lines >= ctx->pbuf->height) {
-                               g_set_error_literal(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED,
-                                                    _("Excess data in file"));
-                               return FALSE;
-                       }
+               while (!ctx->done && gdk_pixbuf_buffer_queue_get_size (ctx->input) >= ctx->rowstride) {
                        parse_data_for_row (ctx);
-                       ctx->completed_lines++;
                }
        }
 


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