Commit 928df1f3 authored by Salvo Miosi's avatar Salvo Miosi

pdftocairo: Setmode binary for windows

parent 4601e1d5
Pipeline #242242 passed with stages
in 10 minutes
......@@ -48,6 +48,7 @@
#include <cstdio>
#include <cmath>
#include <cstring>
#include <fcntl.h>
#include "parseargs.h"
#include "goo/gmem.h"
#include "goo/GooString.h"
......@@ -385,9 +386,12 @@ static void writePageImage(GooString *filename)
if (!writer)
return;
if (filename->cmp("fd://0") == 0)
if (filename->cmp("fd://0") == 0) {
#ifdef _WIN32
setmode(fileno(stdout), O_BINARY);
#endif
file = stdout;
else
} else
file = fopen(filename->c_str(), "wb");
if (!file) {
......
  • For MSVC / clang-cl, setmode() is in <io.h>. Not <fcntl.h>. I assume you tried that with MinGW? The error I get was:

    utils/pdftocairo.cc(392,9): error: use of undeclared identifier 'setmode'
            setmode(fileno(stdout), O_BINARY);
            ^
    1 error generated.

    Fixed by including <io.h>.

    Edited by Gisle Vanem
  • mentioned in issue #1029

    Toggle commit list
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment