MinGW build fixes for QWindowsPipeReader and friends

Change-Id: Ie4d6017c6fb918e7796d1a5e8863e9368e4e1894
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
bb10
Joerg Bornemann 2012-01-31 12:10:45 +01:00 committed by Qt by Nokia
parent 20beb5ff53
commit 9a4d30d999
3 changed files with 6 additions and 3 deletions

View File

@ -56,6 +56,9 @@
#include "private/qfsfileengine_p.h" // for longFileName
#ifndef PIPE_REJECT_REMOTE_CLIENTS
#define PIPE_REJECT_REMOTE_CLIENTS 0x08
#endif
#ifndef QT_NO_PROCESS
@ -80,7 +83,7 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
forever {
// ### The user must make sure to call qsrand() to make the pipe names less predictable.
// ### Replace the call to qrand() with a secure version, once we have it in Qt.
swprintf_s(pipeName, sizeof(pipeName) / sizeof(wchar_t), L"\\\\.\\pipe\\qt-%X", qrand());
swprintf(pipeName, L"\\\\.\\pipe\\qt-%X", qrand());
const DWORD dwPipeBufferSize = 1024 * 1024;
hRead = CreateNamedPipe(pipeName,

View File

@ -67,7 +67,7 @@ QWindowsPipeReader::QWindowsPipeReader(QObject *parent)
QWindowsPipeReader::~QWindowsPipeReader()
{
if (readSequenceStarted) {
CancelIoEx(handle, &overlapped);
CancelIo(handle);
dataReadNotifier->waitForNotified(-1);
}
}
@ -175,6 +175,7 @@ void QWindowsPipeReader::notified(DWORD numberOfBytesRead, DWORD errorCode)
*/
void QWindowsPipeReader::startAsyncRead()
{
const DWORD minReadBufferSize = 4096;
DWORD bytesToRead = qMax(checkPipeState(), minReadBufferSize);
if (pipeBroken)
return;

View File

@ -113,7 +113,6 @@ private:
QTimer *emitReadyReadTimer;
bool pipeBroken;
bool readyReadEmitted;
static const DWORD minReadBufferSize = 4096;
};
QT_END_NAMESPACE