forked from len0rd/rockbox
rbutil: Replace use of QRegExp with QRegularExpression.
Change-Id: Ie89057a9857bc66612cb15fef81d3ca6c3e71b4c
This commit is contained in:
parent
01d2979bce
commit
04e22d8719
3 changed files with 11 additions and 11 deletions
|
@ -418,10 +418,11 @@ QMultiMap<uint32_t, QString> System::listUsbDevices(void)
|
||||||
// the keys (W7 uses different casing than XP at least), in addition
|
// the keys (W7 uses different casing than XP at least), in addition
|
||||||
// XP may use "Vid_" and "Pid_".
|
// XP may use "Vid_" and "Pid_".
|
||||||
QString data = QString::fromWCharArray(buffer).toUpper();
|
QString data = QString::fromWCharArray(buffer).toUpper();
|
||||||
QRegExp rex("USB\\\\VID_([0-9A-F]{4})&PID_([0-9A-F]{4}).*");
|
QRegularExpression regex("^USB\\\\VID_([0-9A-F]{4})&PID_([0-9A-F]{4})&REV_([0-9A-F]{4})$");
|
||||||
if(rex.indexIn(data) >= 0) {
|
QRegularExpressionMatch match = regex.match(data);
|
||||||
|
if(match.hasMatch()) {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
id = rex.cap(1).toUInt(0, 16) << 16 | rex.cap(2).toUInt(0, 16);
|
id = match.captured(1).toUInt(0, 16) << 16 | match.captured(2).toUInt(0, 16);
|
||||||
usbids.insert(id, description);
|
usbids.insert(id, description);
|
||||||
LOG_INFO() << "USB:" << QString("0x%1").arg(id, 8, 16);
|
LOG_INFO() << "USB:" << QString("0x%1").arg(id, 8, 16);
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,9 +177,9 @@ bool TalkFileCreator::createTalkList(QDir startDir)
|
||||||
bool match = false;
|
bool match = false;
|
||||||
for(int i=0; i < m_ignoreFiles.size();i++)
|
for(int i=0; i < m_ignoreFiles.size();i++)
|
||||||
{
|
{
|
||||||
QRegularExpression rx(
|
QString pattern = m_ignoreFiles[i].trimmed()
|
||||||
QRegularExpression::wildcardToRegularExpression(
|
.replace("?", ".").replace("*", ".*");
|
||||||
(m_ignoreFiles[i].trimmed())));
|
QRegularExpression rx(pattern);
|
||||||
if(rx.match(fileInf.fileName()).hasMatch())
|
if(rx.match(fileInf.fileName()).hasMatch())
|
||||||
match = true;
|
match = true;
|
||||||
|
|
||||||
|
|
|
@ -662,13 +662,12 @@ void RbUtilQt::downloadUpdateDone(QNetworkReply::NetworkError error)
|
||||||
else {
|
else {
|
||||||
QString toParse(update->readAll());
|
QString toParse(update->readAll());
|
||||||
|
|
||||||
QRegExp searchString("<a[^>]*>([a-zA-Z]+[^<]*)</a>");
|
QRegularExpression searchString("<a[^>]*>([a-zA-Z]+[^<]*)</a>");
|
||||||
QStringList rbutilList;
|
QStringList rbutilList;
|
||||||
int pos = 0;
|
auto it = searchString.globalMatch(toParse);
|
||||||
while ((pos = searchString.indexIn(toParse, pos)) != -1)
|
while (it.hasNext())
|
||||||
{
|
{
|
||||||
rbutilList << searchString.cap(1);
|
rbutilList << it.next().captured(1);
|
||||||
pos += searchString.matchedLength();
|
|
||||||
}
|
}
|
||||||
LOG_INFO() << "Checking for update";
|
LOG_INFO() << "Checking for update";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue