[librsvg] bgo#710163 - Use _wfullpath() on Windows instead of _fullpath()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] bgo#710163 - Use _wfullpath() on Windows instead of _fullpath()
- Date: Wed, 25 Mar 2015 00:14:43 +0000 (UTC)
commit 28694c791067f0321ae21d44734b1ef88b45d742
Author: LRN <lrn1986 gmail com>
Date: Tue Mar 24 18:14:23 2015 -0600
bgo#710163 - Use _wfullpath() on Windows instead of _fullpath()
rsvg-base.c | 32 ++++++++++++++++++++++++++------
1 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index 4ef8a7a..62340cf 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -57,13 +57,33 @@
#include "rsvg-paint-server.h"
#include "rsvg-xml.h"
-/*
- * XXX: Perhaps do a GIO-based implementation for
- * realpath() or use gnulib implementation for this
- * https://bugzilla.gnome.org/show_bug.cgi?id=710163
- */
#ifdef G_OS_WIN32
-#define realpath(a,b) _fullpath(b,a,_MAX_PATH)
+static char *
+rsvg_realpath_utf8 (const char *filename, const char *unused)
+{
+ wchar_t *wfilename;
+ wchar_t *wfull;
+ char *full;
+
+ wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
+ if (!wfilename)
+ return NULL;
+
+ wfull = _wfullpath (NULL, wfilename, 0);
+ g_free (wfilename);
+ if (!wfull)
+ return NULL;
+
+ full = g_utf16_to_utf8 (wfull, -1, NULL, NULL, NULL);
+ free (wfull);
+
+ if (!full)
+ return NULL;
+
+ return full;
+}
+
+#define realpath(a,b) rsvg_realpath_utf8 (a, b)
#endif
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]