Fixed MSVC warnings, all inocuous

This commit is contained in:
Jean-Francois Dockes 2020-04-17 14:26:40 +01:00
parent a51721b5c2
commit 39c152bada
49 changed files with 262 additions and 224 deletions

View File

@ -63,7 +63,7 @@ void Binc::MimeDocument::parseOnlyHeader(int fd)
nlines = 0;
nbodylines = 0;
doParseOnlyHeader(doc_mimeSource, "");
doParseOnlyHeader(doc_mimeSource);
}
void Binc::MimeDocument::parseOnlyHeader(istream& s)
@ -86,12 +86,11 @@ void Binc::MimeDocument::parseOnlyHeader(istream& s)
nlines = 0;
nbodylines = 0;
doParseOnlyHeader(doc_mimeSource, "");
doParseOnlyHeader(doc_mimeSource);
}
//------------------------------------------------------------------------
int Binc::MimePart::doParseOnlyHeader(MimeInputSource *ms,
const string &toboundary)
int Binc::MimePart::doParseOnlyHeader(MimeInputSource *ms)
{
mimeSource = ms;
string name;

View File

@ -32,155 +32,154 @@
namespace Binc {
class MimeInputSource;
class MimeInputSource;
//----------------------------------------------------------------------
class HeaderItem {
private:
mutable std::string key;
mutable std::string value;
//----------------------------------------------------------------------
class HeaderItem {
private:
mutable std::string key;
mutable std::string value;
public:
inline const std::string &getKey(void) const { return key; }
inline const std::string &getValue(void) const { return value; }
public:
inline const std::string &getKey(void) const { return key; }
inline const std::string &getValue(void) const { return value; }
//--
HeaderItem(void);
HeaderItem(const std::string &key, const std::string &value);
//--
HeaderItem(void);
HeaderItem(const std::string &key, const std::string &value);
};
//----------------------------------------------------------------------
class Header {
private:
mutable std::vector<HeaderItem> content;
public:
bool getFirstHeader(const std::string &key, HeaderItem &dest) const;
bool getAllHeaders(const std::string &key, std::vector<HeaderItem> &dest) const;
void add(const std::string &name, const std::string &content);
void clear(void);
//--
Header(void);
~Header(void);
};
//----------------------------------------------------------------------
class IODevice;
class MimeDocument;
class MimePart {
protected:
public:
mutable bool multipart;
mutable bool messagerfc822;
mutable std::string subtype;
mutable std::string boundary;
mutable unsigned int headerstartoffsetcrlf;
mutable unsigned int headerlength;
mutable unsigned int bodystartoffsetcrlf;
mutable unsigned int bodylength;
mutable unsigned int nlines;
mutable unsigned int nbodylines;
mutable unsigned int size;
public:
enum FetchType {
FetchBody,
FetchHeader,
FetchMime
};
//----------------------------------------------------------------------
class Header {
private:
mutable std::vector<HeaderItem> content;
mutable Header h;
public:
bool getFirstHeader(const std::string &key, HeaderItem &dest) const;
bool getAllHeaders(const std::string &key, std::vector<HeaderItem> &dest) const;
void add(const std::string &name, const std::string &content);
void clear(void);
mutable std::vector<MimePart> members;
//--
Header(void);
~Header(void);
};
inline const std::string &getSubType(void) const { return subtype; }
inline bool isMultipart(void) const { return multipart; }
inline bool isMessageRFC822(void) const { return messagerfc822; }
inline unsigned int getSize(void) const { return bodylength; }
inline unsigned int getNofLines(void) const { return nlines; }
inline unsigned int getNofBodyLines(void) const { return nbodylines; }
inline unsigned int getBodyLength(void) const { return bodylength; }
inline unsigned int getBodyStartOffset(void) const { return bodystartoffsetcrlf; }
//----------------------------------------------------------------------
class IODevice;
class MimeDocument;
class MimePart {
protected:
public:
mutable bool multipart;
mutable bool messagerfc822;
mutable std::string subtype;
mutable std::string boundary;
void printBody(Binc::IODevice &output, unsigned int startoffset, unsigned int length) const;
void getBody(std::string& s, unsigned int startoffset, unsigned int length) const;
virtual void clear(void);
mutable unsigned int headerstartoffsetcrlf;
mutable unsigned int headerlength;
virtual int doParseOnlyHeader(MimeInputSource *ms);
virtual int doParseFull(MimeInputSource *ms,
const std::string &toboundary, int &boundarysize);
mutable unsigned int bodystartoffsetcrlf;
mutable unsigned int bodylength;
mutable unsigned int nlines;
mutable unsigned int nbodylines;
mutable unsigned int size;
MimePart(void);
virtual ~MimePart(void);
public:
enum FetchType {
FetchBody,
FetchHeader,
FetchMime
};
private:
MimeInputSource *mimeSource;
mutable Header h;
bool parseOneHeaderLine(Binc::Header *header, unsigned int *nlines);
mutable std::vector<MimePart> members;
bool skipUntilBoundary(const std::string &delimiter,
unsigned int *nlines, bool *eof);
inline void postBoundaryProcessing(bool *eof,
unsigned int *nlines,
int *boundarysize,
bool *foundendofpart);
void parseMultipart(const std::string &boundary,
const std::string &toboundary,
bool *eof,
unsigned int *nlines,
int *boundarysize,
bool *foundendofpart,
unsigned int *bodylength,
std::vector<Binc::MimePart> *members);
void parseSinglePart(const std::string &toboundary,
int *boundarysize,
unsigned int *nbodylines,
unsigned int *nlines,
bool *eof, bool *foundendofpart,
unsigned int *bodylength);
void parseHeader(Binc::Header *header, unsigned int *nlines);
void analyzeHeader(Binc::Header *header, bool *multipart,
bool *messagerfc822, std::string *subtype,
std::string *boundary);
void parseMessageRFC822(std::vector<Binc::MimePart> *members,
bool *foundendofpart,
unsigned int *bodylength,
unsigned int *nbodylines,
const std::string &toboundary);
};
inline const std::string &getSubType(void) const { return subtype; }
inline bool isMultipart(void) const { return multipart; }
inline bool isMessageRFC822(void) const { return messagerfc822; }
inline unsigned int getSize(void) const { return bodylength; }
inline unsigned int getNofLines(void) const { return nlines; }
inline unsigned int getNofBodyLines(void) const { return nbodylines; }
inline unsigned int getBodyLength(void) const { return bodylength; }
inline unsigned int getBodyStartOffset(void) const { return bodystartoffsetcrlf; }
//----------------------------------------------------------------------
class MimeDocument : public MimePart {
public:
MimeDocument(void);
~MimeDocument(void);
void printBody(Binc::IODevice &output, unsigned int startoffset, unsigned int length) const;
void getBody(std::string& s, unsigned int startoffset, unsigned int length) const;
virtual void clear(void);
void parseOnlyHeader(int fd);
void parseFull(int fd);
void parseOnlyHeader(std::istream& s);
void parseFull(std::istream& s);
virtual int doParseOnlyHeader(MimeInputSource *ms,
const std::string &toboundary);
virtual int doParseFull(MimeInputSource *ms,
const std::string &toboundary, int &boundarysize);
MimePart(void);
virtual ~MimePart(void);
private:
MimeInputSource *mimeSource;
bool parseOneHeaderLine(Binc::Header *header, unsigned int *nlines);
bool skipUntilBoundary(const std::string &delimiter,
unsigned int *nlines, bool *eof);
inline void postBoundaryProcessing(bool *eof,
unsigned int *nlines,
int *boundarysize,
bool *foundendofpart);
void parseMultipart(const std::string &boundary,
const std::string &toboundary,
bool *eof,
unsigned int *nlines,
int *boundarysize,
bool *foundendofpart,
unsigned int *bodylength,
std::vector<Binc::MimePart> *members);
void parseSinglePart(const std::string &toboundary,
int *boundarysize,
unsigned int *nbodylines,
unsigned int *nlines,
bool *eof, bool *foundendofpart,
unsigned int *bodylength);
void parseHeader(Binc::Header *header, unsigned int *nlines);
void analyzeHeader(Binc::Header *header, bool *multipart,
bool *messagerfc822, std::string *subtype,
std::string *boundary);
void parseMessageRFC822(std::vector<Binc::MimePart> *members,
bool *foundendofpart,
unsigned int *bodylength,
unsigned int *nbodylines,
const std::string &toboundary);
};
//----------------------------------------------------------------------
class MimeDocument : public MimePart {
public:
MimeDocument(void);
~MimeDocument(void);
void parseOnlyHeader(int fd);
void parseFull(int fd);
void parseOnlyHeader(std::istream& s);
void parseFull(std::istream& s);
void clear(void);
void clear(void);
bool isHeaderParsed(void) const
bool isHeaderParsed(void) const
{
return headerIsParsed;
}
bool isAllParsed(void) const
bool isAllParsed(void) const
{
return allIsParsed;
}
private:
bool headerIsParsed;
bool allIsParsed;
MimeInputSource *doc_mimeSource;
};
private:
bool headerIsParsed;
bool allIsParsed;
MimeInputSource *doc_mimeSource;
};
};

View File

@ -50,3 +50,5 @@ typedef int ssize_t;
#define lstat stat
#endif // _WIN32
#define PRETEND_USE(expr) ((void)(expr))

View File

@ -969,7 +969,7 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc)
"]: [" << val << "]\n");
return 0;
}
ft.wdfinc = attrs.getInt("wdfinc", 1);
ft.wdfinc = (int)attrs.getInt("wdfinc", 1);
ft.boost = attrs.getFloat("boost", 1.0);
ft.pfxonly = attrs.getBool("pfxonly", false);
ft.noterms = attrs.getBool("noterms", false);
@ -1012,7 +1012,7 @@ bool RclConfig::readFieldsConfig(const string& cnferrloc)
return 0;
}
}
int valuelen = attrs.getInt("len", 0);
int valuelen = (int)attrs.getInt("len", 0);
// Find or insert traits entry
const auto pit =
m_fldtotraits.insert(

View File

@ -224,7 +224,7 @@ bool CreateInvisibleWindow()
return TRUE;
}
DWORD WINAPI RunInvisibleWindowThread(LPVOID lpParam)
DWORD WINAPI RunInvisibleWindowThread(LPVOID)
{
MSG msg;
CreateInvisibleWindow();

View File

@ -319,18 +319,22 @@ static inline int whatcc(unsigned int c, char *asciirep = nullptr)
bool TextSplit::isCJK(int c)
{
PRETEND_USE(c);
return UNICODE_IS_CJK(c);
}
bool TextSplit::isKATAKANA(int c)
{
PRETEND_USE(c);
return UNICODE_IS_KATAKANA(c);
}
bool TextSplit::isHANGUL(int c)
{
PRETEND_USE(c);
return UNICODE_IS_HANGUL(c);
}
bool TextSplit::isNGRAMMED(int c)
{
PRETEND_USE(c);
return UNICODE_IS_CJK(c) && !UNICODE_IS_KATAKANA(c) &&
!UNICODE_IS_HANGUL(c);
}
@ -359,6 +363,8 @@ inline bool TextSplit::emitterm(bool isspan, string &w, int pos,
// long words because stats are used to detect bad text
if (!isspan || m_wordLen == m_span.length())
m_stats.newsamp(m_wordChars);
#else
PRETEND_USE(isspan);
#endif
if (l > 0 && l <= o_maxWordLength) {

View File

@ -1,3 +1,22 @@
/* Copyright (C) 2004-2019 J.F.Dockes
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "autoconfig.h"
#include "utf8fn.h"
#include "rclconfig.h"
#include "transcode.h"
@ -9,6 +28,7 @@ string compute_utf8fn(const RclConfig *config, const string& ifn, bool simple)
{
string lfn(simple ? path_getsimple(ifn) : ifn);
#ifdef _WIN32
PRETEND_USE(config);
// On windows file names are read as UTF16 wchar_t and converted to UTF-8
// while scanning directories
return lfn;

View File

@ -34,6 +34,7 @@ using namespace std;
bool checkRetryFailed(RclConfig *conf, bool record)
{
#ifdef _WIN32
PRETEND_USE(record);
// Under Windows we only retry if the recollindex program is newer
// than the index
struct PathStat st;

View File

@ -65,13 +65,13 @@ EXEDocFetcher::EXEDocFetcher(const EXEDocFetcher::Internal& _m)
stringsToString(m->sfetch) << "\n");
}
bool EXEDocFetcher::fetch(RclConfig* cnf, const Rcl::Doc& idoc, RawDoc& out)
bool EXEDocFetcher::fetch(RclConfig*, const Rcl::Doc& idoc, RawDoc& out)
{
out.kind = RawDoc::RDK_DATADIRECT;
return m->docmd(m->sfetch, idoc, out.data);
}
bool EXEDocFetcher::makesig(RclConfig* cnf, const Rcl::Doc& idoc, string& sig)
bool EXEDocFetcher::makesig(RclConfig*, const Rcl::Doc& idoc, string& sig)
{
return m->docmd(m->smkid, idoc, sig);
}

View File

@ -75,7 +75,7 @@ public:
virtual bool makesig(RclConfig* cnf, const Rcl::Doc& idoc,
std::string& sig) = 0;
enum Reason{FetchOk, FetchNotExist, FetchNoPerm, FetchOther};
virtual Reason testAccess(RclConfig* cnf, const Rcl::Doc& idoc) {
virtual Reason testAccess(RclConfig*, const Rcl::Doc&) {
return FetchOther;
}
virtual ~DocFetcher() {}

View File

@ -26,10 +26,10 @@ void readIdxStatus(RclConfig *config, DbIxStatus &status)
ConfSimple cs(config->getIdxStatusFile().c_str(), 1);
status.phase = DbIxStatus::Phase(cs.getInt("phase", 0));
cs.get("fn", status.fn);
status.docsdone = cs.getInt("docsdone", 0);
status.filesdone = cs.getInt("filesdone", 0);
status.fileerrors = cs.getInt("fileerrors", 0);
status.dbtotdocs = cs.getInt("dbtotdocs", 0);
status.totfiles = cs.getInt("totfiles", 0);
status.docsdone = (int)cs.getInt("docsdone", 0);
status.filesdone = (int)cs.getInt("filesdone", 0);
status.fileerrors = (int)cs.getInt("fileerrors", 0);
status.dbtotdocs = (int)cs.getInt("dbtotdocs", 0);
status.totfiles = (int)cs.getInt("totfiles", 0);
status.hasmonitor = cs.getBool("hasmonitor", false);
}

View File

@ -48,6 +48,8 @@ using namespace std;
static string mimetypefromdata(RclConfig *cfg, const string &fn, bool usfc)
{
LOGDEB1("mimetypefromdata: fn [" << fn << "]\n");
PRETEND_USE(usfc);
PRETEND_USE(cfg);
// First try the internal identifying routine
string mime = idFile(fn.c_str());

View File

@ -229,6 +229,7 @@ static void makeIndexerOrExit(RclConfig *config, bool inPlaceReset)
void rclIxIonice(const RclConfig *config)
{
PRETEND_USE(config);
#ifndef _WIN32
string clss, classdata;
if (!config->getConfParam("monioniceclass", clss) || clss.empty())
@ -241,6 +242,7 @@ void rclIxIonice(const RclConfig *config)
static void setMyPriority(const RclConfig *config)
{
PRETEND_USE(config);
#ifndef _WIN32
int prio{19};
std::string sprio;
@ -474,8 +476,7 @@ static const char usage [] =
" -c <configdir> : specify config directory, overriding $RECOLL_CONFDIR\n"
;
static void
Usage(FILE *where = stderr)
static void Usage()
{
FILE *fp = (op_flags & OPT_h) ? stdout : stderr;
fprintf(fp, "%s: Usage: %s", path_getsimple(thisprog).c_str(), usage);
@ -487,6 +488,7 @@ static RclConfig *config;
static void lockorexit(Pidfile *pidfile, RclConfig *config)
{
PRETEND_USE(config);
pid_t pid;
if ((pid = pidfile->open()) != 0) {
if (pid > 0) {

View File

@ -58,7 +58,7 @@ public:
/** Purge a list of files. No way to do this currently and dont want
* to do anything as this is mostly called by the monitor when *I* delete
* files inside the queue dir */
bool purgeFiles(std::list<std::string>& files) {return true;}
bool purgeFiles(std::list<std::string>&) {return true;}
/** Called when indexing data from the cache, and from internfile for
* search result preview */

View File

@ -58,7 +58,7 @@ bool WQDocFetcher::fetch(RclConfig* cnf, const Rcl::Doc& idoc, RawDoc& out)
return true;
}
bool WQDocFetcher::makesig(RclConfig* cnf, const Rcl::Doc& idoc, string& sig)
bool WQDocFetcher::makesig(RclConfig*, const Rcl::Doc&, string& sig)
{
// Web queue sigs are empty
sig.clear();

View File

@ -85,6 +85,10 @@ void reapXAttrs(const RclConfig* cfg, const string& path,
xfields[key] = value;
LOGDEB2("reapXAttrs: [" << key << "] -> [" << value << "]\n");
}
#else
PRETEND_USE(cfg);
PRETEND_USE(path);
PRETEND_USE(xfields);
#endif
}

View File

@ -112,7 +112,7 @@ HtmlParser::HtmlParser()
}
void
HtmlParser::decode_entities(string &s)
HtmlParser::decode_entities(string &)
{
// Not used for recoll. Kept here to minimize the amount of
// diffs. Almost the same code in myhtmlparse except that the

View File

@ -271,8 +271,8 @@ FileInterner::FileInterner(const string &data, RclConfig *cnf,
init(data, cnf, flags, imime);
}
void FileInterner::init(const string &data, RclConfig *cnf,
int flags, const string& imime)
void FileInterner::init(const string &data, RclConfig *,
int, const string& imime)
{
if (imime.empty()) {
LOGERR("FileInterner: inmemory constructor needs input mime type\n");

View File

@ -47,6 +47,7 @@ void MEAdv::reset()
void MEAdv::newData(int n)
{
PRETEND_USE(n);
LOGDEB2("MHExec:newData(" << n << ")\n");
if (m_filtermaxseconds > 0 &&
time(0L) - m_start > m_filtermaxseconds) {

View File

@ -44,7 +44,7 @@ bool MimeHandlerHtml::set_document_file_impl(const string& mt, const string &fn)
return set_document_string(mt, otext);
}
bool MimeHandlerHtml::set_document_string_impl(const string& mt,
bool MimeHandlerHtml::set_document_string_impl(const string&,
const string& htext)
{
m_html = htext;

View File

@ -85,7 +85,7 @@ void MimeHandlerMail::clear_impl()
m_attachments.clear();
}
bool MimeHandlerMail::set_document_file_impl(const string& mt, const string &fn)
bool MimeHandlerMail::set_document_file_impl(const string&, const string &fn)
{
LOGDEB("MimeHandlerMail::set_document_file(" << fn << ")\n");
if (m_fd >= 0) {
@ -125,7 +125,7 @@ bool MimeHandlerMail::set_document_file_impl(const string& mt, const string &fn)
return true;
}
bool MimeHandlerMail::set_document_string_impl(const string& mt,
bool MimeHandlerMail::set_document_string_impl(const string&,
const string& msgtxt)
{
LOGDEB1("MimeHandlerMail::set_document_string\n");

View File

@ -324,7 +324,9 @@ void MimeHandlerMbox::clear_impl()
m->fn.erase();
m->ipath.erase();
m->instream = ifstream();
m->msgnum = m->lineno = m->fsize = 0;
m->msgnum = 0;
m->lineno = 0;
m->fsize = 0;
m->offsets.clear();
m->quirks = 0;
}
@ -334,7 +336,7 @@ bool MimeHandlerMbox::skip_to_document(const std::string& ipath) {
return true;
}
bool MimeHandlerMbox::set_document_file_impl(const string& mt, const string &fn)
bool MimeHandlerMbox::set_document_file_impl(const string&, const string &fn)
{
LOGDEB("MimeHandlerMbox::set_document_file(" << fn << ")\n");
clear_impl();

View File

@ -39,7 +39,7 @@ class MimeHandlerNull : public RecollFilter {
}
virtual ~MimeHandlerNull() {}
virtual bool is_data_input_ok(DataInput input) const {
virtual bool is_data_input_ok(DataInput) const {
return true;
}

View File

@ -60,7 +60,7 @@ class MimeHandlerSymlink : public RecollFilter {
return true;
}
protected:
virtual bool set_document_file_impl(const string& mt, const string& fn) {
virtual bool set_document_file_impl(const string&, const string& fn) {
m_fn = fn;
return m_havedoc = true;
}

View File

@ -40,7 +40,7 @@ const int MB = 1024*1024;
const int KB = 1024;
// Process a plain text file
bool MimeHandlerText::set_document_file_impl(const string& mt, const string &fn)
bool MimeHandlerText::set_document_file_impl(const string&, const string &fn)
{
LOGDEB("MimeHandlerText::set_document_file: [" << fn << "] offs " <<
m_offs << "\n");
@ -94,7 +94,7 @@ bool MimeHandlerText::set_document_file_impl(const string& mt, const string &fn)
return true;
}
bool MimeHandlerText::set_document_string_impl(const string& mt,
bool MimeHandlerText::set_document_string_impl(const string&,
const string& otext)
{
m_text = otext;

View File

@ -32,7 +32,7 @@ class MimeHandlerUnknown : public RecollFilter {
: RecollFilter(cnf, id) {
}
virtual ~MimeHandlerUnknown() {}
virtual bool is_data_input_ok(DataInput input) const {
virtual bool is_data_input_ok(DataInput) const {
return true;
}

View File

@ -71,8 +71,7 @@ public:
return ctxt->myDoc;
}
virtual bool init(int64_t size, string *) {
LOGDEB1("FileScanXML: init: size " << size << endl);
virtual bool init(int64_t, string *) {
ctxt = xmlCreatePushParserCtxt(NULL, NULL, NULL, 0, m_fn.c_str());
if (ctxt == nullptr) {
LOGERR("FileScanXML: xmlCreatePushParserCtxt failed\n");
@ -276,8 +275,7 @@ bool MimeHandlerXslt::Internal::process_doc_or_string(
return true;
}
bool MimeHandlerXslt::set_document_file_impl(const std::string& mt,
const std::string &fn)
bool MimeHandlerXslt::set_document_file_impl(const string&, const string &fn)
{
LOGDEB0("MimeHandlerXslt::set_document_file_: fn: " << fn << endl);
if (!m || !m->ok) {
@ -290,8 +288,7 @@ bool MimeHandlerXslt::set_document_file_impl(const std::string& mt,
return ret;
}
bool MimeHandlerXslt::set_document_string_impl(const string& mt,
const string& txt)
bool MimeHandlerXslt::set_document_string_impl(const string&, const string& txt)
{
LOGDEB0("MimeHandlerXslt::set_document_string_\n");
if (!m || !m->ok) {

View File

@ -57,7 +57,7 @@ bool dump_contents(RclConfig *rclconfig, Rcl::Doc& idoc)
}
void output_fields(vector<string> fields, Rcl::Doc& doc,
Rcl::Query& query, Rcl::Db& rcldb, bool printnames)
Rcl::Query& query, Rcl::Db&, bool printnames)
{
if (fields.empty()) {
map<string,string>::const_iterator it;

View File

@ -60,7 +60,7 @@ int yylex(yy::parser::semantic_type *, yy::parser::location_type *,
void yyerror(char const *);
static void qualify(Rcl::SearchDataClauseDist *, const string &);
static void addSubQuery(WasaParserDriver *d,
static void addSubQuery(WasaParserDriver *,
Rcl::SearchData *sd, Rcl::SearchData *sq)
{
if (sd && sq)

View File

@ -25,7 +25,7 @@ int yylex(yy::parser::semantic_type *, yy::parser::location_type *,
void yyerror(char const *);
static void qualify(Rcl::SearchDataClauseDist *, const string &);
static void addSubQuery(WasaParserDriver *d,
static void addSubQuery(WasaParserDriver *,
Rcl::SearchData *sd, Rcl::SearchData *sq)
{
if (sd && sq)

View File

@ -33,7 +33,7 @@ using namespace Rcl;
void
yy::parser::error (const location_type& l, const std::string& m)
yy::parser::error (const location_type&, const std::string& m)
{
d->setreason(m);
}
@ -55,7 +55,7 @@ WasaParserDriver::WasaParserDriver(const RclConfig *c, const std::string sl,
const std::string& as)
: m_stemlang(sl), m_autosuffs(as), m_config(c),
m_index(0), m_result(0), m_haveDates(false),
m_maxSize((size_t)-1), m_minSize((size_t)-1)
m_maxSize(-1), m_minSize(-1)
{
}
@ -95,10 +95,10 @@ SearchData *WasaParserDriver::parse(const std::string& in)
if (m_haveDates) {
m_result->setDateSpan(&m_dates);
}
if (m_minSize != (size_t)-1) {
if (m_minSize != -1) {
m_result->setMinSize(m_minSize);
}
if (m_maxSize != (size_t)-1) {
if (m_maxSize != -1) {
m_result->setMaxSize(m_maxSize);
}
//if (m_result) m_result->dump(cout);
@ -193,13 +193,13 @@ bool WasaParserDriver::addClause(SearchData *sd,
// Handle "size" spec
if (!fld.compare("size")) {
char *cp;
size_t size = strtoll(cl->gettext().c_str(), &cp, 10);
int64_t size = strtoll(cl->gettext().c_str(), &cp, 10);
if (*cp != 0) {
switch (*cp) {
case 'k': case 'K': size *= 1000;break;
case 'm': case 'M': size *= 1000*1000;break;
case 'g': case 'G': size *= 1000*1000*1000;break;
case 't': case 'T': size *= size_t(1000)*1000*1000*1000;break;
case 't': case 'T': size *= int64_t(1000)*1000*1000*1000;break;
default:
m_reason = string("Bad multiplier suffix: ") + *cp;
delete cl;

View File

@ -78,8 +78,8 @@ private:
std::vector<std::string> m_nfiletypes;
bool m_haveDates;
DateInterval m_dates; // Restrict to date interval
size_t m_maxSize;
size_t m_minSize;
int64_t m_maxSize;
int64_t m_minSize;
std::string m_reason;

View File

@ -388,7 +388,7 @@ int Query::Native::abstractFromText(
Xapian::docid docid,
const vector<string>& matchTerms,
const multimap<double, vector<string>> byQ,
double totalweight,
double,
int ctxwords,
unsigned int maxtotaloccs,
vector<Snippet>& vabs,

View File

@ -502,7 +502,7 @@ void Query::Native::abstractCreateSnippetsVector(
int Query::Native::abstractFromIndex(
Rcl::Db::Native *ndb,
Xapian::docid docid,
const vector<string>& matchTerms,
const vector<string>&,
const multimap<double, vector<string>> byQ,
double totalweight,
int ctxwords,

View File

@ -1701,7 +1701,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;
struct tm tmb{0};
localtime_r(&mtime, &tmb);
char buf[50]; // It's actually 9, but use 50 to suppress warnings.
snprintf(buf, 50, "%04d%02d%02d",

View File

@ -334,7 +334,7 @@ bool Db::termMatch(int typ_sens, const string &lang, const string &_term,
}
bool Db::Native::idxTermMatch_p(
int typ, const string &lang, const string &root,
int typ, const string&, const string& root,
std::function<bool(const string& term,
Xapian::termcount colfreq,
Xapian::doccount termfreq)> client,

View File

@ -113,8 +113,8 @@ public:
const std::string& getStemLang() {return m_stemlang;}
void setMinSize(size_t size) {m_minSize = size;}
void setMaxSize(size_t size) {m_maxSize = size;}
void setMinSize(int64_t size) {m_minSize = size;}
void setMaxSize(int64_t size) {m_maxSize = size;}
/** Set date span for filtering results */
void setDateSpan(DateInterval *dip) {m_dates = *dip; m_haveDates = true;}
@ -179,8 +179,8 @@ private:
// something else (date and size specs)
bool m_haveDates;
DateInterval m_dates; // Restrict to date interval
size_t m_maxSize;
size_t m_minSize;
int64_t m_maxSize;
int64_t m_minSize;
// Printable expanded version of the complete query, retrieved/set
// from rcldb after the Xapian::setQuery() call

View File

@ -218,15 +218,15 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
}
if (m_minSize != size_t(-1) || m_maxSize != size_t(-1)) {
if (m_minSize != -1 || m_maxSize != -1) {
Xapian::Query sq;
string min = lltodecstr(m_minSize);
string max = lltodecstr(m_maxSize);
if (m_minSize == size_t(-1)) {
if (m_minSize == -1) {
string value(max);
leftzeropad(value, 12);
sq = Xapian::Query(Xapian::Query::OP_VALUE_LE, VALUE_SIZE, value);
} else if (m_maxSize == size_t(-1)) {
} else if (m_maxSize == -1) {
string value(min);
leftzeropad(value, 12);
sq = Xapian::Query(Xapian::Query::OP_VALUE_GE, VALUE_SIZE, value);
@ -331,7 +331,7 @@ public:
m_ts = ts;
}
bool takeword(const std::string &term, int pos, int bs, int be) {
bool takeword(const std::string &term, int pos, int, int be) {
m_alltermcount++;
if (m_lastpos < pos)
m_lastpos = pos;

View File

@ -17,11 +17,11 @@
#ifndef TEST_CHRONO
#include "autoconfig.h"
#include "chrono.h"
#include <time.h>
#include <iostream>
#include "chrono.h"
using namespace std;
#ifndef CLOCK_REALTIME
@ -31,19 +31,19 @@ typedef int clockid_t;
#define SECONDS(TS1, TS2) \
(float((TS2).tv_sec - (TS1).tv_sec) + \
float((TS2).tv_nsec - (TS1).tv_nsec) * 1e-9)
(double((TS2).tv_sec - (TS1).tv_sec) + \
double((TS2).tv_nsec - (TS1).tv_nsec) * 1e-9)
#define MILLIS(TS1, TS2) \
((long long)((TS2).tv_sec - (TS1).tv_sec) * 1000LL + \
((int64_t)((TS2).tv_sec - (TS1).tv_sec) * 1000LL + \
((TS2).tv_nsec - (TS1).tv_nsec) / 1000000)
#define MICROS(TS1, TS2) \
((long long)((TS2).tv_sec - (TS1).tv_sec) * 1000000LL + \
((int64_t)((TS2).tv_sec - (TS1).tv_sec) * 1000000LL + \
((TS2).tv_nsec - (TS1).tv_nsec) / 1000)
#define NANOS(TS1, TS2) \
((long long)((TS2).tv_sec - (TS1).tv_sec) * 1000000000LL + \
((int64_t)((TS2).tv_sec - (TS1).tv_sec) * 1000000000LL + \
((TS2).tv_nsec - (TS1).tv_nsec))
@ -69,7 +69,7 @@ typedef struct timeval {
long tv_usec;
} timeval;
int gettimeofday(struct timeval * tp, struct timezone * tzp)
int gettimeofday(struct timeval * tp, struct timezone * /*tzp*/)
{
// Note: some broken versions only have 8 trailing zero's, the
// correct epoch has 9 trailing zero's
@ -136,26 +136,26 @@ Chrono::Chrono()
}
// Reset and return value before rest in milliseconds
long Chrono::restart()
int64_t Chrono::restart()
{
TimeSpec now;
gettime(CLOCK_REALTIME, &now);
long ret = MILLIS(m_orig, now);
int64_t ret = MILLIS(m_orig, now);
m_orig = now;
return ret;
}
long Chrono::urestart()
int64_t Chrono::urestart()
{
TimeSpec now;
gettime(CLOCK_REALTIME, &now);
long ret = MICROS(m_orig, now);
int64_t ret = MICROS(m_orig, now);
m_orig = now;
return ret;
}
// Get current timer value, milliseconds
long Chrono::millis(bool frozen)
int64_t Chrono::millis(bool frozen)
{
if (frozen) {
return MILLIS(m_orig, o_now);
@ -167,7 +167,7 @@ long Chrono::millis(bool frozen)
}
//
long Chrono::micros(bool frozen)
int64_t Chrono::micros(bool frozen)
{
if (frozen) {
return MICROS(m_orig, o_now);
@ -178,7 +178,7 @@ long Chrono::micros(bool frozen)
}
}
long long Chrono::amicros() const
int64_t Chrono::amicros() const
{
TimeSpec ts;
ts.tv_sec = 0;
@ -187,7 +187,7 @@ long long Chrono::amicros() const
}
//
long long Chrono::nanos(bool frozen)
int64_t Chrono::nanos(bool frozen)
{
if (frozen) {
return NANOS(m_orig, o_now);
@ -198,7 +198,7 @@ long long Chrono::nanos(bool frozen)
}
}
float Chrono::secs(bool frozen)
double Chrono::secs(bool frozen)
{
if (frozen) {
return SECONDS(m_orig, o_now);

View File

@ -19,6 +19,7 @@
#define _CHRONO_H_INCLUDED_
#include <time.h>
#include <cstdint>
/** Easy interface to measuring time intervals */
class Chrono {
@ -27,9 +28,9 @@ public:
Chrono();
/** Re-store current time and return mS since init or last call */
long restart();
int64_t restart();
/** Re-store current time and return uS since init or last call */
long urestart();
int64_t urestart();
/** Snapshot current time to static storage */
static void refnow();
@ -41,13 +42,13 @@ public:
values from many chrono objects, like when examining timeouts
in a queue
*/
long long nanos(bool frozen = false);
long micros(bool frozen = false);
long millis(bool frozen = false);
float secs(bool frozen = false);
int64_t nanos(bool frozen = false);
int64_t micros(bool frozen = false);
int64_t millis(bool frozen = false);
double secs(bool frozen = false);
/** Return the absolute value of the current origin */
long long amicros() const;
int64_t amicros() const;
struct TimeSpec {
time_t tv_sec; /* Time in seconds */

View File

@ -455,8 +455,9 @@ public:
m_reason << "CirCache::weh: erase requested but not empty";
return false;
}
string buf(d.padsize, ' ');
if (write(m_fd, buf.c_str(), d.padsize) != (ssize_t)d.padsize) {
string buf((size_t)d.padsize, ' ');
if (write(m_fd, buf.c_str(), (size_t)d.padsize) !=
(ssize_t)d.padsize) {
m_reason << "CirCache::weh: write failed. errno " << errno;
return false;
}
@ -675,7 +676,7 @@ public:
CCScanHookRecord()
: headoffs(0), padsize(0) {
}
virtual status takeone(int64_t offs, const string& udi,
virtual status takeone(int64_t offs, const string&,
const EntryHeaderData& d) {
headoffs = offs;
padsize = d.padsize;

View File

@ -39,7 +39,7 @@ public:
Canceler(int tmsecs)
: m_timeosecs(tmsecs) {}
virtual void newData(int cnt) {
virtual void newData(int) {
if (m_starttime && (time(0) - m_starttime) > m_timeosecs) {
throw TimeoutExcept();
}

View File

@ -36,7 +36,7 @@
#error dlib.cpp not ported on this system
#endif
void *dlib_open(const std::string& libname, int flags)
void *dlib_open(const std::string& libname, int)
{
#ifdef _WIN32
return LoadLibraryA(libname.c_str());

View File

@ -534,7 +534,7 @@ int64_t fsTreeBytes(const string& topdir)
{
class bytesCB : public FsTreeWalkerCB {
public:
FsTreeWalker::Status processone(const string &path,
FsTreeWalker::Status processone(const string &,
const struct PathStat *st,
FsTreeWalker::CbFlag flg) {
if (flg == FsTreeWalker::FtwDirEnter ||

View File

@ -710,6 +710,7 @@ bool path_makepath(const string& ipath, int mode)
path = "/";
for (const auto& elem : elems) {
#ifdef _WIN32
PRETEND_USE(mode);
if (path == "/" && path_strlookslikedrive(elem)) {
path = "";
}

View File

@ -127,7 +127,7 @@ static const string& path_wingetrcltmpdir()
return tdir;
}
static bool path_gettempfilename(string& filename, string& reason)
static bool path_gettempfilename(string& filename, string&)
{
string tdir = path_wingetrcltmpdir();
wchar_t dbuf[MAX_PATH + 1];
@ -245,6 +245,7 @@ const string& path_pkgdatadir()
bool printableUrl(const string& fcharset, const string& in, string& out)
{
#ifdef _WIN32
PRETEND_USE(fcharset);
// On windows our paths are always utf-8
out = in;
#else

View File

@ -68,9 +68,9 @@ public:
// usage almost by 2 on both linux i586 and macosx (compared to
// just append()) Also tried a version with mmap, but it's
// actually slower on the mac and not faster on linux.
virtual bool init(int64_t size, string *reason) {
virtual bool init(int64_t size, string *) {
if (size > 0) {
m_data.reserve(size);
m_data.reserve((size_t)size);
}
return true;
}
@ -264,10 +264,10 @@ public:
return true;
}
static voidpf alloc_func(voidpf opaque, uInt items, uInt size) {
static voidpf alloc_func(voidpf, uInt items, uInt size) {
return malloc(items * size);
}
static void free_func(voidpf opaque, voidpf address) {
static void free_func(voidpf, voidpf address) {
free(address);
}
@ -372,7 +372,7 @@ public:
}
if (m_cnttoread != -1) {
toread = MIN(toread, (uint64_t)(m_cnttoread - totread));
toread = (size_t)MIN(toread, (uint64_t)(m_cnttoread - totread));
}
ssize_t n = static_cast<ssize_t>(read(fd, buf, toread));
if (n < 0) {
@ -491,6 +491,7 @@ public:
static size_t write_cb(void *pOpaque, mz_uint64 file_ofs,
const void *pBuf, size_t n) {
const char *cp = (const char*)pBuf;
PRETEND_USE(file_ofs);
LOGDEB1("write_cb: ofs " << file_ofs << " cnt " << n << " data: " <<
string(cp, n) << endl);
FileScanSourceZip *ths = (FileScanSourceZip *)pOpaque;

View File

@ -1290,7 +1290,7 @@ bool SimpleRegexp::simpleMatch(const string& val) const
return regex_search(val, m->res, m->expr);
}
string SimpleRegexp::getMatch(const string& val, int i) const
string SimpleRegexp::getMatch(const string&, int i) const
{
return m->res.str(i);
}

View File

@ -161,8 +161,6 @@ windows {
$$RECOLLDEPS/msvc/libxslt/libxslt-1.1.29/ \
$$RECOLLDEPS/msvc/libxml2/libxml2-2.9.4+dfsg1/include \
$$RECOLLDEPS/msvc/wlibiconv/include
QMAKE_CXXFLAGS_WARN_ON -= -w34100
QMAKE_CXXFLAGS += -wd4100
}
}