From 23b4352cb9f4339977c5b5a7604b80c23dca3623 Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Sun, 7 Jul 2019 10:31:01 +0200 Subject: [PATCH] procmime_get_part_as_inputstream doesn't touch error, so remove it --- src/image_viewer.c | 7 +++---- src/plugins/litehtml_viewer/lh_widget.cpp | 11 +++-------- src/procmime.c | 3 +-- src/procmime.h | 3 +-- src/textview.c | 7 +++---- 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/image_viewer.c b/src/image_viewer.c index a9eea6633..c37fd2232 100644 --- a/src/image_viewer.c +++ b/src/image_viewer.c @@ -82,10 +82,9 @@ static void image_viewer_load_image(ImageViewer *imageviewer) if (imageviewer->mimeinfo == NULL) return; - stream = procmime_get_part_as_inputstream(imageviewer->mimeinfo, &error); - if (error != NULL) { - g_warning("Couldn't get image MIME part: %s\n", error->message); - g_error_free(error); + stream = procmime_get_part_as_inputstream(imageviewer->mimeinfo); + if (stream == NULL) { + g_warning("Couldn't get image MIME part"); return; } diff --git a/src/plugins/litehtml_viewer/lh_widget.cpp b/src/plugins/litehtml_viewer/lh_widget.cpp index 8e8e808f9..30b6fb815 100644 --- a/src/plugins/litehtml_viewer/lh_widget.cpp +++ b/src/plugins/litehtml_viewer/lh_widget.cpp @@ -454,14 +454,9 @@ GdkPixbuf *lh_widget::get_local_image(const litehtml::tstring url) const GInputStream *stream; GError *error = NULL; - stream = procmime_get_part_as_inputstream(p, &error); - if (error != NULL || stream == NULL) { - if (error != NULL) { - g_warning("Couldn't get image MIME part: %s\n", error->message); - g_error_free(error); - } else { - g_warning("Could not decode MIME part\n"); - } + stream = procmime_get_part_as_inputstream(p); + if (stream == NULL) { + g_warning("Could not decode MIME part\n"); return NULL; } diff --git a/src/procmime.c b/src/procmime.c index a5961b7ad..a146339e9 100644 --- a/src/procmime.c +++ b/src/procmime.c @@ -2719,8 +2719,7 @@ void *procmime_get_part_as_string(MimeInfo *mimeinfo, /* Returns an open GInputStream. The caller should just * read mimeinfo->length bytes from it and then release it. */ -GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo, - GError **error) +GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo) { cm_return_val_if_fail(mimeinfo != NULL, NULL); diff --git a/src/procmime.h b/src/procmime.h index ac734471a..5749e6f69 100644 --- a/src/procmime.h +++ b/src/procmime.h @@ -243,8 +243,7 @@ gboolean procmime_scan_text_content(MimeInfo *mimeinfo, gpointer cb_data); void *procmime_get_part_as_string(MimeInfo *mimeinfo, gboolean null_terminate); -GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo, - GError **error); +GInputStream *procmime_get_part_as_inputstream(MimeInfo *mimeinfo); #ifdef __cplusplus } diff --git a/src/textview.c b/src/textview.c index ee3c21390..88c0aa10a 100644 --- a/src/textview.c +++ b/src/textview.c @@ -722,10 +722,9 @@ static void textview_add_part(TextView *textview, MimeInfo *mimeinfo) START_TIMING("inserting image"); - stream = procmime_get_part_as_inputstream(mimeinfo, &error); - if (error != NULL) { - g_warning("Can't get the image file: %s", error->message); - g_error_free(error); + stream = procmime_get_part_as_inputstream(mimeinfo); + if (stream == NULL) { + g_warning("Can't get the image file"); END_TIMING(); return; } -- 2.25.1