replace all %lld instances

This commit is contained in:
Jean-Francois Dockes 2015-10-03 17:25:17 +02:00
parent fed748b190
commit d942242047
10 changed files with 35 additions and 48 deletions

View File

@ -401,9 +401,7 @@ BeagleQueueIndexer::processone(const string &path,
if (dotdoc.fmtime.empty())
dotdoc.fmtime = ascdate;
char cbuf[100];
sprintf(cbuf, "%lld", (long long)stp->st_size);
dotdoc.pcbytes = cbuf;
dotdoc.pcbytes = lltodecstr(stp->st_size);
// Document signature for up to date checks: none.
dotdoc.sig.clear();
@ -441,9 +439,7 @@ BeagleQueueIndexer::processone(const string &path,
doc.fmtime = ascdate;
dotdoc.fmtime = doc.fmtime;
char cbuf[100];
sprintf(cbuf, "%lld", (long long)stp->st_size);
doc.pcbytes = cbuf;
doc.pcbytes = lltodecstr(stp->st_size);
// Document signature for up to date checks: none.
doc.sig.clear();
doc.url = dotdoc.url;

View File

@ -487,11 +487,8 @@ void FsIndexer::setlocalfields(const map<string, string>& fields, Rcl::Doc& doc)
void FsIndexer::makesig(const struct stat *stp, string& out)
{
char cbuf[100];
sprintf(cbuf, "%lld" "%ld", (long long)stp->st_size,
o_uptodate_test_use_mtime ?
(long)stp->st_mtime : (long)stp->st_ctime);
out = cbuf;
out = lltodecstr(stp->st_size) +
lltodecstr(o_uptodate_test_use_mtime ? stp->st_mtime : stp->st_ctime);
}
#ifdef IDX_THREADS
@ -778,9 +775,7 @@ FsIndexer::processonefile(RclConfig *config,
// Set container file name for all docs, top or subdoc
doc.meta[Rcl::Doc::keytcfn] = utf8fn;
char cbuf[100];
sprintf(cbuf, "%lld", (long long)stp->st_size);
doc.pcbytes = cbuf;
doc.pcbytes = lltodecstr(stp->st_size);
// Document signature for up to date checks. All subdocs inherit the
// file's.
doc.sig = sig;
@ -868,9 +863,7 @@ FsIndexer::processonefile(RclConfig *config,
fileDoc.url = path_pathtofileurl(fn);
if (m_havelocalfields)
setlocalfields(localfields, fileDoc);
char cbuf[100];
sprintf(cbuf, "%lld", (long long)stp->st_size);
fileDoc.pcbytes = cbuf;
fileDoc.pcbytes = lltodecstr(stp->st_size);
}
fileDoc.sig = sig;

View File

@ -123,8 +123,8 @@ public:
return -1;
}
if (fseeko(fp, cacheoffset(msgnum), SEEK_SET) != 0) {
LOGDEB0(("MboxCache::get_offsets: seek %lld errno %d\n",
cacheoffset(msgnum), errno));
LOGDEB0(("MboxCache::get_offsets: seek %s errno %d\n",
lltodecstr(cacheoffset(msgnum)).c_str(), errno));
return -1;
}
mbhoff_type offset = -1;
@ -135,7 +135,7 @@ public:
ret, errno));
return -1;
}
LOGDEB0(("MboxCache::get_offsets: ret %lld\n", (long long)offset));
LOGDEB0(("MboxCache::get_offsets: ret %s\n", lltodecstr(offset).c_str()));
return offset;
}

View File

