]> Pileus Git - ~andy/gtk/blobdiff - gdk-pixbuf/io-pcx.c
Cleanups
[~andy/gtk] / gdk-pixbuf / io-pcx.c
index 5ccbeea5a841ec45928d39c698c33ca9e8851197..e4d375fe7c6b342cce5f54f2c6996ebaf94104ef 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+#include <config.h>
 #include <stdio.h>
 #include <string.h>
 #include "gdk-pixbuf-private.h"
 #include "gdk-pixbuf-io.h"
 
-#define PCX_DEBUG
+#undef PCX_DEBUG
 
 #define PCX_TASK_DONE 0
 #define PCX_TASK_LOAD_HEADER 1
@@ -235,14 +236,12 @@ pcx_chop_context_buf(struct pcx_context *context, guint size)
 {
        guint i, j;
 
-       if(size > context->buf_pos)
+       if (size > context->buf_pos)
                return FALSE;
-       else if(size < 0)
-               return FALSE;
-       else if(size == 0)
+       else if (size == 0)
                return TRUE;
 
-       for(i = 0, j = size; j < context->buf_pos; i++, j++)
+       for (i = 0, j = size; j < context->buf_pos; i++, j++)
                context->buf[i] = context->buf[j];
 
        context->buf_pos -= size;
@@ -492,7 +491,7 @@ pcx_load_palette_8(struct pcx_context *context)
                                }
 
                                if(context->updated_func)
-                                       context->updated_func(context->pixbuf, 0, context->current_line, context->width, 1, context->user_data);
+                                       context->updated_func(context->pixbuf, 0, i, context->width, 1, context->user_data);
                        }
 
 #ifdef PCX_DEBUG
@@ -606,8 +605,12 @@ gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
                                g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Image has invalid width and/or height"));
                                return FALSE;
                        }
-                       if(context->size_func)
-                               context->size_func(&width, &height, context->user_data);
+                       if (context->size_func)
+                         {
+                           (*context->size_func) (&width, &height, context->user_data);
+                           if (width == 0 || height == 0)
+                             return TRUE;
+                         }
 
                        switch(context->bpp) {
                                default:
@@ -624,7 +627,7 @@ gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
                                case 4:
                                case 8:
                                        if(context->num_planes != 1) {
-                                               g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image has unsupported number of %d-bit planes"), context->bpp);
+                                         g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image has unsupported number of %d-bit planes"), (gint)context->bpp);
                                                return FALSE;
                                        }
                                        break;
@@ -753,5 +756,6 @@ MODULE_ENTRY (pcx, fill_info) (GdkPixbufFormat *info)
        info->description = N_("The PCX image format");
        info->mime_types = mime_types;
        info->extensions = extensions;
-       info->flags = 0;
+       info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
+       info->license = "LGPL";
 }