[goffice] GOImage: create an unknown image placeholder when no image data is given.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] GOImage: create an unknown image placeholder when no image data is given.
- Date: Fri, 27 Feb 2015 18:23:59 +0000 (UTC)
commit 8a01ed6d6ee089d5d633708228dde19bd029f65a
Author: Morten Welinder <terra gnome org>
Date: Fri Feb 27 13:23:23 2015 -0500
GOImage: create an unknown image placeholder when no image data is given.
ChangeLog | 5 +++++
goffice/utils/go-image.c | 7 +++++--
2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9ffa4ab..77ba2a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-27 Morten Welinder <terra gnome org>
+
+ * goffice/utils/go-image.c (go_image_new_from_data): If no image
+ data is given, create an unknown image placeholder.
+
2015-02-24 Morten Welinder <terra gnome org>
* goffice/graph/gog-series-labels.c (gog_data_label_finalize):
diff --git a/goffice/utils/go-image.c b/goffice/utils/go-image.c
index f970d18..d80a5fd 100644
--- a/goffice/utils/go-image.c
+++ b/goffice/utils/go-image.c
@@ -287,7 +287,7 @@ go_image_get_format_from_name (char const *name)
{
unsigned i;
- if (name == NULL)
+ if (name == NULL || strcmp (name, "unknown") == 0)
return GO_IMAGE_FORMAT_UNKNOWN;
go_image_build_pixbuf_format_infos ();
@@ -653,7 +653,10 @@ go_image_new_from_data (char const *type, guint8 const *data, gsize length, char
g_warning ("unrecognized image format");
return NULL;
}
- if (!strcmp (type, "svg")) {
+ if (data == NULL || length == 0) {
+ image = NULL;
+ type = "unknown";
+ } else if (!strcmp (type, "svg")) {
image = go_svg_new_from_data (data, length, error);
} else if (!strcmp (type, "emf") || !strcmp (type, "wmf")) {
image = go_emf_new_from_data (data, length, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]