Windows: fixed a number of int size warnings mostly by casting them away
--HG-- branch : WINDOWSPORT
This commit is contained in:
@@ -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<pair<string, off_t> > 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);
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <sys/param.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/file.h>
|
||||
#include <glob.h>
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
@@ -420,25 +419,6 @@ bool makepath(const string& ipath)
|
||||
return true;
|
||||
}
|
||||
|
||||
vector<string> path_dirglob(const string &dir, const string pattern)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return vector<string>();
|
||||
#else
|
||||
vector<string> 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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user