summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Preprocessor.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-02-01 13:55:12 -0330
committerDwayne Boone <dwayne@zeroc.com>2008-02-01 13:55:12 -0330
commita587e5750379b57e0a1e2ea3d3398a67eed86d37 (patch)
treeb05f749232fe6b86ba4db9e994a36b508c333e9f /cpp/src/Slice/Preprocessor.cpp
parentBug 2672 - mcpp messing up interactive python/ruby demos (diff)
downloadice-a587e5750379b57e0a1e2ea3d3398a67eed86d37.tar.bz2
ice-a587e5750379b57e0a1e2ea3d3398a67eed86d37.tar.xz
ice-a587e5750379b57e0a1e2ea3d3398a67eed86d37.zip
Fixed Windows compile error
Diffstat (limited to 'cpp/src/Slice/Preprocessor.cpp')
-rwxr-xr-xcpp/src/Slice/Preprocessor.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp
index eed134be39b..10047df7cb3 100755
--- a/cpp/src/Slice/Preprocessor.cpp
+++ b/cpp/src/Slice/Preprocessor.cpp
@@ -157,8 +157,11 @@ Slice::Preprocessor::preprocess(bool keepComments)
// we need to save handle to stdin so we can restore it
// after mcpp has finished its processing.
//
+#ifdef _WIN32
+#else
int stdin_save;
stdin_save = dup(0);
+#endif
//
// Call mcpp using memory buffer.
@@ -170,10 +173,13 @@ Slice::Preprocessor::preprocess(bool keepComments)
//
// Restore stdin.
//
+#ifdef _WIN32
+#else
fflush(stdin);
::close(0);
dup2(stdin_save, 0);
::close(stdin_save);
+#endif
//
// Write output to temporary file. Print errors to stderr.
@@ -184,7 +190,7 @@ Slice::Preprocessor::preprocess(bool keepComments)
_cppFile = ".preprocess." + IceUtil::generateUUID();
SignalHandler::addFile(_cppFile);
#ifdef _WIN32
- _cppHandle = ::_fopen(_cppFile.c_str(), "w+");
+ _cppHandle = ::_wfopen(IceUtil::stringToWstring(_cppFile).c_str(), IceUtil::stringToWstring("w+").c_str());
#else
_cppHandle = ::fopen(_cppFile.c_str(), "w+");
#endif