[cairo-commit] 2 commits - boilerplate/cairo-boilerplate.c test/any2ppm.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Jul 23 09:13:33 PDT 2014


 boilerplate/cairo-boilerplate.c |    4 ++--
 test/any2ppm.c                  |    9 ++++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 9e6ceb23b45b7da19911b38eddb7f42f921929b1
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jul 23 12:12:04 2014 -0400

    More binary mode for Windows
    
    Based on:
    https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-cairo/0012-more-binary-mode.mingw.patch

diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 97d624c..b19cd39 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -853,14 +853,14 @@ cairo_boilerplate_open_any2ppm (const char   *filename,
     }
 
     *close_cb = fclose;
-    return fdopen (sk, "r");
+    return fdopen (sk, "rb");
 
 POPEN:
 #endif
 
     *close_cb = pclose;
     sprintf (command, "%s %s %d", any2ppm, filename, page);
-    return popen (command, "r");
+    return popen (command, "rb");
 }
 
 static cairo_bool_t
commit 23dce494d1850ee28a9c8d67972052c5a784cacf
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jul 23 12:09:17 2014 -0400

    Binary mode in any2ppm
    
    From:
    https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-cairo/0010-binary-mode-in-any2ppm.mingw.patch

diff --git a/test/any2ppm.c b/test/any2ppm.c
index 3e0806f..665314f 100644
--- a/test/any2ppm.c
+++ b/test/any2ppm.c
@@ -81,8 +81,11 @@
 
 #include <errno.h>
 
-#if HAVE_UNISTD_H && HAVE_FCNTL_H && HAVE_SIGNAL_H && HAVE_SYS_STAT_H && HAVE_SYS_SOCKET_H && HAVE_SYS_POLL_H && HAVE_SYS_UN_H
+#if HAVE_FCNTL_H
 #include <fcntl.h>
+#endif
+
+#if HAVE_UNISTD_H && HAVE_SIGNAL_H && HAVE_SYS_STAT_H && HAVE_SYS_SOCKET_H && HAVE_SYS_POLL_H && HAVE_SYS_UN_H
 #include <signal.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
@@ -874,6 +877,10 @@ main (int argc, char **argv)
     rsvg_set_default_dpi (72.0);
 #endif
 
+#if defined(_WIN32) && !defined (__CYGWIN__)
+    _setmode (1, _O_BINARY);
+#endif
+
     if (argc == 1)
 	err = any2ppm_daemon ();
     else


More information about the cairo-commit mailing list