]> www.fi.muni.cz Git - evince.git/commitdiff
Propagate all errors upwards.
authorChristian Persch <chpe@src.gnome.org>
Sun, 15 Feb 2009 13:51:30 +0000 (13:51 +0000)
committerChristian Persch <chpe@src.gnome.org>
Sun, 15 Feb 2009 13:51:30 +0000 (13:51 +0000)
* libdocument/ev-file-helpers.c: (get_mime_type_from_data): Propagate
all errors upwards.

svn path=/trunk/; revision=3438

ChangeLog
libdocument/ev-file-helpers.c

index 2a9a51208e26061e7b5209716380cfc70446d9ce..6d4656616d1a76a09a9a1db5d5b4b6d169be8b67 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-02-13  Christian Persch  <chpe@gnome.org>
+
+       * libdocument/ev-file-helpers.c: (get_mime_type_from_data): Propagate
+       all errors upwards.
+
 2009-02-13  Christian Persch  <chpe@gnome.org>
 
        * libdocument/ev-file-helpers.c: (get_mime_type_from_data): Don't use
index 0b82536ceffb2dc0722f6e5525b339319395eeb8..8d51301c1b15fb63ac050132d3855763853fe06c 100644 (file)
@@ -239,6 +239,7 @@ get_mime_type_from_data (const gchar *uri, GError **error)
        GFileInputStream *input_stream;
        gssize            size_read;
        guchar            buffer[1024];
+       gboolean          retval;
 
        file = g_file_new_for_uri (uri);
        
@@ -249,12 +250,15 @@ get_mime_type_from_data (const gchar *uri, GError **error)
        }
 
        size_read = g_input_stream_read (G_INPUT_STREAM (input_stream),
-                                        buffer, 1024, NULL, NULL);
-       g_input_stream_close (G_INPUT_STREAM (input_stream), NULL, error);
+                                        buffer, sizeof (buffer), NULL, error);
+       if (size_read == -1) {
+               g_object_unref (file);
+               return NULL;
+       }
 
+       retval = g_input_stream_close (G_INPUT_STREAM (input_stream), NULL, error);
        g_object_unref (file);
-
-       if (size_read == -1)
+       if (!retval)
                return NULL;
 
        return g_content_type_guess (NULL, /* no filename */