aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-01-22 20:38:49 +0100
committerPřemysl Eric Janouch <p@janouch.name>2022-01-22 21:02:56 +0100
commit8877e171083c58ffe5af2cc5534f3ea11160a8da (patch)
tree776383baf416096392f0e8de4bec96c61e797007
parent686d45553b861f8b42707049adf366a14abea4ab (diff)
downloadfiv-8877e171083c58ffe5af2cc5534f3ea11160a8da.tar.gz
fiv-8877e171083c58ffe5af2cc5534f3ea11160a8da.tar.xz
fiv-8877e171083c58ffe5af2cc5534f3ea11160a8da.zip
Default to gdk-pixbuf even for Wuffs formats
-rw-r--r--fiv-io.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/fiv-io.c b/fiv-io.c
index 4189917..b9ca4f1 100644
--- a/fiv-io.c
+++ b/fiv-io.c
@@ -2517,21 +2517,25 @@ fiv_io_open_from_data(const char *data, size_t len, const gchar *uri,
g_clear_error(error);
}
#endif // HAVE_LIBTIFF --------------------------------------------------------
-#ifdef HAVE_GDKPIXBUF // ------------------------------------------------------
- // This is only used as a last resort, the rest above is special-cased.
- if ((surface = open_gdkpixbuf(data, len, profile, error)))
- break;
- if (error && (*error)->code != GDK_PIXBUF_ERROR_UNKNOWN_TYPE)
- break;
- if (error) {
- g_debug("%s", (*error)->message);
+ set_error(error, "unsupported file type");
+ }
+
+#ifdef HAVE_GDKPIXBUF // ------------------------------------------------------
+ // This is used as a last resort, the rest above is special-cased.
+ // Wuffs #71 and similar concerns make us default to it in all cases.
+ if (!surface) {
+ GError *err = NULL;
+ if ((surface = open_gdkpixbuf(data, len, profile, &err))) {
+ g_clear_error(error);
+ } else if (err->code == GDK_PIXBUF_ERROR_UNKNOWN_TYPE) {
+ g_error_free(err);
+ } else {
g_clear_error(error);
+ g_propagate_error(error, err);
}
-#endif // HAVE_GDKPIXBUF ------------------------------------------------------
-
- set_error(error, "unsupported file type");
}
+#endif // HAVE_GDKPIXBUF ------------------------------------------------------
// gdk-pixbuf only gives out this single field--cater to its limitations,
// since we'd really like to have it.