aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/util
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-06-30 17:17:23 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-06-30 17:30:08 -0700
commit6721d4f0f18c71f5e4ab1cef904944185ed86b89 (patch)
tree6b3b3ff93eba1bb9290ca44e4cdfc67dd60286ae /src/cpp/util
parenta5596db1a53723789d7c90c23d9cbfbb8207f949 (diff)
Return success status of grpc_byte_buffer_reader
Diffstat (limited to 'src/cpp/util')
-rw-r--r--src/cpp/util/byte_buffer.cc10
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 {