diff options
author | 2017-11-10 13:12:49 -0800 | |
---|---|---|
committer | 2017-11-10 16:46:26 -0800 | |
commit | 83c2da808e96dc5c9c3e80353d1db58a17502bf1 (patch) | |
tree | 185b741e08b55fbe8dfa07013a2fc5ef3c7797de /tensorflow/core/util | |
parent | f157cc92a895b0cd9f5f15cc459e60ab0c98c875 (diff) |
Removed StringPiece::set and StringPiece::clear, as they have no absl::string_view equivalents.
This will allow for a more convenient transition to absl::string_view.
Calls to set StringPiece::set and StringPiece::clear were replaced with the StringPiece constructor as follows:
string_piece_foo.set(data, size) => string_piece_foo = StringPiece(data, size)
string_piece_foo.clear() => string_piece_foo = StringPiece()
PiperOrigin-RevId: 175326576
Diffstat (limited to 'tensorflow/core/util')
-rw-r--r-- | tensorflow/core/util/memmapped_file_system.cc | 5 | ||||
-rw-r--r-- | tensorflow/core/util/semver_test.cc | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/tensorflow/core/util/memmapped_file_system.cc b/tensorflow/core/util/memmapped_file_system.cc index e077e94cf8..a0f43d2d4a 100644 --- a/tensorflow/core/util/memmapped_file_system.cc +++ b/tensorflow/core/util/memmapped_file_system.cc @@ -58,12 +58,13 @@ class RandomAccessFileFromMemmapped : public RandomAccessFile { Status Read(uint64 offset, size_t to_read, StringPiece* result, char* scratch) const override { if (offset >= length_) { - result->set(scratch, 0); + *result = StringPiece(scratch, 0); return Status(error::OUT_OF_RANGE, "Read after file end"); } const uint64 region_left = std::min(length_ - offset, static_cast<uint64>(to_read)); - result->set(reinterpret_cast<const uint8*>(data_) + offset, region_left); + *result = + StringPiece(reinterpret_cast<const char*>(data_) + offset, region_left); return (region_left == to_read) ? Status::OK() : Status(error::OUT_OF_RANGE, "Read less bytes than requested"); diff --git a/tensorflow/core/util/semver_test.cc b/tensorflow/core/util/semver_test.cc index 0647f670c7..fdc34fa58b 100644 --- a/tensorflow/core/util/semver_test.cc +++ b/tensorflow/core/util/semver_test.cc @@ -39,7 +39,7 @@ bool ConsumeDotSeparatedIdentifiers(StringPiece* s, const string& prefix, for (i = 0; i < s->size() && IsDotOrIdentifierChar((*s)[i]); ++i) { // Intentionally empty } - val->set(s->data(), i); + *val = StringPiece(s->data(), i); s->remove_prefix(i); return i > 0; } |