diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2021-05-02 17:50:05 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2021-05-02 18:09:09 +0000 |
commit | 1780fb2a237af80ddc1f9cfb70cb892b53b91990 (patch) | |
tree | 889e7adf0ec8d513d75e30a5e7ad939e149ba345 /src/kconf_update/kconfigutils.cpp | |
parent | 1164ef55e93b4171306899ab786bfd0acaa00847 (diff) | |
download | kconfig-1780fb2a237af80ddc1f9cfb70cb892b53b91990.tar.gz kconfig-1780fb2a237af80ddc1f9cfb70cb892b53b91990.tar.bz2 |
Minor code refactoring
Some methods in ConfigLoaderHandler always returned true, change them to return
void instead. Also port them to take a QStringView instead of QStringRef, this
doesn't require a lot of changes because a QStringView can be constructed from
a QStringRef.
QXmlStreamAttribute methods like value() and name() return QStringRef in Qt5
and QStringView in Qt6, "fix" the issue by using auto keyword, which works
in both cases.
QStringView::toInt() isn't efficient in Qt5 so make the build conditional.
NO_CHANGELOG
Diffstat (limited to 'src/kconf_update/kconfigutils.cpp')
-rw-r--r-- | src/kconf_update/kconfigutils.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/kconf_update/kconfigutils.cpp b/src/kconf_update/kconfigutils.cpp index 49d5ac3c..9608f21c 100644 --- a/src/kconf_update/kconfigutils.cpp +++ b/src/kconf_update/kconfigutils.cpp @@ -89,7 +89,11 @@ QString unescapeString(const QString &src, bool *ok, QString *error) break; case L'x': { if (pos + 2 < length) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + char value = QStringView(src).mid(pos + 1, 2).toInt(ok, 16); +#else char value = src.midRef(pos + 1, 2).toInt(ok, 16); +#endif if (*ok) { dst += QLatin1Char{value}; pos += 2; |