diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2022-03-20 10:52:52 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2022-03-20 20:12:20 +0100 |
commit | 04e22d8719dabb33de38eea5cdf4199d147b7b28 (patch) | |
tree | 551c0b41729d3f72b0eaa5c135224635bfcdb416 /utils/rbutilqt/base/system.cpp | |
parent | 01d2979bcef719734f6d8f061c539be9e830a110 (diff) | |
download | rockbox-04e22d8719dabb33de38eea5cdf4199d147b7b28.tar.gz rockbox-04e22d8719dabb33de38eea5cdf4199d147b7b28.zip |
rbutil: Replace use of QRegExp with QRegularExpression.
Change-Id: Ie89057a9857bc66612cb15fef81d3ca6c3e71b4c
Diffstat (limited to 'utils/rbutilqt/base/system.cpp')
-rw-r--r-- | utils/rbutilqt/base/system.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/utils/rbutilqt/base/system.cpp b/utils/rbutilqt/base/system.cpp index a1d3d1165d..0ec1a9d424 100644 --- a/utils/rbutilqt/base/system.cpp +++ b/utils/rbutilqt/base/system.cpp | |||
@@ -418,10 +418,11 @@ QMultiMap<uint32_t, QString> System::listUsbDevices(void) | |||
418 | // the keys (W7 uses different casing than XP at least), in addition | 418 | // the keys (W7 uses different casing than XP at least), in addition |
419 | // XP may use "Vid_" and "Pid_". | 419 | // XP may use "Vid_" and "Pid_". |
420 | QString data = QString::fromWCharArray(buffer).toUpper(); | 420 | QString data = QString::fromWCharArray(buffer).toUpper(); |
421 | QRegExp rex("USB\\\\VID_([0-9A-F]{4})&PID_([0-9A-F]{4}).*"); | 421 | QRegularExpression regex("^USB\\\\VID_([0-9A-F]{4})&PID_([0-9A-F]{4})&REV_([0-9A-F]{4})$"); |
422 | if(rex.indexIn(data) >= 0) { | 422 | QRegularExpressionMatch match = regex.match(data); |
423 | if(match.hasMatch()) { | ||
423 | uint32_t id; | 424 | uint32_t id; |
424 | id = rex.cap(1).toUInt(0, 16) << 16 | rex.cap(2).toUInt(0, 16); | 425 | id = match.captured(1).toUInt(0, 16) << 16 | match.captured(2).toUInt(0, 16); |
425 | usbids.insert(id, description); | 426 | usbids.insert(id, description); |
426 | LOG_INFO() << "USB:" << QString("0x%1").arg(id, 8, 16); | 427 | LOG_INFO() << "USB:" << QString("0x%1").arg(id, 8, 16); |
427 | } | 428 | } |