diff options
author | Michael Natterer <mitch@imendio.com> | 2008-01-16 14:35:46 +0000 |
---|---|---|
committer | Michael Natterer <mitch@src.gnome.org> | 2008-01-16 14:35:46 +0000 |
commit | 7932cfb6691d6ef722dad3056e76130e64e3cfde (patch) | |
tree | 5668b4ddd8de4d4a5cb9b7d9a02982e3c5daa2ce /gdk-pixbuf | |
parent | 7ffe104a772b8d7ffedda87cfbc15ccbce0243fd (diff) | |
download | gdk-pixbuf-7932cfb6691d6ef722dad3056e76130e64e3cfde.tar.gz |
fix signature of this function and propagate errors from
2008-01-16 Michael Natterer <mitch@imendio.com>
* gdk-pixbuf-io.c (save_to_stream): fix signature of this function
and propagate errors from g_output_stream_write(). Return error
also on incomplete writes (which don't generate an error by
themselves).
Unrelated:
(gdk_pixbuf_io_init): initialize "builtin_module" on a separate
line to avoid compiler warning in the common case of no built-in
modules.
svn path=/trunk/; revision=19378
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r-- | gdk-pixbuf/ChangeLog | 13 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-io.c | 30 |
2 files changed, 37 insertions, 6 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 7ba299074..1670d22e1 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,5 +1,18 @@ 2008-01-16 Michael Natterer <mitch@imendio.com> + * gdk-pixbuf-io.c (save_to_stream): fix signature of this function + and propagate errors from g_output_stream_write(). Return error + also on incomplete writes (which don't generate an error by + themselves). + + Unrelated: + + (gdk_pixbuf_io_init): initialize "builtin_module" on a separate + line to avoid compiler warning in the common case of no built-in + modules. + +2008-01-16 Michael Natterer <mitch@imendio.com> + * Makefile.am (LDADDS): use $GDK_PIXBUF_DEP_LIBS instead of $GLIB_LIBS so gio gets pulled in. diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c index 61b7991db..7c3ed83b8 100644 --- a/gdk-pixbuf/gdk-pixbuf-io.c +++ b/gdk-pixbuf/gdk-pixbuf-io.c @@ -306,7 +306,12 @@ gdk_pixbuf_io_init (void) GdkPixbufModulePattern *pattern; GError *error = NULL; #endif - GdkPixbufModule *builtin_module = NULL; + GdkPixbufModule *builtin_module ; + + /* initialize on separate line to avoid compiler warnings in the + * common case of no compiled-in modules. + */ + builtin_module = NULL; #define load_one_builtin_module(format) \ builtin_module = g_new0 (GdkPixbufModule, 1); \ @@ -2209,16 +2214,29 @@ typedef struct { static gboolean save_to_stream (const gchar *buffer, gsize count, - GCancellable *cancellable, GError **error, gpointer data) { SaveToStreamData *sdata = (SaveToStreamData *)data; + GError *my_error = NULL; + gsize n; - g_output_stream_write (sdata->stream, - buffer, count, - sdata->cancellable, - error); + n = g_output_stream_write (sdata->stream, + buffer, count, + sdata->cancellable, + &my_error); + if (n != count) { + if (!my_error) { + g_set_error (error, + G_IO_ERROR, 0, + _("Error writing to image stream")); + } + else { + g_propagate_error (error, my_error); + } + return FALSE; + } + return TRUE; } /** |