summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2017-06-08 09:55:41 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2017-06-12 19:51:07 +0000
commit50d1b99a89ed65d80a60a8d2f1c91c5ab4b80371 (patch)
tree79fcbcdf5fdc4bb9ad0ccf0a0039379110b2767c /src
parentc38583ec73e8490b6373e9ac42503d41b4f28665 (diff)
Get rid of QList in favor to QVector where possible
Change-Id: I872e7d6bc4371beed0b80eb1ebb374d2c48c9167 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp
index 7f0fe728..108f41a6 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp
@@ -48,13 +48,11 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINDOWS)
struct LeDeviceEntry {
- LeDeviceEntry(const QString &path, const QBluetoothAddress &address)
- : devicePath(path), deviceAddress(address) {}
QString devicePath;
QBluetoothAddress deviceAddress;
};
-Q_GLOBAL_STATIC(QList<LeDeviceEntry>, cachedLeDeviceEntries)
+Q_GLOBAL_STATIC(QVector<LeDeviceEntry>, cachedLeDeviceEntries)
Q_GLOBAL_STATIC(QMutex, cachedLeDeviceEntriesGuard)
static QString devicePropertyString(
@@ -180,7 +178,7 @@ static void closeClassicSearch(HBLUETOOTH_DEVICE_FIND *hSearch)
}
}
-static QList<QBluetoothDeviceInfo> enumerateLeDevices(
+static QVector<QBluetoothDeviceInfo> enumerateLeDevices(
int *systemErrorCode)
{
const QUuid deviceInterfaceGuid("781aee18-7733-4ce4-add0-91f41c67b592");
@@ -192,13 +190,13 @@ static QList<QBluetoothDeviceInfo> enumerateLeDevices(
if (hDeviceInfo == INVALID_HANDLE_VALUE) {
*systemErrorCode = ::GetLastError();
- return QList<QBluetoothDeviceInfo>();
+ return QVector<QBluetoothDeviceInfo>();
}
- QList<QBluetoothDeviceInfo> foundDevices;
+ QVector<QBluetoothDeviceInfo> foundDevices;
DWORD index = 0;
- QList<LeDeviceEntry> cachedEntries;
+ QVector<LeDeviceEntry> cachedEntries;
for (;;) {
SP_DEVICE_INTERFACE_DATA deviceInterfaceData;
@@ -265,7 +263,7 @@ static QList<QBluetoothDeviceInfo> enumerateLeDevices(
deviceInfo.setCached(true);
foundDevices << deviceInfo;
- cachedEntries << LeDeviceEntry(systemPath, address);
+ cachedEntries << LeDeviceEntry{systemPath, address};
}
QMutexLocker locker(cachedLeDeviceEntriesGuard());
@@ -406,7 +404,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::taskFinished()
if (systemErrorCode == ERROR_NO_MORE_ITEMS) {
closeClassicSearch(&hSearch);
// Enumerate LE devices.
- const QList<QBluetoothDeviceInfo> foundDevices = enumerateLeDevices(&systemErrorCode);
+ const QVector<QBluetoothDeviceInfo> foundDevices = enumerateLeDevices(&systemErrorCode);
if (systemErrorCode == ERROR_NO_MORE_ITEMS) {
for (const QBluetoothDeviceInfo &foundDevice : foundDevices)
processDiscoveredDevice(foundDevice);