* 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
{
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;
}
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
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:
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;
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";
}