QWindowsPipeWriter: remove inefficient member
'numberOfBytesToWrite' is an equivalent of buffer.size(), which is inlined. Change-Id: I15706a8851734cc085b1f400b78f4820bb6e72c4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
821533b61f
commit
3d77c3629c
@ -57,7 +57,6 @@ QWindowsPipeWriter::QWindowsPipeWriter(HANDLE pipeWriteEnd, QObject *parent)
|
||||
: QObject(parent),
|
||||
handle(pipeWriteEnd),
|
||||
overlapped(this),
|
||||
numberOfBytesToWrite(0),
|
||||
pendingBytesWrittenValue(0),
|
||||
stopped(true),
|
||||
writeSequenceStarted(false),
|
||||
@ -97,7 +96,7 @@ bool QWindowsPipeWriter::waitForWrite(int msecs)
|
||||
|
||||
qint64 QWindowsPipeWriter::bytesToWrite() const
|
||||
{
|
||||
return numberOfBytesToWrite + pendingBytesWrittenValue;
|
||||
return buffer.size() + pendingBytesWrittenValue;
|
||||
}
|
||||
|
||||
void QWindowsPipeWriter::emitPendingBytesWrittenValue()
|
||||
@ -133,7 +132,6 @@ void QWindowsPipeWriter::notified(DWORD errorCode, DWORD numberOfBytesWritten)
|
||||
{
|
||||
notifiedCalled = true;
|
||||
writeSequenceStarted = false;
|
||||
numberOfBytesToWrite = 0;
|
||||
Q_ASSERT(errorCode != ERROR_SUCCESS || numberOfBytesWritten == DWORD(buffer.size()));
|
||||
buffer.clear();
|
||||
|
||||
@ -187,13 +185,11 @@ bool QWindowsPipeWriter::write(const QByteArray &ba)
|
||||
|
||||
overlapped.clear();
|
||||
buffer = ba;
|
||||
numberOfBytesToWrite = buffer.size();
|
||||
stopped = false;
|
||||
writeSequenceStarted = true;
|
||||
if (!WriteFileEx(handle, buffer.constData(), numberOfBytesToWrite,
|
||||
if (!WriteFileEx(handle, buffer.constData(), buffer.size(),
|
||||
&overlapped, &writeFileCompleted)) {
|
||||
writeSequenceStarted = false;
|
||||
numberOfBytesToWrite = 0;
|
||||
buffer.clear();
|
||||
qErrnoWarning("QWindowsPipeWriter::write failed.");
|
||||
return false;
|
||||
|
@ -145,7 +145,6 @@ private:
|
||||
HANDLE handle;
|
||||
Overlapped overlapped;
|
||||
QByteArray buffer;
|
||||
qint64 numberOfBytesToWrite;
|
||||
qint64 pendingBytesWrittenValue;
|
||||
bool stopped;
|
||||
bool writeSequenceStarted;
|
||||
|
Loading…
Reference in New Issue
Block a user