[Poppler-bugs] [Bug 29329] Binary I/O on Windows doesn't work when using redirection

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Jul 31 01:37:05 PDT 2010


https://bugs.freedesktop.org/show_bug.cgi?id=29329

--- Comment #1 from Adrian Johnson <ajohnson at redneon.com> 2010-07-31 01:37:05 PDT ---
The problem with this patch is it changes all of stdin, stdout, and stderr to
binary without checking if binary mode is actually required. For example all
the utilities use stderr to output text error messages. pdfinfo and pdffonts
use stdout to output text. Where text is output the mode should not be set to
binary.

Instead of this patch I would suggest putting the call to _setmode() at the
point where we know stdin will be used for reading a PDF. ie put a 

  #if _WIN32
    _setmode(_fileno(stdin), _O_BINARY);
  #endif

in either StdinCachedFile.cc or StdinPDFDocBuilder.cc.

The other place I can see where binary mode is not currently set on win32 is
when pdftoppm writes images to stdout. The call to _setmode() could be done in
writeImgFile().

The "_fmode = _O_BINARY" line is not necessary as it has no effect on files
already open.

See also the use of setmode in TextOutputDev.cc where the file mode is set to
binary at the point where we know we need binary output.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Poppler-bugs mailing list