From 44fae61d4f128adf08d524480efc38513cfa9c3e Mon Sep 17 00:00:00 2001 From: Caio Carvalho Date: Tue, 9 Jan 2018 19:34:20 -0300 Subject: [PATCH] - Removing libatasmart dependency from CMakeLists.txt - Changing getQuirk regular expression evaluation to use QRegularExpression instead of QRegExp --- CMakeLists.txt | 1 - src/core/smartattributeparseddata.cpp | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f863a7..4d58521 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,7 +79,6 @@ kde_enable_exceptions() find_package(PkgConfig REQUIRED) pkg_check_modules(BLKID REQUIRED blkid>=2.30) -pkg_check_modules(LIBATASMART REQUIRED libatasmart) include_directories(${Qt5Core_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} ${BLKID_INCLUDE_DIRS} lib/ src/) diff --git a/src/core/smartattributeparseddata.cpp b/src/core/smartattributeparseddata.cpp index 3b21ccd..f793338 100644 --- a/src/core/smartattributeparseddata.cpp +++ b/src/core/smartattributeparseddata.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #define MKELVIN_VALID_MIN ((qint64) ((-15LL*1000LL) + 273150LL)) @@ -632,18 +632,20 @@ static SmartAttributeParsedData::SmartQuirk getQuirk(QString model, QString firm { const SmartAttributeParsedData::SmartQuirkDataBase *db; - QRegExp modelRegex; - QRegExp firmwareRegex; + QRegularExpression modelRegex; + QRegularExpression firmwareRegex; for (db = quirkDatabase(); db->model || db->firmware; db++) { if (db->model) { modelRegex.setPattern(QString::fromLocal8Bit(db->model)); - if (!modelRegex.exactMatch(model)) + QRegularExpressionMatch match = modelRegex.match(model); + if (!match.hasMatch()) continue; } if (db->firmware) { firmwareRegex.setPattern(QString::fromLocal8Bit(db->firmware)); - if (!firmwareRegex.exactMatch(firmware)) + QRegularExpressionMatch match = firmwareRegex.match(firmware); + if (!match.hasMatch()) continue; } return db->quirk;