summaryrefslogtreecommitdiffstats
path: root/src/serialport/qserialportinfo_win.cpp
diff options
context:
space:
mode:
authorDebao Zhang <hello@debao.me>2015-03-26 15:41:50 +0800
committerDebao Zhang <hello@debao.me>2015-03-27 00:44:51 +0000
commit7f857db22e0d409aac65e4773bb377796893b624 (patch)
treee342b63a8d03aa030e68e2fbd7d92255a3cd4e8e /src/serialport/qserialportinfo_win.cpp
parent687dfa9312c1ef4894c32a1966b8ac968110b71e (diff)
Don't use QStringLiteral when QLatin1String is efficient.
For QLatin1String, startsWith/endsWith/append/operator==/... are overloaded, so use QLatin1String instead of QStringLiteral in such cases. Change-Id: Id040697480b7b7f195a2b83bb85ba7e0199d38e3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Diffstat (limited to 'src/serialport/qserialportinfo_win.cpp')
-rw-r--r--src/serialport/qserialportinfo_win.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/serialport/qserialportinfo_win.cpp b/src/serialport/qserialportinfo_win.cpp
index df0942fc..546d5e18 100644
--- a/src/serialport/qserialportinfo_win.cpp
+++ b/src/serialport/qserialportinfo_win.cpp
@@ -258,13 +258,13 @@ static QString parseDeviceSerialNumber(const QString &instanceIdentifier)
{
int firstbound = instanceIdentifier.lastIndexOf(QLatin1Char('\\'));
int lastbound = instanceIdentifier.indexOf(QLatin1Char('_'), firstbound);
- if (instanceIdentifier.startsWith(QStringLiteral("USB\\"))) {
+ if (instanceIdentifier.startsWith(QLatin1String("USB\\"))) {
if (lastbound != instanceIdentifier.size() - 3)
lastbound = instanceIdentifier.size();
int ampersand = instanceIdentifier.indexOf(QLatin1Char('&'), firstbound);
if (ampersand != -1 && ampersand < lastbound)
return QString();
- } else if (instanceIdentifier.startsWith(QStringLiteral("FTDIBUS\\"))) {
+ } else if (instanceIdentifier.startsWith(QLatin1String("FTDIBUS\\"))) {
firstbound = instanceIdentifier.lastIndexOf(QLatin1Char('+'));
lastbound = instanceIdentifier.indexOf(QLatin1Char('\\'), firstbound);
if (lastbound == -1)
@@ -304,7 +304,7 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
DWORD index = 0;
while (::SetupDiEnumDeviceInfo(deviceInfoSet, index++, &deviceInfoData)) {
const QString portName = devicePortName(deviceInfoSet, &deviceInfoData);
- if (portName.isEmpty() || portName.contains(QStringLiteral("LPT")))
+ if (portName.isEmpty() || portName.contains(QLatin1String("LPT")))
continue;
if (std::find_if(serialPortInfoList.begin(), serialPortInfoList.end(),
@@ -381,14 +381,14 @@ bool QSerialPortInfo::isValid() const
QString QSerialPortInfoPrivate::portNameToSystemLocation(const QString &source)
{
- return source.startsWith(QStringLiteral("COM"))
- ? (QStringLiteral("\\\\.\\") + source) : source;
+ return source.startsWith(QLatin1String("COM"))
+ ? (QLatin1String("\\\\.\\") + source) : source;
}
QString QSerialPortInfoPrivate::portNameFromSystemLocation(const QString &source)
{
- return (source.startsWith(QStringLiteral("\\\\.\\"))
- || source.startsWith(QStringLiteral("//./")))
+ return (source.startsWith(QLatin1String("\\\\.\\"))
+ || source.startsWith(QLatin1String("//./")))
? source.mid(4) : source;
}