diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index a501ae35..659ccf35 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -416,7 +416,7 @@ void rwSettings(bool writing) } else { vector tl = g_dynconf->getStringEntries(asbdSk); for (const auto& dbd: tl) { - prefs.asearchSubdirHist.push_back(u8s2qs(dbd.c_str())); + prefs.asearchSubdirHist.push_back(u8s2qs(dbd)); } } if (!writing) { diff --git a/src/qtgui/main.cpp b/src/qtgui/main.cpp index 89bd9e0c..32576b71 100644 --- a/src/qtgui/main.cpp +++ b/src/qtgui/main.cpp @@ -26,12 +26,11 @@ #include #include #include -#include #include #include #include #include -#include +#include #include "rcldb.h" #include "rclconfig.h" @@ -100,7 +99,7 @@ bool maybeOpenDb(string &reason, bool force, bool *maindberror) LOGDEB1("maybeOpenDb: force " << force << "\n"); if (force || nullptr == rcldb) { - rcldb = std::shared_ptr(new Rcl::Db(theconfig)); + rcldb = std::make_shared(theconfig); } rcldb->rmQueryDb(""); auto edbs = &prefs.activeExtraDbs; diff --git a/src/qtgui/preview_w.cpp b/src/qtgui/preview_w.cpp index 43d1e080..1d0d00c9 100644 --- a/src/qtgui/preview_w.cpp +++ b/src/qtgui/preview_w.cpp @@ -782,8 +782,9 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum) connect(<hr, SIGNAL(finished()), &loop, SLOT(quit())); bool canGetRawText = rcldb && rcldb->storesDocText(); - auto it = prefs.preferStoredTextMimes.find(idoc.mimetype); - bool preferStoredText = (it != prefs.preferStoredTextMimes.end()); + bool preferStoredText = std::find(prefs.preferStoredTextMimes.begin(), + prefs.preferStoredTextMimes.end(), + idoc.mimetype) != prefs.preferStoredTextMimes.end(); bool loadok{false}; if (!preferStoredText || !canGetRawText) { diff --git a/src/qtgui/rclm_view.cpp b/src/qtgui/rclm_view.cpp index 41d5e194..bad6eaff 100644 --- a/src/qtgui/rclm_view.cpp +++ b/src/qtgui/rclm_view.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "qxtconfirmationmessage.h" @@ -75,7 +76,7 @@ void RclMain::viewUrl() Rcl::Query *query = new Rcl::Query(rcldb.get()); DocSequenceDb *src = new DocSequenceDb( rcldb, std::shared_ptr(query), "", - std::shared_ptr(new Rcl::SearchData)); + std::make_shared()); m_source = std::shared_ptr(src); diff --git a/src/qtgui/recoll.h b/src/qtgui/recoll.h index 6214e9fa..6d2d191e 100644 --- a/src/qtgui/recoll.h +++ b/src/qtgui/recoll.h @@ -54,7 +54,7 @@ inline std::string qs2u8s(const QString& qs) { return std::string((const char *)qs.toUtf8()); } -inline QString u8s2qs(const std::string us) +inline QString u8s2qs(const std::string& us) { return QString::fromUtf8(us.c_str()); } diff --git a/src/qtgui/restable.cpp b/src/qtgui/restable.cpp index 0ea206f5..30311113 100644 --- a/src/qtgui/restable.cpp +++ b/src/qtgui/restable.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -488,7 +487,7 @@ void RecollModel::sort(int column, Qt::SortOrder order) if (!stringlowercmp("date", spec.field) || !stringlowercmp("datetime", spec.field)) spec.field = "mtime"; - spec.desc = order == Qt::AscendingOrder ? false : true; + spec.desc = (order != Qt::AscendingOrder); } emit sortDataChanged(spec); } diff --git a/src/qtgui/rtitool.cpp b/src/qtgui/rtitool.cpp index f4f52c7c..4bc28aa4 100644 --- a/src/qtgui/rtitool.cpp +++ b/src/qtgui/rtitool.cpp @@ -24,7 +24,6 @@ #include -#include #include #include "recoll.h" diff --git a/src/qtgui/spell_w.cpp b/src/qtgui/spell_w.cpp index 63ea7b57..63ff1a98 100644 --- a/src/qtgui/spell_w.cpp +++ b/src/qtgui/spell_w.cpp @@ -218,8 +218,8 @@ void SpellW::doExpand() resTW->setItem(0, 0, new QTableWidgetItem(tr("No expansion found"))); } else { int row = 0; - - if (maxexpand > 0 && int(res.entries.size()) >= maxexpand) { + // maxexpand is static const, thus guaranteed to be >0 + if (int(res.entries.size()) >= maxexpand) { resTW->setRowCount(row + 1); resTW->setSpan(row, 0, 1, 2); resTW->setItem(row++, 0, diff --git a/src/qtgui/ssearch_w.cpp b/src/qtgui/ssearch_w.cpp index 504f5d18..479136b0 100644 --- a/src/qtgui/ssearch_w.cpp +++ b/src/qtgui/ssearch_w.cpp @@ -610,7 +610,6 @@ bool SSearch::fromXML(const SSearchDef& fxml) if (!checkExtIndexes(fxml.extindexes)) { - std::string asString; stringsToString(fxml.extindexes, asString); QMessageBox::warning( 0, "Recoll", diff --git a/src/qtgui/xmltosd.cpp b/src/qtgui/xmltosd.cpp index 1def6e37..f3c24e46 100644 --- a/src/qtgui/xmltosd.cpp +++ b/src/qtgui/xmltosd.cpp @@ -22,6 +22,8 @@ #include "guiutils.h" #include "log.h" #include "xmltosd.h" + +#include #include "smallut.h" #include "recoll.h" #include "picoxml.h" @@ -51,7 +53,7 @@ public: } resetTemps(); // A new search descriptor. Allocate data structure - sd = std::shared_ptr(new SearchData); + sd = std::make_shared(); if (!sd) { LOGERR("SDHXMLHandler::startElement: out of memory\n"); contentsOk = false; diff --git a/src/rcldb/stoplist.cpp b/src/rcldb/stoplist.cpp index e603441b..6f0b46fc 100644 --- a/src/rcldb/stoplist.cpp +++ b/src/rcldb/stoplist.cpp @@ -50,7 +50,7 @@ bool StopList::setFile(const string &filename) // faster than find() in this case. bool StopList::isStop(const string &term) const { - return m_stops.empty() ? false : m_stops.find(term) != m_stops.end(); + return !m_stops.empty() && m_stops.find(term) != m_stops.end(); } }