aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2016-01-14 09:12:08 -0800
committerGravatar yang-g <yangg@google.com>2016-01-14 09:12:08 -0800
commitdf2778d45f57f0647448e566b5bb7e3643b51ebb (patch)
tree773958a73eb6e147d3d995e2a0ea09381481b59b /src
parent11493fbcc82a24f5aa9eeff2a08aa815d17e1145 (diff)
parentdafa125c7b01df1003b96ea2619eb39956f5ddcc (diff)
Merge remote-tracking branch 'upstream/master' into epollset
Diffstat (limited to 'src')
-rw-r--r--src/cpp/util/byte_buffer.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc
index 755234d7e8..df873eb1ce 100644
--- a/src/cpp/util/byte_buffer.cc
+++ b/src/cpp/util/byte_buffer.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -79,4 +79,13 @@ size_t ByteBuffer::Length() const {
}
}
-} // namespace grpc
+ByteBuffer::ByteBuffer(const ByteBuffer& buf)
+ : buffer_(grpc_byte_buffer_copy(buf.buffer_)) {}
+
+ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) {
+ Clear(); // first remove existing data
+ buffer_ = grpc_byte_buffer_copy(buf.buffer_); // then copy
+ return *this;
+}
+
+} // namespace grpc \ No newline at end of file