summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2010-08-10 19:42:40 +0100
committerAlbert Astals Cid <aacid@kde.org>2010-08-10 19:43:36 +0100
commit3bca8ddc10bf4291bf0c0e39c67341a05953e949 (patch)
tree67491d4dced2ca8d003a0b805a1f3c0139104c70 /utils
parentbdd617f2177a7836f6b6686fde892664513a32a7 (diff)
Tell windows we are writing/reading binary data
Bug #29329
Diffstat (limited to 'utils')
-rw-r--r--utils/pdftoppm.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index ed64fea8..14950d01 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 @@ static void savePageSlice(PDFDoc *doc,
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) {