get rid of the OFFTPC nonsense and cast to long long use lld to print off_t
This commit is contained in:
parent
0eeb8f7366
commit
f8803dda49
4 changed files with 9 additions and 17 deletions
|
@ -111,11 +111,3 @@
|
|||
|
||||
#undef _FILE_OFFSET_BITS
|
||||
#undef _LARGE_FILES
|
||||
|
||||
/* The __FreeBSD_kernel__ thing is for debian/kfreebsd. */
|
||||
#if _FILE_OFFSET_BITS == 64 || defined(__APPLE__) || defined(__OpenBSD__) ||\
|
||||
defined(__FreeBSD_kernel__) || (defined(__FreeBSD__) && __FreeBSD__ >= 9)
|
||||
#define OFFTPC "%lld"
|
||||
#else
|
||||
#define OFFTPC "%ld"
|
||||
#endif
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
@ -410,7 +410,7 @@ BeagleQueueIndexer::processone(const string &path,
|
|||
dotdoc.fmtime = ascdate;
|
||||
|
||||
char cbuf[100];
|
||||
sprintf(cbuf, OFFTPC, stp->st_size);
|
||||
sprintf(cbuf, "%lld", (long long)stp->st_size);
|
||||
dotdoc.pcbytes = cbuf;
|
||||
|
||||
// Document signature for up to date checks: none.
|
||||
|
@ -457,7 +457,7 @@ BeagleQueueIndexer::processone(const string &path,
|
|||
doc.fmtime = ascdate;
|
||||
|
||||
char cbuf[100];
|
||||
sprintf(cbuf, OFFTPC, stp->st_size);
|
||||
sprintf(cbuf, "%lld", (long long)stp->st_size);
|
||||
doc.pcbytes = cbuf;
|
||||
// Document signature for up to date checks: none.
|
||||
doc.sig.clear();
|
||||
|
|
|
@ -464,7 +464,7 @@ 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, OFFTPC "%ld", stp->st_size, (long)stp->RCL_STTIME);
|
||||
sprintf(cbuf, "%lld" "%ld", (long long)stp->st_size, (long)stp->RCL_STTIME);
|
||||
out = cbuf;
|
||||
}
|
||||
|
||||
|
@ -703,7 +703,7 @@ FsIndexer::processonefile(RclConfig *config,
|
|||
doc.meta[Rcl::Doc::keyfn] = utf8fn;
|
||||
|
||||
char cbuf[100];
|
||||
sprintf(cbuf, OFFTPC, 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
|
||||
// file's.
|
||||
|
@ -782,7 +782,7 @@ FsIndexer::processonefile(RclConfig *config,
|
|||
if (m_havelocalfields)
|
||||
setlocalfields(localfields, fileDoc);
|
||||
char cbuf[100];
|
||||
sprintf(cbuf, OFFTPC, stp->st_size);
|
||||
sprintf(cbuf, "%lld", (long long)stp->st_size);
|
||||
fileDoc.pcbytes = cbuf;
|
||||
fileDoc.sig = sig;
|
||||
|
||||
|
|
|
@ -619,7 +619,7 @@ string displayableBytes(off_t size)
|
|||
roundable = double(size) / 1E9;
|
||||
}
|
||||
size = round(roundable);
|
||||
sprintf(sizebuf, OFFTPC "%s", size, unit);
|
||||
sprintf(sizebuf, "%lld" "%s", (long long)size, unit);
|
||||
return string(sizebuf);
|
||||
}
|
||||
|
||||
|
@ -1250,7 +1250,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
thisprog = *argv++;argc--;
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
if (argc <=0 ) {
|
||||
cerr << "Usage: smallut <stringtosplit>" << endl;
|
||||
exit(1);
|
||||
|
@ -1346,7 +1346,7 @@ int main(int argc, char **argv)
|
|||
in = "a: %a title: %(title) pcpc: %% %";
|
||||
pcSubst(in, out, substs);
|
||||
cout << "After map clear: " << in << " => " << out << endl;
|
||||
#elif 1
|
||||
#elif 0
|
||||
list<string> tokens;
|
||||
tokens.push_back("");
|
||||
tokens.push_back("a,b");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue