summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-03-12 22:05:04 +0100
committerGitHub <noreply@github.com>2019-03-12 22:05:04 +0100
commitd8ecba43c97b03cd84497ac9d6cd8a803540ed16 (patch)
tree0814354b36ac2745ff8e3cfa608fc0068ffd9bd6
parentfda1590f87993c3c7c306dcb5cb165504c7b3aa9 (diff)
parent95a2f491698066e6f83835e163f31042865a59b3 (diff)
Merge pull request #8765 from vespa-engine/toregge/fix-format-strings-3
Fix format strings in persistence, logd and juniper module.
-rw-r--r--config/src/apps/vespa-get-config/getconfig.cpp2
-rw-r--r--juniper/src/vespa/juniper/Matcher.cpp2
-rw-r--r--juniper/src/vespa/juniper/sumdesc.cpp62
-rw-r--r--juniper/src/vespa/juniper/tokenizer.cpp4
-rw-r--r--logd/src/logd/watch.cpp6
-rw-r--r--persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp16
6 files changed, 46 insertions, 46 deletions
diff --git a/config/src/apps/vespa-get-config/getconfig.cpp b/config/src/apps/vespa-get-config/getconfig.cpp
index 052cef452a0..d12a278cc38 100644
--- a/config/src/apps/vespa-get-config/getconfig.cpp
+++ b/config/src/apps/vespa-get-config/getconfig.cpp
@@ -243,7 +243,7 @@ GetConfig::Main()
printf("configID %s\n", rKey.getConfigId().c_str());
printf("configMD5 %s\n", rState.md5.c_str());
- printf("generation %ld\n", rState.generation);
+ printf("generation %" PRId64 "\n", rState.generation);
printf("internalRedeploy %s\n", rState.internalRedeploy == 0 ? "false" : "true");
printf("trace %s\n", response->getTrace().toString().c_str());
} else if (traceLevel > 0) {
diff --git a/juniper/src/vespa/juniper/Matcher.cpp b/juniper/src/vespa/juniper/Matcher.cpp
index 9ec26195cb6..9b91166fa29 100644
--- a/juniper/src/vespa/juniper/Matcher.cpp
+++ b/juniper/src/vespa/juniper/Matcher.cpp
@@ -159,7 +159,7 @@ bool Matcher::add_occurrence(off_t pos, off_t tpos, size_t len)
{
QueryTerm* mexp = _match_iter.current();
- LOG(spam, "Match: %s(%ld)", mexp->term(), tpos);
+ LOG(spam, "Match: %s(%" PRId64 ")", mexp->term(), static_cast<int64_t>(tpos));
// Add new occurrence to sequence of all occurrences
key_occ_ptr k = new key_occ(mexp->term(), pos, tpos, len);
diff --git a/juniper/src/vespa/juniper/sumdesc.cpp b/juniper/src/vespa/juniper/sumdesc.cpp
index 2e380658272..2fab30b1bdb 100644
--- a/juniper/src/vespa/juniper/sumdesc.cpp
+++ b/juniper/src/vespa/juniper/sumdesc.cpp
@@ -54,8 +54,8 @@ int complete_word(unsigned char* start, ssize_t length,
bool whitespace_elim = false;
const unsigned char* orig_ptr = ptr;
- LOG(spam, "complete_word start 0x%p, length %ld, ptr 0x%p, increment %ld",
- start, length, ptr, increment);
+ LOG(spam, "complete_word start 0x%p, length %zd, ptr 0x%p, increment %" PRId64,
+ start, length, ptr, static_cast<int64_t>(increment));
// Make sure we are at the start of a character before doing any
// comparisons
int start_off = Fast_UnicodeUtil::UTF8move(start, length, ptr, 0);
@@ -156,8 +156,8 @@ SummaryDesc::highlight_desc::highlight_desc(off_t pos,
ssize_t len, bool highlight)
: _pos(pos), _len(len), _highlight(highlight)
{
- LOG(spam, "-- new desc: pos %ld len %ld %s",
- _pos, _len, (highlight ? "(highlight)" : ""));
+ LOG(spam, "-- new desc: pos %" PRId64 " len %ld %s",
+ static_cast<int64_t>(_pos), _len, (highlight ? "(highlight)" : ""));
assert(pos >= 0);
}
@@ -259,7 +259,7 @@ void SummaryDesc::locate_accidential_matches()
/* Turn "token cut at start" into "token contained in" case */
if ((*kit)->startpos() < d->_pos) {
off_t offset = d->_pos - (*kit)->startpos();
- LOG(spam, "Convert start cut: offset %ld", offset);
+ LOG(spam, "Convert start cut: offset %" PRId64, static_cast<int64_t>(offset));
d->_pos -= offset;
d->_len += offset;
}
@@ -280,10 +280,10 @@ void SummaryDesc::locate_accidential_matches()
off_t start_len = kpos - d->_pos;
off_t end_len = (d->_pos + d->_len) - (kpos + klen);
- LOG(spam, "Split: (%ld,%ld) (%ld, %ld) (%ld, %ld)",
- d->_pos, start_len,
- kpos, klen,
- (kpos + klen), end_len);
+ LOG(spam, "Split: (%" PRId64 ",%" PRId64 ") (%" PRId64 ", %" PRId64 " ) (%" PRId64 ", %" PRId64 ")",
+ static_cast<int64_t>(d->_pos), static_cast<int64_t>(start_len),
+ static_cast<int64_t>(kpos), static_cast<int64_t>(klen),
+ static_cast<int64_t>(kpos + klen), static_cast<int64_t>(end_len));
if (start_len > 0)
_plist.insert(pit, highlight_desc(d->_pos, start_len, false));
@@ -293,13 +293,13 @@ void SummaryDesc::locate_accidential_matches()
_plist.insert(pit, highlight_desc(kpos, klen, true));
if (end_len) {
- LOG(spam, "-- Was: (%ld, %lu)", d->_pos, d->_len);
+ LOG(spam, "-- Was: (%" PRId64 ", %" PRId64 ")", static_cast<int64_t>(d->_pos), static_cast<int64_t>(d->_len));
d->_pos = kpos + klen;
d->_len = end_len;
- LOG(spam, "Modifying current to end (%ld, %lu)",
- d->_pos, d->_len);
+ LOG(spam, "Modifying current to end (%" PRId64 ", %" PRId64 ")",
+ static_cast<int64_t>(d->_pos), static_cast<int64_t>(d->_len));
} else {
- LOG(spam, "Erasing (%ld, %lu)", d->_pos, d->_len);
+ LOG(spam, "Erasing (%" PRId64 ", %" PRId64 ")", static_cast<int64_t>(d->_pos), static_cast<int64_t>(d->_len));
pit = _plist.erase(pit);
// Must ensure that d is valid (as the last descriptor seen)
// at top of loop and after end!!
@@ -323,15 +323,15 @@ void SummaryDesc::locate_accidential_matches()
if (more) {
highlight_desc& nd = *nit;
if (nd._pos < kpos) {
- LOG(spam, "(endsplit) Adjusting next desc %ld bytes", offset);
+ LOG(spam, "(endsplit) Adjusting next desc %" PRId64 " bytes", static_cast<int64_t>(offset));
nd._pos += offset;
nd._len -= offset;
}
}
d->_len -= (klen - offset);
- LOG(spam, "[%ld] Endsplit: (%ld, %lu) (%ld, %ld)",
- offset, d->_pos, d->_len, kpos, klen);
+ LOG(spam, "[%" PRId64 "] Endsplit: (%" PRId64 ", %" PRId64 ") (%" PRId64 ", %" PRId64 ")",
+ static_cast<int64_t>(offset), static_cast<int64_t>(d->_pos), static_cast<int64_t>(d->_len), static_cast<int64_t>(kpos), static_cast<int64_t>(klen));
/* Insert new desc after the just processed one */
pit = _plist.insert(++pit, highlight_desc(kpos, klen, true));
@@ -554,8 +554,8 @@ std::string SummaryDesc::get_summary(const char* buffer, size_t bytes,
// we got ourselves an overlap after all. Just skip
// whatever needed..
LOG(spam, "Overlap elim during string buildup: "
- "previous end %ld, current pos %ld",
- prev_end, pos);
+ "previous end %" PRId64 ", current pos %" PRId64,
+ static_cast<uint64_t>(prev_end), static_cast<uint64_t>(pos));
if (pos + len <= prev_end) {
continue;
} else {
@@ -589,8 +589,8 @@ std::string SummaryDesc::get_summary(const char* buffer, size_t bytes,
len += moved;
} else if (!d._highlight) {
LOG(spam, "Not completing word at "
- "char %c/0x%x, prev_end %ld, pos %ld",
- *ptr, *ptr, prev_end, pos);
+ "char %c/0x%x, prev_end %" PRId64 ", pos %" PRId64,
+ *ptr, *ptr, static_cast<int64_t>(prev_end), static_cast<int64_t>(pos));
}
/* Point to "current" endpos to check for split word/ending
@@ -611,12 +611,12 @@ std::string SummaryDesc::get_summary(const char* buffer, size_t bytes,
len += moved;
if ((pos + len) >= next_pos) {
LOG(spam, "Word completion: no space char found - "
- "joining at pos %ld", next_pos);
+ "joining at pos %" PRId64, static_cast<int64_t>(next_pos));
}
} else if (!d._highlight) {
LOG(spam, "Not completing word at "
- "char %c/0x%x, next_pos %ld",
- *ptr, *ptr, next_pos);
+ "char %c/0x%x, next_pos %" PRId64,
+ *ptr, *ptr, static_cast<int64_t>(next_pos));
}
JD_INVAR(JD_DESC, len >= 0, len = 0,
@@ -625,8 +625,8 @@ std::string SummaryDesc::get_summary(const char* buffer, size_t bytes,
static_cast<long>(len)));
int add_len = ((int)bytes > len ? len : bytes);
- LOG(spam, "bytes %ld pos %ld len %ld %s",
- bytes, pos, len, (d._highlight ? "(highlight)" : ""));
+ LOG(spam, "bytes %zd pos %" PRId64 " len %" PRId64 " %s",
+ bytes, static_cast<int64_t>(pos), static_cast<int64_t>(len), (d._highlight ? "(highlight)" : ""));
a.append(s, &buffer[pos], add_len);
len -= add_len;
@@ -664,9 +664,9 @@ bool SummaryDesc::overlap(MatchCandidate* m)
m1 = m;
}
if (m1->endpos() > m2->starttoken()) {
- LOG(spam, "overlap: [%ld, %ld] <-> [%ld, %ld]",
- m->starttoken(), m->endpos(),
- (*it)->starttoken(), (*it)->endpos());
+ LOG(spam, "overlap: [%" PRId64 ", %" PRId64 "] <-> [%" PRId64 ", %" PRId64 "]",
+ static_cast<int64_t>(m->starttoken()), static_cast<int64_t>(m->endpos()),
+ static_cast<int64_t>((*it)->starttoken()), static_cast<int64_t>((*it)->endpos()));
return true;
}
}
@@ -699,8 +699,8 @@ int SummaryDesc::recompute_estimate(int len_per_elem)
int seglen = (*kit)->startpos() - prev_pos;
if (seglen <= 0) {
LOG(spam, "recompute_estimate: Skipped additional match "
- "at pos %lu",
- (*kit)->startpos());
+ "at pos %" PRId64,
+ static_cast<int64_t>((*kit)->startpos()));
continue; // skip multiple matches of same occurrence
}
_hit_len += (*kit)->tokenlen;
@@ -864,7 +864,7 @@ void SummaryDesc::build_highlight_descs()
static_cast<int>(_matcher->DocumentSize() - pos));
add_desc(pos, max_len, false);
}
- LOG(debug, "Summary: start %ld end: %ld", startpos, pos);
+ LOG(debug, "Summary: start %" PRId64 " end: %" PRId64, static_cast<int64_t>(startpos), static_cast<int64_t>(pos));
}
diff --git a/juniper/src/vespa/juniper/tokenizer.cpp b/juniper/src/vespa/juniper/tokenizer.cpp
index 6af15e8d55f..3addd4eab65 100644
--- a/juniper/src/vespa/juniper/tokenizer.cpp
+++ b/juniper/src/vespa/juniper/tokenizer.cpp
@@ -56,8 +56,8 @@ void JuniperTokenizer::scan()
token.wordpos = _wordpos++;
token.bytepos = startpos - _text;
token.bytelen = src - startpos;
- LOG(debug, "curlen %d, bytepos %ld, bytelen %d",
- token.curlen, token.bytepos, token.bytelen);
+ LOG(debug, "curlen %d, bytepos %" PRId64 ", bytelen %d",
+ token.curlen, static_cast<int64_t>(token.bytepos), token.bytelen);
// NB! not setting charlen/charpos/_utf8pos/_utf8len yet...!
_successor->handle_token(token);
}
diff --git a/logd/src/logd/watch.cpp b/logd/src/logd/watch.cpp
index ec27e0ad0e1..fc1937e5693 100644
--- a/logd/src/logd/watch.cpp
+++ b/logd/src/logd/watch.cpp
@@ -271,8 +271,8 @@ Watcher::watchfile()
if (rotTime > 59 || (sb.st_size == offset && rotTime > 4)) {
removeOldLogs(filename);
if (sb.st_size != offset) {
- LOG(warning, "logfile rotation incomplete after %d s (dropping %lu bytes)",
- rotTime, sb.st_size - offset);
+ LOG(warning, "logfile rotation incomplete after %d s (dropping %" PRIu64 " bytes)",
+ rotTime, static_cast<uint64_t>(sb.st_size - offset));
} else {
LOG(debug, "logfile rotation complete after %d s", rotTime);
}
@@ -399,7 +399,7 @@ Watcher::removeOldLogs(const char *prefix)
totalsize += sb.st_size;
if (totalsize > (_confsubscriber.getRemoveMegabytes() * 1048576LL))
{
- LOG(info, "removing %s, total size (%ld) too big", fname, static_cast<int64_t>(totalsize));
+ LOG(info, "removing %s, total size (%" PRId64 ") too big", fname, static_cast<int64_t>(totalsize));
if (unlink(fname) != 0) {
LOG(warning, "cannot remove %s: %s", fname, strerror(errno));
}
diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
index 25c6b71f7ff..65759a0c783 100644
--- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
+++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
@@ -284,7 +284,7 @@ BucketContent::eraseEntry(Timestamp t)
assert(gidIt != _gidMap.end());
_entries.erase(iter);
if (gidIt->second->getTimestamp() == t) {
- LOG(debug, "erasing timestamp %zu from GID map", t.getValue());
+ LOG(debug, "erasing timestamp %" PRIu64 " from GID map", t.getValue());
// TODO(vekterli): O(1) bucket info update for this case
// FIXME: is this correct? seems like it could cause wrong behavior!
_gidMap.erase(gidIt);
@@ -439,7 +439,7 @@ DummyPersistence::put(const Bucket& b, Timestamp t, const Document::SP& doc,
Context&)
{
DUMMYPERSISTENCE_VERIFY_INITIALIZED;
- LOG(debug, "put(%s, %zu, %s)",
+ LOG(debug, "put(%s, %" PRIu64 ", %s)",
b.toString().c_str(),
uint64_t(t),
doc->getId().toString().c_str());
@@ -495,7 +495,7 @@ DummyPersistence::remove(const Bucket& b,
Context&)
{
DUMMYPERSISTENCE_VERIFY_INITIALIZED;
- LOG(debug, "remove(%s, %zu, %s)",
+ LOG(debug, "remove(%s, %" PRIu64 ", %s)",
b.toString().c_str(),
uint64_t(t),
did.toString().c_str());
@@ -643,7 +643,7 @@ IterateResult
DummyPersistence::iterate(IteratorId id, uint64_t maxByteSize, Context& ctx) const
{
DUMMYPERSISTENCE_VERIFY_INITIALIZED;
- LOG(debug, "iterate(%zu, %zu)", uint64_t(id), maxByteSize);
+ LOG(debug, "iterate(%" PRIu64 ", %" PRIu64 ")", uint64_t(id), maxByteSize);
ctx.trace(9, "started iterate()");
Iterator* it;
{
@@ -661,7 +661,7 @@ DummyPersistence::iterate(IteratorId id, uint64_t maxByteSize, Context& ctx) con
ctx.trace(9, "finished iterate(); bucket not found");
return IterateResult(Result::TRANSIENT_ERROR, "Bucket not found");
}
- LOG(debug, "Iterator %zu acquired bucket lock", uint64_t(id));
+ LOG(debug, "Iterator %" PRIu64 " acquired bucket lock", uint64_t(id));
std::vector<DocEntry::UP> entries;
uint32_t currentSize = 0;
@@ -699,7 +699,7 @@ DummyPersistence::iterate(IteratorId id, uint64_t maxByteSize, Context& ctx) con
ctx.trace(9, make_string("finished iterate(), returning %zu documents with %u bytes of data",
entries.size(), currentSize));
}
- LOG(debug, "finished iterate(%zu, %zu), returning %zu documents "
+ LOG(debug, "finished iterate(%" PRIu64 ", %" PRIu64 "), returning %zu documents "
"with %u bytes of data. %u docs cloned in fast path",
uint64_t(id),
maxByteSize,
@@ -717,7 +717,7 @@ Result
DummyPersistence::destroyIterator(IteratorId id, Context&)
{
DUMMYPERSISTENCE_VERIFY_INITIALIZED;
- LOG(debug, "destroyIterator(%zu)", uint64_t(id));
+ LOG(debug, "destroyIterator(%" PRIu64 ")", uint64_t(id));
vespalib::MonitorGuard lock(_monitor);
if (_iterators.find(id) != _iterators.end()) {
_iterators.erase(id);
@@ -856,7 +856,7 @@ Result
DummyPersistence::revert(const Bucket& b, Timestamp t, Context&)
{
DUMMYPERSISTENCE_VERIFY_INITIALIZED;
- LOG(debug, "revert(%s, %zu)",
+ LOG(debug, "revert(%s, %" PRIu64 ")",
b.toString().c_str(),
uint64_t(t));
assert(b.getBucketSpace() == FixedBucketSpaces::default_space());