projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
TRUE not true, FALSE not false
[wxWidgets.git]
/
src
/
msw
/
utilsexc.cpp
diff --git
a/src/msw/utilsexc.cpp
b/src/msw/utilsexc.cpp
index 58b26f2c07d29002db2f71e2bff58235f6a86b1c..b646c56ae2b2f7e2c525adb99e516c5c923c929a 100644
(file)
--- a/
src/msw/utilsexc.cpp
+++ b/
src/msw/utilsexc.cpp
@@
-47,7
+47,7
@@
#include <ctype.h>
#include <ctype.h>
-#if !defined(__GNUWIN32__) && !defined(__
WXWINE__) && !defined(__
SALFORDC__) && !defined(__WXMICROWIN__)
+#if !defined(__GNUWIN32__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__)
#include <direct.h>
#ifndef __MWERKS__
#include <dos.h>
#include <direct.h>
#ifndef __MWERKS__
#include <dos.h>
@@
-59,8
+59,10
@@
#include <sys/stat.h>
#endif
#include <sys/stat.h>
#endif
-#if defined(__WIN32__) && !defined(__WXWINE__) && !defined(__WXMICROWIN__)
-#include <io.h>
+#if defined(__WIN32__) && !defined(__WXMICROWIN__)
+#ifndef __UNIX__
+ #include <io.h>
+#endif
#ifndef __GNUWIN32__
#include <shellapi.h>
#ifndef __GNUWIN32__
#include <shellapi.h>
@@
-139,13
+141,15
@@
public:
bool IsOpened() const { return m_hInput != INVALID_HANDLE_VALUE; }
// returns TRUE if there is any data to be read from the pipe
bool IsOpened() const { return m_hInput != INVALID_HANDLE_VALUE; }
// returns TRUE if there is any data to be read from the pipe
-
bool IsAvailable
() const;
+
virtual bool CanRead
() const;
protected:
size_t OnSysRead(void *buffer, size_t len);
protected:
HANDLE m_hInput;
protected:
size_t OnSysRead(void *buffer, size_t len);
protected:
HANDLE m_hInput;
+
+ DECLARE_NO_COPY_CLASS(wxPipeInputStream)
};
class wxPipeOutputStream: public wxOutputStream
};
class wxPipeOutputStream: public wxOutputStream
@@
-159,6
+163,8
@@
protected:
protected:
HANDLE m_hOutput;
protected:
HANDLE m_hOutput;
+
+ DECLARE_NO_COPY_CLASS(wxPipeOutputStream)
};
// define this to let wxexec.cpp know that we know what we're doing
};
// define this to let wxexec.cpp know that we know what we're doing
@@
-341,12
+347,8
@@
wxPipeInputStream::~wxPipeInputStream()
::CloseHandle(m_hInput);
}
::CloseHandle(m_hInput);
}
-bool wxPipeInputStream::
IsAvailable
() const
+bool wxPipeInputStream::
CanRead
() const
{
{
- // FIXME
-#ifdef __WXWINE__
- return FALSE;
-#else
if ( !IsOpened() )
return FALSE;
if ( !IsOpened() )
return FALSE;
@@
-374,37
+376,35
@@
bool wxPipeInputStream::IsAvailable() const
// it had been closed
::CloseHandle(m_hInput);
// it had been closed
::CloseHandle(m_hInput);
- wx
ConstCast(this, wxPipeInputStream)->m_hInput = INVALID_HANDLE_VALUE
;
+ wx
PipeInputStream *self = wxConstCast(this, wxPipeInputStream)
;
- return FALSE;
+ self->m_hInput = INVALID_HANDLE_VALUE;
+ self->m_lasterror = wxSTREAM_EOF;
+
+ nAvailable = 0;
}
return nAvailable != 0;
}
return nAvailable != 0;
-#endif
}
size_t wxPipeInputStream::OnSysRead(void *buffer, size_t len)
{
}
size_t wxPipeInputStream::OnSysRead(void *buffer, size_t len)
{
- // reading from a pipe may block if there is no more data, always check for
- // EOF first
- if ( !IsAvailable() )
+ if ( !IsOpened() )
{
m_lasterror = wxSTREAM_EOF;
return 0;
}
{
m_lasterror = wxSTREAM_EOF;
return 0;
}
- m_lasterror = wxSTREAM_NOERROR;
-
DWORD bytesRead;
if ( !::ReadFile(m_hInput, buffer, len, &bytesRead, NULL) )
{
DWORD bytesRead;
if ( !::ReadFile(m_hInput, buffer, len, &bytesRead, NULL) )
{
- if ( ::GetLastError() == ERROR_BROKEN_PIPE )
- m_lasterror = wxSTREAM_EOF;
- else
- m_lasterror = wxSTREAM_READ_ERROR;
+ m_lasterror = ::GetLastError() == ERROR_BROKEN_PIPE
+ ? wxSTREAM_EOF
+ : wxSTREAM_READ_ERROR;
}
}
+ // bytesRead is set to 0, as desired, if an error occured
return bytesRead;
}
return bytesRead;
}
@@
-424,18
+424,17
@@
wxPipeOutputStream::~wxPipeOutputStream()
size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len)
{
size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len)
{
- DWORD bytes
Read
;
+ DWORD bytes
Written
;
- m_lasterror = wxSTREAM_NOERROR;
- if ( !::WriteFile(m_hOutput, buffer, len, &bytes
Read
, NULL) )
+ m_lasterror = wxSTREAM_NO
_
ERROR;
+ if ( !::WriteFile(m_hOutput, buffer, len, &bytes
Written
, NULL) )
{
{
- if ( ::GetLastError() == ERROR_BROKEN_PIPE )
- m_lasterror = wxSTREAM_EOF;
- else
- m_lasterror = wxSTREAM_READ_ERROR;
+ m_lasterror = ::GetLastError() == ERROR_BROKEN_PIPE
+ ? wxSTREAM_EOF
+ : wxSTREAM_WRITE_ERROR;
}
}
- return bytes
Read
;
+ return bytes
Written
;
}
#endif // wxUSE_STREAMS
}
#endif // wxUSE_STREAMS
@@
-453,7
+452,7
@@
static bool wxExecuteDDE(const wxString& ddeServer,
const wxString& ddeTopic,
const wxString& ddeCommand)
{
const wxString& ddeTopic,
const wxString& ddeCommand)
{
- bool ok;
+ bool ok
= FALSE
;
wxDDEClient client;
wxConnectionBase *conn = client.MakeConnection(_T(""),
wxDDEClient client;
wxConnectionBase *conn = client.MakeConnection(_T(""),
@@
-470,17
+469,17
@@
static bool wxExecuteDDE(const wxString& ddeServer,
// important ones - like IE and other MS stuff - use
// XTYP_REQUEST!
//
// important ones - like IE and other MS stuff - use
// XTYP_REQUEST!
//
- // so we try
it
first and then the other one if it
+ // so we try
one
first and then the other one if it
// failed
{
wxLogNull noErrors;
// failed
{
wxLogNull noErrors;
- ok = conn->
Request(ddeCommand) != NULL
;
+ ok = conn->
Execute(ddeCommand)
;
}
if ( !ok )
{
}
if ( !ok )
{
- // now try
execute
- but show the errors
- ok = conn->
Execute(ddeCommand)
;
+ // now try
request
- but show the errors
+ ok = conn->
Request(ddeCommand) != NULL
;
}
}
}
}