load the vtable fully.

1999-10-26  Jonathan Blandford  <jrb@redhat.com>

	* src/gdk-pixbuf-io.c (image_handler_load): load the vtable fully.
This commit is contained in:
Jonathan Blandford 1999-10-26 23:26:16 +00:00 committed by Jonathan Blandford
parent 2ff92119aa
commit eacb3ad51f
3 changed files with 28 additions and 19 deletions

View File

@ -136,17 +136,17 @@ pixbuf_check_ppm (guchar *buffer, int size)
#endif #endif
ModuleType file_formats [] = { ModuleType file_formats [] = {
{ "png", pixbuf_check_png, NULL, NULL, NULL }, { "png", pixbuf_check_png, NULL, NULL, NULL, NULL, NULL, NULL },
{ "jpeg", pixbuf_check_jpeg, NULL, NULL, NULL }, { "jpeg", pixbuf_check_jpeg, NULL, NULL, NULL, NULL, NULL, NULL },
{ "tiff", pixbuf_check_tiff, NULL, NULL, NULL }, { "tiff", pixbuf_check_tiff, NULL, NULL, NULL, NULL, NULL, NULL },
{ "gif", pixbuf_check_gif, NULL, NULL, NULL }, { "gif", pixbuf_check_gif, NULL, NULL, NULL, NULL, NULL, NULL },
#define XPM_FILE_FORMAT_INDEX 4 #define XPM_FILE_FORMAT_INDEX 4
{ "xpm", pixbuf_check_xpm, NULL, NULL, NULL }, { "xpm", pixbuf_check_xpm, NULL, NULL, NULL, NULL, NULL, NULL },
#if 0 #if 0
{ "bmp", pixbuf_check_bmp, NULL, NULL, NULL }, { "bmp", pixbuf_check_bmp, NULL, NULL, NULL, NULL, NULL, NULL },
{ "ppm", pixbuf_check_ppm, NULL, NULL, NULL }, { "ppm", pixbuf_check_ppm, NULL, NULL, NULL, NULL, NULL, NULL },
#endif #endif
{ NULL, NULL, NULL, NULL } { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
}; };
static void static void
@ -155,7 +155,7 @@ image_handler_load (ModuleType *image_module)
char *module_name; char *module_name;
char *path; char *path;
GModule *module; GModule *module;
void *load_sym; gpointer load_sym;
g_return_if_fail(image_module->module == NULL); g_return_if_fail(image_module->module == NULL);
@ -177,6 +177,15 @@ image_handler_load (ModuleType *image_module)
if (g_module_symbol (module, "image_load_xpm_data", &load_sym)) if (g_module_symbol (module, "image_load_xpm_data", &load_sym))
image_module->load_xpm_data = load_sym; image_module->load_xpm_data = load_sym;
if (g_module_symbol (module, "image_begin_load", &load_sym))
image_module->begin_load = load_sym;
if (g_module_symbol (module, "image_stop_load", &load_sym))
image_module->stop_load = load_sym;
if (g_module_symbol (module, "image_load_increment", &load_sym))
image_module->load_increment = load_sym;
} }

View File

