Suppressed many integer size warnings by a mix of type adjustments and casts,

none of which should have a real effect.
This commit is contained in:
Jean-Francois Dockes 2015-09-01 19:39:20 +02:00
parent 1b9673deb1
commit 535bf682f2
36 changed files with 107 additions and 103 deletions

View file

@ -47,7 +47,7 @@ BincStream::~BincStream(void)
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
string BincStream::popString(unsigned int size) string BincStream::popString(std::string::size_type size)
{ {
if (size > nstr.length()) if (size > nstr.length())
size = nstr.length(); size = nstr.length();

View file

@ -93,7 +93,7 @@ namespace Binc {
std::string tmp; std::string tmp;
for (std::string::const_iterator i = s.begin(); for (std::string::const_iterator i = s.begin();
i != s.end() && i + 1 != s.end(); i += 2) { i != s.end() && i + 1 != s.end(); i += 2) {
int n; ptrdiff_t n;
unsigned char c = *i; unsigned char c = *i;
unsigned char d = *(i + 1); unsigned char d = *(i + 1);
@ -145,7 +145,7 @@ namespace Binc {
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void chomp(std::string &s_in, const std::string &chars = " \t\r\n") inline void chomp(std::string &s_in, const std::string &chars = " \t\r\n")
{ {
int n = s_in.length(); std::string::size_type n = s_in.length();
while (n > 1 && chars.find(s_in[n - 1]) != std::string::npos) while (n > 1 && chars.find(s_in[n - 1]) != std::string::npos)
s_in.resize(n-- - 1); s_in.resize(n-- - 1);
} }
@ -290,7 +290,7 @@ namespace Binc {
BincStream &operator << (char t); BincStream &operator << (char t);
//-- //--
std::string popString(unsigned int size); std::string popString(std::string::size_type size);
//-- //--
char popChar(void); char popChar(void);

View file

@ -49,7 +49,7 @@ namespace Binc {
inline MimeInputSource(int fd, unsigned int start = 0); inline MimeInputSource(int fd, unsigned int start = 0);
virtual inline ~MimeInputSource(void); virtual inline ~MimeInputSource(void);
virtual inline size_t fillRaw(char *raw, size_t nbytes); virtual inline ssize_t fillRaw(char *raw, size_t nbytes);
virtual inline void reset(void); virtual inline void reset(void);
virtual inline bool fillInputBuffer(void); virtual inline bool fillInputBuffer(void);
@ -87,7 +87,7 @@ namespace Binc {
{ {
} }
inline size_t MimeInputSource::fillRaw(char *raw, size_t nbytes) inline ssize_t MimeInputSource::fillRaw(char *raw, size_t nbytes)
{ {
return read(fd, raw, nbytes); return read(fd, raw, nbytes);
} }
@ -179,7 +179,7 @@ namespace Binc {
class MimeInputSourceStream : public MimeInputSource { class MimeInputSourceStream : public MimeInputSource {
public: public:
inline MimeInputSourceStream(istream& s, unsigned int start = 0); inline MimeInputSourceStream(istream& s, unsigned int start = 0);
virtual inline size_t fillRaw(char *raw, size_t nb); virtual inline ssize_t fillRaw(char *raw, size_t nb);
virtual inline void reset(void); virtual inline void reset(void);
private: private:
istream& s; istream& s;
@ -191,7 +191,7 @@ namespace Binc {
{ {
} }
inline size_t MimeInputSourceStream::fillRaw(char *raw, size_t nb) inline ssize_t MimeInputSourceStream::fillRaw(char *raw, size_t nb)
{ {
// Why can't streams tell how many characters were actually read // Why can't streams tell how many characters were actually read
// when hitting eof ? // when hitting eof ?
@ -204,11 +204,11 @@ namespace Binc {
nbytes = nb; nbytes = nb;
} }
if (nbytes <= 0) { if (nbytes <= 0) {
return (size_t)-1; return (ssize_t)-1;
} }
s.read(raw, nbytes); s.read(raw, nbytes);
return nbytes; return static_cast<ssize_t>(nbytes);
} }
inline void MimeInputSourceStream::reset(void) inline void MimeInputSourceStream::reset(void)

View file

@ -306,7 +306,7 @@ void Binc::MimePart::parseMessageRFC822(vector<Binc::MimePart> *members,
bool Binc::MimePart::skipUntilBoundary(const string &delimiter, bool Binc::MimePart::skipUntilBoundary(const string &delimiter,
unsigned int *nlines, bool *eof) unsigned int *nlines, bool *eof)
{ {
int endpos = delimiter.length(); string::size_type endpos = delimiter.length();
char *delimiterqueue = 0; char *delimiterqueue = 0;
int delimiterpos = 0; int delimiterpos = 0;
const char *delimiterStr = delimiter.c_str(); const char *delimiterStr = delimiter.c_str();
@ -340,7 +340,7 @@ bool Binc::MimePart::skipUntilBoundary(const string &delimiter,
delimiterpos = 0; delimiterpos = 0;
if (compareStringToQueue(delimiterStr, delimiterqueue, if (compareStringToQueue(delimiterStr, delimiterqueue,
delimiterpos, endpos)) { delimiterpos, int(endpos))) {
foundBoundary = true; foundBoundary = true;
break; break;
} }
@ -451,7 +451,7 @@ void Binc::MimePart::parseMultipart(const string &boundary,
skipUntilBoundary(delimiter, nlines, eof); skipUntilBoundary(delimiter, nlines, eof);
if (!eof) if (!eof)
*boundarysize = delimiter.size(); *boundarysize = int(delimiter.size());
postBoundaryProcessing(eof, nlines, boundarysize, foundendofpart); postBoundaryProcessing(eof, nlines, boundarysize, foundendofpart);
@ -484,7 +484,7 @@ void Binc::MimePart::parseMultipart(const string &boundary,
skipUntilBoundary(delimiter, nlines, eof); skipUntilBoundary(delimiter, nlines, eof);
if (!*eof) if (!*eof)
*boundarysize = delimiter.size(); *boundarysize = int(delimiter.size());
postBoundaryProcessing(eof, nlines, boundarysize, foundendofpart); postBoundaryProcessing(eof, nlines, boundarysize, foundendofpart);
} }
@ -528,7 +528,7 @@ void Binc::MimePart::parseSinglePart(const string &toboundary,
// *boundarysize = _toboundary.length(); // *boundarysize = _toboundary.length();
char *boundaryqueue = 0; char *boundaryqueue = 0;
int endpos = _toboundary.length(); size_t endpos = _toboundary.length();
if (toboundary != "") { if (toboundary != "") {
boundaryqueue = new char[endpos]; boundaryqueue = new char[endpos];
memset(boundaryqueue, 0, endpos); memset(boundaryqueue, 0, endpos);
@ -553,8 +553,8 @@ void Binc::MimePart::parseSinglePart(const string &toboundary,
boundarypos = 0; boundarypos = 0;
if (compareStringToQueue(_toboundaryStr, boundaryqueue, if (compareStringToQueue(_toboundaryStr, boundaryqueue,
boundarypos, endpos)) { boundarypos, int(endpos))) {
*boundarysize = _toboundary.length(); *boundarysize = static_cast<int>(_toboundary.length());
break; break;
} }
} }

View file

@ -119,7 +119,7 @@ int Binc::MimePart::doParseOnlyHeader(MimeInputSource *ms,
if (c == '\n') ++nlines; if (c == '\n') ++nlines;
if (c == ':') break; if (c == ':') break;
if (c == '\n') { if (c == '\n') {
for (int i = name.length() - 1; i >= 0; --i) for (string::size_type i = name.length() - 1; i >= 0; --i)
mimeSource->ungetChar(); mimeSource->ungetChar();
quit = true; quit = true;

View file

@ -639,7 +639,7 @@ bool RclConfig::inStopSuffixes(const string& fni)
it != stoplist.end(); it++) { it != stoplist.end(); it++) {
STOPSUFFIXES->insert(SfString(stringtolower(*it))); STOPSUFFIXES->insert(SfString(stringtolower(*it)));
if (m_maxsufflen < it->length()) if (m_maxsufflen < it->length())
m_maxsufflen = it->length(); m_maxsufflen = int(it->length());
} }
} }

View file

@ -219,11 +219,11 @@ bool TextSplit::o_deHyphenate = false;
// Final term checkpoint: do some checking (the kind which is simpler // Final term checkpoint: do some checking (the kind which is simpler
// to do here than in the main loop), then send term to our client. // to do here than in the main loop), then send term to our client.
inline bool TextSplit::emitterm(bool isspan, string &w, int pos, inline bool TextSplit::emitterm(bool isspan, string &w, int pos,
int btstart, int btend) size_t btstart, size_t btend)
{ {
LOGDEB2(("TextSplit::emitterm: [%s] pos %d\n", w.c_str(), pos)); LOGDEB2(("TextSplit::emitterm: [%s] pos %d\n", w.c_str(), pos));
unsigned int l = w.length(); size_t l = w.length();
#ifdef TEXTSPLIT_STATS #ifdef TEXTSPLIT_STATS
// Update word length statistics. Do this before we filter out // Update word length statistics. Do this before we filter out
@ -247,9 +247,9 @@ inline bool TextSplit::emitterm(bool isspan, string &w, int pos,
} }
} }
if (pos != m_prevpos || l != m_prevlen) { if (pos != m_prevpos || l != m_prevlen) {
bool ret = takeword(w, pos, btstart, btend); bool ret = takeword(w, pos, int(btstart), int(btend));
m_prevpos = pos; m_prevpos = pos;
m_prevlen = w.length(); m_prevlen = int(w.length());
return ret; return ret;
} }
LOGDEB2(("TextSplit::emitterm:dup: [%s] pos %d\n", w.c_str(), pos)); LOGDEB2(("TextSplit::emitterm:dup: [%s] pos %d\n", w.c_str(), pos));
@ -295,7 +295,7 @@ bool TextSplit::span_is_acronym(string *acronym)
// Generate terms from span. Have to take into account the // Generate terms from span. Have to take into account the
// flags: ONLYSPANS, NOSPANS, noNumbers // flags: ONLYSPANS, NOSPANS, noNumbers
bool TextSplit::words_from_span(int bp) bool TextSplit::words_from_span(size_t bp)
{ {
#if 0 #if 0
cerr << "Span: [" << m_span << "] " << " w_i_s size: " << cerr << "Span: [" << m_span << "] " << " w_i_s size: " <<
@ -307,10 +307,10 @@ bool TextSplit::words_from_span(int bp)
} }
cerr << endl; cerr << endl;
#endif #endif
unsigned int spanwords = m_words_in_span.size(); int spanwords = int(m_words_in_span.size());
int pos = m_spanpos; int pos = m_spanpos;
// Byte position of the span start // Byte position of the span start
int spboffs = bp - m_span.size(); size_t spboffs = bp - m_span.size();
if (o_deHyphenate && spanwords == 2 && if (o_deHyphenate && spanwords == 2 &&
m_span[m_words_in_span[0].second] == '-') { m_span[m_words_in_span[0].second] == '-') {
@ -324,13 +324,13 @@ bool TextSplit::words_from_span(int bp)
m_spanpos, spboffs, spboffs + m_words_in_span[1].second); m_spanpos, spboffs, spboffs + m_words_in_span[1].second);
} }
for (unsigned int i = 0; for (int i = 0;
i < ((m_flags&TXTS_ONLYSPANS) ? 1 : spanwords); i < ((m_flags&TXTS_ONLYSPANS) ? 1 : spanwords);
i++, pos++) { i++, pos++) {
int deb = m_words_in_span[i].first; int deb = m_words_in_span[i].first;
for (unsigned int j = ((m_flags&TXTS_ONLYSPANS) ? spanwords-1 : i); for (int j = ((m_flags&TXTS_ONLYSPANS) ? spanwords-1 : i);
j < ((m_flags&TXTS_NOSPANS) ? i+1 : spanwords); j < ((m_flags&TXTS_NOSPANS) ? i+1 : spanwords);
j++) { j++) {
@ -364,11 +364,11 @@ bool TextSplit::words_from_span(int bp)
* @param spanerase Set if the current span is at its end. Process it. * @param spanerase Set if the current span is at its end. Process it.
* @param bp The current BYTE position in the stream * @param bp The current BYTE position in the stream
*/ */
inline bool TextSplit::doemit(bool spanerase, int bp) inline bool TextSplit::doemit(bool spanerase, size_t bp)
{ {
LOGDEB2(("TextSplit::doemit: sper %d bp %d spp %d spanwords %u wS %d wL %d " LOGDEB2(("TextSplit::doemit: sper %d bp %d spp %d spanwords %u wS %d wL %d "
"inn %d span [%s]\n", "inn %d span [%s]\n",
spanerase, bp, m_spanpos, m_words_in_span.size(), spanerase, int(bp), m_spanpos, m_words_in_span.size(),
m_wordStart, m_wordLen, m_inNumber, m_span.c_str())); m_wordStart, m_wordLen, m_inNumber, m_span.c_str()));
if (m_wordLen) { if (m_wordLen) {
@ -406,8 +406,8 @@ inline bool TextSplit::doemit(bool spanerase, int bp)
case '\'': case '\'':
m_span.resize(m_span.length()-1); m_span.resize(m_span.length()-1);
if (m_words_in_span.size() && if (m_words_in_span.size() &&
m_words_in_span.back().second > m_span.size()) m_words_in_span.back().second > int(m_span.size()))
m_words_in_span.back().second = m_span.size(); m_words_in_span.back().second = int(m_span.size());
if (--bp < 0) if (--bp < 0)
bp = 0; bp = 0;
break; break;
@ -424,7 +424,7 @@ inline bool TextSplit::doemit(bool spanerase, int bp)
} else { } else {
m_wordStart = m_span.length(); m_wordStart = int(m_span.length());
} }
@ -832,16 +832,16 @@ bool TextSplit::cjk_to_words(Utf8Iter *itp, unsigned int *cp)
} }
// Take note of byte offset for this character. // Take note of byte offset for this character.
boffs[nchars-1] = it.getBpos(); boffs[nchars-1] = int(it.getBpos());
// Output all new ngrams: they begin at each existing position // Output all new ngrams: they begin at each existing position
// and end after the new character. onlyspans->only output // and end after the new character. onlyspans->only output
// maximum words, nospans=> single chars // maximum words, nospans=> single chars
if (!(m_flags & TXTS_ONLYSPANS) || nchars == o_CJKNgramLen) { if (!(m_flags & TXTS_ONLYSPANS) || nchars == o_CJKNgramLen) {
unsigned int btend = it.getBpos() + it.getBlen(); int btend = int(it.getBpos() + it.getBlen());
unsigned int loopbeg = (m_flags & TXTS_NOSPANS) ? nchars-1 : 0; int loopbeg = (m_flags & TXTS_NOSPANS) ? nchars-1 : 0;
unsigned int loopend = (m_flags & TXTS_ONLYSPANS) ? 1 : nchars; int loopend = (m_flags & TXTS_ONLYSPANS) ? 1 : nchars;
for (unsigned int i = loopbeg; i < loopend; i++) { for (int i = loopbeg; i < loopend; i++) {
if (!takeword(it.buffer().substr(boffs[i], if (!takeword(it.buffer().substr(boffs[i],
btend-boffs[i]), btend-boffs[i]),
m_wordpos - (nchars-i-1), boffs[i], btend)) { m_wordpos - (nchars-i-1), boffs[i], btend)) {
@ -862,7 +862,7 @@ bool TextSplit::cjk_to_words(Utf8Iter *itp, unsigned int *cp)
// If onlyspans is set, there may be things to flush in the buffer // If onlyspans is set, there may be things to flush in the buffer
// first // first
if ((m_flags & TXTS_ONLYSPANS) && nchars > 0 && nchars != o_CJKNgramLen) { if ((m_flags & TXTS_ONLYSPANS) && nchars > 0 && nchars != o_CJKNgramLen) {
unsigned int btend = it.getBpos(); // Current char is out int btend = int(it.getBpos()); // Current char is out
if (!takeword(it.buffer().substr(boffs[0], btend-boffs[0]), if (!takeword(it.buffer().substr(boffs[0], btend-boffs[0]),
m_wordpos - nchars, m_wordpos - nchars,
boffs[0], btend)) { boffs[0], btend)) {

View file

@ -201,7 +201,7 @@ private:
// It may happen that our cleanup would result in emitting the // It may happen that our cleanup would result in emitting the
// same term twice. We try to avoid this // same term twice. We try to avoid this
int m_prevpos; int m_prevpos;
unsigned int m_prevlen; int m_prevlen;
#ifdef TEXTSPLIT_STATS #ifdef TEXTSPLIT_STATS
// Stats counters. These are processed in TextSplit rather than by a // Stats counters. These are processed in TextSplit rather than by a
@ -215,11 +215,11 @@ private:
// This processes cjk text: // This processes cjk text:
bool cjk_to_words(Utf8Iter *it, unsigned int *cp); bool cjk_to_words(Utf8Iter *it, unsigned int *cp);
bool emitterm(bool isspan, std::string &term, int pos, int bs, int be); bool emitterm(bool isspan, std::string &term, int pos, size_t bs,size_t be);
bool doemit(bool spanerase, int bp); bool doemit(bool spanerase, size_t bp);
void discardspan(); void discardspan();
bool span_is_acronym(std::string *acronym); bool span_is_acronym(std::string *acronym);
bool words_from_span(int bp); bool words_from_span(size_t bp);
}; };
#endif /* _TEXTSPLIT_H_INCLUDED_ */ #endif /* _TEXTSPLIT_H_INCLUDED_ */

View file

@ -144,13 +144,11 @@ FsIndexer::~FsIndexer()
void *status; void *status;
if (m_haveInternQ) { if (m_haveInternQ) {
status = m_iwqueue.setTerminateAndWait(); status = m_iwqueue.setTerminateAndWait();
LOGDEB0(("FsIndexer: internfile wrkr status: %ld (1->ok)\n", LOGDEB0(("FsIndexer: internfile wrkr status: %p (1->ok)\n", status));
long(status)));
} }
if (m_haveSplitQ) { if (m_haveSplitQ) {
status = m_dwqueue.setTerminateAndWait(); status = m_dwqueue.setTerminateAndWait();
LOGDEB0(("FsIndexer: dbupd worker status: %ld (1->ok)\n", LOGDEB0(("FsIndexer: dbupd worker status: %p (1->ok)\n", status));
long(status)));
} }
delete m_stableconfig; delete m_stableconfig;
#endif // IDX_THREADS #endif // IDX_THREADS

View file

@ -292,7 +292,7 @@ static bool checktopdirs(RclConfig *config, vector<string>& nonexist)
} }
return false; return false;
} }
if (access(it->c_str(), 0) < 0) { if (!path_exists(*it)) {
nonexist.push_back(*it); nonexist.push_back(*it);
} }
} }
@ -302,7 +302,7 @@ static bool checktopdirs(RclConfig *config, vector<string>& nonexist)
if (config->getConfParam("skippedPaths", &tdl, true)) { if (config->getConfParam("skippedPaths", &tdl, true)) {
for (vector<string>::iterator it = tdl.begin(); it != tdl.end(); it++) { for (vector<string>::iterator it = tdl.begin(); it != tdl.end(); it++) {
*it = path_tildexpand(*it); *it = path_tildexpand(*it);
if (access(it->c_str(), 0) < 0) { if (!path_exists(*it)) {
nonexist.push_back(*it); nonexist.push_back(*it);
} }
} }
@ -311,7 +311,7 @@ static bool checktopdirs(RclConfig *config, vector<string>& nonexist)
if (config->getConfParam("daemSkippedPaths", &tdl, true)) { if (config->getConfParam("daemSkippedPaths", &tdl, true)) {
for (vector<string>::iterator it = tdl.begin(); it != tdl.end(); it++) { for (vector<string>::iterator it = tdl.begin(); it != tdl.end(); it++) {
*it = path_tildexpand(*it); *it = path_tildexpand(*it);
if (access(it->c_str(), 0) < 0) { if (!path_exists(*it)) {
nonexist.push_back(*it); nonexist.push_back(*it);
} }
} }

View file

@ -108,7 +108,7 @@ namespace Dijon
*/ */
virtual bool set_document_data(const std::string& mtype, virtual bool set_document_data(const std::string& mtype,
const char *data_ptr, const char *data_ptr,
unsigned int data_length) = 0; size_t data_length) = 0;
/** (Re)initializes the filter with the given data. /** (Re)initializes the filter with the given data.
* Call next_document() to position the filter onto the first document. * Call next_document() to position the filter onto the first document.

View file

@ -629,7 +629,7 @@ void FileInterner::popHandler()
{ {
if (m_handlers.empty()) if (m_handlers.empty())
return; return;
int i = m_handlers.size() - 1; size_t i = m_handlers.size() - 1;
if (m_tmpflgs[i]) { if (m_tmpflgs[i]) {
m_tempfiles.pop_back(); m_tempfiles.pop_back();
m_tmpflgs[i] = false; m_tmpflgs[i] = false;

View file

@ -128,7 +128,7 @@ public:
return -1; return -1;
} }
mbhoff_type offset = -1; mbhoff_type offset = -1;
int ret; size_t ret;
if ((ret = fread(&offset, 1, sizeof(mbhoff_type), fp)) if ((ret = fread(&offset, 1, sizeof(mbhoff_type), fp))
!= sizeof(mbhoff_type)) { != sizeof(mbhoff_type)) {
LOGDEB0(("MboxCache::get_offsets: read ret %d errno %d\n", LOGDEB0(("MboxCache::get_offsets: read ret %d errno %d\n",
@ -318,7 +318,7 @@ bool MimeHandlerMbox::set_document_file(const string& mt, const string &fn)
typedef char line_type[LL+10]; typedef char line_type[LL+10];
static inline void stripendnl(line_type& line, int& ll) static inline void stripendnl(line_type& line, int& ll)
{ {
ll = strlen(line); ll = int(strlen(line));
while (ll > 0) { while (ll > 0) {
if (line[ll-1] == '\n' || line[ll-1] == '\r') { if (line[ll-1] == '\n' || line[ll-1] == '\r') {
line[ll-1] = 0; line[ll-1] = 0;

View file

@ -86,7 +86,7 @@ public:
return false; return false;
} }
virtual bool set_document_data(const std::string& mtype, virtual bool set_document_data(const std::string& mtype,
const char *cp, unsigned int sz) const char *cp, size_t sz)
{ {
return set_document_string(mtype, std::string(cp, sz)); return set_document_string(mtype, std::string(cp, sz));
} }

View file

@ -35,7 +35,7 @@ using std::list;
bool RclDHistoryEntry::encode(string& value) bool RclDHistoryEntry::encode(string& value)
{ {
char chartime[30]; char chartime[30];
sprintf(chartime,"%ld", unixtime); sprintf(chartime,"%lld", (long long)unixtime);
string budi; string budi;
base64_encode(udi, budi); base64_encode(udi, budi);
value = string("U ") + string(chartime) + " " + budi; value = string("U ") + string(chartime) + " " + budi;
@ -161,5 +161,5 @@ int DocSequenceHistory::getResCnt()
{ {
if (m_hlist.empty()) if (m_hlist.empty())
m_hlist = getDocHistory(m_hist); m_hlist = getDocHistory(m_hist);
return m_hlist.size(); return int(m_hlist.size());
} }

View file

@ -16,6 +16,7 @@
*/ */
#ifndef _DOCSEQHIST_H_INCLUDED_ #ifndef _DOCSEQHIST_H_INCLUDED_
#define _DOCSEQHIST_H_INCLUDED_ #define _DOCSEQHIST_H_INCLUDED_
#include <time.h>
#include "docseq.h" #include "docseq.h"
#include "dynconf.h" #include "dynconf.h"
@ -28,13 +29,13 @@ namespace Rcl {
class RclDHistoryEntry : public DynConfEntry { class RclDHistoryEntry : public DynConfEntry {
public: public:
RclDHistoryEntry() : unixtime(0) {} RclDHistoryEntry() : unixtime(0) {}
RclDHistoryEntry(long t, const string& u) RclDHistoryEntry(time_t t, const string& u)
: unixtime(t), udi(u) {} : unixtime(t), udi(u) {}
virtual ~RclDHistoryEntry() {} virtual ~RclDHistoryEntry() {}
virtual bool decode(const string &value); virtual bool decode(const string &value);
virtual bool encode(string& value); virtual bool encode(string& value);
virtual bool equal(const DynConfEntry& other); virtual bool equal(const DynConfEntry& other);
long unixtime; time_t unixtime;
string udi; string udi;
}; };
@ -57,7 +58,7 @@ private:
Rcl::Db *m_db; Rcl::Db *m_db;
RclDynConf *m_hist; RclDynConf *m_hist;
int m_prevnum; int m_prevnum;
long m_prevtime; time_t m_prevtime;
std::string m_description; // This is just an nls translated 'doc history' std::string m_description; // This is just an nls translated 'doc history'
std::list<RclDHistoryEntry> m_hlist; std::list<RclDHistoryEntry> m_hlist;
std::list<RclDHistoryEntry>::const_iterator m_it; std::list<RclDHistoryEntry>::const_iterator m_it;

View file

@ -54,8 +54,8 @@ struct MatchEntry {
pair<int, int> offs; pair<int, int> offs;
// Index of the search group this comes from: this is to relate a // Index of the search group this comes from: this is to relate a
// match to the original user input. // match to the original user input.
unsigned int grpidx; size_t grpidx;
MatchEntry(int sta, int sto, unsigned int idx) MatchEntry(int sta, int sto, size_t idx)
: offs(sta, sto), grpidx(idx) : offs(sta, sto), grpidx(idx)
{ {
} }
@ -105,7 +105,7 @@ class TextSplitPTR : public TextSplit {
// pos, bts, bte)); // pos, bts, bte));
// If this word is a search term, remember its byte-offset span. // If this word is a search term, remember its byte-offset span.
map<string, unsigned int>::const_iterator it = m_terms.find(dumb); map<string, size_t>::const_iterator it = m_terms.find(dumb);
if (it != m_terms.end()) { if (it != m_terms.end()) {
tboffs.push_back(MatchEntry(bts, bte, (*it).second)); tboffs.push_back(MatchEntry(bts, bte, (*it).second));
} }
@ -135,7 +135,7 @@ private:
int m_wcount; int m_wcount;
// In: user query terms // In: user query terms
map<string, unsigned int> m_terms; map<string, size_t> m_terms;
// m_gterms holds all the terms in m_groups, as a set for quick lookup // m_gterms holds all the terms in m_groups, as a set for quick lookup
set<string> m_gterms; set<string> m_gterms;
@ -214,7 +214,7 @@ static bool do_proximity_test(int window, vector<vector<int>* >& plists,
bool TextSplitPTR::matchGroup(unsigned int grpidx) bool TextSplitPTR::matchGroup(unsigned int grpidx)
{ {
const vector<string>& terms = m_hdata.groups[grpidx]; const vector<string>& terms = m_hdata.groups[grpidx];
int window = m_hdata.groups[grpidx].size() + m_hdata.slacks[grpidx]; int window = int(m_hdata.groups[grpidx].size() + m_hdata.slacks[grpidx]);
LOGDEB1(("TextSplitPTR::matchGroup:d %d: %s\n", window, LOGDEB1(("TextSplitPTR::matchGroup:d %d: %s\n", window,
vecStringToString(terms).c_str())); vecStringToString(terms).c_str()));
@ -270,7 +270,7 @@ bool TextSplitPTR::matchGroup(unsigned int grpidx)
for (vector<int>::iterator it = plists[0]->begin(); for (vector<int>::iterator it = plists[0]->begin();
it != plists[0]->end(); it++) { it != plists[0]->end(); it++) {
int pos = *it; int pos = *it;
int sta = int(10E9), sto = 0; int sta = INT_MAX, sto = 0;
LOGDEB2(("MatchGroup: Testing at pos %d\n", pos)); LOGDEB2(("MatchGroup: Testing at pos %d\n", pos));
if (do_proximity_test(window,plists, 1, pos, pos, &sta, &sto, minpos)) { if (do_proximity_test(window,plists, 1, pos, pos, &sta, &sto, minpos)) {
LOGDEB1(("TextSplitPTR::matchGroup: MATCH termpos [%d,%d]\n", LOGDEB1(("TextSplitPTR::matchGroup: MATCH termpos [%d,%d]\n",
@ -417,10 +417,10 @@ bool PlainToRich::plaintorich(const string& in,
// If we still have terms positions, check (byte) position. If // If we still have terms positions, check (byte) position. If
// we are at or after a term match, mark. // we are at or after a term match, mark.
if (tPosIt != tPosEnd) { if (tPosIt != tPosEnd) {
int ibyteidx = chariter.getBpos(); size_t ibyteidx = chariter.getBpos();
if (ibyteidx == tPosIt->offs.first) { if (ibyteidx == tPosIt->offs.first) {
if (!intag && ibyteidx >= (int)headend) { if (!intag && ibyteidx >= (int)headend) {
*olit += startMatch(tPosIt->grpidx); *olit += startMatch((unsigned int)(tPosIt->grpidx));
} }
inrcltag = 1; inrcltag = 1;
} else if (ibyteidx == tPosIt->offs.second) { } else if (ibyteidx == tPosIt->offs.second) {

View file

@ -77,7 +77,7 @@ void ResListPager::resultPageNext()
if (m_winfirst < 0) { if (m_winfirst < 0) {
m_winfirst = 0; m_winfirst = 0;
} else { } else {
m_winfirst += m_respage.size(); m_winfirst += int(m_respage.size());
} }
// Get the next page of results. Note that we look ahead by one to // Get the next page of results. Note that we look ahead by one to
// determine if there is actually a next page // determine if there is actually a next page
@ -102,7 +102,7 @@ void ResListPager::resultPageNext()
// Next button. We'd need to remove the Next link from the page // Next button. We'd need to remove the Next link from the page
// too. // too.
// Restore the m_winfirst value, let the current result vector alone // Restore the m_winfirst value, let the current result vector alone
m_winfirst -= m_respage.size(); m_winfirst -= int(m_respage.size());
} else { } else {
// No results at all (on first page) // No results at all (on first page)
m_winfirst = -1; m_winfirst = -1;
@ -213,9 +213,9 @@ void ResListPager::displayDoc(RclConfig *config, int i, Rcl::Doc& doc,
// Size information. We print both doc and file if they differ a lot // Size information. We print both doc and file if they differ a lot
off_t fsize = -1, dsize = -1; off_t fsize = -1, dsize = -1;
if (!doc.dbytes.empty()) if (!doc.dbytes.empty())
dsize = atoll(doc.dbytes.c_str()); dsize = static_cast<off_t>(atoll(doc.dbytes.c_str()));
if (!doc.fbytes.empty()) if (!doc.fbytes.empty())
fsize = atoll(doc.fbytes.c_str()); fsize = static_cast<off_t>(atoll(doc.fbytes.c_str()));
string sizebuf; string sizebuf;
if (dsize > 0) { if (dsize > 0) {
sizebuf = displayableBytes(dsize); sizebuf = displayableBytes(dsize);

View file

@ -64,7 +64,7 @@ public:
int pageLastDocNum() { int pageLastDocNum() {
if (m_winfirst < 0 || m_respage.size() == 0) if (m_winfirst < 0 || m_respage.size() == 0)
return -1; return -1;
return m_winfirst + m_respage.size() - 1; return m_winfirst + int(m_respage.size()) - 1;
} }
virtual int pageSize() const {return m_pagesize;} virtual int pageSize() const {return m_pagesize;}
void pageNext(); void pageNext();

View file

@ -39,7 +39,7 @@ class DocSeqSorted : public DocSeqModifier {
virtual bool canSort() {return true;} virtual bool canSort() {return true;}
virtual bool setSortSpec(const DocSeqSortSpec &sortspec); virtual bool setSortSpec(const DocSeqSortSpec &sortspec);
virtual bool getDoc(int num, Rcl::Doc &doc, string *sh = 0); virtual bool getDoc(int num, Rcl::Doc &doc, string *sh = 0);
virtual int getResCnt() {return m_docsp.size();} virtual int getResCnt() {return int(m_docsp.size());}
private: private:
DocSeqSortSpec m_spec; DocSeqSortSpec m_spec;
std::vector<Rcl::Doc> m_docs; std::vector<Rcl::Doc> m_docs;

View file

@ -161,10 +161,10 @@ bool WasaParserDriver::addClause(SearchData *sd,
size_t size = strtoll(cl->gettext().c_str(), &cp, 10); size_t size = strtoll(cl->gettext().c_str(), &cp, 10);
if (*cp != 0) { if (*cp != 0) {
switch (*cp) { switch (*cp) {
case 'k': case 'K': size *= 1E3;break; case 'k': case 'K': size *= 1000;break;
case 'm': case 'M': size *= 1E6;break; case 'm': case 'M': size *= 1000*1000;break;
case 'g': case 'G': size *= 1E9;break; case 'g': case 'G': size *= 1000*1000*1000;break;
case 't': case 'T': size *= 1E12;break; case 't': case 'T': size *= size_t(1000)*1000*1000*1000;break;
default: default:
m_reason = string("Bad multiplier suffix: ") + *cp; m_reason = string("Bad multiplier suffix: ") + *cp;
delete cl; delete cl;

View file

@ -433,7 +433,7 @@ bool Db::Native::dbDataToRclDoc(Xapian::docid docid, std::string &data,
string dbdir = m_rcldb->m_basedir; string dbdir = m_rcldb->m_basedir;
doc.idxi = 0; doc.idxi = 0;
if (!m_rcldb->m_extraDbs.empty()) { if (!m_rcldb->m_extraDbs.empty()) {
unsigned int idxi = whatDbIdx(docid); int idxi = int(whatDbIdx(docid));
// idxi is in [0, extraDbs.size()]. 0 is for the main index, // idxi is in [0, extraDbs.size()]. 0 is for the main index,
// idxi-1 indexes into the additional dbs array. // idxi-1 indexes into the additional dbs array.
@ -555,7 +555,7 @@ int Db::Native::getPageNumberForPosition(const vector<int>& pbreaks, int pos)
return -1; return -1;
vector<int>::const_iterator it = vector<int>::const_iterator it =
upper_bound(pbreaks.begin(), pbreaks.end(), pos); upper_bound(pbreaks.begin(), pbreaks.end(), pos);
return it - pbreaks.begin() + 1; return int(it - pbreaks.begin() + 1);
} }
// Note: we're passed a Xapian::Document* because Xapian // Note: we're passed a Xapian::Document* because Xapian

View file

@ -242,7 +242,7 @@ void SearchData::simplify()
j < i + clsubp->getSub()->m_query.size(); j++) { j < i + clsubp->getSub()->m_query.size(); j++) {
m_query[j]->setParent(this); m_query[j]->setParent(this);
} }
i += clsubp->getSub()->m_query.size() - 1; i += int(clsubp->getSub()->m_query.size()) - 1;
// We don't want the clauses to be deleted when the parent is, as we // We don't want the clauses to be deleted when the parent is, as we
// know own them. // know own them.

View file

@ -376,7 +376,7 @@ protected:
std::string m_field; // Field specification if any std::string m_field; // Field specification if any
HighlightData m_hldata; HighlightData m_hldata;
// Current count of Xapian clauses, to check against expansion limit // Current count of Xapian clauses, to check against expansion limit
int m_curcl; size_t m_curcl;
bool processUserString(Rcl::Db &db, const string &iq, bool processUserString(Rcl::Db &db, const string &iq,
std::string &ermsg, std::string &ermsg,
void* pq, int slack = 0, bool useNear = false); void* pq, int slack = 0, bool useNear = false);

View file

@ -840,7 +840,7 @@ bool SearchDataClauseSimple::processUserString(Rcl::Db &db, const string &iq,
tpq.setTSQ(&splitter); tpq.setTSQ(&splitter);
splitter.text_to_words(*it); splitter.text_to_words(*it);
slack += tpq.lastpos() - tpq.terms().size() + 1; slack += tpq.lastpos() - int(tpq.terms().size()) + 1;
LOGDEB0(("strToXapianQ: termcount: %d\n", tpq.terms().size())); LOGDEB0(("strToXapianQ: termcount: %d\n", tpq.terms().size()));
switch (tpq.terms().size() + terminc) { switch (tpq.terms().size() + terminc) {

View file

@ -217,7 +217,7 @@ void base64_encode(const string &in, string &out)
out.clear(); out.clear();
int srclength = in.length(); string::size_type srclength = in.length();
int sidx = 0; int sidx = 0;
while (2 < srclength) { while (2 < srclength) {
input[0] = in[sidx++]; input[0] = in[sidx++];

View file

@ -1013,10 +1013,10 @@ bool CirCache::put(const string& udi, const ConfSimple *iconf,
unsigned short flags = 0; unsigned short flags = 0;
TempBuf compbuf; TempBuf compbuf;
if (!(iflags & NoCompHint)) { if (!(iflags & NoCompHint)) {
ULONG len = compressBound(data.size()); uLong len = compressBound(static_cast<uLong>(data.size()));
char *bf = compbuf.setsize(len); char *bf = compbuf.setsize(len);
if (bf != 0 && if (bf != 0 &&
compress((Bytef*)bf, &len, (Bytef*)data.c_str(), data.size()) compress((Bytef*)bf, &len, (Bytef*)data.c_str(), static_cast<uLong>(data.size()))
== Z_OK) { == Z_OK) {
if (float(len) < 0.9 * float(data.size())) { if (float(len) < 0.9 * float(data.size())) {
// bf is local but it's our static buffer address // bf is local but it's our static buffer address
@ -1034,7 +1034,7 @@ bool CirCache::put(const string& udi, const ConfSimple *iconf,
} }
// Characteristics for the new entry. // Characteristics for the new entry.
int nsize = CIRCACHE_HEADER_SIZE + dic.size() + datalen; off_t nsize = CIRCACHE_HEADER_SIZE + dic.size() + datalen;
off_t nwriteoffs = m_d->m_oheadoffs; off_t nwriteoffs = m_d->m_oheadoffs;
off_t npadsize = 0; off_t npadsize = 0;
bool extending = false; bool extending = false;

View file

@ -68,7 +68,7 @@ void ConfSimple::parseinput(istream &input)
} }
{ {
int ll = strlen(cline); size_t ll = strlen(cline);
while (ll > 0 && (cline[ll-1] == '\n' || cline[ll-1] == '\r')) { while (ll > 0 && (cline[ll-1] == '\n' || cline[ll-1] == '\r')) {
cline[ll-1] = 0; cline[ll-1] = 0;
ll--; ll--;

View file

@ -46,7 +46,7 @@ struct HighlightData {
* user term or group may generate many processed/expanded terms * user term or group may generate many processed/expanded terms
* or groups, this is how we relate an expansion to its source. * or groups, this is how we relate an expansion to its source.
*/ */
std::vector<unsigned int> grpsugidx; std::vector<size_t> grpsugidx;
void clear() void clear()
{ {

View file

@ -134,7 +134,7 @@ bool file_scan(const string &fn, FileScanDo* doer, off_t startoffs,
if (cnttoread != size_t(-1)) { if (cnttoread != size_t(-1)) {
toread = MIN(toread, cnttoread - totread); toread = MIN(toread, cnttoread - totread);
} }
int n = read(fd, buf, toread); ssize_t n = static_cast<ssize_t>(read(fd, buf, toread));
if (n < 0) { if (n < 0) {
catstrerror(reason, "read", errno); catstrerror(reason, "read", errno);
goto out; goto out;

View file

@ -54,7 +54,7 @@ int stringicmp(const string & s1, const string& s2)
{ {
string::const_iterator it1 = s1.begin(); string::const_iterator it1 = s1.begin();
string::const_iterator it2 = s2.begin(); string::const_iterator it2 = s2.begin();
int size1 = s1.length(), size2 = s2.length(); string::size_type size1 = s1.length(), size2 = s2.length();
char c1, c2; char c1, c2;
if (size1 < size2) { if (size1 < size2) {
@ -114,7 +114,7 @@ int stringlowercmp(const string & s1, const string& s2)
{ {
string::const_iterator it1 = s1.begin(); string::const_iterator it1 = s1.begin();
string::const_iterator it2 = s2.begin(); string::const_iterator it2 = s2.begin();
int size1 = s1.length(), size2 = s2.length(); string::size_type size1 = s1.length(), size2 = s2.length();
char c2; char c2;
if (size1 < size2) { if (size1 < size2) {
@ -143,7 +143,7 @@ int stringuppercmp(const string & s1, const string& s2)
{ {
string::const_iterator it1 = s1.begin(); string::const_iterator it1 = s1.begin();
string::const_iterator it2 = s2.begin(); string::const_iterator it2 = s2.begin();
int size1 = s1.length(), size2 = s2.length(); string::size_type size1 = s1.length(), size2 = s2.length();
char c2; char c2;
if (size1 < size2) { if (size1 < size2) {
@ -486,7 +486,7 @@ void utf8truncate(string &s, int maxlen)
if (s.size() <= string::size_type(maxlen)) if (s.size() <= string::size_type(maxlen))
return; return;
Utf8Iter iter(s); Utf8Iter iter(s);
int pos = 0; string::size_type pos = 0;
while (iter++ != string::npos) while (iter++ != string::npos)
if (iter.getBpos() < string::size_type(maxlen)) if (iter.getBpos() < string::size_type(maxlen))
pos = iter.getBpos(); pos = iter.getBpos();
@ -1176,7 +1176,7 @@ void HighlightData::toString(std::string& out)
int(groups.size()), int(grpsugidx.size()), int(ugroups.size())); int(groups.size()), int(grpsugidx.size()), int(ugroups.size()));
out.append(cbuf); out.append(cbuf);
unsigned int ugidx = (unsigned int)-1; size_t ugidx = (size_t)-1;
for (unsigned int i = 0; i < groups.size(); i++) { for (unsigned int i = 0; i < groups.size(); i++) {
if (ugidx != grpsugidx[i]) { if (ugidx != grpsugidx[i]) {
ugidx = grpsugidx[i]; ugidx = grpsugidx[i];
@ -1205,7 +1205,7 @@ void HighlightData::append(const HighlightData& hl)
groups.insert(groups.end(), hl.groups.begin(), hl.groups.end()); groups.insert(groups.end(), hl.groups.begin(), hl.groups.end());
slacks.insert(slacks.end(), hl.slacks.begin(), hl.slacks.end()); slacks.insert(slacks.end(), hl.slacks.begin(), hl.slacks.end());
for (std::vector<unsigned int>::const_iterator it = hl.grpsugidx.begin(); for (std::vector<size_t>::const_iterator it = hl.grpsugidx.begin();
it != hl.grpsugidx.end(); it++) { it != hl.grpsugidx.end(); it++) {
grpsugidx.push_back(*it + ugsz0); grpsugidx.push_back(*it + ugsz0);
} }

View file

@ -50,7 +50,7 @@ public:
/** "Direct" access. Awfully inefficient as we skip from start or current /** "Direct" access. Awfully inefficient as we skip from start or current
* position at best. This can only be useful for a lookahead from the * position at best. This can only be useful for a lookahead from the
* current position */ * current position */
unsigned int operator[](unsigned int charpos) const unsigned int operator[](std::string::size_type charpos) const
{ {
std::string::size_type mypos = 0; std::string::size_type mypos = 0;
unsigned int mycp = 0; unsigned int mycp = 0;

View file

@ -138,6 +138,7 @@
<Text Include="ReadMe.txt" /> <Text Include="ReadMe.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\bincimapmime\convert.h" />
<ClInclude Include="..\common\autoconfig.h" /> <ClInclude Include="..\common\autoconfig.h" />
<ClInclude Include="..\common\conf_post.h" /> <ClInclude Include="..\common\conf_post.h" />
<ClInclude Include="..\index\indexer.h" /> <ClInclude Include="..\index\indexer.h" />

View file

@ -81,12 +81,15 @@
<ClInclude Include="..\index\mimetype.h"> <ClInclude Include="..\index\mimetype.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\utils\wipedir.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\utils\strmatcher.h"> <ClInclude Include="..\utils\strmatcher.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\bincimapmime\convert.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\utils\wipedir.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\utils\smallut.cpp"> <ClCompile Include="..\utils\smallut.cpp">

View file

@ -105,6 +105,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>__WIN32__;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>__WIN32__;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>C:\pthreads-w32\Pre-built.2\include;C:\Users\Bill\recoll\src\xaposix;C:\Users\Bill\recoll\src\utils;C:\Users\Bill\recoll\src\unac;C:\Users\Bill\recoll\src\rcldb;C:\Users\Bill\recoll\src\internfile;C:\Users\Bill\recoll\src\index;C:\Users\Bill\recoll\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>C:\pthreads-w32\Pre-built.2\include;C:\Users\Bill\recoll\src\xaposix;C:\Users\Bill\recoll\src\utils;C:\Users\Bill\recoll\src\unac;C:\Users\Bill\recoll\src\rcldb;C:\Users\Bill\recoll\src\internfile;C:\Users\Bill\recoll\src\index;C:\Users\Bill\recoll\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4800</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>

View file

@ -38,7 +38,7 @@ char * strptime(const char *s, const char *format, struct tm *tm)
case 'A': // weekday name case 'A': // weekday name
tm->tm_wday = -1; tm->tm_wday = -1;
working = false; working = false;
for (size_t i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
size_t len = strlen(strp_weekdays[i]); size_t len = strlen(strp_weekdays[i]);
if (!strnicmp(strp_weekdays[i], s, len)) if (!strnicmp(strp_weekdays[i], s, len))
@ -62,7 +62,7 @@ char * strptime(const char *s, const char *format, struct tm *tm)
case 'h': // month name case 'h': // month name
tm->tm_mon = -1; tm->tm_mon = -1;
working = false; working = false;
for (size_t i = 0; i < 12; ++i) for (int i = 0; i < 12; ++i)
{ {
size_t len = strlen(strp_monthnames[i]); size_t len = strlen(strp_monthnames[i]);
if (!strnicmp(strp_monthnames[i], s, len)) if (!strnicmp(strp_monthnames[i], s, len))
@ -252,4 +252,4 @@ char * strptime(const char *s, const char *format, struct tm *tm)
} }
return (working ? (char *)s : 0); return (working ? (char *)s : 0);
} }
#endif // _MSC_VER #endif // _MSC_VER