summaryrefslogtreecommitdiffstats
path: root/src/serialport/qserialport_wince.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-20 15:55:55 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-25 10:22:53 +0100
commita325de1910e6627e4d042114d22303cc68fae7a9 (patch)
treecabf88f9e4e42579e6695ecff5e6ab787f3922ab /src/serialport/qserialport_wince.cpp
parentd42d5838b9a4c3cbd6b0e67dabce658ba737eba8 (diff)
parentb84fe7eb3d6d977a347bfbb82da724409b2eda69 (diff)
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts: .qmake.conf src/serialport/qserialport_unix.cpp src/serialport/qserialport_unix_p.h src/serialport/qserialport_win.cpp src/serialport/qserialport_win_p.h src/serialport/qserialport_wince.cpp src/serialport/qserialport_wince_p.h Change-Id: Ibb917652b132e66fbb90f437bf762c1094911dc0
Diffstat (limited to 'src/serialport/qserialport_wince.cpp')
-rw-r--r--src/serialport/qserialport_wince.cpp31
1 files changed, 12 insertions, 19 deletions
diff --git a/src/serialport/qserialport_wince.cpp b/src/serialport/qserialport_wince.cpp
index 754a5745..b8affb64 100644
--- a/src/serialport/qserialport_wince.cpp
+++ b/src/serialport/qserialport_wince.cpp
@@ -196,7 +196,7 @@ bool QSerialPortPrivate::open(QIODevice::OpenMode mode)
}
handle = ::CreateFile(reinterpret_cast<const wchar_t*>(systemLocation.utf16()),
- desiredAccess, 0, NULL, OPEN_EXISTING, 0, NULL);
+ desiredAccess, 0, Q_NULLPTR, OPEN_EXISTING, 0, Q_NULLPTR);
if (handle == INVALID_HANDLE_VALUE) {
q->setError(decodeSystemError());
@@ -214,7 +214,7 @@ void QSerialPortPrivate::close()
{
if (eventNotifier) {
eventNotifier->deleteLater();
- eventNotifier = 0;
+ eventNotifier = Q_NULLPTR;
}
if (settingsRestoredOnClose) {
@@ -249,9 +249,9 @@ QSerialPort::PinoutSignals QSerialPortPrivate::pinoutSignals()
ret |= QSerialPort::DataCarrierDetectSignal;
DWORD bytesReturned = 0;
- if (!::DeviceIoControl(handle, IOCTL_SERIAL_GET_DTRRTS, NULL, 0,
+ if (!::DeviceIoControl(handle, IOCTL_SERIAL_GET_DTRRTS, Q_NULLPTR, 0,
&modemStat, sizeof(modemStat),
- &bytesReturned, NULL)) {
+ &bytesReturned, Q_NULLPTR)) {
q->setError(decodeSystemError());
return ret;
}
@@ -345,11 +345,9 @@ bool QSerialPortPrivate::waitForReadyRead(int msec)
forever {
bool readyToRead = false;
bool readyToWrite = false;
- bool timedOut = false;
if (!waitForReadOrWrite(&readyToRead, &readyToWrite,
true, !writeBuffer.isEmpty(),
- timeoutValue(msec, stopWatch.elapsed()),
- &timedOut)) {
+ timeoutValue(msec, stopWatch.elapsed()))) {
return false;
}
if (readyToRead) {
@@ -373,11 +371,9 @@ bool QSerialPortPrivate::waitForBytesWritten(int msec)
forever {
bool readyToRead = false;
bool readyToWrite = false;
- bool timedOut = false;
if (!waitForReadOrWrite(&readyToRead, &readyToWrite,
true, !writeBuffer.isEmpty(),
- timeoutValue(msec, stopWatch.elapsed()),
- &timedOut)) {
+ timeoutValue(msec, stopWatch.elapsed()))) {
return false;
}
if (readyToRead) {
@@ -509,7 +505,7 @@ bool QSerialPortPrivate::notifyRead()
char *ptr = buffer.reserve(bytesToRead);
DWORD readBytes = 0;
- BOOL sucessResult = ::ReadFile(handle, ptr, bytesToRead, &readBytes, NULL);
+ BOOL sucessResult = ::ReadFile(handle, ptr, bytesToRead, &readBytes, Q_NULLPTR);
if (!sucessResult) {
buffer.chop(bytesToRead);
@@ -555,7 +551,7 @@ bool QSerialPortPrivate::notifyWrite()
const char *ptr = writeBuffer.readPointer();
DWORD bytesWritten = 0;
- if (!::WriteFile(handle, ptr, nextSize, &bytesWritten, NULL)) {
+ if (!::WriteFile(handle, ptr, nextSize, &bytesWritten, Q_NULLPTR)) {
q->setError(QSerialPort::WriteError);
return false;
}
@@ -591,7 +587,7 @@ void QSerialPortPrivate::processIoErrors(bool error)
}
DWORD errors = 0;
- if (!::ClearCommError(handle, &errors, NULL)) {
+ if (!::ClearCommError(handle, &errors, Q_NULLPTR)) {
q->setError(decodeSystemError());
return;
}
@@ -727,7 +723,7 @@ QSerialPort::SerialPortError QSerialPortPrivate::decodeSystemError(int systemErr
bool QSerialPortPrivate::waitForReadOrWrite(bool *selectForRead, bool *selectForWrite,
bool checkRead, bool checkWrite,
- int msecs, bool *timedOut)
+ int msecs)
{
Q_Q(QSerialPort);
@@ -736,15 +732,12 @@ bool QSerialPortPrivate::waitForReadOrWrite(bool *selectForRead, bool *selectFor
// breaker can work out before you call a method WaitCommEvent()
// and so it will loop forever!
WaitCommEventBreaker breaker(handle, qMax(msecs, 0));
- ::WaitCommEvent(handle, &eventMask, NULL);
+ ::WaitCommEvent(handle, &eventMask, Q_NULLPTR);
breaker.stop();
if (breaker.isWorked()) {
- *timedOut = true;
q->setError(QSerialPort::TimeoutError);
- }
-
- if (!breaker.isWorked()) {
+ } else {
if (checkRead) {
Q_ASSERT(selectForRead);
*selectForRead = eventMask & EV_RXCHAR;