diff options
author | Andre Hartmann <aha_1980@gmx.de> | 2021-07-21 20:07:30 +0200 |
---|---|---|
committer | Andre Hartmann <aha_1980@gmx.de> | 2021-07-23 09:58:05 +0200 |
commit | 98691947d1aa6fb3ab63c7b749bc6407fa01be8a (patch) | |
tree | 87df742ff3539404283d3ea388fcb6568afefef2 /src/plugins/canbus/systeccan/systeccanbackend.cpp | |
parent | 8199ed388753dda6239a597fb4bb7acba664f73e (diff) |
QCanBusDevice: Consolidate createDeviceInfo()
This protected function is used from the CAN
plugins to create QCanBusDeviceInfo objects.
We want to add another parameter (plugin) to the
function in a follow-up commit, so let's first
remove unneeded overloads that were created during
Qt 5 times and only keep the very simple and the
all-embracing one.
While at it, remove the std::move calls as clang
gives performance warnings here:
socketcanbackend.cpp:149:23: error:
moving a temporary object prevents copy elision
socketcanbackend.cpp:149:23: note:
remove std::move call here
Pick-to: 6.2
Change-Id: Ie83db3cd3a9d6b40b2da4a9ce736861a0ee8359f
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/plugins/canbus/systeccan/systeccanbackend.cpp')
-rw-r--r-- | src/plugins/canbus/systeccan/systeccanbackend.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/canbus/systeccan/systeccanbackend.cpp b/src/plugins/canbus/systeccan/systeccanbackend.cpp index c5d8951..4daf48d 100644 --- a/src/plugins/canbus/systeccan/systeccanbackend.cpp +++ b/src/plugins/canbus/systeccan/systeccanbackend.cpp @@ -69,7 +69,8 @@ QCanBusDeviceInfo SystecCanBackend::createDeviceInfo(const QString &serialNumber int channelNumber) { const QString name = QString::fromLatin1("can%1.%2").arg(deviceNumber).arg(channelNumber); - return QCanBusDevice::createDeviceInfo(name, serialNumber, description, channelNumber, false, false); + return QCanBusDevice::createDeviceInfo(name, serialNumber, description, + QString(), channelNumber, false, false); } static QString descriptionString(uint productCode) @@ -100,11 +101,11 @@ static void DRV_CALLBACK_TYPE ucanEnumCallback(DWORD index, BOOL isUsed, const QString serialNumber = QString::number(hardwareInfo->m_dwSerialNr); const QString description = descriptionString(hardwareInfo->m_dwProductCode); - result->append(std::move(SystecCanBackend::createDeviceInfo(serialNumber, description, - hardwareInfo->m_bDeviceNr, 0))); + result->append(SystecCanBackend::createDeviceInfo(serialNumber, description, + hardwareInfo->m_bDeviceNr, 0)); if (USBCAN_CHECK_SUPPORT_TWO_CHANNEL(hardwareInfo)) { - result->append(std::move(SystecCanBackend::createDeviceInfo(serialNumber, description, - hardwareInfo->m_bDeviceNr, 1))); + result->append(SystecCanBackend::createDeviceInfo(serialNumber, description, + hardwareInfo->m_bDeviceNr, 1)); } initInfo->m_fTryNext = true; // continue enumerating with next device |