@ -43,8 +43,8 @@ const int KB = 1024;
// Process a plain text file
bool MimeHandlerText::set_document_file(const string& mt, const string &fn)
{
LOGDEB(("MimeHandlerText::set_document_file: [%s] offs %lld\n",
fn.c_str(), m_offs));
LOGDEB(("MimeHandlerText::set_document_file: [%s] offs %s\n",
fn.c_str(), lltodecstr(m_offs).c_str()));
RecollFilter::set_document_file(mt, fn);
@ -109,8 +109,9 @@ bool MimeHandlerText::set_document_string(const string& mt, const string& otext)
bool MimeHandlerText::skip_to_document(const string& ipath)
{
long long t;
if (sscanf(ipath.c_str(), "%lld", &t) != 1) {
char *endptr;
long long t = strtoll(ipath.c_str(), &endptr, 10);
if (endptr == ipath.c_str()) {
LOGERR(("MimeHandlerText::skip_to_document: bad ipath offs [%s]\n",
ipath.c_str()));
return false;
@ -156,8 +157,7 @@ bool MimeHandlerText::next_document()
// first chunk). This is a hack. The right thing to do would
// be to use a different mtype for files over the page size,
// and keep text/plain only for smaller files.
char buf[30];
sprintf(buf, "%lld", (long long)(m_offs - srclen));
string buf = lltodecstr(m_offs - srclen);
if (m_offs - srclen != 0)
m_metaData[cstr_dj_keyipath] = buf;
readnext();

View File

@ -85,9 +85,10 @@ bool Uncomp::uncompressfile(const string& ifn,
long long filembs = fsize / (1024 * 1024);
if (availmbs < 2 * filembs + 1) {
LOGERR(("uncompressfile. %lld MBs available in %s not enough "
"to uncompress %s of size %lld mbs\n", availmbs,
m_dir->dirname(), ifn.c_str(), filembs));
LOGERR(("uncompressfile. %s MBs available in %s not enough "
"to uncompress %s of size %s mbs\n",
lltodecstr(availmbs).c_str(), m_dir->dirname(),
ifn.c_str(), lltodecstr(filembs).c_str()));
return false;
}
}

View File

@ -34,11 +34,9 @@ using std::list;
// The U distinguishes udi-based entries from older fn+ipath ones
bool RclDHistoryEntry::encode(string& value)
{
char chartime[30];
sprintf(chartime,"%lld", (long long)unixtime);
string budi;
base64_encode(udi, budi);
value = string("U ") + string(chartime) + " " + budi;
value = string("U ") + lltodecstr(unixtime) + " " + budi;
return true;
}

View File

@ -26,6 +26,7 @@
#include <vector>
#include <algorithm>
#include <sstream>
#include <iostream>
using namespace std;
@ -1690,8 +1691,8 @@ void Db::waitUpdIdle()
LOGERR(("Db::waitUpdIdle: flush() failed: %s\n", ermsg.c_str()));
}
m_ndb->m_totalworkns += chron.nanos();
LOGINFO(("Db::waitUpdIdle: total xapian work %lld mS\n",
m_ndb->m_totalworkns/1000000));
LOGINFO(("Db::waitUpdIdle: total xapian work %s mS\n",
lltodecstr(m_ndb->m_totalworkns/1000000).c_str()));
}
}
#endif

View File

@ -219,9 +219,8 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
if (m_minSize != size_t(-1) || m_maxSize != size_t(-1)) {
Xapian::Query sq;
char min[50], max[50];
sprintf(min, "%lld", (long long)m_minSize);
sprintf(max, "%lld", (long long)m_maxSize);
string min = lltodecstr(m_minSize);
string max = lltodecstr(m_maxSize);
if (m_minSize == size_t(-1)) {
string value(max);
leftzeropad(value, 12);

View File

@ -653,8 +653,8 @@ public:
{
headoffs = offs;
padsize = d.padsize;
LOGDEB2(("CCScanHookRecord::takeone: offs %lld padsize %lld\n",
headoffs, padsize));
LOGDEB2(("CCScanHookRecord::takeone: offs %s padsize %s\n",
lltodecstr(headoffs).c_str(), lltodecstr(padsize).c_str()));
return Continue;
}
};
@ -666,8 +666,8 @@ string CirCache::getpath()
bool CirCache::create(off_t maxsize, int flags)
{
LOGDEB(("CirCache::create: [%s] maxsz %lld flags 0x%x\n",
m_dir.c_str(), maxsize, flags));
LOGDEB(("CirCache::create: [%s] maxsz %s flags 0x%x\n",
m_dir.c_str(), lltodecstr((long long)maxsize).c_str(), flags));
if (m_d == 0) {
LOGERR(("CirCache::create: null data\n"));
return false;
@ -708,10 +708,12 @@ bool CirCache::create(off_t maxsize, int flags)
}
m_d->m_maxsize = maxsize;
m_d->m_uniquentries = ((flags & CC_CRUNIQUE) != 0);
LOGDEB(("CirCache::create: rewriting header with "
"maxsize %lld oheadoffs %lld nheadoffs %lld "
LOGDEB2(("CirCache::create: rewriting header with "
"maxsize %s oheadoffs %s nheadoffs %s "
"npadsize %d unient %d\n",
m_d->m_maxsize, m_d->m_oheadoffs, m_d->m_nheadoffs,
lltodecstr(m_d->m_maxsize).c_str(),
lltodecstr(m_d->m_oheadoffs).c_str(),
lltodecstr(m_d->m_nheadoffs).c_str(),
m_d->m_npadsize, int(m_d->m_uniquentries)));
return m_d->writefirstblock();
}

View File

@ -633,7 +633,6 @@ inline static void ullcopyreverse(const char *rbuf, string& buf, int idx)
for (int i = idx - 1; i >= 0; i--) {
buf.push_back(rbuf[i]);
}
buf.push_back(0);
}
void ulltodecstr(unsigned long long val, string& buf)
@ -691,7 +690,6 @@ string ulltodecstr(unsigned long long val)
// Convert byte count into unit (KB/MB...) appropriate for display
string displayableBytes(off_t size)
{
char sizebuf[50];
const char *unit;
double roundable = 0;
@ -709,8 +707,7 @@ string displayableBytes(off_t size)
roundable = double(size) / 1E9;
}
size = off_t(round(roundable));
sprintf(sizebuf, "%lld" "%s", (long long)size, unit);
return string(sizebuf);
return lltodecstr(size).append(unit);
}
string breakIntoLines(const string& in, unsigned int ll,