diff options
author | Liang Qi <liang.qi@qt.io> | 2016-06-11 18:58:15 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-06-11 18:58:15 +0200 |
commit | 5fbb69b1cad02d58d48e4753e6d246e68fcc6fab (patch) | |
tree | f46679b33f3176abd15b71b0d83046a1a884fcb7 | |
parent | f6639e64a98ebdebdee903e4f6ec4fea032f63a7 (diff) | |
parent | 63ac6874eeea037b4b8b1a450a938999fb4f31b8 (diff) | |
download | qtserialport-5fbb69b1cad02d58d48e4753e6d246e68fcc6fab.tar.gz |
Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: I49f290620c04e95a962d36901137f458c9ce9578
-rw-r--r-- | dist/changes-5.7.0 | 23 | ||||
-rw-r--r-- | src/serialport/qserialport.cpp | 2 | ||||
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 2 | ||||
-rw-r--r-- | src/serialport/qserialport_win.cpp | 8 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_freebsd.cpp | 2 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_osx.cpp | 4 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_unix.cpp | 6 | ||||
-rw-r--r-- | src/serialport/qserialportinfo_win.cpp | 16 |
8 files changed, 41 insertions, 22 deletions
diff --git a/dist/changes-5.7.0 b/dist/changes-5.7.0 new file mode 100644 index 0000000..27e9ddb --- /dev/null +++ b/dist/changes-5.7.0 @@ -0,0 +1,23 @@ +QtSerialPort 5.7 introduces a few new features and improvements as well as +bugfixes over the 5.6.x series. For more details, refer to the online +documentation included in this distribution. The documentation is also available +online: + + http://doc.qt.io/qt-5/index.html + +The QtSerialPort version 5.7 series is binary compatible with the 5.6.x series. +Applications compiled for 5.6 will continue to run with 5.7. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Library * +**************************************************************************** + +- Started transition to use C++11 features. diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index ba2f5fc..45f56c8 100644 --- a/src/serialport/qserialport.cpp +++ b/src/serialport/qserialport.cpp @@ -184,7 +184,7 @@ void QSerialPortPrivate::setError(const QSerialPortErrorInfo &errorInfo) int numRead = 0, numReadTotal = 0; char buffer[50]; - forever { + for (;;) { numRead = serial.read(buffer, 50); // Do whatever with the array diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 2d49822..7078040 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -410,7 +410,7 @@ bool QSerialPortPrivate::waitForBytesWritten(int msecs) QElapsedTimer stopWatch; stopWatch.start(); - forever { + for (;;) { bool readyToRead = false; bool readyToWrite = false; if (!waitForReadOrWrite(&readyToRead, &readyToWrite, true, !writeBuffer.isEmpty(), diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index 5dccd39..b41af02 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -257,7 +257,7 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs) stopWatch.start(); do { - OVERLAPPED *overlapped = waitForNotified( + const OVERLAPPED *overlapped = waitForNotified( qt_subtract_from_timeout(msecs, stopWatch.elapsed())); if (!overlapped) return false; @@ -290,8 +290,8 @@ bool QSerialPortPrivate::waitForBytesWritten(int msecs) QElapsedTimer stopWatch; stopWatch.start(); - forever { - OVERLAPPED *overlapped = waitForNotified( + for (;;) { + const OVERLAPPED *overlapped = waitForNotified( qt_subtract_from_timeout(msecs, stopWatch.elapsed())); if (!overlapped) return false; @@ -598,7 +598,7 @@ OVERLAPPED *QSerialPortPrivate::waitForNotified(int msecs) OVERLAPPED *overlapped = notifier->waitForAnyNotified(msecs); if (!overlapped) { setError(getSystemError(WAIT_TIMEOUT)); - return 0; + return Q_NULLPTR; } return overlapped; } diff --git a/src/serialport/qserialportinfo_freebsd.cpp b/src/serialport/qserialportinfo_freebsd.cpp index 219cd7c..291cfac 100644 --- a/src/serialport/qserialportinfo_freebsd.cpp +++ b/src/serialport/qserialportinfo_freebsd.cpp @@ -195,7 +195,7 @@ static QList<NodeInfo> enumerateDesiredNodes(const QVector<int> &mib) QVector<int> oid = mib; - forever { + for (;;) { const QVector<int> nextoid = nextOid(oid); if (nextoid.isEmpty()) break; diff --git a/src/serialport/qserialportinfo_osx.cpp b/src/serialport/qserialportinfo_osx.cpp index ca77e5a..03cb59b 100644 --- a/src/serialport/qserialportinfo_osx.cpp +++ b/src/serialport/qserialportinfo_osx.cpp @@ -166,7 +166,7 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() QList<QSerialPortInfo> serialPortInfoList; - forever { + for (;;) { io_registry_entry_t serialPortService = ::IOIteratorNext(serialPortIterator); if (!serialPortService) break; @@ -176,7 +176,7 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() QString calloutDevice; QString dialinDevice; - forever { + for (;;) { if (calloutDevice.isEmpty()) calloutDevice = calloutDeviceSystemLocation(serialPortService); diff --git a/src/serialport/qserialportinfo_unix.cpp b/src/serialport/qserialportinfo_unix.cpp index 08e75c1..0f62a9d 100644 --- a/src/serialport/qserialportinfo_unix.cpp +++ b/src/serialport/qserialportinfo_unix.cpp @@ -166,10 +166,7 @@ static bool isRfcommDevice(const QString &portName) // provided by the tty0tty driver static bool isVirtualNullModemDevice(const QString &portName) { - if (!portName.startsWith(QLatin1String("tnt"))) - return false; - - return true; + return portName.startsWith(QLatin1String("tnt")); } static QString ueventProperty(const QDir &targetDir, const QByteArray &pattern) @@ -391,7 +388,6 @@ QList<QSerialPortInfo> availablePortsByUdev(bool &ok) if (!symbolsResolved) return QList<QSerialPortInfo>(); #endif - static const QString rfcommDeviceName(QStringLiteral("rfcomm")); QScopedPointer<struct ::udev, ScopedPointerUdevDeleter> udev(::udev_new()); diff --git a/src/serialport/qserialportinfo_win.cpp b/src/serialport/qserialportinfo_win.cpp index 9c5305c..4a80325 100644 --- a/src/serialport/qserialportinfo_win.cpp +++ b/src/serialport/qserialportinfo_win.cpp @@ -79,7 +79,7 @@ static QStringList portNamesFromHardwareDeviceMap() std::vector<wchar_t> outputValueName(MaximumValueNameInChars, 0); std::vector<wchar_t> outputBuffer(MAX_PATH + 1, 0); DWORD bytesRequired = MAX_PATH; - forever { + for (;;) { DWORD requiredValueNameChars = MaximumValueNameInChars; const LONG ret = ::RegEnumValue(hKey, index, &outputValueName[0], &requiredValueNameChars, Q_NULLPTR, Q_NULLPTR, reinterpret_cast<PBYTE>(&outputBuffer[0]), &bytesRequired); @@ -103,7 +103,7 @@ static QString deviceRegistryProperty(HDEVINFO deviceInfoSet, DWORD dataType = 0; std::vector<wchar_t> outputBuffer(MAX_PATH + 1, 0); DWORD bytesRequired = MAX_PATH; - forever { + for (;;) { if (::SetupDiGetDeviceRegistryProperty(deviceInfoSet, deviceInfoData, property, &dataType, reinterpret_cast<PBYTE>(&outputBuffer[0]), bytesRequired, &bytesRequired)) { @@ -158,14 +158,14 @@ static QString devicePortName(HDEVINFO deviceInfoSet, PSP_DEVINFO_DATA deviceInf L"PortNumber\0" }; - static const int keyTokensCount = sizeof(keyTokens) / sizeof(keyTokens[0]); + enum { KeyTokensCount = sizeof(keyTokens) / sizeof(keyTokens[0]) }; QString portName; - for (int i = 0; i < keyTokensCount; ++i) { + for (int i = 0; i < KeyTokensCount; ++i) { DWORD dataType = 0; std::vector<wchar_t> outputBuffer(MAX_PATH + 1, 0); DWORD bytesRequired = MAX_PATH; - forever { + for (;;) { const LONG ret = ::RegQueryValueEx(key, keyTokens[i], Q_NULLPTR, &dataType, reinterpret_cast<PBYTE>(&outputBuffer[0]), &bytesRequired); if (ret == ERROR_MORE_DATA) { @@ -273,7 +273,7 @@ static QString parseDeviceSerialNumber(const QString &instanceIdentifier) static QString deviceSerialNumber(QString instanceIdentifier, DEVINST deviceInstanceNumber) { - forever { + for (;;) { const QString result = parseDeviceSerialNumber(instanceIdentifier); if (!result.isEmpty()) return result; @@ -299,11 +299,11 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts() { GUID_DEVINTERFACE_MODEM, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE } }; - static const int setupTokensCount = sizeof(setupTokens) / sizeof(setupTokens[0]); + enum { SetupTokensCount = sizeof(setupTokens) / sizeof(setupTokens[0]) }; QList<QSerialPortInfo> serialPortInfoList; - for (int i = 0; i < setupTokensCount; ++i) { + for (int i = 0; i < SetupTokensCount; ++i) { const HDEVINFO deviceInfoSet = ::SetupDiGetClassDevs(&setupTokens[i].guid, Q_NULLPTR, Q_NULLPTR, setupTokens[i].flags); if (deviceInfoSet == INVALID_HANDLE_VALUE) return serialPortInfoList; |