diff options
9 files changed, 12 insertions, 11 deletions
diff --git a/document/src/vespa/document/base/field.cpp b/document/src/vespa/document/base/field.cpp index 7ce766c47c6..578294df7b0 100644 --- a/document/src/vespa/document/base/field.cpp +++ b/document/src/vespa/document/base/field.cpp @@ -91,7 +91,7 @@ Field::validateId(int newId) { throw vespalib::IllegalArgumentException(vespalib::make_string( "Attempt to set the id of %s to %d failed, values from " "100 to 127 are reserved for internal use", - vespalib::string(getName()).c_str(), newId)); + getName().data(), newId)); } if ((newId & 0x80000000) != 0) // Highest bit must not be set @@ -99,7 +99,7 @@ Field::validateId(int newId) { throw vespalib::IllegalArgumentException(vespalib::make_string( "Attempt to set the id of %s to %d" " failed, negative id values are illegal", - vespalib::string(getName()).c_str(), newId)); + getName().data(), newId)); } } diff --git a/document/src/vespa/document/datatype/documenttype.cpp b/document/src/vespa/document/datatype/documenttype.cpp index 31485aa42b6..2be5acaf3db 100644 --- a/document/src/vespa/document/datatype/documenttype.cpp +++ b/document/src/vespa/document/datatype/documenttype.cpp @@ -96,7 +96,7 @@ DocumentType::addField(const Field& field) } else if (!_ownedFields.get()) { throw vespalib::IllegalStateException(make_string( "Cannot add field %s to a DocumentType that does not " - "own its fields.", vespalib::string(field.getName()).c_str()), VESPA_STRLOC); + "own its fields.", field.getName().data()), VESPA_STRLOC); } _ownedFields->addField(field); } diff --git a/document/src/vespa/document/datatype/structdatatype.cpp b/document/src/vespa/document/datatype/structdatatype.cpp index 1303f16c43b..9ff0b7e0b0a 100644 --- a/document/src/vespa/document/datatype/structdatatype.cpp +++ b/document/src/vespa/document/datatype/structdatatype.cpp @@ -83,7 +83,7 @@ StructDataType::addField(const Field& field) vespalib::string error = containsConflictingField(field); if (error != "") { throw IllegalArgumentException(make_string("Failed to add field '%s' to struct '%s': %s", - vespalib::string(field.getName()).c_str(), getName().c_str(), + field.getName().data(), getName().c_str(), error.c_str()), VESPA_STRLOC); } if (hasField(field.getName())) { diff --git a/document/src/vespa/document/update/arithmeticvalueupdate.cpp b/document/src/vespa/document/update/arithmeticvalueupdate.cpp index 7363899d5cf..3af9350062e 100644 --- a/document/src/vespa/document/update/arithmeticvalueupdate.cpp +++ b/document/src/vespa/document/update/arithmeticvalueupdate.cpp @@ -35,7 +35,7 @@ ArithmeticValueUpdate::checkCompatibility(const Field& field) const if ( ! field.getDataType().inherits(NumericDataType::classId)) { throw IllegalArgumentException(vespalib::make_string( "Can not perform arithmetic update on non-numeric field '%s'.", - vespalib::string(field.getName()).c_str()), VESPA_STRLOC); + field.getName().data()), VESPA_STRLOC); } } diff --git a/document/src/vespa/document/update/mapvalueupdate.cpp b/document/src/vespa/document/update/mapvalueupdate.cpp index cc0aec3618a..be970b3c30a 100644 --- a/document/src/vespa/document/update/mapvalueupdate.cpp +++ b/document/src/vespa/document/update/mapvalueupdate.cpp @@ -46,7 +46,7 @@ MapValueUpdate::checkCompatibility(const Field& field) const if (_key->getClass().id() != IntFieldValue::classId) { throw IllegalArgumentException(vespalib::make_string( "Key for field '%s' is of wrong type (expected '%s', was '%s').", - vespalib::string(field.getName()).c_str(), DataType::INT->toString().c_str(), + field.getName().data(), DataType::INT->toString().c_str(), _key->getDataType()->toString().c_str()), VESPA_STRLOC); } } else if (field.getDataType().getClass().id() == WeightedSetDataType::classId) { @@ -54,7 +54,7 @@ MapValueUpdate::checkCompatibility(const Field& field) const if (!type.getNestedType().isValueType(*_key)) { throw IllegalArgumentException(vespalib::make_string( "Key for field '%s' is of wrong type (expected '%s', was '%s').", - vespalib::string(field.getName()).c_str(), DataType::INT->toString().c_str(), + field.getName().data(), DataType::INT->toString().c_str(), _key->getDataType()->toString().c_str()), VESPA_STRLOC); } } else { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp index 3fecf661dcd..442d04d30c8 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'.", vespalib::string(fupd.getField().getName()).c_str()); + LOG(debug, "Retrieving guard for attribute vector '%s'.", fupd.getField().getName().data()); 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", vespalib::string(fupd.getField().getName()).c_str()); + LOG(spam, "Failed to find attribute vector %s", fupd.getField().getName().data()); continue; } // TODO: Check if we must use > due to multiple entries for same diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/fieldcache.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/fieldcache.cpp index 9579c99ff42..ecc0569cccd 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(), vespalib::string(field.getName()).c_str(), field.getId()); + fieldName.c_str(), field.getName().data(), 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 5310d132092..1a1bf1ed000 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", vespalib::string(field->getName()).c_str()); + LOG(debug, "Field '%s' is a position field", field->getName().data()); const vespalib::string & zcurve_name = PositionDataType::getZCurveFieldName(field->getName()); AttributeGuard::UP attr = attr_manager.getAttribute(zcurve_name); if (attr && attr->valid()) { diff --git a/staging_vespalib/src/vespa/vespalib/objects/fieldbase.h b/staging_vespalib/src/vespa/vespalib/objects/fieldbase.h index cdb9ae95c72..d10687a36ad 100644 --- a/staging_vespalib/src/vespa/vespalib/objects/fieldbase.h +++ b/staging_vespalib/src/vespa/vespalib/objects/fieldbase.h @@ -9,6 +9,7 @@ class IFieldBase { public: virtual ~IFieldBase() { } + // Overrides must guarantee that returned reference is zero-terminated. virtual stringref getName() const = 0; }; |