summaryrefslogtreecommitdiffstats
path: root/searchcommon
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2018-07-26 14:03:08 +0200
committerGitHub <noreply@github.com>2018-07-26 14:03:08 +0200
commit8039d52c40c5860ab14030975c728c9a7f458cb4 (patch)
tree12343d0c12a76084f321a7609d4c79fa461c7ad8 /searchcommon
parentdf6f72fb34b6d28d6ee27e42ebfba24a4d3545ef (diff)
parent5037bb7c8c9de94337c0d5bc1b831145f69ec9a3 (diff)
Merge pull request #6469 from vespa-engine/vekterli/remove-dangerous-stringref-c_str-function
Remove dangerous stringref::c_str()
Diffstat (limited to 'searchcommon')
-rw-r--r--searchcommon/src/vespa/searchcommon/common/schema.cpp6
-rw-r--r--searchcommon/src/vespa/searchcommon/common/schema.h4
2 files changed, 5 insertions, 5 deletions
diff --git a/searchcommon/src/vespa/searchcommon/common/schema.cpp b/searchcommon/src/vespa/searchcommon/common/schema.cpp
index eafe9c28c1b..6cd9d87fa77 100644
--- a/searchcommon/src/vespa/searchcommon/common/schema.cpp
+++ b/searchcommon/src/vespa/searchcommon/common/schema.cpp
@@ -22,7 +22,7 @@ writeFields(vespalib::asciistream & os,
{
os << prefix << "[" << fields.size() << "]\n";
for (size_t i = 0; i < fields.size(); ++i) {
- fields[i].write(os, vespalib::make_string("%s[%zu].", prefix.c_str(), i));
+ fields[i].write(os, vespalib::make_string("%s[%zu].", prefix.data(), i));
}
}
@@ -245,7 +245,7 @@ Schema & Schema::operator=(Schema && rhs) = default;
Schema::~Schema() { }
bool
-Schema::loadFromFile(const vespalib::stringref & fileName)
+Schema::loadFromFile(const vespalib::string & fileName)
{
std::ifstream file(fileName.c_str());
if (!file) {
@@ -284,7 +284,7 @@ Schema::loadFromFile(const vespalib::stringref & fileName)
}
bool
-Schema::saveToFile(const vespalib::stringref & fileName) const
+Schema::saveToFile(const vespalib::string & fileName) const
{
vespalib::asciistream os;
writeToStream(os, true);
diff --git a/searchcommon/src/vespa/searchcommon/common/schema.h b/searchcommon/src/vespa/searchcommon/common/schema.h
index 374ea840f5c..1c3ab3ccd56 100644
--- a/searchcommon/src/vespa/searchcommon/common/schema.h
+++ b/searchcommon/src/vespa/searchcommon/common/schema.h
@@ -179,7 +179,7 @@ public:
* @return true if the schema could be loaded.
**/
bool
- loadFromFile(const vespalib::stringref & fileName);
+ loadFromFile(const vespalib::string & fileName);
/**
* Save this schema to the file with the given name.
@@ -188,7 +188,7 @@ public:
* @return true if the schema could be saved.
**/
bool
- saveToFile(const vespalib::stringref & fileName) const;
+ saveToFile(const vespalib::string & fileName) const;
vespalib::string toString() const;