Tell windows we are writing/reading binary data

Bug #29329
diff --git a/poppler/StdinCachedFile.cc b/poppler/StdinCachedFile.cc
index 4bfc31e..5747572 100644
--- a/poppler/StdinCachedFile.cc
+++ b/poppler/StdinCachedFile.cc
@@ -6,6 +6,7 @@
 //
 // Copyright 2010 Hib Eris <hib@hiberis.nl>
 // Copyright 2010 Albert Astals Cid <aacid@kde.org>
+// Copyright 2010 Jonathan Liu <net147@gmail.com>
 //
 //========================================================================
 
@@ -13,6 +14,10 @@
 
 #include "StdinCachedFile.h"
 
+#ifdef _WIN32
+#include <fcntl.h> // for O_BINARY
+#include <io.h>    // for setmode
+#endif
 #include <stdio.h>
 
 size_t StdinCacheLoader::init(GooString *dummy, CachedFile *cachedFile)
@@ -20,6 +25,10 @@
   size_t read, size = 0;
   char buf[CachedFileChunkSize];
 
+#if _WIN32
+  setmode(fileno(stdin), O_BINARY);
+#endif
+
   CachedFileWriter writer = CachedFileWriter (cachedFile, NULL);
   do {
     read = fread(buf, 1, CachedFileChunkSize, stdin);
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index ed64fea..14950d0 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -21,6 +21,7 @@
 // Copyright (C) 2009, 2010 Albert Astals Cid <aacid@kde.org>
 // Copyright (C) 2010 Adrian Johnson <ajohnson@redneon.com>
 // Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
+// Copyright (C) 2010 Jonathan Liu <net147@gmail.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -29,6 +30,10 @@
 
 #include "config.h"
 #include <poppler-config.h>
+#ifdef _WIN32
+#include <fcntl.h> // for O_BINARY
+#include <io.h>    // for setmode
+#endif
 #include <stdio.h>
 #include <math.h>
 #include "parseargs.h"
@@ -178,6 +183,10 @@
       bitmap->writePNMFile(ppmFile);
     }
   } else {
+#if _WIN32
+    setmode(fileno(stdout), O_BINARY);
+#endif
+
     if (png) {
       bitmap->writeImgFile(splashFormatPng, stdout, x_resolution, y_resolution);
     } else if (jpeg) {