Author: mitch
Date: Wed Jan 16 14:35:46 2008
New Revision: 19378
URL: http://svn.gnome.org/viewvc/gtk+?rev=19378&view=rev

Log:
2008-01-16  Michael Natterer  <[EMAIL PROTECTED]>

        * 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.



Modified:
   trunk/gdk-pixbuf/ChangeLog
   trunk/gdk-pixbuf/gdk-pixbuf-io.c

Modified: trunk/gdk-pixbuf/gdk-pixbuf-io.c
==============================================================================
--- trunk/gdk-pixbuf/gdk-pixbuf-io.c    (original)
+++ trunk/gdk-pixbuf/gdk-pixbuf-io.c    Wed Jan 16 14:35:46 2008
@@ -306,7 +306,12 @@
        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 @@
 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;
 }
 
 /** 
_______________________________________________
SVN-commits-list mailing list (read only)
http://mail.gnome.org/mailman/listinfo/svn-commits-list

Want to limit the commits to a few modules? Go to above URL, log in to edit 
your options and select the modules ('topics') you want.
Module maintainer? It is possible to set the reply-to to your development 
mailing list. Email [EMAIL PROTECTED] if interested.

Reply via email to