diff --git a/src/bincimapmime/mime-inputsource.h b/src/bincimapmime/mime-inputsource.h index 9648e604..3b600e48 100644 --- a/src/bincimapmime/mime-inputsource.h +++ b/src/bincimapmime/mime-inputsource.h @@ -199,7 +199,7 @@ namespace Binc { s.seekg(0, ios::end); std::streampos lst = s.tellg(); s.seekg(st); - size_t nbytes = lst - st; + size_t nbytes = size_t(lst - st); if (nbytes > nb) { nbytes = nb; } diff --git a/src/common/conf_post.h b/src/common/conf_post.h index 182e3e2e..4bcbb4e8 100644 --- a/src/common/conf_post.h +++ b/src/common/conf_post.h @@ -46,7 +46,7 @@ typedef int mode_t; typedef int ssize_t; #define strncasecmp _strnicmp #define strcasecmp _stricmp -#define ftruncate _chsize +#define ftruncate _chsize_s #define PATH_MAX MAX_PATH #define MAXPATHLEN PATH_MAX #define R_OK 4 @@ -56,7 +56,7 @@ typedef int ssize_t; #define S_ISLNK(X) false #define lstat stat #define fseeko _fseeki64 -#define ftello _ftelli64 +#define ftello (off_t)_ftelli64 #define timegm _mkgmtime #endif diff --git a/src/index/fsindexer.cpp b/src/index/fsindexer.cpp index feaf5678..43031fae 100644 --- a/src/index/fsindexer.cpp +++ b/src/index/fsindexer.cpp @@ -329,7 +329,7 @@ bool FsIndexer::indexFiles(list& files, int flags) { LOGDEB(("FsIndexer::indexFiles\n")); m_noretryfailed = (flags & ConfIndexer::IxFNoRetryFailed) != 0; - int ret = false; + bool ret = false; if (!init()) return false; @@ -702,7 +702,7 @@ FsIndexer::processonefile(RclConfig *config, } LOGDEB0(("processone: processing: [%s] %s\n", - displayableBytes(stp->st_size).c_str(), fn.c_str())); + displayableBytes(off_t(stp->st_size)).c_str(), fn.c_str())); string utf8fn = compute_utf8fn(config, fn); diff --git a/src/internfile/Filter.h b/src/internfile/Filter.h index c0b309f3..ebee8f5e 100644 --- a/src/internfile/Filter.h +++ b/src/internfile/Filter.h @@ -140,7 +140,7 @@ namespace Dijon stat() calls The value is stored inside metaData, docsize key */ - virtual void set_docsize(size_t size) = 0; + virtual void set_docsize(off_t size) = 0; // Going from one nested document to the next. diff --git a/src/internfile/internfile.cpp b/src/internfile/internfile.cpp index 2801824e..18ee598f 100644 --- a/src/internfile/internfile.cpp +++ b/src/internfile/internfile.cpp @@ -169,7 +169,7 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf, l_mime = *imime; } - size_t docsize = stp->st_size; + off_t docsize = stp->st_size; if (!l_mime.empty()) { // Has mime: check for a compressed file. If so, create a diff --git a/src/internfile/mimehandler.h b/src/internfile/mimehandler.h index c85ec0ba..98867153 100644 --- a/src/internfile/mimehandler.h +++ b/src/internfile/mimehandler.h @@ -91,7 +91,7 @@ public: return set_document_string(mtype, std::string(cp, sz)); } - virtual void set_docsize(size_t size) + virtual void set_docsize(off_t size) { char csize[30]; sprintf(csize, "%lld", (long long)size); diff --git a/src/rcldb/rclabstract.cpp b/src/rcldb/rclabstract.cpp index 364e6bbc..dc0fa3ca 100644 --- a/src/rcldb/rclabstract.cpp +++ b/src/rcldb/rclabstract.cpp @@ -386,7 +386,7 @@ int Query::Native::makeAbstract(Xapian::docid docid, for (multimap >::reverse_iterator mit = byQ.rbegin(); mit != byQ.rend(); mit++) { unsigned int maxgrpoccs; - float q; + double q; if (byQ.size() == 1) { maxgrpoccs = maxtotaloccs; q = 1.0; diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp index 4905c0a4..6069d0a2 100644 --- a/src/rcldb/rcldb.cpp +++ b/src/rcldb/rcldb.cpp @@ -549,8 +549,7 @@ bool Db::Native::getPagePositions(Xapian::docid docid, vector& vpos) return true; } -int Db::Native::getPageNumberForPosition(const vector& pbreaks, - unsigned int pos) +int Db::Native::getPageNumberForPosition(const vector& pbreaks, int pos) { if (pos < baseTextPosition) // Not in text body return -1; diff --git a/src/rcldb/rcldb_p.h b/src/rcldb/rcldb_p.h index bc7c1d02..76a31437 100644 --- a/src/rcldb/rcldb_p.h +++ b/src/rcldb/rcldb_p.h @@ -120,7 +120,7 @@ class Db::Native { const string& uniterm); bool getPagePositions(Xapian::docid docid, vector& vpos); - int getPageNumberForPosition(const vector& pbreaks, unsigned int pos); + int getPageNumberForPosition(const vector& pbreaks, int pos); bool dbDataToRclDoc(Xapian::docid docid, std::string &data, Doc &doc); diff --git a/src/utils/circache.cpp b/src/utils/circache.cpp index 445eba1a..329dfb35 100644 --- a/src/utils/circache.cpp +++ b/src/utils/circache.cpp @@ -956,10 +956,10 @@ bool CirCache::erase(const string& udi) // entry. class CCScanHookSpacer : public CCScanHook { public: - UINT sizewanted; - UINT sizeseen; + off_t sizewanted; + off_t sizeseen; vector > squashed_udis; - CCScanHookSpacer(int sz) + CCScanHookSpacer(off_t sz) : sizewanted(sz), sizeseen(0) {assert(sz > 0);} virtual status takeone(off_t offs, const string& udi, @@ -1035,15 +1035,15 @@ bool CirCache::put(const string& udi, const ConfSimple *iconf, // Characteristics for the new entry. int nsize = CIRCACHE_HEADER_SIZE + dic.size() + datalen; - int nwriteoffs = m_d->m_oheadoffs; - int npadsize = 0; + off_t nwriteoffs = m_d->m_oheadoffs; + off_t npadsize = 0; bool extending = false; LOGDEB(("CirCache::put: nsz %d oheadoffs %d\n", nsize, m_d->m_oheadoffs)); // Check if we can recover some pad space from the (physically) previous // entry. - int recovpadsize = m_d->m_oheadoffs == CIRCACHE_FIRSTBLOCK_SIZE ? + off_t recovpadsize = m_d->m_oheadoffs == CIRCACHE_FIRSTBLOCK_SIZE ? 0 : m_d->m_npadsize; if (recovpadsize != 0) { // Need to read the latest entry's header, to rewrite it with a @@ -1082,7 +1082,7 @@ bool CirCache::put(const string& udi, const ConfSimple *iconf, } else { // Scan the file until we have enough space for the new entry, // and determine the pad size up to the 1st preserved entry - int scansize = nsize - recovpadsize; + off_t scansize = nsize - recovpadsize; LOGDEB(("CirCache::put: scanning for size %d from offs %u\n", scansize, (UINT)m_d->m_oheadoffs)); CCScanHookSpacer spacer(scansize); diff --git a/src/utils/pathut.cpp b/src/utils/pathut.cpp index 451fcbf5..b4a02155 100644 --- a/src/utils/pathut.cpp +++ b/src/utils/pathut.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #endif #include #include @@ -420,25 +419,6 @@ bool makepath(const string& ipath) return true; } -vector path_dirglob(const string &dir, const string pattern) -{ -#ifdef _WIN32 - return vector(); -#else - vector res; - glob_t mglob; - string mypat=path_cat(dir, pattern); - if (glob(mypat.c_str(), 0, 0, &mglob)) { - return res; - } - for (int i = 0; i < int(mglob.gl_pathc); i++) { - res.push_back(mglob.gl_pathv[i]); - } - globfree(&mglob); - return res; -#endif -} - bool path_isdir(const string& path) { struct stat st; diff --git a/src/utils/readfile.cpp b/src/utils/readfile.cpp index df23e9ee..a018ac9c 100644 --- a/src/utils/readfile.cpp +++ b/src/utils/readfile.cpp @@ -104,7 +104,7 @@ bool file_scan(const string &fn, FileScanDo* doer, off_t startoffs, if (cnttoread != (size_t)-1 && cnttoread) { doer->init(cnttoread+1, reason); } else if (st.st_size > 0) { - doer->init(st.st_size+1, reason); + doer->init(size_t(st.st_size+1), reason); } else { doer->init(0, reason); } @@ -123,7 +123,7 @@ bool file_scan(const string &fn, FileScanDo* doer, off_t startoffs, for (;;) { size_t toread = RDBUFSZ; if (startoffs > 0 && curoffs < startoffs) { - toread = MIN(RDBUFSZ, startoffs - curoffs); + toread = size_t(MIN(RDBUFSZ, startoffs - curoffs)); } if (cnttoread != size_t(-1)) { diff --git a/src/utils/smallut.cpp b/src/utils/smallut.cpp index d19a2367..f91c6352 100644 --- a/src/utils/smallut.cpp +++ b/src/utils/smallut.cpp @@ -637,7 +637,7 @@ string displayableBytes(off_t size) unit = " GB "; roundable = double(size) / 1E9; } - size = round(roundable); + size = off_t(round(roundable)); sprintf(sizebuf, "%lld" "%s", (long long)size, unit); return string(sizebuf); }