replace atol with atoll to fix result size display bug. Also use atoll for time conversions, 2032 is coming...

This commit is contained in:
"Jean-Francois Dockes ext:(%22) 2013-04-04 20:01:31 +02:00
parent 98528d3203
commit 321978bfea
7 changed files with 16 additions and 16 deletions

View File

@ -612,7 +612,7 @@ void Preview::setCurTabProps(const Rcl::Doc &doc, int docnum)
datebuf[0] = 0;
if (!doc.fmtime.empty() || !doc.dmtime.empty()) {
time_t mtime = doc.dmtime.empty() ?
atol(doc.fmtime.c_str()) : atol(doc.dmtime.c_str());
atoll(doc.fmtime.c_str()) : atoll(doc.dmtime.c_str());
struct tm *tm = localtime(&mtime);
strftime(datebuf, 99, "%Y-%m-%d %H:%M:%S", tm);
}

View File

@ -184,7 +184,7 @@ static string dategetter(const string&, const Rcl::Doc& doc)
datebuf[0] = 0;
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
time_t mtime = doc.dmtime.empty() ?
atol(doc.fmtime.c_str()) : atol(doc.dmtime.c_str());
atoll(doc.fmtime.c_str()) : atoll(doc.dmtime.c_str());
struct tm *tm = localtime(&mtime);
strftime(datebuf, 99, "%Y-%m-%d", tm);
}
@ -197,7 +197,7 @@ static string datetimegetter(const string&, const Rcl::Doc& doc)
datebuf[0] = 0;
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
time_t mtime = doc.dmtime.empty() ?
atol(doc.fmtime.c_str()) : atol(doc.dmtime.c_str());
atoll(doc.fmtime.c_str()) : atoll(doc.dmtime.c_str());
struct tm *tm = localtime(&mtime);
strftime(datebuf, 99, "%Y-%m-%d %H:%M:%S %z", tm);
}

View File

@ -56,18 +56,18 @@ bool RclDHistoryEntry::decode(const string &value)
switch (vall.size()) {
case 2:
// Old fn+ipath, null ipath case
unixtime = atol((*it++).c_str());
unixtime = atoll((*it++).c_str());
base64_decode(*it++, fn);
break;
case 3:
if (!it->compare("U")) {
// New udi-based entry
it++;
unixtime = atol((*it++).c_str());
unixtime = atoll((*it++).c_str());
base64_decode(*it++, udi);
} else {
// Old fn + ipath. We happen to know how to build an udi
unixtime = atol((*it++).c_str());
unixtime = atoll((*it++).c_str());
base64_decode(*it++, fn);
base64_decode(*it, ipath);
}

View File

@ -187,7 +187,7 @@ void ResListPager::displayDoc(RclConfig *config, int i, Rcl::Doc& doc,
datebuf[0] = 0;
if (!doc.dmtime.empty() || !doc.fmtime.empty()) {
time_t mtime = doc.dmtime.empty() ?
atol(doc.fmtime.c_str()) : atol(doc.dmtime.c_str());
atoll(doc.fmtime.c_str()) : atoll(doc.dmtime.c_str());
struct tm *tm = localtime(&mtime);
strftime(datebuf, 99, dateFormat().c_str(), tm);
}
@ -195,9 +195,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 = atol(doc.dbytes.c_str());
dsize = atoll(doc.dbytes.c_str());
if (!doc.fbytes.empty())
fsize = atol(doc.fbytes.c_str());
fsize = atoll(doc.fbytes.c_str());
string sizebuf;
if (dsize > 0) {
sizebuf = displayableBytes(dsize);

View File

@ -1008,7 +1008,7 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi, Doc &doc)
newdocument.add_term(make_parentterm(parent_udi));
}
// Dates etc.
time_t mtime = atol(doc.dmtime.empty() ? doc.fmtime.c_str() :
time_t mtime = atoll(doc.dmtime.empty() ? doc.fmtime.c_str() :
doc.dmtime.c_str());
struct tm *tm = localtime(&mtime);
char buf[9];

View File

@ -367,22 +367,22 @@ public:
m_reason << "readfirstblock: conf get maxsize failed";
return false;
}
m_maxsize = atol(value.c_str());
m_maxsize = atoll(value.c_str());
if (!conf.get("oheadoffs", value, cstr_null)) {
m_reason << "readfirstblock: conf get oheadoffs failed";
return false;
}
m_oheadoffs = atol(value.c_str());
m_oheadoffs = atoll(value.c_str());
if (!conf.get("nheadoffs", value, cstr_null)) {
m_reason << "readfirstblock: conf get nheadoffs failed";
return false;
}
m_nheadoffs = atol(value.c_str());
m_nheadoffs = atoll(value.c_str());
if (!conf.get("npadsize", value, cstr_null)) {
m_reason << "readfirstblock: conf get npadsize failed";
return false;
}
m_npadsize = atol(value.c_str());
m_npadsize = atoll(value.c_str());
if (!conf.get("unient", value, cstr_null)) {
m_uniquentries = false;
} else {

View File

@ -234,10 +234,10 @@ int main(int argc, const char **argv)
while (**argv)
switch (*(*argv)++) {
case 'c': op_flags |= OPT_c; if (argc < 2) Usage();
cnt = atol(*(++argv)); argc--;
cnt = atoll(*(++argv)); argc--;
goto b1;
case 'o': op_flags |= OPT_o; if (argc < 2) Usage();
offs = strtoul(*(++argv), 0, 0); argc--;
offs = strtoull(*(++argv), 0, 0); argc--;
goto b1;
default: Usage(); break;
}