@ -25,6 +25,7 @@
#include "gdk-pixbuf-loader.h" #include "gdk-pixbuf-loader.h"
#include "gdk-pixbuf-io.h" #include "gdk-pixbuf-io.h"
#include <gtk/gtksignal.h>
enum { enum {
AREA_UPDATED, AREA_UPDATED,
@ -58,10 +59,9 @@ static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 };
/* our marshaller */ /* our marshaller */
typedef void (*GtkSignal_NONE__INT_INT_INT_INT) (GtkObject * object, typedef void (*GtkSignal_NONE__INT_INT_INT_INT) (GtkObject * object,
gint arg1, gint arg1,
gpointer arg2, gint arg2,
gint arg3, gint arg3,
gint arg4, gint arg4,
gint arg5,
gpointer user_data); gpointer user_data);
void void
gtk_marshal_NONE__INT_INT_INT_INT (GtkObject * object, gtk_marshal_NONE__INT_INT_INT_INT (GtkObject * object,
@ -184,7 +184,7 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, gpointer loader)
g_assert (priv->pixbuf == NULL); g_assert (priv->pixbuf == NULL);
priv->pixbuf = pixbuf; priv->pixbuf = pixbuf;
gtk_signal_emit (GTK_OBJECT (loader), druid_page_signals[AREA_PREPARED]); gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED]);
} }
/* Public functions */ /* Public functions */
@ -315,7 +315,7 @@ gdk_pixbuf_loader_close (GdkPixbufLoader *loader)
g_return_if_fail (priv->closed == FALSE); g_return_if_fail (priv->closed == FALSE);
/* We have less the 128 bytes in the image. Flush it, and keep going. */ /* We have less the 128 bytes in the image. Flush it, and keep going. */
if (priv->module == NULL) { if (priv->image_module == NULL) {
priv->image_module = gdk_pixbuf_get_module (priv->buf, priv->buf_offset); priv->image_module = gdk_pixbuf_get_module (priv->buf, priv->buf_offset);
if (priv->image_module && if (priv->image_module &&
((priv->image_module->begin_load == NULL) || ((priv->image_module->begin_load == NULL) ||
@ -331,7 +331,7 @@ gdk_pixbuf_loader_close (GdkPixbufLoader *loader)
} }
if (priv->image_module && priv->image_module->stop_load) if (priv->image_module && priv->image_module->stop_load)
(priv->image_module->stop_load) (loader->context); (priv->image_module->stop_load) (priv->context);
priv->closed = TRUE; priv->closed = TRUE;
} }

View File

@ -25,6 +25,7 @@
#include "gdk-pixbuf-loader.h" #include "gdk-pixbuf-loader.h"
#include "gdk-pixbuf-io.h" #include "gdk-pixbuf-io.h"
#include <gtk/gtksignal.h>
enum { enum {
AREA_UPDATED, AREA_UPDATED,
@ -58,10 +59,9 @@ static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 };
/* our marshaller */ /* our marshaller */
typedef void (*GtkSignal_NONE__INT_INT_INT_INT) (GtkObject * object, typedef void (*GtkSignal_NONE__INT_INT_INT_INT) (GtkObject * object,
gint arg1, gint arg1,
gpointer arg2, gint arg2,
gint arg3, gint arg3,
gint arg4, gint arg4,
gint arg5,
gpointer user_data); gpointer user_data);
void void
gtk_marshal_NONE__INT_INT_INT_INT (GtkObject * object, gtk_marshal_NONE__INT_INT_INT_INT (GtkObject * object,
@ -184,7 +184,7 @@ gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf, gpointer loader)
g_assert (priv->pixbuf == NULL); g_assert (priv->pixbuf == NULL);
priv->pixbuf = pixbuf; priv->pixbuf = pixbuf;
gtk_signal_emit (GTK_OBJECT (loader), druid_page_signals[AREA_PREPARED]); gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[AREA_PREPARED]);
} }
/* Public functions */ /* Public functions */
@ -315,7 +315,7 @@ gdk_pixbuf_loader_close (GdkPixbufLoader *loader)
g_return_if_fail (priv->closed == FALSE); g_return_if_fail (priv->closed == FALSE);
/* We have less the 128 bytes in the image. Flush it, and keep going. */ /* We have less the 128 bytes in the image. Flush it, and keep going. */
if (priv->module == NULL) { if (priv->image_module == NULL) {
priv->image_module = gdk_pixbuf_get_module (priv->buf, priv->buf_offset); priv->image_module = gdk_pixbuf_get_module (priv->buf, priv->buf_offset);
if (priv->image_module && if (priv->image_module &&
((priv->image_module->begin_load == NULL) || ((priv->image_module->begin_load == NULL) ||
@ -331,7 +331,7 @@ gdk_pixbuf_loader_close (GdkPixbufLoader *loader)
} }
if (priv->image_module && priv->image_module->stop_load) if (priv->image_module && priv->image_module->stop_load)
(priv->image_module->stop_load) (loader->context); (priv->image_module->stop_load) (priv->context);
priv->closed = TRUE; priv->closed = TRUE;
} }