diff options
author | David Garcia Quintas <dgq@google.com> | 2016-07-14 11:38:38 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2016-07-14 14:13:41 -0700 |
commit | 7c3ba12813e967b9383a73b6a621eccd9b3e706d (patch) | |
tree | 089cd9d41a86ed1db58fd5cce58bbd4cfe1404be /src/cpp/util/byte_buffer.cc | |
parent | 78fbb0a3017ebf772757848336e4db706a1b234e (diff) | |
parent | bda40a0301de58305cebe025a885852686e4391a (diff) |
Merge branch 'master' of github.com:grpc/grpc into grpclb_v0
Diffstat (limited to 'src/cpp/util/byte_buffer.cc')
-rw-r--r-- | src/cpp/util/byte_buffer.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc index c0a14de418..c2cd20ee07 100644 --- a/src/cpp/util/byte_buffer.cc +++ b/src/cpp/util/byte_buffer.cc @@ -58,18 +58,22 @@ void ByteBuffer::Clear() { } } -void ByteBuffer::Dump(std::vector<Slice>* slices) const { +Status ByteBuffer::Dump(std::vector<Slice>* slices) const { slices->clear(); if (!buffer_) { - return; + return Status(StatusCode::FAILED_PRECONDITION, "Buffer not initialized"); } grpc_byte_buffer_reader reader; - grpc_byte_buffer_reader_init(&reader, buffer_); + if (!grpc_byte_buffer_reader_init(&reader, buffer_)) { + return Status(StatusCode::INTERNAL, + "Couldn't initialize byte buffer reader"); + } gpr_slice s; while (grpc_byte_buffer_reader_next(&reader, &s)) { slices->push_back(Slice(s, Slice::STEAL_REF)); } grpc_byte_buffer_reader_destroy(&reader); + return Status::OK; } size_t ByteBuffer::Length() const { |