Commit a3b1b484 authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

fixed mac os clang warnings

parent db659c4d
......@@ -133,18 +133,18 @@ public:
QtGuiResListPager(ResList *p, int ps, bool alwayssnip)
: ResListPager(ps, alwayssnip), m_reslist(p)
{}
virtual bool append(const string& data);
virtual bool append(const string& data, int idx, const Rcl::Doc& doc);
virtual string trans(const string& in);
virtual string detailsLink();
virtual const string &parFormat();
virtual const string &dateFormat();
virtual string nextUrl();
virtual string prevUrl();
virtual string headerContent();
virtual bool append(const string& data) override;
virtual bool append(const string& data, int idx, const Rcl::Doc& doc) override;
virtual string trans(const string& in) override;
virtual string detailsLink() override;
virtual const string &parFormat() override;
virtual const string &dateFormat() override;
virtual string nextUrl() override;
virtual string prevUrl() override;
virtual string headerContent() override;
virtual void suggest(const vector<string>uterms,
map<string, vector<string> >& sugg);
virtual string absSep() {return (const char *)(prefs.abssep.toUtf8());}
map<string, vector<string> >& sugg) override;
virtual string absSep() override {return (const char *)(prefs.abssep.toUtf8());}
#if defined(USING_WEBENGINE) || defined(USING_WEBKIT)
// We used to use http://localhost/. Now use file:/// as this is
......
......@@ -247,7 +247,7 @@ void SSearch::onCompleterShown()
}
// Test if the completer text begins with the current input.
QString text = data.toString();
if (!text.lastIndexOf(queryText->text()) == 0) {
if (text.lastIndexOf(queryText->text()) != 0) {
return;
}
......
......@@ -470,7 +470,7 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="toolTip">
......
......@@ -223,7 +223,7 @@ public:
}
void startElement(const std::string &nm,
const std::map<std::string, std::string>& attrs) {
const std::map<std::string, std::string>& attrs) override {
LOGDEB2("SSHXMLHandler::startElement: name [" << nm << "]\n");
if (nm == "SD") {
// Simple search saved data has a type='ssearch' attribute.
......@@ -277,7 +277,7 @@ public:
return ;
}
void characterData(const std::string &str) {
void characterData(const std::string &str) override {
currentText += str;
}
......
......@@ -128,7 +128,6 @@ class RclDynConf {
getStringEntries(const std::string& sk);
private:
unsigned int m_mlen;
ConfSimple m_data;
};
......
......@@ -169,6 +169,7 @@ public:
}
if (m_terms.find(dumb) != m_terms.end()) {
PRETEND_USE(m_rawtext);
// This word is a search term. Extend or create fragment
LOGDEB1("match: [" << dumb << "] pos " << pos << " bpos " << bts <<
":" << bte << " remainingWords " << m_remainingWords << endl);
......
......@@ -1721,7 +1721,7 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi, Doc &doc)
// won't work).
time_t mtime = atoll(doc.dmtime.empty() ? doc.fmtime.c_str() :
doc.dmtime.c_str());
struct tm tmb{0,0,0,0,0,0,0,0,0};
struct tm tmb;
localtime_r(&mtime, &tmb);
char buf[50]; // It's actually 9, but use 50 to suppress warnings.
snprintf(buf, 50, "%04d%02d%02d",
......
......@@ -49,11 +49,11 @@ public:
* Construct from readable xapian database and family name (ie: Stm)
*/
XapSynFamily(Xapian::Database xdb, const std::string& familyname)
: m_rdb(xdb)
{
m_prefix1 = std::string(":") + familyname;
: m_rdb(xdb) {
m_prefix1 = std::string(":") + familyname;
}
virtual ~XapSynFamily() {}
/** Retrieve all members of this family (e.g: french english german...) */
virtual bool getMembers(std::vector<std::string>&);
......@@ -62,23 +62,20 @@ public:
/** Expand term to list of synonyms for given member */
bool synExpand(const std::string& membername,
const std::string& term, std::vector<std::string>& result);
const std::string& term, std::vector<std::string>& result);
// The prefix shared by all synonym entries inside a family member
virtual std::string entryprefix(const std::string& member)
{
return m_prefix1 + ":" + member + ":";
virtual std::string entryprefix(const std::string& member) {
return m_prefix1 + ":" + member + ":";
}
// The key for the "list of members" entry
virtual std::string memberskey()
{
return m_prefix1 + ";" + "members";
virtual std::string memberskey() {
return m_prefix1 + ";" + "members";
}
Xapian::Database& getdb()
{
return m_rdb;
Xapian::Database& getdb() {
return m_rdb;
}
protected:
......@@ -95,12 +92,11 @@ protected:
class XapWritableSynFamily : public XapSynFamily {
public:
/** Construct with Xapian db open for r/w */
XapWritableSynFamily(Xapian::WritableDatabase db,
const std::string& familyname)
: XapSynFamily(db, familyname), m_wdb(db)
{
}
XapWritableSynFamily(Xapian::WritableDatabase db, const std::string& familyname)
: XapSynFamily(db, familyname), m_wdb(db) {}
virtual ~XapWritableSynFamily() {}
/** Delete all entries for one member (e.g. french), and remove from list
* of members */
virtual bool deleteMember(const std::string& membername);
......@@ -117,6 +113,7 @@ protected:
/** A functor which transforms a string */
class SynTermTrans {
public:
virtual ~SynTermTrans() {}
virtual std::string operator()(const std::string&) = 0;
virtual std::string name() { return "SynTermTrans: unknown";}
};
......@@ -129,11 +126,11 @@ public:
class XapComputableSynFamMember {
public:
XapComputableSynFamMember(Xapian::Database xdb, std::string familyname,
std::string membername, SynTermTrans* trans)
: m_family(xdb, familyname), m_membername(membername),
m_trans(trans), m_prefix(m_family.entryprefix(m_membername))
{
}
std::string membername, SynTermTrans* trans)
: m_family(xdb, familyname), m_membername(membername),
m_trans(trans), m_prefix(m_family.entryprefix(m_membername)) {}
virtual ~XapComputableSynFamMember() {}
/** Expand a term to its list of synonyms. If filtertrans is set we
* keep only the results which transform to the same value as the input
......@@ -141,12 +138,12 @@ public:
* expansion when only either case or diac expansion is desired.
*/
bool synExpand(const std::string& term, std::vector<std::string>& result,
SynTermTrans *filtertrans = 0);
SynTermTrans *filtertrans = 0);
/** Same with also wildcard/regexp expansion of entry against the keys.
* The input matcher will be modified to fit our key format. */
bool synKeyExpand(StrMatcher* in, std::vector<std::string>& result,
SynTermTrans *filtertrans = 0);
SynTermTrans *filtertrans = 0);
private:
XapSynFamily m_family;
......@@ -159,41 +156,38 @@ private:
class XapWritableComputableSynFamMember {
public:
XapWritableComputableSynFamMember(
Xapian::WritableDatabase xdb, std::string familyname,
std::string membername, SynTermTrans* trans)
: m_family(xdb, familyname), m_membername(membername),
m_trans(trans), m_prefix(m_family.entryprefix(m_membername))
{
}
virtual bool addSynonym(const std::string& term)
{
LOGDEB2("addSynonym:me " << (this) << " term [" << (term) << "] m_trans " << (m_trans) << "\n" );
std::string transformed = (*m_trans)(term);
LOGDEB2("addSynonym: transformed [" << (transformed) << "]\n" );
if (transformed == term)
Xapian::WritableDatabase xdb, std::string familyname,
std::string membername, SynTermTrans* trans)
: m_family(xdb, familyname), m_membername(membername),
m_trans(trans), m_prefix(m_family.entryprefix(m_membername)) {}
virtual ~XapWritableComputableSynFamMember() {}
virtual bool addSynonym(const std::string& term) {
LOGDEB2("addSynonym:me " << this << " term [" << term << "] m_trans " << m_trans << "\n");
std::string transformed = (*m_trans)(term);
LOGDEB2("addSynonym: transformed [" << transformed << "]\n");
if (transformed == term)
return true;
std::string ermsg;
try {
m_family.getdb().add_synonym(m_prefix + transformed, term);
} XCATCHERROR(ermsg);
if (!ermsg.empty()) {
LOGERR("XapWritableComputableSynFamMember::addSynonym: xapian error " << ermsg << "\n");
return false;
}
return true;
std::string ermsg;
try {
m_family.getdb().add_synonym(m_prefix + transformed, term);
} XCATCHERROR(ermsg);
if (!ermsg.empty()) {
LOGERR("XapWritableComputableSynFamMember::addSynonym: xapian error " << (ermsg) << "\n" );
return false;
}
return true;
}
void clear()
{
m_family.deleteMember(m_membername);
void clear() {
m_family.deleteMember(m_membername);
}
void recreate()
{
clear();
m_family.createMember(m_membername);
void recreate() {
clear();
m_family.createMember(m_membername);
}
private:
......@@ -222,4 +216,3 @@ static const std::string synFamDiCa("DCa");
} // end namespace Rcl
#endif /* _SYNFAMILY_H_INCLUDED_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment