Changes in directory llvm/lib/System/Win32:
Program.inc updated: 1.15 -> 1.16 --- Log message: For PR787: http://llvm.cs.uiuc.edu/PR787 : Provide new llvm::sys::Program facilities for converting the stdout and stdin to binary mode. There is no standard way to do this and the available mechanisms are platform specific. Adjust the bytecode reader and writer to use these methods when their input is stdin or output is stdout. THis avoids the problem with \n writing CRLF to a bytecode file on windows. Patch Contributed by Michael Smith. --- Diffs of the changes: (+14 -0) Program.inc | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm/lib/System/Win32/Program.inc diff -u llvm/lib/System/Win32/Program.inc:1.15 llvm/lib/System/Win32/Program.inc:1.16 --- llvm/lib/System/Win32/Program.inc:1.15 Thu Jul 7 21:48:42 2005 +++ llvm/lib/System/Win32/Program.inc Wed Jun 7 18:18:34 2006 @@ -12,8 +12,10 @@ //===----------------------------------------------------------------------===// #include "Win32.h" +#include <cstdio> #include <malloc.h> #include <io.h> +#include <fcntl.h> //===----------------------------------------------------------------------===// //=== WARNING: Implementation here must contain only Win32 specific code @@ -218,4 +220,16 @@ return status; } +void Program::ChangeStdinToBinary(){ + int result = _setmode( _fileno(stdin), _O_BINARY ); + if( result == -1 ) + throw std::string("Cannot set input mode on stdin to binary."); +} + +void Program::ChangeStdoutToBinary(){ + int result = _setmode( _fileno(stdout), _O_BINARY ); + if( result == -1 ) + throw std::string("Cannot set output mode on stdout to binary."); +} + } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits