diff options
author | Liang Qi <liang.qi@qt.io> | 2016-06-30 11:51:54 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-06-30 11:51:54 +0200 |
commit | 69b6a9a19a37b990e43e0f9660b9ef687b5dafb3 (patch) | |
tree | d2653d124f4d1f2eea594d7e53c682ef7a293628 /src/serialport | |
parent | 5fbb69b1cad02d58d48e4753e6d246e68fcc6fab (diff) | |
parent | 9df15226d3e7cbf8e601432d706c199f6ec3d112 (diff) | |
download | qtserialport-69b6a9a19a37b990e43e0f9660b9ef687b5dafb3.tar.gz |
Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: I576cf803037a823eb4dcbdf5eb0d209735871326
Diffstat (limited to 'src/serialport')
-rw-r--r-- | src/serialport/qserialport.h | 6 | ||||
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 6 | ||||
-rw-r--r-- | src/serialport/qserialport_win.cpp | 18 | ||||
-rw-r--r-- | src/serialport/qserialportinfo.cpp | 2 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_freebsd.cpp | 18 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_win.cpp | 12 | ||||
-rw-r--r-- | src/serialport/qtudev_p.h | 2 |
7 files changed, 32 insertions, 32 deletions
diff --git a/src/serialport/qserialport.h b/src/serialport/qserialport.h index 4772724..3289ca1 100644 --- a/src/serialport/qserialport.h +++ b/src/serialport/qserialport.h @@ -200,9 +200,9 @@ public: #endif #endif - explicit QSerialPort(QObject *parent = Q_NULLPTR); - explicit QSerialPort(const QString &name, QObject *parent = Q_NULLPTR); - explicit QSerialPort(const QSerialPortInfo &info, QObject *parent = Q_NULLPTR); + explicit QSerialPort(QObject *parent = nullptr); + explicit QSerialPort(const QString &name, QObject *parent = nullptr); + explicit QSerialPort(const QSerialPortInfo &info, QObject *parent = nullptr); virtual ~QSerialPort(); void setPortName(const QString &name); diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 7078040..acc53c8 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -251,14 +251,14 @@ void QSerialPortPrivate::close() #endif delete readNotifier; - readNotifier = Q_NULLPTR; + readNotifier = nullptr; delete writeNotifier; - writeNotifier = Q_NULLPTR; + writeNotifier = nullptr; qt_safe_close(descriptor); - lockFileScopedPointer.reset(Q_NULLPTR); + lockFileScopedPointer.reset(nullptr); descriptor = -1; pendingBytesWritten = 0; diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index b41af02..7cbb81d 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -94,7 +94,7 @@ bool QSerialPortPrivate::open(QIODevice::OpenMode mode) desiredAccess |= GENERIC_WRITE; handle = ::CreateFile(reinterpret_cast<const wchar_t*>(systemLocation.utf16()), - desiredAccess, 0, Q_NULLPTR, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, Q_NULLPTR); + desiredAccess, 0, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, nullptr); if (handle == INVALID_HANDLE_VALUE) { setError(getSystemError()); @@ -113,10 +113,10 @@ void QSerialPortPrivate::close() ::CancelIo(handle); delete notifier; - notifier = Q_NULLPTR; + notifier = nullptr; delete startAsyncWriteTimer; - startAsyncWriteTimer = Q_NULLPTR; + startAsyncWriteTimer = nullptr; communicationStarted = false; readStarted = false; @@ -154,9 +154,9 @@ QSerialPort::PinoutSignals QSerialPortPrivate::pinoutSignals() ret |= QSerialPort::DataCarrierDetectSignal; DWORD bytesReturned = 0; - if (!::DeviceIoControl(handle, IOCTL_SERIAL_GET_DTRRTS, Q_NULLPTR, 0, + if (!::DeviceIoControl(handle, IOCTL_SERIAL_GET_DTRRTS, nullptr, 0, &modemStat, sizeof(modemStat), - &bytesReturned, Q_NULLPTR)) { + &bytesReturned, nullptr)) { setError(getSystemError()); return ret; } @@ -507,7 +507,7 @@ bool QSerialPortPrivate::startAsyncRead() } ::ZeroMemory(&readCompletionOverlapped, sizeof(readCompletionOverlapped)); - if (::ReadFile(handle, readChunkBuffer.data(), bytesToRead, Q_NULLPTR, &readCompletionOverlapped)) { + if (::ReadFile(handle, readChunkBuffer.data(), bytesToRead, nullptr, &readCompletionOverlapped)) { readStarted = true; return true; } @@ -534,7 +534,7 @@ bool QSerialPortPrivate::_q_startAsyncWrite() const int writeBytes = writeBuffer.nextDataBlockSize(); ::ZeroMemory(&writeCompletionOverlapped, sizeof(writeCompletionOverlapped)); if (!::WriteFile(handle, writeBuffer.readPointer(), - writeBytes, Q_NULLPTR, &writeCompletionOverlapped)) { + writeBytes, nullptr, &writeCompletionOverlapped)) { QSerialPortErrorInfo error = getSystemError(); if (error.errorCode != QSerialPort::NoError) { @@ -598,7 +598,7 @@ OVERLAPPED *QSerialPortPrivate::waitForNotified(int msecs) OVERLAPPED *overlapped = notifier->waitForAnyNotified(msecs); if (!overlapped) { setError(getSystemError(WAIT_TIMEOUT)); - return Q_NULLPTR; + return nullptr; } return overlapped; } @@ -606,7 +606,7 @@ OVERLAPPED *QSerialPortPrivate::waitForNotified(int msecs) qint64 QSerialPortPrivate::queuedBytesCount(QSerialPort::Direction direction) const { COMSTAT comstat; - if (::ClearCommError(handle, Q_NULLPTR, &comstat) == 0) + if (::ClearCommError(handle, nullptr, &comstat) == 0) return -1; return (direction == QSerialPort::Input) ? comstat.cbInQue diff --git a/src/serialport/qserialportinfo.cpp b/src/serialport/qserialportinfo.cpp index acd0179..2b69966 100644 --- a/src/serialport/qserialportinfo.cpp +++ b/src/serialport/qserialportinfo.cpp @@ -79,7 +79,7 @@ QSerialPortInfo::QSerialPortInfo() Constructs a copy of \a other. */ QSerialPortInfo::QSerialPortInfo(const QSerialPortInfo &other) - : d_ptr(other.d_ptr ? new QSerialPortInfoPrivate(*other.d_ptr) : Q_NULLPTR) + : d_ptr(other.d_ptr ? new QSerialPortInfoPrivate(*other.d_ptr) : nullptr) { } diff --git a/src/serialport/qserialportinfo_freebsd.cpp b/src/serialport/qserialportinfo_freebsd.cpp index 291cfac..066290d 100644 --- a/src/serialport/qserialportinfo_freebsd.cpp +++ b/src/serialport/qserialportinfo_freebsd.cpp @@ -106,7 +106,7 @@ struct NodeInfo static QVector<int> mibFromName(const QString &name) { size_t mibsize = 0; - if (::sysctlnametomib(name.toLocal8Bit().constData(), Q_NULLPTR, &mibsize) < 0 + if (::sysctlnametomib(name.toLocal8Bit().constData(), nullptr, &mibsize) < 0 || mibsize == 0) { return QVector<int>(); } @@ -126,11 +126,11 @@ static QVector<int> nextOid(const QVector<int> &previousOid) mib.append(code); size_t requiredLength = 0; - if (::sysctl(&mib[0], mib.count(), Q_NULLPTR, &requiredLength, Q_NULLPTR, 0) < 0) + if (::sysctl(&mib[0], mib.count(), nullptr, &requiredLength, nullptr, 0) < 0) return QVector<int>(); const size_t oidLength = requiredLength / sizeof(int); QVector<int> oid(oidLength, 0); - if (::sysctl(&mib[0], mib.count(), &oid[0], &requiredLength, Q_NULLPTR, 0) < 0) + if (::sysctl(&mib[0], mib.count(), &oid[0], &requiredLength, nullptr, 0) < 0) return QVector<int>(); if (previousOid.first() != oid.first()) @@ -149,27 +149,27 @@ static NodeInfo nodeForOid(const QVector<int> &oid) // query node name size_t requiredLength = 0; - if (::sysctl(&mib[0], mib.count(), Q_NULLPTR, &requiredLength, Q_NULLPTR, 0) < 0) + if (::sysctl(&mib[0], mib.count(), nullptr, &requiredLength, nullptr, 0) < 0) return NodeInfo(); QByteArray name(requiredLength, 0); - if (::sysctl(&mib[0], mib.count(), name.data(), &requiredLength, Q_NULLPTR, 0) < 0) + if (::sysctl(&mib[0], mib.count(), name.data(), &requiredLength, nullptr, 0) < 0) return NodeInfo(); // query node value requiredLength = 0; - if (::sysctl(&oid[0], oid.count(), Q_NULLPTR, &requiredLength, Q_NULLPTR, 0) < 0) + if (::sysctl(&oid[0], oid.count(), nullptr, &requiredLength, nullptr, 0) < 0) return NodeInfo(); QByteArray value(requiredLength, 0); - if (::sysctl(&oid[0], oid.count(), value.data(), &requiredLength, Q_NULLPTR, 0) < 0) + if (::sysctl(&oid[0], oid.count(), value.data(), &requiredLength, nullptr, 0) < 0) return NodeInfo(); // query value format mib[1] = 4; // Magic undocumented code requiredLength = 0; - if (::sysctl(&mib[0], mib.count(), Q_NULLPTR, &requiredLength, Q_NULLPTR, 0) < 0) + if (::sysctl(&mib[0], mib.count(), nullptr, &requiredLength, nullptr, 0) < 0) return NodeInfo(); QByteArray buf(requiredLength, 0); - if (::sysctl(&mib[0], mib.count(), buf.data(), &requiredLength, Q_NULLPTR, 0) < 0) + if (::sysctl(&mib[0], mib.count(), buf.data(), &requiredLength, nullptr, 0) < 0) return NodeInfo(); QDataStream in(buf); diff --git a/src/serialport/qserialportinfo_win.cpp b/src/serialport/qserialportinfo_win.cpp index 4a80325..398666e 100644 --- a/src/serialport/qserialportinfo_win.cpp +++ b/src/serialport/qserialportinfo_win.cpp @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE static QStringList portNamesFromHardwareDeviceMap() { - HKEY hKey = Q_NULLPTR; + HKEY hKey = nullptr; if (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"HARDWARE\\DEVICEMAP\\SERIALCOMM", 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS) return QStringList(); @@ -82,7 +82,7 @@ static QStringList portNamesFromHardwareDeviceMap() for (;;) { DWORD requiredValueNameChars = MaximumValueNameInChars; const LONG ret = ::RegEnumValue(hKey, index, &outputValueName[0], &requiredValueNameChars, - Q_NULLPTR, Q_NULLPTR, reinterpret_cast<PBYTE>(&outputBuffer[0]), &bytesRequired); + nullptr, nullptr, reinterpret_cast<PBYTE>(&outputBuffer[0]), &bytesRequired); if (ret == ERROR_MORE_DATA) { outputBuffer.resize(bytesRequired / sizeof(wchar_t) + 2, 0); } else if (ret == ERROR_SUCCESS) { @@ -166,7 +166,7 @@ static QString devicePortName(HDEVINFO deviceInfoSet, PSP_DEVINFO_DATA deviceInf std::vector<wchar_t> outputBuffer(MAX_PATH + 1, 0); DWORD bytesRequired = MAX_PATH; for (;;) { - const LONG ret = ::RegQueryValueEx(key, keyTokens[i], Q_NULLPTR, &dataType, + const LONG ret = ::RegQueryValueEx(key, keyTokens[i], nullptr, &dataType, reinterpret_cast<PBYTE>(&outputBuffer[0]), &bytesRequired); if (ret == ERROR_MORE_DATA) { outputBuffer.resize(bytesRequired / sizeof(wchar_t) + 2, 0); @@ -304,7 +304,7 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() QList<QSerialPortInfo> serialPortInfoList; for (int i = 0; i < SetupTokensCount; ++i) { - const HDEVINFO deviceInfoSet = ::SetupDiGetClassDevs(&setupTokens[i].guid, Q_NULLPTR, Q_NULLPTR, setupTokens[i].flags); + const HDEVINFO deviceInfoSet = ::SetupDiGetClassDevs(&setupTokens[i].guid, nullptr, nullptr, setupTokens[i].flags); if (deviceInfoSet == INVALID_HANDLE_VALUE) return serialPortInfoList; @@ -362,7 +362,7 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() bool QSerialPortInfo::isBusy() const { const HANDLE handle = ::CreateFile(reinterpret_cast<const wchar_t*>(systemLocation().utf16()), - GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, Q_NULLPTR); + GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr); if (handle == INVALID_HANDLE_VALUE) { if (::GetLastError() == ERROR_ACCESS_DENIED) @@ -378,7 +378,7 @@ bool QSerialPortInfo::isBusy() const bool QSerialPortInfo::isValid() const { const HANDLE handle = ::CreateFile(reinterpret_cast<const wchar_t*>(systemLocation().utf16()), - GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, Q_NULLPTR); + GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr); if (handle == INVALID_HANDLE_VALUE) { if (::GetLastError() != ERROR_ACCESS_DENIED) diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h index aad2dfe..af2dab2 100644 --- a/src/serialport/qtudev_p.h +++ b/src/serialport/qtudev_p.h @@ -74,7 +74,7 @@ struct udev; #define udev_list_entry_foreach(list_entry, first_entry) \ for (list_entry = first_entry; \ - list_entry != NULL; \ + list_entry != nullptr; \ list_entry = udev_list_entry_get_next(list_entry)) struct udev_device; |