Add sanity checks for GError handling. (#108345)

This commit is contained in:
Matthias Clasen 2003-04-24 18:51:07 +00:00
parent 89ef7509b1
commit 691a5fd50a
4 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,14 @@
2003-04-24 Matthias Clasen <maclas@gmx.de>
* gdk-pixbuf-loader.c (gdk_pixbuf_loader_write):
(gdk_pixbuf_loader_new_with_type):
(gdk_pixbuf_loader_close):
* gdk-pixbuf-io.c (gdk_pixbuf_new_from_file):
(gdk_pixbuf_save):
(gdk_pixbuf_savev):
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
Add sanity checks for GError handling. (#108345)
Tue Apr 1 15:33:51 2003 Owen Taylor <otaylor@redhat.com> Tue Apr 1 15:33:51 2003 Owen Taylor <otaylor@redhat.com>
* pixops/pixops.c (make_weights): Exploit the fact that all * pixops/pixops.c (make_weights): Exploit the fact that all

View File

@ -137,6 +137,7 @@ gdk_pixbuf_animation_new_from_file (const char *filename,
GdkPixbufModule *image_module; GdkPixbufModule *image_module;
g_return_val_if_fail (filename != NULL, NULL); g_return_val_if_fail (filename != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
f = fopen (filename, "rb"); f = fopen (filename, "rb");
if (!f) { if (!f) {

View File

@ -694,6 +694,7 @@ gdk_pixbuf_new_from_file (const char *filename,
GdkPixbufModule *image_module; GdkPixbufModule *image_module;
g_return_val_if_fail (filename != NULL, NULL); g_return_val_if_fail (filename != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
f = fopen (filename, "rb"); f = fopen (filename, "rb");
if (!f) { if (!f) {
@ -914,6 +915,8 @@ gdk_pixbuf_save (GdkPixbuf *pixbuf,
gchar **values = NULL; gchar **values = NULL;
va_list args; va_list args;
gboolean result; gboolean result;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
va_start (args, error); va_start (args, error);
@ -961,6 +964,7 @@ gdk_pixbuf_savev (GdkPixbuf *pixbuf,
g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (type != NULL, FALSE); g_return_val_if_fail (type != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
f = fopen (filename, "wb"); f = fopen (filename, "wb");

View File

@ -423,6 +423,7 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
g_return_val_if_fail (buf != NULL, FALSE); g_return_val_if_fail (buf != NULL, FALSE);
g_return_val_if_fail (count >= 0, FALSE); g_return_val_if_fail (count >= 0, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
priv = loader->priv; priv = loader->priv;
@ -499,11 +500,12 @@ gdk_pixbuf_loader_new_with_type (const char *image_type,
{ {
GdkPixbufLoader *retval; GdkPixbufLoader *retval;
GError *tmp; GError *tmp;
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
retval = g_object_new (GDK_TYPE_PIXBUF_LOADER, NULL); retval = g_object_new (GDK_TYPE_PIXBUF_LOADER, NULL);
tmp = NULL; tmp = NULL;
gdk_pixbuf_loader_load_module(retval, image_type, &tmp); gdk_pixbuf_loader_load_module (retval, image_type, &tmp);
if (tmp != NULL) if (tmp != NULL)
{ {
g_propagate_error (error, tmp); g_propagate_error (error, tmp);
@ -602,6 +604,7 @@ gdk_pixbuf_loader_close (GdkPixbufLoader *loader,
g_return_val_if_fail (loader != NULL, TRUE); g_return_val_if_fail (loader != NULL, TRUE);
g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), TRUE); g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), TRUE);
g_return_val_if_fail (error == NULL || *error == NULL, TRUE);
priv = loader->priv; priv = loader->priv;