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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,6 +26,7 @@
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
#include <iostream>
using namespace std; using namespace std;
@ -1690,8 +1691,8 @@ void Db::waitUpdIdle()
LOGERR(("Db::waitUpdIdle: flush() failed: %s\n", ermsg.c_str())); LOGERR(("Db::waitUpdIdle: flush() failed: %s\n", ermsg.c_str()));
} }
m_ndb->m_totalworkns += chron.nanos(); m_ndb->m_totalworkns += chron.nanos();
LOGINFO(("Db::waitUpdIdle: total xapian work %lld mS\n", LOGINFO(("Db::waitUpdIdle: total xapian work %s mS\n",
m_ndb->m_totalworkns/1000000)); lltodecstr(m_ndb->m_totalworkns/1000000).c_str()));
} }
} }
#endif #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)) { if (m_minSize != size_t(-1) || m_maxSize != size_t(-1)) {
Xapian::Query sq; Xapian::Query sq;
char min[50], max[50]; string min = lltodecstr(m_minSize);
sprintf(min, "%lld", (long long)m_minSize); string max = lltodecstr(m_maxSize);
sprintf(max, "%lld", (long long)m_maxSize);
if (m_minSize == size_t(-1)) { if (m_minSize == size_t(-1)) {
string value(max); string value(max);
leftzeropad(value, 12); leftzeropad(value, 12);

View File

@ -653,8 +653,8 @@ public:
{ {
headoffs = offs; headoffs = offs;
padsize = d.padsize; padsize = d.padsize;
LOGDEB2(("CCScanHookRecord::takeone: offs %lld padsize %lld\n", LOGDEB2(("CCScanHookRecord::takeone: offs %s padsize %s\n",
headoffs, padsize)); lltodecstr(headoffs).c_str(), lltodecstr(padsize).c_str()));
return Continue; return Continue;
} }
}; };
@ -666,8 +666,8 @@ string CirCache::getpath()
bool CirCache::create(off_t maxsize, int flags) bool CirCache::create(off_t maxsize, int flags)
{ {
LOGDEB(("CirCache::create: [%s] maxsz %lld flags 0x%x\n", LOGDEB(("CirCache::create: [%s] maxsz %s flags 0x%x\n",
m_dir.c_str(), maxsize, flags)); m_dir.c_str(), lltodecstr((long long)maxsize).c_str(), flags));
if (m_d == 0) { if (m_d == 0) {
LOGERR(("CirCache::create: null data\n")); LOGERR(("CirCache::create: null data\n"));
return false; return false;
@ -708,10 +708,12 @@ bool CirCache::create(off_t maxsize, int flags)
} }
m_d->m_maxsize = maxsize; m_d->m_maxsize = maxsize;
m_d->m_uniquentries = ((flags & CC_CRUNIQUE) != 0); m_d->m_uniquentries = ((flags & CC_CRUNIQUE) != 0);
LOGDEB(("CirCache::create: rewriting header with " LOGDEB2(("CirCache::create: rewriting header with "
"maxsize %lld oheadoffs %lld nheadoffs %lld " "maxsize %s oheadoffs %s nheadoffs %s "
"npadsize %d unient %d\n", "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))); m_d->m_npadsize, int(m_d->m_uniquentries)));
return m_d->writefirstblock(); 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--) { for (int i = idx - 1; i >= 0; i--) {
buf.push_back(rbuf[i]); buf.push_back(rbuf[i]);
} }
buf.push_back(0);
} }
void ulltodecstr(unsigned long long val, string& buf) 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 // Convert byte count into unit (KB/MB...) appropriate for display
string displayableBytes(off_t size) string displayableBytes(off_t size)
{ {
char sizebuf[50];
const char *unit; const char *unit;
double roundable = 0; double roundable = 0;
@ -709,8 +707,7 @@ string displayableBytes(off_t size)
roundable = double(size) / 1E9; roundable = double(size) / 1E9;
} }
size = off_t(round(roundable)); size = off_t(round(roundable));
sprintf(sizebuf, "%lld" "%s", (long long)size, unit); return lltodecstr(size).append(unit);
return string(sizebuf);
} }
string breakIntoLines(const string& in, unsigned int ll, string breakIntoLines(const string& in, unsigned int ll,