[evince] [windows] Use \r\n as delimiter to split lines on Windows
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evince] [windows] Use \r\n as delimiter to split lines on Windows
- Date: Wed, 23 Dec 2009 12:28:56 +0000 (UTC)
commit a9f7fe8cd4c9d51e407acafe78d2bc89d3b98f6b
Author: Hib Eris <hib hiberis nl>
Date: Tue Dec 22 21:06:06 2009 +0100
[windows] Use \r\n as delimiter to split lines on Windows
Fixes bgo#605146.
backend/comics/comics-document.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c
index 9f657c2..b66f4ce 100644
--- a/backend/comics/comics-document.c
+++ b/backend/comics/comics-document.c
@@ -42,6 +42,16 @@
#include "ev-document-thumbnails.h"
#include "ev-file-helpers.h"
+#ifdef G_OS_WIN32
+/* On windows g_spawn_command_line_sync reads stdout in O_BINARY mode, not in O_TEXT mode.
+ * As a consequence, newlines are in a platform dependent representation (\r\n). This
+ * might be considered a bug in glib.
+ */
+#define EV_EOL "\r\n"
+#else
+#define EV_EOL "\n"
+#endif
+
typedef enum
{
RARLABS,
@@ -414,7 +424,8 @@ comics_document_load (EvDocument *document,
}
/* FIXME: is this safe against filenames containing \n in the archive ? */
- cb_files = g_strsplit (std_out, "\n", 0);
+ cb_files = g_strsplit (std_out, EV_EOL, 0);
+
g_free (std_out);
if (!cb_files) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]