aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fastlib/src/vespa/fastlib/io/bufferedfile.cpp3
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp2
-rw-r--r--searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp2
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp4
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp2
-rw-r--r--vespalib/src/tests/zcurve/zcurve_ranges_test.cpp5
-rw-r--r--vespalib/src/vespa/vespalib/data/slime/json_format.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/io/fileutil.cpp28
-rw-r--r--vespalib/src/vespa/vespalib/trace/trace.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/compress.cpp8
-rw-r--r--vespalib/src/vespa/vespalib/util/compressor.cpp2
11 files changed, 31 insertions, 29 deletions
diff --git a/fastlib/src/vespa/fastlib/io/bufferedfile.cpp b/fastlib/src/vespa/fastlib/io/bufferedfile.cpp
index 6a50cfe2259..9af2a73a31b 100644
--- a/fastlib/src/vespa/fastlib/io/bufferedfile.cpp
+++ b/fastlib/src/vespa/fastlib/io/bufferedfile.cpp
@@ -3,6 +3,7 @@
#include "bufferedfile.h"
#include <cassert>
#include <cstring>
+#include <cinttypes>
namespace {
@@ -191,7 +192,7 @@ Fast_BufferedFile::SetPosition(const int64_t s)
diff = _filepos - s;
if ( !(((diff > 0l) || ((diff == 0l) && (_fileleft == 0l))) && (diff <= static_cast<int64_t>(_buf.size())))) {
char tmp[8196];
- sprintf(tmp, "diff %ld _fileleft=%ld _buflen=%ld", diff, _fileleft, _buf.size());
+ sprintf(tmp, "diff %" PRId64 " _fileleft=%" PRId64 " _buflen=%zu", diff, _fileleft, _buf.size());
*static_cast<int *>(0) = 5;
}
}
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp
index 47af497ec15..3486f7167c0 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.cpp
@@ -42,7 +42,7 @@ IndexFlushTarget::needUrgentFlush(void) const
{
bool urgent = _numFrozenMemoryIndexes > _maxFrozenMemoryIndexes;
SerialNum flushedSerial = _indexMaintainer.getFlushedSerialNum();
- LOG(debug, "Num frozen: %u Urgent: %d, flushedSerial=%lu",
+ LOG(debug, "Num frozen: %u Urgent: %d, flushedSerial=%" PRIu64,
_numFrozenMemoryIndexes, static_cast<int>(urgent), flushedSerial);
return urgent;
}
diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
index 440cc8bc605..dd31c476567 100644
--- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
+++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp
@@ -1180,7 +1180,7 @@ void
IndexMaintainer::compactLidSpace(uint32_t lidLimit, SerialNum serialNum)
{
assert(_ctx.getThreadingService().index().isCurrentThread());
- LOG(info, "compactLidSpace(%u, %lu)", lidLimit, serialNum);
+ LOG(info, "compactLidSpace(%u, %" PRIu64 ")", lidLimit, serialNum);
LockGuard lock(_index_update_lock);
_current_serial_num = serialNum;
_selector->compactLidSpace(lidLimit);
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp
index 7c30944d911..4b9b2639d3b 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp
@@ -82,8 +82,8 @@ ThreadImpl::registerTick(CycleType cycleType, MilliSecTime time)
if (data._lastTickMs == 0) { return; }
if (previousTickMs > nowMs) {
- LOGBP(warning, "Thread is registering tick at time %lu, but "
- "last time it registered a tick, the time was %lu"
+ LOGBP(warning, "Thread is registering tick at time %" PRIu64 ", but "
+ "last time it registered a tick, the time was %" PRIu64
". Assuming clock has been adjusted backwards",
nowMs, previousTickMs);
return;
diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
index 333f7257595..15328f1c627 100644
--- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
@@ -418,7 +418,7 @@ SearchVisitor::PositionInserter::onStructStart(const Content & c)
value.getValue(_fieldX, _valueX);
value.getValue(_fieldY, _valueY);
int64_t zcurve = vespalib::geo::ZCurve::encode(_valueX.getValue(), _valueY.getValue());
- LOG(debug, "X=%d, Y=%d, zcurve=%ld", _valueX.getValue(), _valueY.getValue(), zcurve);
+ LOG(debug, "X=%d, Y=%d, zcurve=%" PRId64, _valueX.getValue(), _valueY.getValue(), zcurve);
search::IExtendAttribute & attr = *_attribute.getExtendInterface();
attr.add(zcurve, c.getWeight());
}
diff --git a/vespalib/src/tests/zcurve/zcurve_ranges_test.cpp b/vespalib/src/tests/zcurve/zcurve_ranges_test.cpp
index d4acbf3bd30..b0af41667c1 100644
--- a/vespalib/src/tests/zcurve/zcurve_ranges_test.cpp
+++ b/vespalib/src/tests/zcurve/zcurve_ranges_test.cpp
@@ -2,6 +2,7 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/vespalib/geo/zcurve.h>
#include <vector>
+#include <cinttypes>
typedef vespalib::geo::ZCurve Z;
@@ -12,9 +13,9 @@ bool inside(int x, int y, const Z::RangeVector &ranges) {
return true;
}
}
- fprintf(stderr, "FAILED: (%d, %d) -> (%ld) not in:\n", x, y, z);
+ fprintf(stderr, "FAILED: (%d, %d) -> (%" PRId64 ") not in:\n", x, y, z);
for (auto range: ranges) {
- fprintf(stderr, " [%ld, %ld]\n", range.min(), range.max());
+ fprintf(stderr, " [%" PRId64 ", %" PRId64 "]\n", range.min(), range.max());
}
return false;
}
diff --git a/vespalib/src/vespa/vespalib/data/slime/json_format.cpp b/vespalib/src/vespa/vespalib/data/slime/json_format.cpp
index 3e06529cd5b..637be8db999 100644
--- a/vespalib/src/vespa/vespalib/data/slime/json_format.cpp
+++ b/vespalib/src/vespa/vespalib/data/slime/json_format.cpp
@@ -61,7 +61,7 @@ struct JsonEncoder : public ArrayTraverser,
}
}
void encodeLONG(int64_t value) {
- out.printf("%ld", value);
+ out.printf("%" PRId64, value);
}
void encodeDOUBLE(double value) {
if (std::isnan(value) || std::isinf(value)) {
diff --git a/vespalib/src/vespa/vespalib/io/fileutil.cpp b/vespalib/src/vespa/vespalib/io/fileutil.cpp
index 5c3cd04cbb4..3f54b83bee6 100644
--- a/vespalib/src/vespa/vespalib/io/fileutil.cpp
+++ b/vespalib/src/vespa/vespalib/io/fileutil.cpp
@@ -257,23 +257,23 @@ File::verifyDirectIO(uint64_t buf, size_t bufsize, off_t offset) const
{
if (offset % 512 != 0) {
LOG(error,
- "Access to file %s failed because offset %zd wasn't 512-byte "
- "aligned. Buffer memory address was %zx, length %zu",
- _filename.c_str(), offset, buf, bufsize);
+ "Access to file %s failed because offset %" PRIu64 " wasn't 512-byte "
+ "aligned. Buffer memory address was %" PRIx64 ", length %zu",
+ _filename.c_str(), static_cast<uint64_t>(offset), buf, bufsize);
assert(false);
}
if (buf % 512 != 0) {
LOG(error,
- "Access to file %s failed because buffer memory address %zx "
- "wasn't 512-byte aligned. Offset was %zd, length %zu",
- _filename.c_str(), buf, offset, bufsize);
+ "Access to file %s failed because buffer memory address %" PRIx64 " "
+ "wasn't 512-byte aligned. Offset was %" PRIu64 ", length %zu",
+ _filename.c_str(), buf, static_cast<uint64_t>(offset), bufsize);
assert(false);
}
if (bufsize % 512 != 0) {
LOG(error,
"Access to file %s failed because buffer size %zu wasn't 512-byte "
- "aligned. Buffer memory address was %zx, offset %zd",
- _filename.c_str(), bufsize, buf, offset);
+ "aligned. Buffer memory address was %" PRIx64 ", offset %" PRIu64,
+ _filename.c_str(), bufsize, buf, static_cast<uint64_t>(offset));
assert(false);
}
}
@@ -283,7 +283,7 @@ File::write(const void *buf, size_t bufsize, off_t offset)
{
++_fileWrites;
size_t left = bufsize;
- LOG(debug, "write(%s): Writing %" PRIu64 " bytes at offset %" PRIu64 ".",
+ LOG(debug, "write(%s): Writing %zu bytes at offset %" PRIu64 ".",
_filename.c_str(), bufsize, offset);
if (_flags & DIRECTIO) {
@@ -293,13 +293,13 @@ File::write(const void *buf, size_t bufsize, off_t offset)
while (left > 0) {
ssize_t written = ::pwrite(_fd, buf, left, offset);
if (written > 0) {
- LOG(spam, "write(%s): Wrote %" PRIu64 " bytes at offset %" PRIu64 ".",
+ LOG(spam, "write(%s): Wrote %zd bytes at offset %" PRIu64 ".",
_filename.c_str(), written, offset);
left -= written;
buf = ((const char*) buf) + written;
offset += written;
} else if (written == 0) {
- LOG(spam, "write(%s): Wrote %" PRIu64 " bytes at offset %" PRIu64 ".",
+ LOG(spam, "write(%s): Wrote %zd bytes at offset %" PRIu64 ".",
_filename.c_str(), written, offset);
assert(false); // Can this happen?
} else if (errno != EINTR && errno != EAGAIN) {
@@ -319,7 +319,7 @@ File::read(void *buf, size_t bufsize, off_t offset) const
{
++_fileReads;
size_t remaining = bufsize;
- LOG(debug, "read(%s): Reading %" PRIu64 " bytes from offset %" PRIu64 ".",
+ LOG(debug, "read(%s): Reading %zu bytes from offset %" PRIu64 ".",
_filename.c_str(), bufsize, offset);
if (_flags & DIRECTIO) {
@@ -329,7 +329,7 @@ File::read(void *buf, size_t bufsize, off_t offset) const
while (remaining > 0) {
ssize_t bytesread = ::pread(_fd, buf, remaining, offset);
if (bytesread > 0) {
- LOG(spam, "read(%s): Read %" PRIu64 " bytes from offset %" PRIu64 ".",
+ LOG(spam, "read(%s): Read %zd bytes from offset %" PRIu64 ".",
_filename.c_str(), bytesread, offset);
remaining -= bytesread;
buf = ((char*) buf) + bytesread;
@@ -720,7 +720,7 @@ copy(const string & frompath, const string & topath,
size_t sourceSize = source.getFileSize();
if (useDirectIO && sourceSize % diskAlignmentSize != 0) {
LOG(warning, "copy(%s, %s): Cannot use direct IO to write new file, "
- "as source file has size %" PRIu64 ", which is not "
+ "as source file has size %zu, which is not "
"dividable by the disk alignment size of %u.",
frompath.c_str(), topath.c_str(), sourceSize, diskAlignmentSize);
useDirectIO = false;
diff --git a/vespalib/src/vespa/vespalib/trace/trace.cpp b/vespalib/src/vespa/vespalib/trace/trace.cpp
index 4d0ecc0e9df..8ca2ef6561c 100644
--- a/vespalib/src/vespa/vespalib/trace/trace.cpp
+++ b/vespalib/src/vespa/vespalib/trace/trace.cpp
@@ -54,7 +54,7 @@ Trace::trace(uint32_t level, const string &note, bool addTime)
if (addTime) {
struct timeval tv;
gettimeofday(&tv, NULL);
- _root.addChild(make_string("[%ld.%06ld] %s", tv.tv_sec, tv.tv_usec, note.c_str()));
+ _root.addChild(make_string("[%ld.%06ld] %s", tv.tv_sec, static_cast<long>(tv.tv_usec), note.c_str()));
} else {
_root.addChild(note);
}
diff --git a/vespalib/src/vespa/vespalib/util/compress.cpp b/vespalib/src/vespa/vespalib/util/compress.cpp
index 617b632e0bf..12f511f9062 100644
--- a/vespalib/src/vespa/vespalib/util/compress.cpp
+++ b/vespalib/src/vespa/vespalib/util/compress.cpp
@@ -15,7 +15,7 @@ size_t Integer::compressedPositiveLength(uint64_t n)
} else if ( n < (0x1 << 30)) {
return 4;
} else {
- throw IllegalArgumentException(make_string("Number '%lu' too big, must extend encoding", n));
+ throw IllegalArgumentException(make_string("Number '%" PRIu64 "' too big, must extend encoding", n));
}
}
@@ -37,7 +37,7 @@ size_t Integer::compressPositive(uint64_t n, void *destination)
d[3] = n & 0xff;
return 4;
} else {
- throw IllegalArgumentException(make_string("Number '%lu' too big, must extend encoding", n));
+ throw IllegalArgumentException(make_string("Number '%" PRIu64 "' too big, must extend encoding", n));
}
}
@@ -53,7 +53,7 @@ size_t Integer::compressedLength(int64_t n)
} else if ( n < (0x1 << 29)) {
return 4;
} else {
- throw IllegalArgumentException(make_string("Number '%ld' too big, must extend encoding", n));
+ throw IllegalArgumentException(make_string("Number '%" PRId64 "' too big, must extend encoding", n));
}
}
@@ -78,7 +78,7 @@ size_t Integer::compress(int64_t n, void *destination)
d[3] = n & 0xff;
return 4;
} else {
- throw IllegalArgumentException(make_string("Number '%ld' too big, must extend encoding", negative ? -n : n));
+ throw IllegalArgumentException(make_string("Number '%" PRId64 "' too big, must extend encoding", negative ? -n : n));
}
}
diff --git a/vespalib/src/vespa/vespalib/util/compressor.cpp b/vespalib/src/vespa/vespalib/util/compressor.cpp
index 6853c8375fd..efa61197739 100644
--- a/vespalib/src/vespa/vespalib/util/compressor.cpp
+++ b/vespalib/src/vespa/vespalib/util/compressor.cpp
@@ -84,7 +84,7 @@ decompress(ICompressor & decompressor, size_t uncompressedLen, const ConstBuffer
dest.writeBytes(org.c_str(), org.size());
}
} else {
- throw std::runtime_error(make_string("unprocess failed had %" PRIu64 ", wanted %" PRId64 ", got %" PRIu64,
+ throw std::runtime_error(make_string("unprocess failed had %zu, wanted %zu, got %zu",
org.size(), uncompressedLen, realUncompressedLen));
}
} else {