poppler/StdinCachedFile.cc | 9 +++++++++ utils/pdftoppm.cc | 9 +++++++++ 2 files changed, 18 insertions(+)
New commits: commit 213a60ad48684f56b94f6b0eac642e7dfb3b4825 Author: Jonathan Liu <[email protected]> Date: Tue Aug 10 19:42:40 2010 +0100 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 <[email protected]> // Copyright 2010 Albert Astals Cid <[email protected]> +// Copyright 2010 Jonathan Liu <[email protected]> // //======================================================================== @@ -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 StdinCacheLoader::init(GooString *dummy, CachedFile *cachedFile) 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 <[email protected]> // Copyright (C) 2010 Adrian Johnson <[email protected]> // Copyright (C) 2010 Hib Eris <[email protected]> +// Copyright (C) 2010 Jonathan Liu <[email protected]> // // 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) { _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
