aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-01-17 20:25:44 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2020-01-17 21:27:00 +0200
commitcb30cee7a065a074394347f112451decc4847674 (patch)
tree25f0ef36bb776a5e1938232e132b0a464fd5a9bc
parentMerge branch 'firefox-bookmarks-json-importer' (diff)
downloadsmolbote-cb30cee7a065a074394347f112451decc4847674.tar.xz
Fix various gcc and clazy compile warnings
-rw-r--r--lib/about/aboutplugin.cpp16
-rw-r--r--lib/bookmarks/formats/xbel.cpp2
-rw-r--r--lib/pluginloader/pluginloader.cpp4
-rw-r--r--lib/pluginloader/pluginloader.h4
-rw-r--r--lib/urlfilter/adblock/adblocklist.cpp44
-rw-r--r--lib/urlfilter/adblock/parser.cpp26
-rw-r--r--lib/urlfilter/hostlist/hostlist.cpp8
-rw-r--r--src/browser.cpp10
-rw-r--r--src/browser.h2
-rw-r--r--src/crashhandler.h8
-rw-r--r--src/crashhandler_dummy.cpp16
-rw-r--r--src/mainwindow/menubar.cpp2
-rw-r--r--src/meson.build7
-rw-r--r--src/util.cpp2
-rw-r--r--src/webengine/urlinterceptor.cpp4
-rw-r--r--src/webengine/webprofilemanager.cpp4
-rw-r--r--test/firefox-bookmarks-json-parser/meson.build10
17 files changed, 88 insertions, 81 deletions
diff --git a/lib/about/aboutplugin.cpp b/lib/about/aboutplugin.cpp
index b345b75..99c04ec 100644
--- a/lib/about/aboutplugin.cpp
+++ b/lib/about/aboutplugin.cpp
@@ -13,11 +13,11 @@
QTreeWidgetItem *createItem(const QString &key, const QJsonValue &json, QTreeWidgetItem *parent)
{
- auto *item = new QTreeWidgetItem(parent, { key, QLatin1Literal("---") });
+ auto *item = new QTreeWidgetItem(parent, { key, QLatin1String("---") });
switch(json.type()) {
case QJsonValue::Bool:
- item->setText(1, json.toBool() ? QLatin1Literal("true") : QLatin1Literal("false"));
+ item->setText(1, json.toBool() ? QLatin1String("true") : QLatin1String("false"));
break;
case QJsonValue::Double:
@@ -43,11 +43,11 @@ QTreeWidgetItem *createItem(const QString &key, const QJsonValue &json, QTreeWid
break;
case QJsonValue::Null:
- item->setText(1, QLatin1Literal("null"));
+ item->setText(1, QLatin1String("null"));
break;
case QJsonValue::Undefined:
- item->setText(1, QLatin1Literal("undefined"));
+ item->setText(1, QLatin1String("undefined"));
break;
}
@@ -92,10 +92,10 @@ AboutPluginDialog::AboutPluginDialog(QPluginLoader *loader, QWidget *parent)
}
});
- ui->name->setText(metaData[QLatin1Literal("name")].toString());
- ui->author->setText(metaData[QLatin1Literal("author")].toString());
- ui->license->setText(metaData[QLatin1Literal("license")].toString());
- ui->shortcut->setText(metaData[QLatin1Literal("shortcut")].toString());
+ ui->name->setText(metaData[QLatin1String("name")].toString());
+ ui->author->setText(metaData[QLatin1String("author")].toString());
+ ui->license->setText(metaData[QLatin1String("license")].toString());
+ ui->shortcut->setText(metaData[QLatin1String("shortcut")].toString());
for(const QString &key : loader->metaData().keys()) {
auto *i = createItem(key, loader->metaData()[key], nullptr);
diff --git a/lib/bookmarks/formats/xbel.cpp b/lib/bookmarks/formats/xbel.cpp
index bac2bc8..7ff79a9 100644
--- a/lib/bookmarks/formats/xbel.cpp
+++ b/lib/bookmarks/formats/xbel.cpp
@@ -32,7 +32,7 @@ inline void readChildElements(QXmlStreamReader &reader, BookmarkItem *parent)
} else if(reader.name() == "folder") {
auto *item = new BookmarkItem({}, BookmarkItem::Folder, parent);
- item->setExpanded(!(reader.attributes().value("folded") == QLatin1Literal("yes")));
+ item->setExpanded(!(reader.attributes().value("folded") == QLatin1String("yes")));
parent->appendChild(item);
readChildElements(reader, item);
diff --git a/lib/pluginloader/pluginloader.cpp b/lib/pluginloader/pluginloader.cpp
index ef17513..c8358bf 100644
--- a/lib/pluginloader/pluginloader.cpp
+++ b/lib/pluginloader/pluginloader.cpp
@@ -49,7 +49,7 @@ PluginLoader::VerifyState PluginLoader::verify(const char *hashName) const
int read = 0;
auto *buf = new unsigned char[1024];
while(len > 0) {
- read = plugin.read((char*) buf, 1024);
+ read = plugin.read(reinterpret_cast<char*>(buf), 1024);
len -= read;
rc = EVP_DigestVerifyUpdate(ctx, buf, read);
@@ -65,7 +65,7 @@ PluginLoader::VerifyState PluginLoader::verify(const char *hashName) const
const int sig_len = sigFile.size();
const auto* sig = [&sigFile, sig_len]() {
auto* buf = new unsigned char[sig_len];
- sigFile.read((char*) buf, sig_len);
+ sigFile.read(reinterpret_cast<char*>(buf), sig_len);
return buf;
}();
sigFile.close();
diff --git a/lib/pluginloader/pluginloader.h b/lib/pluginloader/pluginloader.h
index 0c8bcd3..48be61d 100644
--- a/lib/pluginloader/pluginloader.h
+++ b/lib/pluginloader/pluginloader.h
@@ -40,7 +40,9 @@ public:
QString errorString() const
{
if(signature < requiredSignatureLevel)
- return QString("Required signature level: %2; Signature level: %3").arg(QString::number((int) requiredSignatureLevel), QString::number((int) signature));
+ return QString("Required signature level: %2; Signature level: %3").arg(
+ QString::number(static_cast<int>(requiredSignatureLevel)),
+ QString::number(static_cast<int>(signature)));
else
return QPluginLoader::errorString();
}
diff --git a/lib/urlfilter/adblock/adblocklist.cpp b/lib/urlfilter/adblock/adblocklist.cpp
index c749e9e..3be21bd 100644
--- a/lib/urlfilter/adblock/adblocklist.cpp
+++ b/lib/urlfilter/adblock/adblocklist.cpp
@@ -71,7 +71,7 @@ void AdBlockList::parseLine(const QString& line)
if(parsedLine.isEmpty())
return;
- if(parsedLine.startsWith(QLatin1Literal("!"))) {
+ if(parsedLine.startsWith(QLatin1String("!"))) {
const auto comment = parseComment(parsedLine);
if(comment) {
@@ -84,7 +84,7 @@ void AdBlockList::parseLine(const QString& line)
}
// css rule -> filterleaves cannot do element blocking
- if(parsedLine.contains(QLatin1Literal("##")) || parsedLine.contains(QLatin1Literal("#@#"))) {
+ if(parsedLine.contains(QLatin1String("##")) || parsedLine.contains(QLatin1String("#@#"))) {
qDebug("TODO: %s", qUtf8Printable(parsedLine));
return;
}
@@ -93,7 +93,7 @@ void AdBlockList::parseLine(const QString& line)
r.action = UrlFilter::Block;
// exception rules
- if(parsedLine.startsWith(QLatin1Literal("@@"))) {
+ if(parsedLine.startsWith(QLatin1String("@@"))) {
r.action = UrlFilter::Allow;
parsedLine.remove(0, 2);
}
@@ -102,24 +102,24 @@ void AdBlockList::parseLine(const QString& line)
// parse options
{
- const int sepPos = parsedLine.indexOf(QLatin1Literal("$"));
+ const int sepPos = parsedLine.indexOf(QLatin1String("$"));
if(sepPos != -1) {
- const auto options = parsedLine.mid(sepPos + 1).split(QLatin1Literal(","));
+ const auto options = parsedLine.mid(sepPos + 1).split(QLatin1String(","));
parsedLine = parsedLine.mid(0, sepPos);
for(const QString &option : options) {
- if(option.startsWith(QLatin1Literal("domain"))) {
- const auto domainList = option.mid(7).split(QLatin1Literal("|"));
+ if(option.startsWith(QLatin1String("domain"))) {
+ const auto domainList = option.mid(7).split(QLatin1String("|"));
for(const QString &domain : domainList) {
- if(domain.startsWith(QLatin1Literal("~"))) {
+ if(domain.startsWith(QLatin1String("~"))) {
r.disabledOn.append(domain.mid(1));
} else {
r.enabledOn.append(domain);
}
}
- } else if(option.endsWith(QLatin1Literal("match-case"))) {
- matchCase = !option.startsWith(QLatin1Literal("~"));
+ } else if(option.endsWith(QLatin1String("match-case"))) {
+ matchCase = !option.startsWith(QLatin1String("~"));
} else {
const auto pair = parseResourceOption(option);
@@ -130,26 +130,26 @@ void AdBlockList::parseLine(const QString& line)
}
}
- if(parsedLine.startsWith(QLatin1Literal("/")) && parsedLine.endsWith(QLatin1Literal("/"))) {
+ if(parsedLine.startsWith(QLatin1String("/")) && parsedLine.endsWith(QLatin1String("/"))) {
// regular expression rule
parsedLine = parsedLine.mid(1, parsedLine.length() - 2);
r.matcher = new ContentsMatcher<QRegularExpression>(parsedLine, UrlFilter::RegularExpressionMatch);
- } else if(parsedLine.startsWith(QLatin1Literal("||")) && parsedLine.endsWith(QLatin1Literal("^"))) {
+ } else if(parsedLine.startsWith(QLatin1String("||")) && parsedLine.endsWith(QLatin1String("^"))) {
parsedLine = parsedLine.mid(2, parsedLine.length() - 3);
r.matcher = new ContentsMatcher<QString>(parsedLine, UrlFilter::DomainMatch);
- } else if(parsedLine.startsWith(QLatin1Literal("|")) && parsedLine.endsWith(QLatin1Literal("|"))) {
+ } else if(parsedLine.startsWith(QLatin1String("|")) && parsedLine.endsWith(QLatin1String("|"))) {
// string equals rule
parsedLine = parsedLine.mid(1, parsedLine.length() - 2);
r.matcher = new ContentsMatcher<QStringMatcher>(parsedLine, UrlFilter::StringEquals);
- } else if(parsedLine.startsWith(QLatin1Literal("||"))) {
+ } else if(parsedLine.startsWith(QLatin1String("||"))) {
// string starts with rule
parsedLine = parsedLine.mid(2);
r.matcher = new ContentsMatcher<QStringMatcher>(parsedLine, UrlFilter::StringStartsWith);
- } else if(parsedLine.endsWith(QLatin1Literal("|"))) {
+ } else if(parsedLine.endsWith(QLatin1String("|"))) {
// string ends with rule
parsedLine.chop(1);
r.matcher = new ContentsMatcher<QStringMatcher>(parsedLine, UrlFilter::StringEndsWith);
@@ -158,20 +158,20 @@ void AdBlockList::parseLine(const QString& line)
// generic contains rule
// remove beginning and ending wildcards
- if(parsedLine.startsWith(QLatin1Literal("*")))
+ if(parsedLine.startsWith(QLatin1String("*")))
parsedLine = parsedLine.mid(1);
- if(parsedLine.endsWith(QLatin1Literal("*")))
+ if(parsedLine.endsWith(QLatin1String("*")))
parsedLine.chop(1);
- if(parsedLine.contains(QLatin1Literal("*")) || parsedLine.contains(QLatin1Literal("^"))) {
+ if(parsedLine.contains(QLatin1String("*")) || parsedLine.contains(QLatin1String("^"))) {
// check for wildcards and translate to regexp
// wildcard "*" - any number of characters
// separator "^" - end, ? or /
- parsedLine.replace(QLatin1Literal("||"), QLatin1Literal("^\\w+://"));
- parsedLine.replace(QLatin1Literal("|"), QLatin1Literal("\\|"));
- parsedLine.replace(QLatin1Literal("*"), QLatin1Literal(".*"));
- parsedLine.replace(QLatin1Literal("^"), QLatin1Literal("($|\\?|\\/)"));
+ parsedLine.replace(QLatin1String("||"), QLatin1String("^\\w+://"));
+ parsedLine.replace(QLatin1String("|"), QLatin1String("\\|"));
+ parsedLine.replace(QLatin1String("*"), QLatin1String(".*"));
+ parsedLine.replace(QLatin1String("^"), QLatin1String("($|\\?|\\/)"));
r.matcher = new ContentsMatcher<QRegularExpression>(parsedLine, UrlFilter::RegularExpressionMatch);
diff --git a/lib/urlfilter/adblock/parser.cpp b/lib/urlfilter/adblock/parser.cpp
index d65a2e4..68f895d 100644
--- a/lib/urlfilter/adblock/parser.cpp
+++ b/lib/urlfilter/adblock/parser.cpp
@@ -20,53 +20,53 @@ std::optional<std::pair<QString, QString>> parseComment(QString &line)
std::optional<std::pair<QWebEngineUrlRequestInfo::ResourceType, bool>> parseResourceOption(const QString &option)
{
- const bool exception = !option.startsWith(QLatin1Literal("~"));
+ const bool exception = !option.startsWith(QLatin1String("~"));
- if(option.endsWith(QLatin1Literal("script"))) {
+ if(option.endsWith(QLatin1String("script"))) {
// external scripts loaded via HTML script tag
return std::make_pair(QWebEngineUrlRequestInfo::ResourceTypeScript, exception);
- } else if(option.endsWith(QLatin1Literal("image"))) {
+ } else if(option.endsWith(QLatin1String("image"))) {
// regular images, typically loaded via HTML img tag
return std::make_pair(QWebEngineUrlRequestInfo::ResourceTypeImage, exception);
- } else if(option.endsWith(QLatin1Literal("stylesheet"))) {
+ } else if(option.endsWith(QLatin1String("stylesheet"))) {
// external CSS stylesheet files
return std::make_pair(QWebEngineUrlRequestInfo::ResourceTypeStylesheet, exception);
- } else if(option.endsWith(QLatin1Literal("object"))) {
+ } else if(option.endsWith(QLatin1String("object"))) {
// content handled by browser plugins, e.g. Flash or Java
return std::make_pair(QWebEngineUrlRequestInfo::ResourceTypeObject, exception);
- } else if(option.endsWith(QLatin1Literal("xmlhttprequest"))) {
+ } else if(option.endsWith(QLatin1String("xmlhttprequest"))) {
// requests started using the XMLHttpRequest object or fetch() API
return std::make_pair(QWebEngineUrlRequestInfo::ResourceTypeXhr, exception);
- } else if(option.endsWith(QLatin1Literal("object-subrequest"))) {
+ } else if(option.endsWith(QLatin1String("object-subrequest"))) {
// requests started by plugins like Flash
return std::make_pair(QWebEngineUrlRequestInfo::ResourceTypePluginResource, exception);
- } else if(option.endsWith(QLatin1Literal("subdocument"))) {
+ } else if(option.endsWith(QLatin1String("subdocument"))) {
// embedded pages, usually included via HTML frames
return std::make_pair(QWebEngineUrlRequestInfo::ResourceTypeSubFrame, exception);
- } else if(option.endsWith(QLatin1Literal("ping"))) {
+ } else if(option.endsWith(QLatin1String("ping"))) {
// requests started by <a ping> or navigator.sendBeacon()
return std::make_pair(QWebEngineUrlRequestInfo::ResourceTypePing, exception);
- } else if(option.endsWith(QLatin1Literal("websocket"))) {
+ } else if(option.endsWith(QLatin1String("websocket"))) {
// requests initiated via WebSocket object
qDebug("Resource type 'websocket' not available");
- } else if(option.endsWith(QLatin1Literal("webrtc"))) {
+ } else if(option.endsWith(QLatin1String("webrtc"))) {
// connections opened via RTCPeerConnection instances to ICE servers
qDebug("Resource type 'webrtc' not available");
- } else if(option.endsWith(QLatin1Literal("document"))) {
+ } else if(option.endsWith(QLatin1String("document"))) {
// the page itself
return std::make_pair(QWebEngineUrlRequestInfo::ResourceTypeMainFrame, exception);
- } else if(option.endsWith(QLatin1Literal("other"))) {
+ } else if(option.endsWith(QLatin1String("other"))) {
return std::make_pair(QWebEngineUrlRequestInfo::ResourceTypeUnknown, exception);
}
diff --git a/lib/urlfilter/hostlist/hostlist.cpp b/lib/urlfilter/hostlist/hostlist.cpp
index ff652cf..bec79ea 100644
--- a/lib/urlfilter/hostlist/hostlist.cpp
+++ b/lib/urlfilter/hostlist/hostlist.cpp
@@ -52,18 +52,18 @@ std::pair<UrlFilter::MatchResult, QString> HostList::match(const QUrl& firstPart
void HostList::parseLine(const QString& line)
{
// check comment
- if(line.startsWith(QLatin1Literal("#")))
+ if(line.startsWith(QLatin1String("#")))
return;
QString parsedLine = line.trimmed();
// malformed rule
- if(!parsedLine.contains(QLatin1Literal(" ")))
+ if(!parsedLine.contains(QLatin1String(" ")))
return;
- const QStringList parts = parsedLine.split(QLatin1Literal(" "));
+ const QStringList parts = parsedLine.split(QLatin1String(" "));
const QString &redirect = parts.at(0);
- const auto action = (redirect == QLatin1Literal("0.0.0.0")) ? UrlFilter::Block : UrlFilter::Redirect;
+ const auto action = (redirect == QLatin1String("0.0.0.0")) ? UrlFilter::Block : UrlFilter::Redirect;
for(int i = 1; i < parts.size(); i++) {
const QString &domain = parts.at(i);
diff --git a/src/browser.cpp b/src/browser.cpp
index 488131e..61cd2c6 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -76,7 +76,7 @@ Browser::~Browser()
if(m_bookmarks)
m_bookmarks->save();
- for(auto *info : m_plugins)
+ for(auto *info : qAsConst(m_plugins))
delete info;
qDeleteAll(m_windows);
@@ -109,13 +109,13 @@ void Browser::loadProfiles(const QStringList &profilePaths)
connect(profile, &WebProfile::downloadRequested, m_downloads.get(), &DownloadsWidget::addDownload);
auto *interceptor = new UrlRequestInterceptor(profile, profile);
- for(UrlFilter *filter : m_filters) {
+ for(UrlFilter *filter : qAsConst(m_filters)) {
interceptor->addFilter(filter);
}
const auto headers = conf.value<QStringList>("filter.header").value_or(QStringList());
for(const QString &header : headers) {
- const auto h = header.split(QLatin1Literal(":"));
+ const auto h = header.split(QLatin1String(":"));
if(h.length() == 2)
interceptor->addHttpHeader(h.at(0).toLatin1(), h.at(1).toLatin1());
}
@@ -142,7 +142,7 @@ QPluginLoader *Browser::addPlugin(const QString &path)
auto *info = new PluginInfo(loader);
m_plugins.append(info);
- for(MainWindow *window : m_windows) {
+ for(MainWindow *window : qAsConst(m_windows)) {
addPluginTo(info, window);
}
@@ -259,7 +259,7 @@ MainWindow *Browser::createWindow()
auto *window = new MainWindow();
connect(window->addressBar, &AddressBar::complete, m_bookmarks.get(), &BookmarksWidget::search);
- for(auto *info : m_plugins) {
+ for(auto *info : qAsConst(m_plugins)) {
addPluginTo(info, window);
}
diff --git a/src/browser.h b/src/browser.h
index a16bd6d..d4117ba 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -72,7 +72,7 @@ private:
~PluginInfo()
{
loader->unload();
- for(auto *m : menus)
+ for(auto *m : qAsConst(menus))
m->deleteLater();
};
diff --git a/src/crashhandler.h b/src/crashhandler.h
index ac1bf12..73b1768 100644
--- a/src/crashhandler.h
+++ b/src/crashhandler.h
@@ -24,13 +24,7 @@ struct Context {
}
};
-bool install_handler(Context &ctx)
-#ifndef HAVE_BREAKPAD
-{
- return false;
-}
-#endif
-;
+bool install_handler(Context &ctx);
}
#endif // SMOLBOTE_CRASHHANDLER_H
diff --git a/src/crashhandler_dummy.cpp b/src/crashhandler_dummy.cpp
new file mode 100644
index 0000000..e230c82
--- /dev/null
+++ b/src/crashhandler_dummy.cpp
@@ -0,0 +1,16 @@
+/*
+ * This file is part of smolbote. It's copyrighted by the contributors recorded
+ * in the version control history of the file, available from its original
+ * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote
+ *
+ * SPDX-License-Identifier: GPL-3.0
+ */
+
+#include "crashhandler.h"
+
+
+bool CrashHandler::install_handler(CrashHandler::Context &)
+{
+ return false;
+}
+
diff --git a/src/mainwindow/menubar.cpp b/src/mainwindow/menubar.cpp
index a8d0590..eecb61a 100644
--- a/src/mainwindow/menubar.cpp
+++ b/src/mainwindow/menubar.cpp
@@ -100,7 +100,7 @@ MenuBar::MenuBar(MainWindow *parent)
return;
// findChildren
- for(QAction *a : this->findChildren<QAction *>()) {
+ for(QAction *a : findChildren<QAction *>()) {
if(a->text().contains(text))
findMenu->addAction(a);
}
diff --git a/src/meson.build b/src/meson.build
index 1783455..4d6c411 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -9,7 +9,7 @@ poi_settings_h = custom_target('default_config_value',
poi_sourceset.add(mod_qt5.preprocess(
moc_headers: ['browser.h',
- 'mainwindow/mainwindow.h', 'mainwindow/addressbar.h', 'mainwindow/menubar.h', 'mainwindow/widgets/completer.h', 'mainwindow/widgets/urllineedit.h', 'mainwindow/widgets/dockwidget.h', 'mainwindow/widgets/menusearch.h', 'mainwindow/widgets/navigationbar.h', 'mainwindow/widgets/searchform.h',
+ 'mainwindow/mainwindow.h', 'mainwindow/addressbar.h', 'mainwindow/menubar.h', 'mainwindow/widgets/completer.h', 'mainwindow/widgets/urllineedit.h', 'mainwindow/widgets/dockwidget.h', 'mainwindow/widgets/navigationbar.h', 'mainwindow/widgets/searchform.h',
'bookmarks/bookmarkswidget.h', 'bookmarks/editbookmarkdialog.h',
'session/savesessiondialog.h', 'session/sessiondialog.h', 'session/sessionform.h',
'subwindow/subwindow.h', 'subwindow/tabwidget.h',
@@ -60,5 +60,8 @@ poi_sourceset.add(files(
interfaces_moc, version_h, poi_settings_h
)
-poi_sourceset.add(when: [dep_breakpad, dep_threads], if_true: files('crashhandler.cpp'))
+poi_sourceset.add(when: [dep_breakpad, dep_threads],
+ if_true: files('crashhandler.cpp'),
+ if_false: files('crashhandler_dummy.cpp')
+)
diff --git a/src/util.cpp b/src/util.cpp
index cd73d94..fe74175 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -12,7 +12,7 @@
#include <QApplication>
#include <spdlog/spdlog.h>
-#define ListSeparator QLatin1Literal(";")
+#define ListSeparator QLatin1String(";")
const QStringList Util::files(const QString &location, const QStringList &nameFilters)
{
diff --git a/src/webengine/urlinterceptor.cpp b/src/webengine/urlinterceptor.cpp
index 490dea6..29cd869 100644
--- a/src/webengine/urlinterceptor.cpp
+++ b/src/webengine/urlinterceptor.cpp
@@ -37,7 +37,7 @@ void UrlRequestInterceptor::removeFilter(UrlFilter *filter)
void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
- for(const auto *filter : filters) {
+ for(const auto *filter : qAsConst(filters)) {
const auto match = filter->match(info.firstPartyUrl(), info.requestUrl(), info.resourceType());
// skip if no match
@@ -57,7 +57,7 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
}
// set headers
- for(const auto &header : headers) {
+ for(const auto &header : qAsConst(headers)) {
info.setHttpHeader(header.first, header.second);
}
for(auto i = m_profile->headers().constBegin(); i != m_profile->headers().constEnd(); ++i) {
diff --git a/src/webengine/webprofilemanager.cpp b/src/webengine/webprofilemanager.cpp
index 80762f7..bdd10f0 100644
--- a/src/webengine/webprofilemanager.cpp
+++ b/src/webengine/webprofilemanager.cpp
@@ -30,7 +30,7 @@ WebProfileManager::WebProfileManager(QObject *parent)
WebProfileManager::~WebProfileManager()
{
- for(Profile p : profiles) {
+ for(Profile p : qAsConst(profiles)) {
if(p.selfDestruct && p.settings != nullptr) {
if(!p.ptr->isOffTheRecord()) {
if(!p.ptr->persistentStoragePath().isEmpty())
@@ -160,7 +160,7 @@ void profileMenu(QMenu *menu, const std::function<void(WebProfile *)> &callback,
auto *group = new QActionGroup(menu);
QObject::connect(menu, &QMenu::aboutToHide, group, &QActionGroup::deleteLater);
- for(const auto &profile : s_instance->profiles) {
+ for(const auto &profile : qAsConst(s_instance->profiles)) {
auto *action = menu->addAction(profile.ptr->name(), profile.ptr, [profile, callback]() {
callback(profile.ptr);
});
diff --git a/test/firefox-bookmarks-json-parser/meson.build b/test/firefox-bookmarks-json-parser/meson.build
index 1432e68..a3531dc 100644
--- a/test/firefox-bookmarks-json-parser/meson.build
+++ b/test/firefox-bookmarks-json-parser/meson.build
@@ -1,13 +1,5 @@
-e = executable('bookmarks-json-parser',
+executable('bookmarks-json-parser',
sources: [ 'main.cpp' ],
dependencies: [ dep_qt5, dep_bookmarks ]
)
-env = environment({
- 'NOGUI' : '1',
- 'FILE' : 'bookmarks.json'
-})
-test('Firefox bookmarks.json parser', e,
- env: env,
- workdir: meson.build_root()
-)