aboutsummaryrefslogtreecommitdiff
path: root/fastiv-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fastiv-io.c')
-rw-r--r--fastiv-io.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/fastiv-io.c b/fastiv-io.c
index d02c2fe..ee43cd8 100644
--- a/fastiv-io.c
+++ b/fastiv-io.c
@@ -18,7 +18,11 @@
#include "config.h"
#include <cairo.h>
+#include <errno.h>
#include <glib.h>
+#include <glib/gstdio.h>
+
+#include <spng.h>
#include <turbojpeg.h>
#ifdef HAVE_LIBRAW
#include <libraw.h>
@@ -44,9 +48,6 @@
#define WUFFS_CONFIG__MODULE__ZLIB
#include "wuffs-mirror-release-c/release/c/wuffs-v0.3.c"
-#include <glib/gstdio.h>
-#include <spng.h>
-
#include "xdg.h"
#include "fastiv-io.h"
@@ -495,7 +496,13 @@ open_librsvg(const gchar *data, gsize len, const gchar *path, GError **error)
rsvg_handle_set_dpi(handle, 96);
double w = 0, h = 0;
+#if LIBRSVG_CHECK_VERSION(2, 51, 0)
if (!rsvg_handle_get_intrinsic_size_in_pixels(handle, &w, &h)) {
+#else
+ RsvgDimensionData dd = {};
+ rsvg_handle_get_dimensions(handle, &dd);
+ if ((w = dd.width) <= 0 || (h = dd.height) <= 0) {
+#endif
RsvgRectangle viewbox = {};
gboolean has_viewport = FALSE;
rsvg_handle_get_intrinsic_dimensions(handle, NULL, NULL, NULL, NULL,
@@ -675,6 +682,10 @@ fastiv_io_open_from_data(const char *data, size_t len, const gchar *path,
// --- Thumbnails --------------------------------------------------------------
+#ifndef __linux__
+#define st_mtim st_mtimespec
+#endif // ! __linux__
+
static int // tri-state
check_spng_thumbnail_texts(struct spng_text *texts, uint32_t texts_len,
const gchar *target, time_t mtime)