diff --git a/src/bincimapmime/convert.cc b/src/bincimapmime/convert.cc index 90e7c1ca..73d58117 100644 --- a/src/bincimapmime/convert.cc +++ b/src/bincimapmime/convert.cc @@ -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()) size = nstr.length(); diff --git a/src/bincimapmime/convert.h b/src/bincimapmime/convert.h index 8ea1f964..a5304f02 100644 --- a/src/bincimapmime/convert.h +++ b/src/bincimapmime/convert.h @@ -93,7 +93,7 @@ namespace Binc { std::string tmp; for (std::string::const_iterator i = s.begin(); i != s.end() && i + 1 != s.end(); i += 2) { - int n; + ptrdiff_t n; unsigned char c = *i; 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") { - 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) s_in.resize(n-- - 1); } @@ -290,7 +290,7 @@ namespace Binc { BincStream &operator << (char t); //-- - std::string popString(unsigned int size); + std::string popString(std::string::size_type size); //-- char popChar(void); diff --git a/src/bincimapmime/mime-inputsource.h b/src/bincimapmime/mime-inputsource.h index 3b600e48..977d7689 100644 --- a/src/bincimapmime/mime-inputsource.h +++ b/src/bincimapmime/mime-inputsource.h @@ -49,7 +49,7 @@ namespace Binc { inline MimeInputSource(int fd, unsigned int start = 0); 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 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); } @@ -179,7 +179,7 @@ namespace Binc { class MimeInputSourceStream : public MimeInputSource { public: 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); private: 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 // when hitting eof ? @@ -204,11 +204,11 @@ namespace Binc { nbytes = nb; } if (nbytes <= 0) { - return (size_t)-1; + return (ssize_t)-1; } s.read(raw, nbytes); - return nbytes; + return static_cast(nbytes); } inline void MimeInputSourceStream::reset(void) diff --git a/src/bincimapmime/mime-parsefull.cc b/src/bincimapmime/mime-parsefull.cc index 9e9a43e3..de7c670a 100644 --- a/src/bincimapmime/mime-parsefull.cc +++ b/src/bincimapmime/mime-parsefull.cc @@ -306,7 +306,7 @@ void Binc::MimePart::parseMessageRFC822(vector *members, bool Binc::MimePart::skipUntilBoundary(const string &delimiter, unsigned int *nlines, bool *eof) { - int endpos = delimiter.length(); + string::size_type endpos = delimiter.length(); char *delimiterqueue = 0; int delimiterpos = 0; const char *delimiterStr = delimiter.c_str(); @@ -340,7 +340,7 @@ bool Binc::MimePart::skipUntilBoundary(const string &delimiter, delimiterpos = 0; if (compareStringToQueue(delimiterStr, delimiterqueue, - delimiterpos, endpos)) { + delimiterpos, int(endpos))) { foundBoundary = true; break; } @@ -451,7 +451,7 @@ void Binc::MimePart::parseMultipart(const string &boundary, skipUntilBoundary(delimiter, nlines, eof); if (!eof) - *boundarysize = delimiter.size(); + *boundarysize = int(delimiter.size()); postBoundaryProcessing(eof, nlines, boundarysize, foundendofpart); @@ -484,7 +484,7 @@ void Binc::MimePart::parseMultipart(const string &boundary, skipUntilBoundary(delimiter, nlines, eof); if (!*eof) - *boundarysize = delimiter.size(); + *boundarysize = int(delimiter.size()); postBoundaryProcessing(eof, nlines, boundarysize, foundendofpart); } @@ -528,7 +528,7 @@ void Binc::MimePart::parseSinglePart(const string &toboundary, // *boundarysize = _toboundary.length(); char *boundaryqueue = 0; - int endpos = _toboundary.length(); + size_t endpos = _toboundary.length(); if (toboundary != "") { boundaryqueue = new char[endpos]; memset(boundaryqueue, 0, endpos); @@ -553,8 +553,8 @@ void Binc::MimePart::parseSinglePart(const string &toboundary, boundarypos = 0; if (compareStringToQueue(_toboundaryStr, boundaryqueue, - boundarypos, endpos)) { - *boundarysize = _toboundary.length(); + boundarypos, int(endpos))) { + *boundarysize = static_cast(_toboundary.length()); break; } } diff --git a/src/bincimapmime/mime-parseonlyheader.cc b/src/bincimapmime/mime-parseonlyheader.cc index b65f9fa9..c8a67bbd 100644 --- a/src/bincimapmime/mime-parseonlyheader.cc +++ b/src/bincimapmime/mime-parseonlyheader.cc @@ -119,7 +119,7 @@ int Binc::MimePart::doParseOnlyHeader(MimeInputSource *ms, if (c == '\n') ++nlines; if (c == ':') break; 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(); quit = true; diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp index 6636c389..5513cd7d 100644 --- a/src/common/rclconfig.cpp +++ b/src/common/rclconfig.cpp @@ -639,7 +639,7 @@ bool RclConfig::inStopSuffixes(const string& fni) it != stoplist.end(); it++) { STOPSUFFIXES->insert(SfString(stringtolower(*it))); if (m_maxsufflen < it->length()) - m_maxsufflen = it->length(); + m_maxsufflen = int(it->length()); } } diff --git a/src/common/textsplit.cpp b/src/common/textsplit.cpp index f9dc87e1..2adc380b 100644 --- a/src/common/textsplit.cpp +++ b/src/common/textsplit.cpp @@ -219,11 +219,11 @@ bool TextSplit::o_deHyphenate = false; // 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. 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)); - unsigned int l = w.length(); + size_t l = w.length(); #ifdef TEXTSPLIT_STATS // 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) { - bool ret = takeword(w, pos, btstart, btend); + bool ret = takeword(w, pos, int(btstart), int(btend)); m_prevpos = pos; - m_prevlen = w.length(); + m_prevlen = int(w.length()); return ret; } 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 // flags: ONLYSPANS, NOSPANS, noNumbers -bool TextSplit::words_from_span(int bp) +bool TextSplit::words_from_span(size_t bp) { #if 0 cerr << "Span: [" << m_span << "] " << " w_i_s size: " << @@ -307,10 +307,10 @@ bool TextSplit::words_from_span(int bp) } cerr << endl; #endif - unsigned int spanwords = m_words_in_span.size(); + int spanwords = int(m_words_in_span.size()); int pos = m_spanpos; // Byte position of the span start - int spboffs = bp - m_span.size(); + size_t spboffs = bp - m_span.size(); if (o_deHyphenate && spanwords == 2 && 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); } - for (unsigned int i = 0; + for (int i = 0; i < ((m_flags&TXTS_ONLYSPANS) ? 1 : spanwords); i++, pos++) { 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++) { @@ -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 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 " "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())); if (m_wordLen) { @@ -406,8 +406,8 @@ inline bool TextSplit::doemit(bool spanerase, int bp) case '\'': m_span.resize(m_span.length()-1); if (m_words_in_span.size() && - m_words_in_span.back().second > m_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 = int(m_span.size()); if (--bp < 0) bp = 0; break; @@ -424,7 +424,7 @@ inline bool TextSplit::doemit(bool spanerase, int bp) } 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. - boffs[nchars-1] = it.getBpos(); + boffs[nchars-1] = int(it.getBpos()); // Output all new ngrams: they begin at each existing position // and end after the new character. onlyspans->only output // maximum words, nospans=> single chars if (!(m_flags & TXTS_ONLYSPANS) || nchars == o_CJKNgramLen) { - unsigned int btend = it.getBpos() + it.getBlen(); - unsigned int loopbeg = (m_flags & TXTS_NOSPANS) ? nchars-1 : 0; - unsigned int loopend = (m_flags & TXTS_ONLYSPANS) ? 1 : nchars; - for (unsigned int i = loopbeg; i < loopend; i++) { + int btend = int(it.getBpos() + it.getBlen()); + int loopbeg = (m_flags & TXTS_NOSPANS) ? nchars-1 : 0; + int loopend = (m_flags & TXTS_ONLYSPANS) ? 1 : nchars; + for (int i = loopbeg; i < loopend; i++) { if (!takeword(it.buffer().substr(boffs[i], btend-boffs[i]), 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 // first 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]), m_wordpos - nchars, boffs[0], btend)) { diff --git a/src/common/textsplit.h b/src/common/textsplit.h index ff0ab31e..66a49675 100644 --- a/src/common/textsplit.h +++ b/src/common/textsplit.h @@ -201,7 +201,7 @@ private: // It may happen that our cleanup would result in emitting the // same term twice. We try to avoid this int m_prevpos; - unsigned int m_prevlen; + int m_prevlen; #ifdef TEXTSPLIT_STATS // Stats counters. These are processed in TextSplit rather than by a @@ -215,11 +215,11 @@ private: // This processes cjk text: bool cjk_to_words(Utf8Iter *it, unsigned int *cp); - bool emitterm(bool isspan, std::string &term, int pos, int bs, int be); - bool doemit(bool spanerase, int bp); + bool emitterm(bool isspan, std::string &term, int pos, size_t bs,size_t be); + bool doemit(bool spanerase, size_t bp); void discardspan(); bool span_is_acronym(std::string *acronym); - bool words_from_span(int bp); + bool words_from_span(size_t bp); }; #endif /* _TEXTSPLIT_H_INCLUDED_ */ diff --git a/src/index/fsindexer.cpp b/src/index/fsindexer.cpp index b6ad0513..a7ea822a 100644 --- a/src/index/fsindexer.cpp +++ b/src/index/fsindexer.cpp @@ -144,13 +144,11 @@ FsIndexer::~FsIndexer() void *status; if (m_haveInternQ) { status = m_iwqueue.setTerminateAndWait(); - LOGDEB0(("FsIndexer: internfile wrkr status: %ld (1->ok)\n", - long(status))); + LOGDEB0(("FsIndexer: internfile wrkr status: %p (1->ok)\n", status)); } if (m_haveSplitQ) { status = m_dwqueue.setTerminateAndWait(); - LOGDEB0(("FsIndexer: dbupd worker status: %ld (1->ok)\n", - long(status))); + LOGDEB0(("FsIndexer: dbupd worker status: %p (1->ok)\n", status)); } delete m_stableconfig; #endif // IDX_THREADS diff --git a/src/index/recollindex.cpp b/src/index/recollindex.cpp index d8c21b9f..24dcfdd6 100644 --- a/src/index/recollindex.cpp +++ b/src/index/recollindex.cpp @@ -292,7 +292,7 @@ static bool checktopdirs(RclConfig *config, vector& nonexist) } return false; } - if (access(it->c_str(), 0) < 0) { + if (!path_exists(*it)) { nonexist.push_back(*it); } } @@ -302,7 +302,7 @@ static bool checktopdirs(RclConfig *config, vector& nonexist) if (config->getConfParam("skippedPaths", &tdl, true)) { for (vector::iterator it = tdl.begin(); it != tdl.end(); it++) { *it = path_tildexpand(*it); - if (access(it->c_str(), 0) < 0) { + if (!path_exists(*it)) { nonexist.push_back(*it); } } @@ -311,7 +311,7 @@ static bool checktopdirs(RclConfig *config, vector& nonexist) if (config->getConfParam("daemSkippedPaths", &tdl, true)) { for (vector::iterator it = tdl.begin(); it != tdl.end(); it++) { *it = path_tildexpand(*it); - if (access(it->c_str(), 0) < 0) { + if (!path_exists(*it)) { nonexist.push_back(*it); } } diff --git a/src/internfile/Filter.h b/src/internfile/Filter.h index ebee8f5e..742567ef 100644 --- a/src/internfile/Filter.h +++ b/src/internfile/Filter.h @@ -108,7 +108,7 @@ namespace Dijon */ virtual bool set_document_data(const std::string& mtype, const char *data_ptr, - unsigned int data_length) = 0; + size_t data_length) = 0; /** (Re)initializes the filter with the given data. * Call next_document() to position the filter onto the first document. diff --git a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp index 18ee598f..6ce359ed 100644 --- a/src/internfile/internfile.cpp +++ b/src/internfile/internfile.cpp @@ -629,7 +629,7 @@ void FileInterner::popHandler() { if (m_handlers.empty()) return; - int i = m_handlers.size() - 1; + size_t i = m_handlers.size() - 1; if (m_tmpflgs[i]) { m_tempfiles.pop_back(); m_tmpflgs[i] = false; diff --git a/src/internfile/mh_mbox.cpp b/src/internfile/mh_mbox.cpp index d646cbef..db2b4f33 100644 --- a/src/internfile/mh_mbox.cpp +++ b/src/internfile/mh_mbox.cpp @@ -128,7 +128,7 @@ public: return -1; } mbhoff_type offset = -1; - int ret; + size_t ret; if ((ret = fread(&offset, 1, sizeof(mbhoff_type), fp)) != sizeof(mbhoff_type)) { 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]; static inline void stripendnl(line_type& line, int& ll) { - ll = strlen(line); + ll = int(strlen(line)); while (ll > 0) { if (line[ll-1] == '\n' || line[ll-1] == '\r') { line[ll-1] = 0; diff --git a/src/internfile/mimehandler.h b/src/internfile/mimehandler.h index 98867153..38e5429a 100644 --- a/src/internfile/mimehandler.h +++ b/src/internfile/mimehandler.h @@ -86,7 +86,7 @@ public: return false; } 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)); } diff --git a/src/query/docseqhist.cpp b/src/query/docseqhist.cpp index 264b36f0..abffe77d 100644 --- a/src/query/docseqhist.cpp +++ b/src/query/docseqhist.cpp @@ -35,7 +35,7 @@ using std::list; bool RclDHistoryEntry::encode(string& value) { char chartime[30]; - sprintf(chartime,"%ld", unixtime); + sprintf(chartime,"%lld", (long long)unixtime); string budi; base64_encode(udi, budi); value = string("U ") + string(chartime) + " " + budi; @@ -161,5 +161,5 @@ int DocSequenceHistory::getResCnt() { if (m_hlist.empty()) m_hlist = getDocHistory(m_hist); - return m_hlist.size(); + return int(m_hlist.size()); } diff --git a/src/query/docseqhist.h b/src/query/docseqhist.h index b176c776..2f2f5abc 100644 --- a/src/query/docseqhist.h +++ b/src/query/docseqhist.h @@ -16,6 +16,7 @@ */ #ifndef _DOCSEQHIST_H_INCLUDED_ #define _DOCSEQHIST_H_INCLUDED_ +#include #include "docseq.h" #include "dynconf.h" @@ -28,13 +29,13 @@ namespace Rcl { class RclDHistoryEntry : public DynConfEntry { public: RclDHistoryEntry() : unixtime(0) {} - RclDHistoryEntry(long t, const string& u) + RclDHistoryEntry(time_t t, const string& u) : unixtime(t), udi(u) {} virtual ~RclDHistoryEntry() {} virtual bool decode(const string &value); virtual bool encode(string& value); virtual bool equal(const DynConfEntry& other); - long unixtime; + time_t unixtime; string udi; }; @@ -57,7 +58,7 @@ private: Rcl::Db *m_db; RclDynConf *m_hist; int m_prevnum; - long m_prevtime; + time_t m_prevtime; std::string m_description; // This is just an nls translated 'doc history' std::list m_hlist; std::list::const_iterator m_it; diff --git a/src/query/plaintorich.cpp b/src/query/plaintorich.cpp index 9ea08fdc..50b6d1ba 100644 --- a/src/query/plaintorich.cpp +++ b/src/query/plaintorich.cpp @@ -54,8 +54,8 @@ struct MatchEntry { pair offs; // Index of the search group this comes from: this is to relate a // match to the original user input. - unsigned int grpidx; - MatchEntry(int sta, int sto, unsigned int idx) + size_t grpidx; + MatchEntry(int sta, int sto, size_t idx) : offs(sta, sto), grpidx(idx) { } @@ -105,7 +105,7 @@ class TextSplitPTR : public TextSplit { // pos, bts, bte)); // If this word is a search term, remember its byte-offset span. - map::const_iterator it = m_terms.find(dumb); + map::const_iterator it = m_terms.find(dumb); if (it != m_terms.end()) { tboffs.push_back(MatchEntry(bts, bte, (*it).second)); } @@ -135,7 +135,7 @@ private: int m_wcount; // In: user query terms - map m_terms; + map m_terms; // m_gterms holds all the terms in m_groups, as a set for quick lookup set m_gterms; @@ -214,7 +214,7 @@ static bool do_proximity_test(int window, vector* >& plists, bool TextSplitPTR::matchGroup(unsigned int grpidx) { const vector& 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, vecStringToString(terms).c_str())); @@ -270,7 +270,7 @@ bool TextSplitPTR::matchGroup(unsigned int grpidx) for (vector::iterator it = plists[0]->begin(); it != plists[0]->end(); it++) { int pos = *it; - int sta = int(10E9), sto = 0; + int sta = INT_MAX, sto = 0; LOGDEB2(("MatchGroup: Testing at pos %d\n", pos)); if (do_proximity_test(window,plists, 1, pos, pos, &sta, &sto, minpos)) { 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 // we are at or after a term match, mark. if (tPosIt != tPosEnd) { - int ibyteidx = chariter.getBpos(); + size_t ibyteidx = chariter.getBpos(); if (ibyteidx == tPosIt->offs.first) { if (!intag && ibyteidx >= (int)headend) { - *olit += startMatch(tPosIt->grpidx); + *olit += startMatch((unsigned int)(tPosIt->grpidx)); } inrcltag = 1; } else if (ibyteidx == tPosIt->offs.second) { diff --git a/src/query/reslistpager.cpp b/src/query/reslistpager.cpp index 2f898b5f..577af8f0 100644 --- a/src/query/reslistpager.cpp +++ b/src/query/reslistpager.cpp @@ -77,7 +77,7 @@ void ResListPager::resultPageNext() if (m_winfirst < 0) { m_winfirst = 0; } 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 // 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 // too. // Restore the m_winfirst value, let the current result vector alone - m_winfirst -= m_respage.size(); + m_winfirst -= int(m_respage.size()); } else { // No results at all (on first page) 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 off_t fsize = -1, dsize = -1; if (!doc.dbytes.empty()) - dsize = atoll(doc.dbytes.c_str()); + dsize = static_cast(atoll(doc.dbytes.c_str())); if (!doc.fbytes.empty()) - fsize = atoll(doc.fbytes.c_str()); + fsize = static_cast(atoll(doc.fbytes.c_str())); string sizebuf; if (dsize > 0) { sizebuf = displayableBytes(dsize); diff --git a/src/query/reslistpager.h b/src/query/reslistpager.h index 9d585374..5817af20 100644 --- a/src/query/reslistpager.h +++ b/src/query/reslistpager.h @@ -64,7 +64,7 @@ public: int pageLastDocNum() { if (m_winfirst < 0 || m_respage.size() == 0) return -1; - return m_winfirst + m_respage.size() - 1; + return m_winfirst + int(m_respage.size()) - 1; } virtual int pageSize() const {return m_pagesize;} void pageNext(); diff --git a/src/query/sortseq.h b/src/query/sortseq.h index 4fd73b12..da660a54 100644 --- a/src/query/sortseq.h +++ b/src/query/sortseq.h @@ -39,7 +39,7 @@ class DocSeqSorted : public DocSeqModifier { virtual bool canSort() {return true;} virtual bool setSortSpec(const DocSeqSortSpec &sortspec); 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: DocSeqSortSpec m_spec; std::vector m_docs; diff --git a/src/query/wasaparseaux.cpp b/src/query/wasaparseaux.cpp index ce63e9d6..22a11ee7 100644 --- a/src/query/wasaparseaux.cpp +++ b/src/query/wasaparseaux.cpp @@ -161,10 +161,10 @@ bool WasaParserDriver::addClause(SearchData *sd, size_t size = strtoll(cl->gettext().c_str(), &cp, 10); if (*cp != 0) { switch (*cp) { - case 'k': case 'K': size *= 1E3;break; - case 'm': case 'M': size *= 1E6;break; - case 'g': case 'G': size *= 1E9;break; - case 't': case 'T': size *= 1E12;break; + 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; default: m_reason = string("Bad multiplier suffix: ") + *cp; delete cl; diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp index 2d41e864..7ed4cf47 100644 --- a/src/rcldb/rcldb.cpp +++ b/src/rcldb/rcldb.cpp @@ -433,7 +433,7 @@ bool Db::Native::dbDataToRclDoc(Xapian::docid docid, std::string &data, string dbdir = m_rcldb->m_basedir; doc.idxi = 0; 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-1 indexes into the additional dbs array. @@ -555,7 +555,7 @@ int Db::Native::getPageNumberForPosition(const vector& pbreaks, int pos) return -1; vector::const_iterator it = 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 diff --git a/src/rcldb/searchdata.cpp b/src/rcldb/searchdata.cpp index 46d31b16..cc2be91c 100644 --- a/src/rcldb/searchdata.cpp +++ b/src/rcldb/searchdata.cpp @@ -242,7 +242,7 @@ void SearchData::simplify() j < i + clsubp->getSub()->m_query.size(); j++) { 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 // know own them. diff --git a/src/rcldb/searchdata.h b/src/rcldb/searchdata.h index df478a80..62d8c64e 100644 --- a/src/rcldb/searchdata.h +++ b/src/rcldb/searchdata.h @@ -376,7 +376,7 @@ protected: std::string m_field; // Field specification if any HighlightData m_hldata; // 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, std::string &ermsg, void* pq, int slack = 0, bool useNear = false); diff --git a/src/rcldb/searchdatatox.cpp b/src/rcldb/searchdatatox.cpp index 35f9636c..fa68aa26 100644 --- a/src/rcldb/searchdatatox.cpp +++ b/src/rcldb/searchdatatox.cpp @@ -840,7 +840,7 @@ bool SearchDataClauseSimple::processUserString(Rcl::Db &db, const string &iq, tpq.setTSQ(&splitter); 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())); switch (tpq.terms().size() + terminc) { diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index 87cd530d..fb5e2f09 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -217,7 +217,7 @@ void base64_encode(const string &in, string &out) out.clear(); - int srclength = in.length(); + string::size_type srclength = in.length(); int sidx = 0; while (2 < srclength) { input[0] = in[sidx++]; diff --git a/src/utils/circache.cpp b/src/utils/circache.cpp index 329dfb35..b2854fba 100644 --- a/src/utils/circache.cpp +++ b/src/utils/circache.cpp @@ -1013,10 +1013,10 @@ bool CirCache::put(const string& udi, const ConfSimple *iconf, unsigned short flags = 0; TempBuf compbuf; if (!(iflags & NoCompHint)) { - ULONG len = compressBound(data.size()); + uLong len = compressBound(static_cast(data.size())); char *bf = compbuf.setsize(len); if (bf != 0 && - compress((Bytef*)bf, &len, (Bytef*)data.c_str(), data.size()) + compress((Bytef*)bf, &len, (Bytef*)data.c_str(), static_cast(data.size())) == Z_OK) { if (float(len) < 0.9 * float(data.size())) { // 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. - 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 npadsize = 0; bool extending = false; diff --git a/src/utils/conftree.cpp b/src/utils/conftree.cpp index 97956d87..d2beddc3 100644 --- a/src/utils/conftree.cpp +++ b/src/utils/conftree.cpp @@ -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')) { cline[ll-1] = 0; ll--; diff --git a/src/utils/hldata.h b/src/utils/hldata.h index 94c6ca27..168e6896 100644 --- a/src/utils/hldata.h +++ b/src/utils/hldata.h @@ -46,7 +46,7 @@ struct HighlightData { * user term or group may generate many processed/expanded terms * or groups, this is how we relate an expansion to its source. */ - std::vector grpsugidx; + std::vector grpsugidx; void clear() { diff --git a/src/utils/readfile.cpp b/src/utils/readfile.cpp index ce0721f6..4858a53d 100644 --- a/src/utils/readfile.cpp +++ b/src/utils/readfile.cpp @@ -134,7 +134,7 @@ bool file_scan(const string &fn, FileScanDo* doer, off_t startoffs, if (cnttoread != size_t(-1)) { toread = MIN(toread, cnttoread - totread); } - int n = read(fd, buf, toread); + ssize_t n = static_cast(read(fd, buf, toread)); if (n < 0) { catstrerror(reason, "read", errno); goto out; diff --git a/src/utils/smallut.cpp b/src/utils/smallut.cpp index 469c969f..cfb8716b 100644 --- a/src/utils/smallut.cpp +++ b/src/utils/smallut.cpp @@ -54,7 +54,7 @@ int stringicmp(const string & s1, const string& s2) { string::const_iterator it1 = s1.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; if (size1 < size2) { @@ -114,7 +114,7 @@ int stringlowercmp(const string & s1, const string& s2) { string::const_iterator it1 = s1.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; if (size1 < size2) { @@ -143,7 +143,7 @@ int stringuppercmp(const string & s1, const string& s2) { string::const_iterator it1 = s1.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; if (size1 < size2) { @@ -486,7 +486,7 @@ void utf8truncate(string &s, int maxlen) if (s.size() <= string::size_type(maxlen)) return; Utf8Iter iter(s); - int pos = 0; + string::size_type pos = 0; while (iter++ != string::npos) if (iter.getBpos() < string::size_type(maxlen)) pos = iter.getBpos(); @@ -1176,7 +1176,7 @@ void HighlightData::toString(std::string& out) int(groups.size()), int(grpsugidx.size()), int(ugroups.size())); out.append(cbuf); - unsigned int ugidx = (unsigned int)-1; + size_t ugidx = (size_t)-1; for (unsigned int i = 0; i < groups.size(); i++) { if (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()); slacks.insert(slacks.end(), hl.slacks.begin(), hl.slacks.end()); - for (std::vector::const_iterator it = hl.grpsugidx.begin(); + for (std::vector::const_iterator it = hl.grpsugidx.begin(); it != hl.grpsugidx.end(); it++) { grpsugidx.push_back(*it + ugsz0); } diff --git a/src/utils/utf8iter.h b/src/utils/utf8iter.h index 4e8894a1..fd2ee9cb 100644 --- a/src/utils/utf8iter.h +++ b/src/utils/utf8iter.h @@ -50,7 +50,7 @@ public: /** "Direct" access. Awfully inefficient as we skip from start or current * position at best. This can only be useful for a lookahead from the * current position */ - unsigned int operator[](unsigned int charpos) const + unsigned int operator[](std::string::size_type charpos) const { std::string::size_type mypos = 0; unsigned int mycp = 0; diff --git a/src/windows/Win32ProjectRecoll.vcxproj b/src/windows/Win32ProjectRecoll.vcxproj index 5bdffe40..c7d65847 100644 --- a/src/windows/Win32ProjectRecoll.vcxproj +++ b/src/windows/Win32ProjectRecoll.vcxproj @@ -138,6 +138,7 @@ + diff --git a/src/windows/Win32ProjectRecoll.vcxproj.filters b/src/windows/Win32ProjectRecoll.vcxproj.filters index 0d538e3c..8c233892 100644 --- a/src/windows/Win32ProjectRecoll.vcxproj.filters +++ b/src/windows/Win32ProjectRecoll.vcxproj.filters @@ -81,12 +81,15 @@ Header Files - - Source Files - Header Files + + Header Files + + + Header Files + diff --git a/src/windows/recollindex/recollindex.vcxproj b/src/windows/recollindex/recollindex.vcxproj index 40f32fa7..77cef2a8 100644 --- a/src/windows/recollindex/recollindex.vcxproj +++ b/src/windows/recollindex/recollindex.vcxproj @@ -105,6 +105,7 @@ Disabled __WIN32__;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 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) + 4800 Console diff --git a/src/windows/strptime.cpp b/src/windows/strptime.cpp index b582fd9a..0021aa99 100644 --- a/src/windows/strptime.cpp +++ b/src/windows/strptime.cpp @@ -38,7 +38,7 @@ char * strptime(const char *s, const char *format, struct tm *tm) case 'A': // weekday name tm->tm_wday = -1; working = false; - for (size_t i = 0; i < 7; ++i) + for (int i = 0; i < 7; ++i) { size_t len = strlen(strp_weekdays[i]); 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 tm->tm_mon = -1; working = false; - for (size_t i = 0; i < 12; ++i) + for (int i = 0; i < 12; ++i) { size_t len = strlen(strp_monthnames[i]); 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); } -#endif // _MSC_VER \ No newline at end of file +#endif // _MSC_VER