Avoid build errors

pull/18165/head
Vijay Pai 6 years ago
parent de29ab752e
commit 2eb25c871e
  1. 15
      include/grpcpp/impl/codegen/byte_buffer.h
  2. 14
      src/cpp/util/byte_buffer_cc.cc

@ -96,7 +96,7 @@ class ByteBuffer final {
/// \a buf. Wrapper of core function grpc_byte_buffer_copy . This is not
/// a deep copy; it is just a referencing. As a result, its performance is
/// size-independent.
ByteBuffer(const ByteBuffer& buf);
ByteBuffer(const ByteBuffer& buf) : buffer_(nullptr) { operator=(buf); }
~ByteBuffer() {
if (buffer_) {
@ -107,7 +107,16 @@ class ByteBuffer final {
/// Wrapper of core function grpc_byte_buffer_copy . This is not
/// a deep copy; it is just a referencing. As a result, its performance is
/// size-independent.
ByteBuffer& operator=(const ByteBuffer&);
ByteBuffer& operator=(const ByteBuffer& buf) {
if (this != &buf) {
Clear(); // first remove existing data
}
if (buf.buffer_) {
// then copy
buffer_ = g_core_codegen_interface->grpc_byte_buffer_copy(buf.buffer_);
}
return *this;
}
/// Dump (read) the buffer contents into \a slices.
Status Dump(std::vector<Slice>* slices) const;
@ -215,7 +224,7 @@ class SerializationTraits<ByteBuffer, void> {
bool* own_buffer) {
*buffer = source;
*own_buffer = true;
return Status::OK;
return g_core_codegen_interface->ok();
}
};

@ -43,18 +43,4 @@ Status ByteBuffer::Dump(std::vector<Slice>* slices) const {
return Status::OK;
}
ByteBuffer::ByteBuffer(const ByteBuffer& buf) : buffer_(nullptr) {
operator=(buf);
}
ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) {
if (this != &buf) {
Clear(); // first remove existing data
}
if (buf.buffer_) {
buffer_ = grpc_byte_buffer_copy(buf.buffer_); // then copy
}
return *this;
}
} // namespace grpc

Loading…
Cancel
Save