gdk-pixbuf-loader.c: Fixed init function to properly initialize all

structure members.

testpixbuf.c: Added call to close and destroy pixbuf loader properly.
This commit is contained in:
Michael Fulbright 1999-10-27 16:41:44 +00:00
parent a9c16bfabd
commit 14cb9e710a
3 changed files with 18 additions and 13 deletions

View File

@ -452,21 +452,24 @@ main (int argc, char **argv)
found_valid = TRUE;
}
}
}
pixbuf_loader = gdk_pixbuf_loader_new ();
file = fopen ("/usr/share/pixmaps/up2date.png", "r");
g_assert (file != NULL);
while (TRUE) {
val = fgetc (file);
if (val == EOF)
break;
buf = (guint) val;
if (gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (pixbuf_loader), &buf, 1) == FALSE)
break;
pixbuf_loader = gdk_pixbuf_loader_new ();
file = fopen (argv[1], "r");
g_assert (file != NULL);
while (TRUE) {
val = fgetc (file);
if (val == EOF)
break;
buf = (guint) val;
if (gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (pixbuf_loader), &buf, 1) == FALSE)
break;
}
gdk_pixbuf_loader_close (GDK_PIXBUF_LOADER (pixbuf_loader));
gtk_object_destroy (pixbuf_loader);
fclose (file);
}
fclose (file);
if (found_valid)
gtk_main ();

View File

@ -145,6 +145,7 @@ gdk_pixbuf_loader_init (GdkPixbufLoader *loader)
priv = g_new (GdkPixbufLoaderPrivate, 1);
loader->private = priv;
priv->image_module=NULL;
priv->pixbuf = NULL;
priv->closed = FALSE;
priv->buf_offset = 0;

View File

@ -145,6 +145,7 @@ gdk_pixbuf_loader_init (GdkPixbufLoader *loader)
priv = g_new (GdkPixbufLoaderPrivate, 1);
loader->private = priv;
priv->image_module=NULL;
priv->pixbuf = NULL;
priv->closed = FALSE;
priv->buf_offset = 0;