diff options
Diffstat (limited to 'searchcore/src')
10 files changed, 32 insertions, 31 deletions
diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp index 6a098667be8..d88199e6ae8 100644 --- a/searchcore/src/tests/proton/index/indexmanager_test.cpp +++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp @@ -662,7 +662,7 @@ TEST_F("requireThatSerialNumberIsReadOnLoad", Fixture) { void crippleFusion(uint32_t fusionId) { vespalib::asciistream ost; ost << index_dir << "/index.flush." << fusionId << "/serial.dat"; - FastOS_File(ost.str().c_str()).Delete(); + FastOS_File(ost.str().data()).Delete(); } TEST_F("requireThatFailedFusionIsRetried", Fixture) { diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp index 8206eba6350..0a520044985 100644 --- a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp @@ -68,7 +68,7 @@ public: DocsumReply::Docsum docsum; docsum.docid = 10 + i; docsum.gid = h.gid; - docsum.setData(_reply.c_str(), _reply.size()); + docsum.setData(_reply.data(), _reply.size()); retval->docsums.push_back(docsum); } return retval; diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/query.h b/searchcore/src/vespa/searchcore/fdispatch/search/query.h index 171a68de9ab..4d336d9843e 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/query.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/query.h @@ -70,6 +70,6 @@ private: const vespalib::stringref &b) { return (a.size() == b.size() && - memcmp(a.c_str(), b.c_str(), a.size()) == 0); + memcmp(a.data(), b.data(), a.size()) == 0); } }; diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp index d1731b91e6c..90c6fa2155c 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/search/search_path.cpp @@ -46,7 +46,7 @@ SearchPath::parsePartList(const vespalib::stringref &partSpec, size_t numNodes) } } catch (const std::exception & e) { LOG(warning, "Failed parsing part of searchpath='%s' with error '%s'. Result might be mumbo jumbo.", - partSpec.c_str(), e.what()); + vespalib::string(partSpec).c_str(), e.what()); } } @@ -97,7 +97,8 @@ void SearchPath::parseRow(const vespalib::stringref &rowSpec) { if (!rowSpec.empty()) { - _elements.back().setRow(strtoul(rowSpec.c_str(), NULL, 0)); + // FIXME C++17 range-safe from_chars() instead of strtoul() + _elements.back().setRow(strtoul(rowSpec.data(), nullptr, 0)); } } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp index eb6020b8d5f..3fecf661dcd 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp @@ -555,12 +555,12 @@ AttributeWriter::update(SerialNum serialNum, const DocumentUpdate &upd, Document } for (const auto &fupd : upd.getUpdates()) { - LOG(debug, "Retrieving guard for attribute vector '%s'.", fupd.getField().getName().c_str()); + LOG(debug, "Retrieving guard for attribute vector '%s'.", vespalib::string(fupd.getField().getName()).c_str()); auto found = _attrMap.find(fupd.getField().getName()); AttributeVector * attrp = (found != _attrMap.end()) ? found->second.first : nullptr; onUpdate.onUpdateField(fupd.getField().getName(), attrp); if (attrp == nullptr) { - LOG(spam, "Failed to find attribute vector %s", fupd.getField().getName().c_str()); + LOG(spam, "Failed to find attribute vector %s", vespalib::string(fupd.getField().getName()).c_str()); continue; } // TODO: Check if we must use > due to multiple entries for same diff --git a/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp b/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp index f3afab96cf5..78f73742fed 100644 --- a/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp @@ -28,7 +28,7 @@ doTransactionLogReplayStart(const string &domainName, SerialNum first, SerialNum .appendKey("last").appendInt64(last) .endObject(); jstr.endObject(); - EV_STATE(eventName.c_str(), jstr.toString().c_str()); + EV_STATE(eventName.c_str(), jstr.toString().data()); } void @@ -39,7 +39,7 @@ doTransactionLogReplayComplete(const string &domainName, int64_t elapsedTimeMs, jstr.appendKey("domain").appendString(domainName); jstr.appendKey("time.elapsed.ms").appendInt64(elapsedTimeMs); jstr.endObject(); - EV_STATE(eventName.c_str(), jstr.toString().c_str()); + EV_STATE(eventName.c_str(), jstr.toString().data()); } } @@ -67,7 +67,7 @@ EventLogger::transactionLogReplayProgress(const string &domainName, float progre .appendKey("current").appendInt64(current) .endObject(); jstr.endObject(); - EV_STATE("transactionlog.replay.progress", jstr.toString().c_str()); + EV_STATE("transactionlog.replay.progress", jstr.toString().data()); } void @@ -83,7 +83,7 @@ EventLogger::flushInit(const string &name) jstr.beginObject(); jstr.appendKey("name").appendString(name); jstr.endObject(); - EV_STATE("flush.init", jstr.toString().c_str()); + EV_STATE("flush.init", jstr.toString().data()); } void @@ -105,7 +105,7 @@ EventLogger::flushStart(const string &name, int64_t beforeMemory, int64_t afterM .appendKey("current").appendInt64(current) .endObject(); jstr.endObject(); - EV_STATE("flush.start", jstr.toString().c_str()); + EV_STATE("flush.start", jstr.toString().data()); } void @@ -121,7 +121,7 @@ EventLogger::flushComplete(const string &name, int64_t elapsedTimeMs, LogUtil::logDir(jstr, outputPath, outputPathElems); } jstr.endObject(); - EV_STATE("flush.complete", jstr.toString().c_str()); + EV_STATE("flush.complete", jstr.toString().data()); } namespace { @@ -146,7 +146,7 @@ EventLogger::populateAttributeStart(const std::vector<string> &names) jstr.beginObject(); addNames(jstr, names); jstr.endObject(); - EV_STATE("populate.attribute.start", jstr.toString().c_str()); + EV_STATE("populate.attribute.start", jstr.toString().data()); } void @@ -157,7 +157,7 @@ EventLogger::populateAttributeComplete(const std::vector<string> &names, int64_t addNames(jstr, names); jstr.appendKey("documents.populated").appendInt64(documentsPopulated); jstr.endObject(); - EV_STATE("populate.attribute.complete", jstr.toString().c_str()); + EV_STATE("populate.attribute.complete", jstr.toString().data()); } void @@ -167,7 +167,7 @@ EventLogger::populateDocumentFieldStart(const string &fieldName) jstr.beginObject(); jstr.appendKey("name").appendString(fieldName); jstr.endObject(); - EV_STATE("populate.documentfield.start", jstr.toString().c_str()); + EV_STATE("populate.documentfield.start", jstr.toString().data()); } void @@ -178,7 +178,7 @@ EventLogger::populateDocumentFieldComplete(const string &fieldName, int64_t docu jstr.appendKey("name").appendString(fieldName); jstr.appendKey("documents.populated").appendInt64(documentsPopulated); jstr.endObject(); - EV_STATE("populate.documentfield.complete", jstr.toString().c_str()); + EV_STATE("populate.documentfield.complete", jstr.toString().data()); } void @@ -189,7 +189,7 @@ EventLogger::lidSpaceCompactionComplete(const string &subDbName, uint32_t lidLim jstr.appendKey("documentsubdb").appendString(subDbName); jstr.appendKey("lidlimit").appendInt64(lidLimit); jstr.endObject(); - EV_STATE("lidspace.compaction.complete", jstr.toString().c_str()); + EV_STATE("lidspace.compaction.complete", jstr.toString().data()); } @@ -201,7 +201,7 @@ EventLogger::reprocessDocumentsStart(const string &subDb, double visitCost) jstr.appendKey("documentsubdb").appendString(subDb); jstr.appendKey("visitcost").appendDouble(visitCost); jstr.endObject(); - EV_STATE("reprocess.documents.start", jstr.toString().c_str()); + EV_STATE("reprocess.documents.start", jstr.toString().data()); } @@ -214,7 +214,7 @@ EventLogger::reprocessDocumentsProgress(const string &subDb, double progress, do jstr.appendKey("progress").appendDouble(progress); jstr.appendKey("visitcost").appendDouble(visitCost); jstr.endObject(); - EV_STATE("reprocess.documents.progress", jstr.toString().c_str()); + EV_STATE("reprocess.documents.progress", jstr.toString().data()); } @@ -227,7 +227,7 @@ EventLogger::reprocessDocumentsComplete(const string &subDb, double visitCost, i jstr.appendKey("visitcost").appendDouble(visitCost); jstr.appendKey("time.elapsed.ms").appendInt64(elapsedTimeMs); jstr.endObject(); - EV_STATE("reprocess.documents.complete", jstr.toString().c_str()); + EV_STATE("reprocess.documents.complete", jstr.toString().data()); } void @@ -238,7 +238,7 @@ EventLogger::loadAttributeStart(const vespalib::string &subDbName, const vespali jstr.appendKey("documentsubdb").appendString(subDbName); jstr.appendKey("name").appendString(attrName); jstr.endObject(); - EV_STATE("load.attribute.start", jstr.toString().c_str()); + EV_STATE("load.attribute.start", jstr.toString().data()); } void @@ -251,7 +251,7 @@ EventLogger::loadAttributeComplete(const vespalib::string &subDbName, jstr.appendKey("name").appendString(attrName); jstr.appendKey("time.elapsed.ms").appendInt64(elapsedTimeMs); jstr.endObject(); - EV_STATE("load.attribute.complete", jstr.toString().c_str()); + EV_STATE("load.attribute.complete", jstr.toString().data()); } namespace { @@ -263,7 +263,7 @@ loadComponentStart(const vespalib::string &subDbName, const vespalib::string &co jstr.beginObject(); jstr.appendKey("documentsubdb").appendString(subDbName); jstr.endObject(); - EV_STATE(make_string("load.%s.start", componentName.c_str()).c_str(), jstr.toString().c_str()); + EV_STATE(make_string("load.%s.start", componentName.c_str()).c_str(), jstr.toString().data()); } void @@ -274,7 +274,7 @@ loadComponentComplete(const vespalib::string &subDbName, const vespalib::string jstr.appendKey("documentsubdb").appendString(subDbName); jstr.appendKey("time.elapsed.ms").appendInt64(elapsedTimeMs); jstr.endObject(); - EV_STATE(make_string("load.%s.complete", componentName.c_str()).c_str(), jstr.toString().c_str()); + EV_STATE(make_string("load.%s.complete", componentName.c_str()).c_str(), jstr.toString().data()); } } @@ -314,7 +314,7 @@ EventLogger::transactionLogPruneComplete(const string &domainName, SerialNum pru .appendKey("pruned").appendInt64(prunedSerial) .endObject(); jstr.endObject(); - EV_STATE("transactionlog.prune.complete", jstr.toString().c_str()); + EV_STATE("transactionlog.prune.complete", jstr.toString().data()); } } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/documentstoreadapter.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/documentstoreadapter.cpp index 85ae621db48..ea6a16e1547 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/documentstoreadapter.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/documentstoreadapter.cpp @@ -66,10 +66,10 @@ DocumentStoreAdapter::writeField(const FieldValue &value, ResType type) const LiteralFieldValueB & lfv = static_cast<const LiteralFieldValueB &>(value); vespalib::stringref s = lfv.getValueRef(); - return writeStringField(s.c_str(), s.size(), type); + return writeStringField(s.data(), s.size(), type); } else { vespalib::string s = value.getAsString(); - return writeStringField(s.c_str(), s.size(), type); + return writeStringField(s.data(), s.size(), type); } } case RES_DATA: diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/fieldcache.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/fieldcache.cpp index 92bb7da55e1..9579c99ff42 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/fieldcache.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/fieldcache.cpp @@ -26,7 +26,7 @@ FieldCache::FieldCache(const ResultClass &resClass, if (docType.hasField(fieldName)) { const Field &field = docType.getField(fieldName); LOG(debug, "Caching Field instance for field '%s': %s.%u", - fieldName.c_str(), field.getName().c_str(), field.getId()); + fieldName.c_str(), vespalib::string(field.getName()).c_str(), field.getId()); _cache.push_back(Field::CSP(new Field(field))); } else { _cache.push_back(Field::CSP()); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp b/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp index a7bd61e75d4..5310d132092 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentretriever.cpp @@ -48,7 +48,7 @@ DocumentRetriever LOG(debug, "checking document type '%s' for position fields", docTypeName.getName().c_str()); for (const document::Field * field : fields) { if (field->getDataType().getId() == positionDataTypeId) { - LOG(debug, "Field '%s' is a position field", field->getName().c_str()); + LOG(debug, "Field '%s' is a position field", vespalib::string(field->getName()).c_str()); const vespalib::string & zcurve_name = PositionDataType::getZCurveFieldName(field->getName()); AttributeGuard::UP attr = attr_manager.getAttribute(zcurve_name); if (attr && attr->valid()) { diff --git a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp index 7d97cc4030a..d72ef274d99 100644 --- a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp @@ -213,7 +213,7 @@ MemoryFlush::getFlushTargets(const FlushContext::List &targetList, } oss << fv[i]->getName(); } - LOG(debug, "getFlushTargets(): %zu sorted targets: [%s]", fv.size(), oss.str().c_str()); + LOG(debug, "getFlushTargets(): %zu sorted targets: [%s]", fv.size(), oss.str().data()); } return fv; } |