diff --git a/src/qtgui/advsearch_w.cpp b/src/qtgui/advsearch_w.cpp index e218f176..4d9b1e8c 100644 --- a/src/qtgui/advsearch_w.cpp +++ b/src/qtgui/advsearch_w.cpp @@ -552,16 +552,16 @@ void AdvSearch::fromSearch(std::shared_ptr sdata) maxDateDTE->setDate(date); } - if (sdata->m_maxSize != (size_t)-1 || sdata->m_minSize != (size_t)-1) { + if (sdata->m_maxSize != -1 || sdata->m_minSize != -1) { filterSizesCB->setChecked(1); QString sz; - if (sdata->m_minSize != (size_t)-1) { + if (sdata->m_minSize != -1) { sz.setNum(sdata->m_minSize); minSizeLE->setText(sz); } else { minSizeLE->setText(""); } - if (sdata->m_maxSize != (size_t)-1) { + if (sdata->m_maxSize != -1) { sz.setNum(sdata->m_maxSize); maxSizeLE->setText(sz); } else { diff --git a/src/rcldb/searchdata.cpp b/src/rcldb/searchdata.cpp index 4067d239..7292e96b 100644 --- a/src/rcldb/searchdata.cpp +++ b/src/rcldb/searchdata.cpp @@ -53,19 +53,6 @@ namespace Rcl { typedef vector::iterator qlist_it_t; typedef vector::const_iterator qlist_cit_t; -void SearchData::commoninit() -{ - m_haveDates = false; - m_maxSize = size_t(-1); - m_minSize = size_t(-1); - m_haveWildCards = false; - m_autodiacsens = false; - m_autocasesens = true; - m_maxexp = 10000; - m_maxcl = 100000; - m_softmaxexpand = -1; -} - SearchData::~SearchData() { LOGDEB0("SearchData::~SearchData\n" ); @@ -215,8 +202,8 @@ void SearchData::simplify() if (!clsubp->getSub()->m_filetypes.empty() || !clsubp->getSub()->m_nfiletypes.empty() || clsubp->getSub()->m_haveDates || - clsubp->getSub()->m_maxSize != size_t(-1) || - clsubp->getSub()->m_minSize != size_t(-1) || + clsubp->getSub()->m_maxSize != -1 || + clsubp->getSub()->m_minSize != -1 || clsubp->getSub()->m_haveWildCards) { if (!clsubp->getSub()->m_query.empty()) continue; @@ -229,9 +216,9 @@ void SearchData::simplify() if (clsubp->getSub()->m_haveDates && !m_haveDates) { m_dates = clsubp->getSub()->m_dates; } - if (m_maxSize == size_t(-1)) + if (m_maxSize == -1) m_maxSize = clsubp->getSub()->m_maxSize; - if (m_minSize == size_t(-1)) + if (m_minSize == -1) m_minSize = clsubp->getSub()->m_minSize; m_haveWildCards = m_haveWildCards || clsubp->getSub()->m_haveWildCards; @@ -305,8 +292,8 @@ void SearchData::dump(ostream& o) const o << dumptabs << "SearchData: " << tpToString(m_tp) << " qs " << int(m_query.size()) << " ft " << m_filetypes.size() << " nft " << m_nfiletypes.size() << - " hd " << m_haveDates << " maxs " << int(m_maxSize) << " mins " << - int(m_minSize) << " wc " << m_haveWildCards << "\n"; + " hd " << m_haveDates << " maxs " << m_maxSize << " mins " << + m_minSize << " wc " << m_haveWildCards << "\n"; for (std::vector::const_iterator it = m_query.begin(); it != m_query.end(); it++) { o << dumptabs; diff --git a/src/rcldb/searchdata.h b/src/rcldb/searchdata.h index 654ae7af..1e01919d 100644 --- a/src/rcldb/searchdata.h +++ b/src/rcldb/searchdata.h @@ -81,11 +81,9 @@ public: : m_tp(tp), m_stemlang(stemlang) { if (m_tp != SCLT_OR && m_tp != SCLT_AND) m_tp = SCLT_OR; - commoninit(); } SearchData() : m_tp(SCLT_AND) { - commoninit(); } ~SearchData(); @@ -177,33 +175,33 @@ private: // Special stuff produced by input which looks like a clause but means // something else (date and size specs) - bool m_haveDates; - DateInterval m_dates; // Restrict to date interval - int64_t m_maxSize; - int64_t m_minSize; + bool m_haveDates{false}; + DateInterval m_dates; // Restrict to date interval + int64_t m_maxSize{-1}; + int64_t m_minSize{-1}; // Printable expanded version of the complete query, retrieved/set // from rcldb after the Xapian::setQuery() call std::string m_description; // Error diag std::string m_reason; - bool m_haveWildCards; + bool m_haveWildCards{false}; std::string m_stemlang; // Parameters set at the start of ToNativeQuery because they need // an rclconfig. Actually this does not make sense and it would be // simpler to just pass an rclconfig to the constructor; - bool m_autodiacsens; - bool m_autocasesens; - int m_maxexp; - int m_maxcl; + bool m_autodiacsens{false}; + bool m_autocasesens{true}; + int m_maxexp{10000}; + int m_maxcl{100000}; // Parameters which are not part of the main query data but may influence // translation in special cases. // Maximum TermMatch (e.g. wildcard) expansion. This is normally set // from the configuration with a high default, but may be set to a lower // value during "find-as-you-type" operations from the GUI - int m_softmaxexpand; + int m_softmaxexpand{-1}; // Collapse bogus subqueries generated by the query parser, mostly // so that we can check if this is an autophrase candidate (else @@ -214,8 +212,6 @@ private: bool clausesToQuery(Rcl::Db &db, SClType tp, std::vector& query, string& reason, void *d); - void commoninit(); - /* Copyconst and assignment private and forbidden */ SearchData(const SearchData &) {} SearchData& operator=(const SearchData&) {return *this;}; diff --git a/src/rcldb/searchdataxml.cpp b/src/rcldb/searchdataxml.cpp index e0a465b1..41cb0fa3 100644 --- a/src/rcldb/searchdataxml.cpp +++ b/src/rcldb/searchdataxml.cpp @@ -139,10 +139,10 @@ string SearchData::asXML() } } - if (m_minSize != size_t(-1)) { + if (m_minSize != -1) { os << "" << m_minSize << "" << endl; } - if (m_maxSize != size_t(-1)) { + if (m_maxSize != -1) { os << "" << m_maxSize << "" << endl; }