diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-05-02 18:52:02 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-05-02 18:55:37 -0700 |
commit | 223be4abe74592a781735a6b66e12cb0146f0830 (patch) | |
tree | 40171aa19e37c27169ec94e745354e8020107842 /tensorflow/core/lib/io | |
parent | 2b1a03c2ad502329a1f2b1368a40913ef21e97a0 (diff) |
Replaced calls to tensorflow::StringPiece::ToString with std::string conversions.
That is, instances of sp.ToString() are replaced with std::string(sp).
This will allow tensorflow::StringPiece::ToString to be removed, which is necessary before it can be replaced with absl::string_view.
PiperOrigin-RevId: 195188185
Diffstat (limited to 'tensorflow/core/lib/io')
-rw-r--r-- | tensorflow/core/lib/io/path.cc | 6 | ||||
-rw-r--r-- | tensorflow/core/lib/io/table_test.cc | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tensorflow/core/lib/io/path.cc b/tensorflow/core/lib/io/path.cc index 996fbf62e5..b62206012c 100644 --- a/tensorflow/core/lib/io/path.cc +++ b/tensorflow/core/lib/io/path.cc @@ -42,7 +42,7 @@ string JoinPathImpl(std::initializer_list<StringPiece> paths) { if (path.empty()) continue; if (result.empty()) { - result = path.ToString(); + result = std::string(path); continue; } @@ -124,7 +124,7 @@ StringPiece Extension(StringPiece path) { } string CleanPath(StringPiece unclean_path) { - string path = unclean_path.ToString(); + string path = std::string(unclean_path); const char* src = path.c_str(); string::iterator dst = path.begin(); @@ -237,7 +237,7 @@ void ParseURI(StringPiece remaining, StringPiece* scheme, StringPiece* host, string CreateURI(StringPiece scheme, StringPiece host, StringPiece path) { if (scheme.empty()) { - return path.ToString(); + return std::string(path); } return strings::StrCat(scheme, "://", host, path); } diff --git a/tensorflow/core/lib/io/table_test.cc b/tensorflow/core/lib/io/table_test.cc index 78a3fa501c..9e3309f0a7 100644 --- a/tensorflow/core/lib/io/table_test.cc +++ b/tensorflow/core/lib/io/table_test.cc @@ -147,7 +147,7 @@ class Constructor { virtual ~Constructor() {} void Add(const string& key, const StringPiece& value) { - data_[key] = value.ToString(); + data_[key] = std::string(value); } // Finish constructing the data structure with all the keys that have @@ -188,7 +188,7 @@ class BlockConstructor : public Constructor { builder.Add(it->first, it->second); } // Open the block - data_ = builder.Finish().ToString(); + data_ = std::string(builder.Finish()); BlockContents contents; contents.data = data_; contents.cachable = false; @@ -515,7 +515,7 @@ TEST_F(Harness, Randomized) { for (int e = 0; e < num_entries; e++) { string v; Add(test::RandomKey(&rnd, rnd.Skewed(4)), - test::RandomString(&rnd, rnd.Skewed(5), &v).ToString()); + std::string(test::RandomString(&rnd, rnd.Skewed(5), &v))); } Test(&rnd); } |