diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-03-12 21:30:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-12 21:30:45 +0100 |
commit | fda1590f87993c3c7c306dcb5cb165504c7b3aa9 (patch) | |
tree | 258a933e9bcad57b150fcaa5c7477de4bf59799a | |
parent | 767db18444bc5364618f987a413143bc27818c34 (diff) | |
parent | aea7b70cc8bf14c4c132430e4dff38db72e32c24 (diff) |
Merge pull request #8763 from vespa-engine/toregge/fix-format-strings-2
Fix format strings in searchlib module.
18 files changed, 53 insertions, 51 deletions
diff --git a/searchlib/src/apps/docstore/create-idx-from-dat.cpp b/searchlib/src/apps/docstore/create-idx-from-dat.cpp index b6794832afb..5990b3ec805 100644 --- a/searchlib/src/apps/docstore/create-idx-from-dat.cpp +++ b/searchlib/src/apps/docstore/create-idx-from-dat.cpp @@ -6,6 +6,7 @@ #include <vespa/vespalib/objects/nbostream.h> #include <vespa/fastos/app.h> #include <vespa/vespalib/util/exception.h> +#include <cinttypes> using namespace search; @@ -60,10 +61,10 @@ generate(uint64_t serialNum, size_t chunks, FastOS_FileInterface & idxFile, size for (size_t lengthError(0); int64_t(sz+lengthError) <= nextStart-start; lengthError++) { try { Chunk chunk(chunks, current, sz + lengthError, false); - fprintf(stdout, "id=%d lastSerial=%ld count=%ld\n", chunk.getId(), chunk.getLastSerial(), chunk.count()); + fprintf(stdout, "id=%d lastSerial=%" PRIu64 " count=%ld\n", chunk.getId(), chunk.getLastSerial(), chunk.count()); const Chunk::LidList & lidlist = chunk.getLids(); if (chunk.getLastSerial() < serialNum) { - fprintf(stdout, "Serial num grows down prev=%ld, current=%ld\n", serialNum, chunk.getLastSerial()); + fprintf(stdout, "Serial num grows down prev=%" PRIu64 ", current=%" PRIu64 "\n", serialNum, chunk.getLastSerial()); } serialNum = std::max(serialNum, chunk.getLastSerial()); ChunkMeta cmeta(current-start, sz + lengthError, serialNum, chunk.count()); @@ -96,7 +97,7 @@ int CreateIdxFileFromDatApp::createIdxFile(const vespalib::string & datFileName, assert(idxFile.OpenWriteOnly()); index::DummyFileHeaderContext fileHeaderContext; idxFile.SetPosition(WriteableFileChunk::writeIdxHeader(fileHeaderContext, std::numeric_limits<uint32_t>::max(), idxFile)); - fprintf(stdout, "datHeaderLen=%ld\n", datHeaderLen); + fprintf(stdout, "datHeaderLen=%" PRIu64 "\n", datHeaderLen); uint64_t serialNum(0); for (const char * current(start + datHeaderLen); current < end; ) { if (validHead(current, current-start)) { @@ -111,7 +112,7 @@ int CreateIdxFileFromDatApp::createIdxFile(const vespalib::string & datFileName, if (tryDecode(chunks, current-start, current, tail - current, nextStart-current)) { break; } else { - fprintf(stdout, "chunk %ld possibly starting at %ld ending at %ld false sync at pos=%ld\n", + fprintf(stdout, "chunk %" PRIu64 " possibly starting at %ld ending at %ld false sync at pos=%ld\n", chunks, current-start, tail-start, nextStart-start); } } @@ -124,7 +125,7 @@ int CreateIdxFileFromDatApp::createIdxFile(const vespalib::string & datFileName, } } uint64_t sz = tail - current; - fprintf(stdout, "Most likely found chunk at offset %ld with length %ld\n", current - start, sz); + fprintf(stdout, "Most likely found chunk at offset %ld with length %" PRIu64 "\n", current - start, sz); serialNum = generate(serialNum, chunks,idxFile, sz, current, start, nextStart); chunks++; for(current += alignment; current < tail; current += alignment); @@ -144,7 +145,7 @@ int CreateIdxFileFromDatApp::createIdxFile(const vespalib::string & datFileName, } #endif } - fprintf(stdout, "Processed %ld chunks with total entries = %ld\n", chunks, entries); + fprintf(stdout, "Processed %" PRIu64 " chunks with total entries = %" PRIu64 "\n", chunks, entries); return 0; } diff --git a/searchlib/src/apps/docstore/documentstoreinspect.cpp b/searchlib/src/apps/docstore/documentstoreinspect.cpp index 40f603c3da1..2526ce456ae 100644 --- a/searchlib/src/apps/docstore/documentstoreinspect.cpp +++ b/searchlib/src/apps/docstore/documentstoreinspect.cpp @@ -6,6 +6,7 @@ #include <vespa/fastos/app.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/util/threadstackexecutor.h> +#include <cinttypes> using namespace search; @@ -43,7 +44,7 @@ int DocumentStoreInspectApp::dumpIdxFile(const vespalib::string & file) for (; ! is.empty(); chunk++) { ChunkMeta cm; cm.deserialize(is); - fprintf(stdout, "Chunk(%ld) : LastSerial(%ld), Entries(%d), Offset(%ld), Size(%d)\n", + fprintf(stdout, "Chunk(%zd) : LastSerial(%" PRIu64 "), Entries(%d), Offset(%" PRIu64 "), Size(%d)\n", chunk, cm.getLastSerial(), cm.getNumEntries(), cm.getOffset(), cm.getSize()); for (size_t i(0), m(cm.getNumEntries()); i < m; i++, entries++) { LidMeta lm; diff --git a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp index 8c3684829fd..ce9e6bc737e 100644 --- a/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp +++ b/searchlib/src/tests/attribute/compaction/attribute_compaction_test.cpp @@ -141,7 +141,7 @@ public: AttributeStatus getStatus() { _v->commit(true); return _v->getStatus(); } AttributeStatus getStatus(const vespalib::string &prefix) { AttributeStatus status(getStatus()); - LOG(info, "status %s: used=%zu, dead=%zu, onHold=%zu", + LOG(info, "status %s: used=%" PRIu64 ", dead=%" PRIu64 ", onHold=%" PRIu64, prefix.c_str(), status.getUsed(), status.getDead(), status.getOnHold()); return status; } diff --git a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp index 185b36ec414..c678d88427f 100644 --- a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp +++ b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp @@ -348,7 +348,7 @@ addBoundary(uint64_t boundary, uint64_t maxVal, std::vector<uint64_t> &v) uint64_t low = boundary > 2u ? boundary - 2 : 0; uint64_t high = maxVal - 2u < boundary ? maxVal : boundary + 2; assert(low <= high); - LOG(info, "low=0x%lx, high=0x%lx", low, high); + LOG(info, "low=0x%" PRIx64 ", high=0x%" PRIx64, low, high); uint64_t i = low; for (;;) { v.push_back(i); @@ -370,14 +370,14 @@ TestFixtureBase::calcBoundaries(int kValue, bool small, if (small) { maxVal = EC::maxExpGolombVal(kValue, 64); } - LOG(debug, "kValue=%u, %s, maxVal is 0x%lx", kValue, smallStr, maxVal); + LOG(debug, "kValue=%u, %s, maxVal is 0x%" PRIx64, kValue, smallStr, maxVal); for (int bits = kValue + 1; bits + kValue <= 128 && (bits <= 64 || !small); ++bits) { uint64_t boundary = EC::maxExpGolombVal(kValue, bits); if (bits + kValue == 128) { LOG(debug, - "boundary for kValue=%d, %s, bits=%d: 0x%lx", + "boundary for kValue=%d, %s, bits=%d: 0x%" PRIx64, kValue, smallStr, bits, boundary); } addBoundary(boundary, maxVal, v); @@ -388,7 +388,7 @@ TestFixtureBase::calcBoundaries(int kValue, bool small, v.resize(ve - v.begin()); uint32_t newSize = v.size(); LOG(debug, - "kValues=%u, %s, boundaries %u -> %u, maxVal=0x%lx, highest=0x%lx", + "kValues=%u, %s, boundaries %u -> %u, maxVal=0x%" PRIx64 ", highest=0x%" PRIx64, kValue, smallStr, oldSize, newSize, maxVal, v.back()); } diff --git a/searchlib/src/tests/bytecomplens/bytecomp.cpp b/searchlib/src/tests/bytecomplens/bytecomp.cpp index 8d91116032d..adc92b0097d 100644 --- a/searchlib/src/tests/bytecomplens/bytecomp.cpp +++ b/searchlib/src/tests/bytecomplens/bytecomp.cpp @@ -92,7 +92,7 @@ Test::testRandomLengths() offlen = foo.getOffLen(i); if ((i % 1000000) == 0) { - LOG(info, "data blob [%d] length %ld offset %ld", i, offlen.length, offlen.offset); + LOG(info, "data blob [%d] length %" PRIu64 " offset %" PRIu64, i, offlen.length, offlen.offset); } EXPECT_EQUAL(lentable[i], offlen.length); EXPECT_EQUAL(offtable[i], offlen.offset); diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp index 84d925e0780..436bfd97d8f 100644 --- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp +++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp @@ -44,8 +44,8 @@ void showStats(const DataStoreStorageStats &stats) { fprintf(stdout, - "Storage stats usage=%9lu bloat=%9lu" - " lastSerial=%9lu lastFlushedSerial=%9lu" + "Storage stats usage=%9" PRIu64 " bloat=%9" PRIu64 + " lastSerial=%9" PRIu64 " lastFlushedSerial=%9" PRIu64 " maxBucketSpread=%6.2f\n", stats.diskUsage(), stats.diskBloat(), stats.lastSerialNum(), stats.lastFlushedSerialNum(), @@ -59,8 +59,8 @@ showChunks(const std::vector<DataStoreFileChunkStats> &chunkStats) fprintf(stdout, "Number of chunks is %zu\n", chunkStats.size()); for (const auto &chunk : chunkStats) { fprintf(stdout, - "Chunk %019lu usage=%9lu bloat=%9lu" - " lastSerial=%9lu lastFlushedSerial=%9lu" + "Chunk %019" PRIu64 " usage=%9" PRIu64 " bloat=%9" PRIu64 + " lastSerial=%9" PRIu64 " lastFlushedSerial=%9" PRIu64 " bucketSpread=%6.2f\n", chunk.nameId(), chunk.diskUsage(), chunk.diskBloat(), chunk.lastSerialNum(), chunk.lastFlushedSerialNum(), diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp index 28310c65862..49c378f0e3e 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp @@ -163,7 +163,7 @@ public: _rangeSearches.push_back(attr.createSearchContext(QueryTermDecoder::decodeTerm(stack), attribute::SearchContextParams())); estHits += _rangeSearches.back()->approximateHits(); - LOG(debug, "Range '%s' estHits %ld", qr.getRangeString().c_str(), estHits); + LOG(debug, "Range '%s' estHits %" PRId64, qr.getRangeString().c_str(), estHits); } if (estHits > attr.getNumDocs()) { estHits = attr.getNumDocs(); diff --git a/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp b/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp index a063ed347a4..e124cc05448 100644 --- a/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp +++ b/searchlib/src/vespa/searchlib/common/bitvectorcache.cpp @@ -146,7 +146,7 @@ BitVectorCache::populate(Key2Index & newKeys, CondensedBitVector & chunk, const accum += percentage; m.chunkId(0); m.chunkIndex(index); - LOG(info, "Populating bitvector %2d with feature %ld and %ld bits set. Cost is %8f = %2.2f%%, accumulated cost is %2.2f%%", + LOG(info, "Populating bitvector %2d with feature %" PRIu64 " and %ld bits set. Cost is %8f = %2.2f%%, accumulated cost is %2.2f%%", index, e.first, m.bitCount(), m.cost(), percentage, accum); index++; assert(m.isCached()); diff --git a/searchlib/src/vespa/searchlib/docstore/bytecomplens.cpp b/searchlib/src/vespa/searchlib/docstore/bytecomplens.cpp index acf7fb2aee0..4ef57b77dbd 100644 --- a/searchlib/src/vespa/searchlib/docstore/bytecomplens.cpp +++ b/searchlib/src/vespa/searchlib/docstore/bytecomplens.cpp @@ -177,8 +177,8 @@ ByteCompressedLengths::addOffsetTable(uint64_t entries, uint64_t *offsets) _ptrcache.l2table = (uint8_t *)_l2space.getData(); // some statistics available when debug logging: - LOG(debug, "compressed %ld offsets", (_entries+1)); - LOG(debug, "(%ld bytes)", (_entries+1)*sizeof(uint64_t)); + LOG(debug, "compressed %" PRIu64 " offsets", (_entries+1)); + LOG(debug, "(%" PRIu64 " bytes)", (_entries+1)*sizeof(uint64_t)); LOG(debug, "to (%ld + %ld + %ld) bytes + %ld l3entries", _l0space.getDataLen(), _l1space.getDataLen(), diff --git a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp index 39394724853..e175fbd9381 100644 --- a/searchlib/src/vespa/searchlib/docstore/filechunk.cpp +++ b/searchlib/src/vespa/searchlib/docstore/filechunk.cpp @@ -186,14 +186,14 @@ FileChunk::updateLidMap(const LockGuard &guard, ISetLid &ds, uint64_t serialNum, chunkMeta.fill(is); } catch (const vespalib::IllegalStateException & e) { LOG(warning, "Exception deserializing idx file : %s", e.what()); - LOG(warning, "File '%s' seems to be partially truncated. Will truncate from size=%ld to %ld", + LOG(warning, "File '%s' seems to be partially truncated. Will truncate from size=%" PRId64 " to %" PRId64, _idxFileName.c_str(), fileSize, lastKnownGoodPos); FastOS_File toTruncate(_idxFileName.c_str()); if ( toTruncate.OpenReadWrite()) { if (toTruncate.SetSize(lastKnownGoodPos)) { tempVector.resize(tempVector.size() - 1); } else { - throw SummaryException("SetSize(%ld) failed.", toTruncate, VESPA_STRLOC); + throw SummaryException("SetSize() failed.", toTruncate, VESPA_STRLOC); } } else { throw SummaryException("Open for truncation failed.", toTruncate, VESPA_STRLOC); @@ -205,8 +205,8 @@ FileChunk::updateLidMap(const LockGuard &guard, ISetLid &ds, uint64_t serialNum, verifyOrAssert(tempVector); if (tempVector[0].getLastSerial() < serialNum) { LOG(warning, - "last serial num(%ld) from previous file is " - "bigger than my first(%ld). That is odd." + "last serial num(%" PRIu64 ") from previous file is " + "bigger than my first(%" PRIu64 "). That is odd." "Current filename is '%s'", serialNum, tempVector[0].getLastSerial(), _idxFileName.c_str()); @@ -478,7 +478,7 @@ FileChunk::verify(bool reportOnly) const LOG(info, "Verifying file '%s' with fileid '%u'. erased-count='%zu' and erased-bytes='%zu'. diskFootprint='%zu'", _name.c_str(), _fileId.getId(), _erasedCount, _erasedBytes, _diskFootprint); - size_t lastSerial(0); + uint64_t lastSerial(0); size_t chunkId(0); bool errorInPrev(false); for (const ChunkInfo & ci : _chunkInfo) { @@ -489,13 +489,13 @@ FileChunk::verify(bool reportOnly) const assert(chunk.getLastSerial() >= lastSerial); lastSerial = chunk.getLastSerial(); if (errorInPrev) { - LOG(error, "Last serial number in first good chunk is %ld", chunk.getLastSerial()); + LOG(error, "Last serial number in first good chunk is %" PRIu64, chunk.getLastSerial()); errorInPrev = false; } } catch (const std::exception & e) { LOG(error, - "Errors in chunk number %ld/%ld at file offset %lu and size %u." - " Last known good serial number = %ld\n.Got Exception : %s", + "Errors in chunk number %zu/%zu at file offset %" PRIu64 " and size %u." + " Last known good serial number = %" PRIu64 "\n.Got Exception : %s", chunkId, _chunkInfo.size(), ci.getOffset(), ci.getSize(), lastSerial, e.what()); errorInPrev = true; } diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp index ac874911b27..6db0dee5c85 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp +++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp @@ -639,7 +639,7 @@ LogDataStore::createWritableFile(FileId fileId, SerialNum serialNum, NameId name { for (const auto & fc : _fileChunks) { if (fc && (fc->getNameId() == nameId)) { - LOG(error, "We already have a file registered with internal fileId=%u, and external nameId=%ld", + LOG(error, "We already have a file registered with internal fileId=%u, and external nameId=%" PRIu64, fileId.getId(), nameId.getId()); return FileChunk::UP(); } @@ -667,7 +667,7 @@ lsSingleFile(const vespalib::string & fileName) vespalib::string s; FastOS_StatInfo stat; if ( FastOS_File::Stat(fileName.c_str(), &stat)) { - s += make_string("%s %20ld %12ld", fileName.c_str(), stat._modifiedTimeNS, stat._size); + s += make_string("%s %20" PRIu64 " %12" PRId64, fileName.c_str(), stat._modifiedTimeNS, stat._size); } else { s = make_string("%s 'stat' FAILED !!", fileName.c_str()); } @@ -747,13 +747,13 @@ LogDataStore::verifyModificationTime(const NameIdSet & partList) } ns_log::Logger::LogLevel logLevel = ns_log::Logger::debug; if ((datStat._modifiedTimeNS < prevDatStat._modifiedTimeNS) && hasNonHeaderData(datName)) { - VLOG(logLevel, "Older file '%s' is newer (%ld) than file '%s' (%ld)\nDirectory =\n%s", + VLOG(logLevel, "Older file '%s' is newer (%" PRIu64 ") than file '%s' (%" PRIu64 ")\nDirectory =\n%s", prevDatNam.c_str(), prevDatStat._modifiedTimeNS, datName.c_str(), datStat._modifiedTimeNS, ls(partList).c_str()); } if ((idxStat._modifiedTimeNS < prevIdxStat._modifiedTimeNS) && hasNonHeaderData(idxName)) { - VLOG(logLevel, "Older file '%s' is newer (%ld) than file '%s' (%ld)\nDirectory =\n%s", + VLOG(logLevel, "Older file '%s' is newer (%" PRIu64 ") than file '%s' (%" PRIu64 ")\nDirectory =\n%s", prevIdxNam.c_str(), prevIdxStat._modifiedTimeNS, idxName.c_str(), idxStat._modifiedTimeNS, ls(partList).c_str()); @@ -828,7 +828,7 @@ LogDataStore::findIncompleteCompactedFiles(const NameIdSet & partList) { for (FileChunk::NameId prev = *it++; it != partList.end(); it++) { if (prev.next() == *it) { if (!incomplete.empty() && (*incomplete.rbegin() == prev)) { - throw IllegalStateException(make_string("3 consecutive files {%ld, %ld, %ld}. Impossible", + throw IllegalStateException(make_string("3 consecutive files {%" PRIu64 ", %" PRIu64 ", %" PRIu64 "}. Impossible", prev.getId()-1, prev.getId(), it->getId())); } incomplete.insert(*it); diff --git a/searchlib/src/vespa/searchlib/expression/resultnodes.cpp b/searchlib/src/vespa/searchlib/expression/resultnodes.cpp index 8e34babd92a..fb4652a4d62 100644 --- a/searchlib/src/vespa/searchlib/expression/resultnodes.cpp +++ b/searchlib/src/vespa/searchlib/expression/resultnodes.cpp @@ -438,7 +438,7 @@ RawResultNode::onGetString(size_t, BufferRef ) const { ResultNode::ConstBufferRef EnumResultNode::onGetString(size_t, BufferRef buf) const { - int numWritten(std::min(buf.size(), (size_t)std::max(0, snprintf(buf.str(), buf.size(), "%ld", getValue())))); + int numWritten(std::min(buf.size(), (size_t)std::max(0, snprintf(buf.str(), buf.size(), "%" PRId64, getValue())))); return ConstBufferRef(buf.str(), numWritten); } @@ -467,7 +467,7 @@ Int32ResultNode::onGetString(size_t, BufferRef buf) const { ResultNode::ConstBufferRef Int64ResultNode::onGetString(size_t, BufferRef buf) const { - int numWritten(std::min(buf.size(), (size_t)std::max(0, snprintf(buf.str(), buf.size(), "%ld", getValue())))); + int numWritten(std::min(buf.size(), (size_t)std::max(0, snprintf(buf.str(), buf.size(), "%" PRId64, getValue())))); return ConstBufferRef(buf.str(), numWritten); } diff --git a/searchlib/src/vespa/searchlib/features/random_normal_feature.cpp b/searchlib/src/vespa/searchlib/features/random_normal_feature.cpp index 192fc968324..99de8ba31e2 100644 --- a/searchlib/src/vespa/searchlib/features/random_normal_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/random_normal_feature.cpp @@ -14,7 +14,7 @@ RandomNormalExecutor::RandomNormalExecutor(uint64_t seed, double mean, double st search::fef::FeatureExecutor(), _rnd(mean, stddev, true) { - LOG(debug, "RandomNormalExecutor: seed=%zu, mean=%f, stddev=%f", seed, mean, stddev); + LOG(debug, "RandomNormalExecutor: seed=%" PRIu64 ", mean=%f, stddev=%f", seed, mean, stddev); _rnd.seed(seed); } diff --git a/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.cpp b/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.cpp index f760f52ee88..5e93173abac 100644 --- a/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.cpp @@ -15,7 +15,7 @@ RandomNormalStableExecutor::RandomNormalStableExecutor(uint64_t seed, double mea _rnd(mean, stddev, false), // don't use spares, as we reset seed on every generation _seed(seed) { - LOG(debug, "RandomNormalStableExecutor: seed=%zu, mean=%f, stddev=%f", seed, mean, stddev); + LOG(debug, "RandomNormalStableExecutor: seed=%" PRIu64 ", mean=%f, stddev=%f", seed, mean, stddev); } void diff --git a/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp b/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp index 946bec964de..dac446df7d5 100644 --- a/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp +++ b/searchlib/src/vespa/searchlib/parsequery/simplequerystack.cpp @@ -157,13 +157,13 @@ SimpleQueryStack::StackbufToString(vespalib::stringref theBuf) int64_t tmpLong(0); p += vespalib::compress::Integer::decompress(tmpLong, p); metaStr.append("(w:"); - metaStr.append(make_string("%ld", tmpLong)); + metaStr.append(make_string("%" PRId64, tmpLong)); metaStr.append(")"); } if (ParseItem::getFeature_UniqueId(rawtype)) { p += vespalib::compress::Integer::decompressPositive(tmp, p); metaStr.append("(u:"); - metaStr.append(make_string("%ld", tmp)); + metaStr.append(make_string("%" PRIu64, tmp)); metaStr.append(")"); } if (ParseItem::getFeature_Flags(rawtype)) { @@ -290,7 +290,7 @@ SimpleQueryStack::StackbufToString(vespalib::stringref theBuf) vespalib::string key = ReadString(p); vespalib::string value = ReadString(p); uint64_t sub_queries = ReadUint64(p); - result.append(make_string("%s:%s:%lx", key.c_str(), value.c_str(), sub_queries)); + result.append(make_string("%s:%s:%" PRIx64, key.c_str(), value.c_str(), sub_queries)); if (i < feature_count - 1) { result.append(','); } @@ -302,7 +302,7 @@ SimpleQueryStack::StackbufToString(vespalib::stringref theBuf) vespalib::string key = ReadString(p); uint64_t value = ReadUint64(p); uint64_t sub_queries = ReadUint64(p); - result.append(make_string("%s:%zu:%lx", key.c_str(), value, sub_queries)); + result.append(make_string("%s:%" PRIu64 ":%" PRIx64, key.c_str(), value, sub_queries)); if (i < range_feature_count - 1) { result.append(','); } diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_range_term_expander.h b/searchlib/src/vespa/searchlib/predicate/predicate_range_term_expander.h index ea4ca45b290..807d73fbe8c 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_range_term_expander.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_range_term_expander.h @@ -63,7 +63,7 @@ void PredicateRangeTermExpander::expand(const vespalib::string &key, int64_t sig } int64_t edge_interval = (value / _arity) * _arity; - size = sprintf(buffer + prefix_size, "%lu", edge_interval); + size = sprintf(buffer + prefix_size, "%" PRIu64, edge_interval); handler.handleEdge(vespalib::stringref(buffer, prefix_size + size), value - edge_interval); @@ -74,13 +74,13 @@ void PredicateRangeTermExpander::expand(const vespalib::string &key, int64_t sig if (start + level_size - 1 > uint64_t(-LLONG_MIN)) { break; } - size = sprintf(buffer + prefix_size, "%lu-%lu", + size = sprintf(buffer + prefix_size, "%" PRIu64 "-%" PRIu64, start + level_size - 1, start); } else { if (start + level_size - 1 > LLONG_MAX) { break; } - size = sprintf(buffer + prefix_size, "%lu-%lu", + size = sprintf(buffer + prefix_size, "%" PRIu64 "-%" PRIu64, start, start + level_size - 1); } handler.handleRange(vespalib::stringref(buffer, prefix_size + size)); diff --git a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp index 126028c27e9..d2838711a51 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp @@ -96,7 +96,7 @@ handleWriteError(const char *text, string getError(FastOS_FileInterface & f) { - return make_string("File '%s' of size %ld has last error of '%s'.", + return make_string("File '%s' of size %" PRId64 " has last error of '%s'.", f.GetFileName(), f.GetSize(), FastOS_File::getLastErrorString().c_str()); } @@ -418,7 +418,7 @@ DomainPart::commit(SerialNum firstSerial, const Packet &packet) _sz++; _range.to(entry.serial()); } else { - throw runtime_error(make_string("Incomming serial number(%ld) must be bigger than the last one (%ld).", + throw runtime_error(make_string("Incomming serial number(%" PRIu64 ") must be bigger than the last one (%" PRIu64 ").", entry.serial(), _range.to())); } } @@ -615,7 +615,7 @@ DomainPart::read(FastOS_FileInterface &file, if ((retval = (rlen == sizeof(tmp)))) { if ( ! (retval = (version == ccitt_crc32) || version == xxh64)) { string msg(make_string("Version mismatch. Expected 'ccitt_crc32=1' or 'xxh64=2'," - " got %d from '%s' at position %ld", + " got %d from '%s' at position %" PRId64, version, file.GetFileName(), lastKnownGoodPos)); if ((version == 0) && (len == 0) && tailOfFileIsZero(file, lastKnownGoodPos)) { LOG(warning, "%s", msg.c_str()); diff --git a/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp b/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp index 3adccb2f815..a3aa4be384d 100644 --- a/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp +++ b/searchlib/src/vespa/searchlib/util/filesizecalculator.cpp @@ -31,19 +31,19 @@ FileSizeCalculator::extractFileSize(const vespalib::GenericHeader &header, uint64_t fileByteSize = fileBitSize / 8; if (!byteAligned(fileBitSize)) { LOG(error, - "Bad header file size tag for %s, fileBitSize=%zu which is not a multiple of 8", + "Bad header file size tag for %s, fileBitSize=%" PRIu64 " which is not a multiple of 8", fileName.c_str(), fileBitSize); return false; } if (fileByteSize < headerLen) { LOG(error, - "Bad header file size tag for %s, fileBitSize=%zu but header is %zu bits", + "Bad header file size tag for %s, fileBitSize=%" PRIu64 " but header is %zu bits", fileName.c_str(), fileBitSize, headerLen * 8); return false; } if (fileByteSize > fileSize) { LOG(error, - "Bad header file size tag for %s, fileBitSize=%zu but whole file size is %zu bits", + "Bad header file size tag for %s, fileBitSize=%" PRIu64 " but whole file size is %" PRIu64 " bits", fileName.c_str(), fileBitSize, fileSize * 8); return false; } |