Browse Source

Use _WIN32 instead of WIN32. Reason: MinGW-W64 defines _WIN32 but not WIN32.


git-svn-id: https://svn.microneil.com/svn/CodeDweller/branches/adeniz_1@51 d34b734f-a00e-4b39-a726-e4eeb87269ab
adeniz_1
adeniz 10 years ago
parent
commit
c31de176c5
2 changed files with 17 additions and 17 deletions
  1. 11
    11
      child.cpp
  2. 6
    6
      child.hpp

+ 11
- 11
child.cpp View File

@@ -20,7 +20,7 @@
// Place, Suite 330, Boston, MA 02111-1307 USA
//==============================================================================
#ifndef WIN32
#ifndef _WIN32
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -85,7 +85,7 @@ namespace CodeDweller {
"run() was called");
}
#ifdef WIN32
#ifdef _WIN32
// Set the bInheritHandle flag so pipe handles are inherited.
SECURITY_ATTRIBUTES securityAttributes;
@@ -325,7 +325,7 @@ namespace CodeDweller {
}
#ifdef WIN32
#ifdef _WIN32
if (!TerminateProcess(childProcess, terminateExitCode)) {
#else
if (kill(childPid, SIGTERM) != 0) {
@@ -352,7 +352,7 @@ namespace CodeDweller {
int result;
#ifdef WIN32
#ifdef _WIN32
if (!GetExitCodeProcess(childProcess, (LPDWORD) &result)) {
throw std::runtime_error("Error checking status of child process: " +
getErrorText());
@@ -433,7 +433,7 @@ namespace CodeDweller {
std::string
Child::getErrorText() {
#ifdef WIN32
#ifdef _WIN32
LPVOID winMsgBuf;
DWORD lastError = GetLastError();
@@ -457,7 +457,7 @@ namespace CodeDweller {
}
Child::ReadStreambuf::ReadStreambuf(std::size_t bufferSize) :
#ifdef WIN32
#ifdef _WIN32
inputHandle(0),
#else
inputFileDescriptor(-1),
@@ -471,7 +471,7 @@ namespace CodeDweller {
}
#ifdef WIN32
#ifdef _WIN32
void
Child::ReadStreambuf::setInputHandle(HANDLE inHandle) {
@@ -511,7 +511,7 @@ namespace CodeDweller {
}
// start points to the start of the buffer. Fill buffer.
#ifdef WIN32
#ifdef _WIN32
DWORD nBytesRead;
if (!ReadFile(inputHandle,
@@ -545,7 +545,7 @@ namespace CodeDweller {
}
Child::WriteStreambuf::WriteStreambuf(std::size_t bufferSize) :
#ifdef WIN32
#ifdef _WIN32
outputHandle(0),
#else
outputFileDescriptor(-1),
@@ -559,7 +559,7 @@ namespace CodeDweller {
}
#ifdef WIN32
#ifdef _WIN32
void
Child::WriteStreambuf::setOutputHandle(HANDLE outHandle) {
@@ -581,7 +581,7 @@ namespace CodeDweller {
// Write.
std::ptrdiff_t nBytes = pptr() - pbase();
#ifdef WIN32
#ifdef _WIN32
DWORD nBytesWritten;
if (!WriteFile(outputHandle,

+ 6
- 6
child.hpp View File

@@ -28,7 +28,7 @@
#ifndef CHILD_HPP
#define CHILD_HPP

#ifdef WIN32
#ifdef _WIN32
#include <windows.h>
#endif

@@ -74,7 +74,7 @@ namespace CodeDweller {
//
explicit ReadStreambuf(std::size_t bufferSize = 4096);

#ifdef WIN32
#ifdef _WIN32
/// Set the handle to read the standard output of the child
/// process.
//
@@ -104,7 +104,7 @@ namespace CodeDweller {
ReadStreambuf &operator=(const ReadStreambuf &);

/// Input handle.
#ifdef WIN32
#ifdef _WIN32
HANDLE inputHandle;
#else
int inputFileDescriptor;
@@ -132,7 +132,7 @@ namespace CodeDweller {
//
explicit WriteStreambuf(std::size_t bufferSize = 4096);

#ifdef WIN32
#ifdef _WIN32
/// Set the handle to write the standard input of the child
/// process.
//
@@ -168,7 +168,7 @@ namespace CodeDweller {
WriteStreambuf &operator=(const WriteStreambuf &);

/// Output handle.
#ifdef WIN32
#ifdef _WIN32
HANDLE outputHandle;
#else
int outputFileDescriptor;
@@ -295,7 +295,7 @@ namespace CodeDweller {
/// Child executable path and command-line parameters.
std::string cmdline;

#ifdef WIN32
#ifdef _WIN32
/// Child's process handle.
HANDLE childProcess;


Loading…
Cancel
Save