File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -43,8 +43,9 @@ Status ByteBuffer::Dump(std::vector<Slice>* slices) const {
43
43
return Status::OK;
44
44
}
45
45
46
- ByteBuffer::ByteBuffer (const ByteBuffer& buf)
47
- : buffer_(grpc_byte_buffer_copy(buf.buffer_)) {}
46
+ ByteBuffer::ByteBuffer (const ByteBuffer& buf) : buffer_(nullptr ) {
47
+ operator =(buf);
48
+ }
48
49
49
50
ByteBuffer& ByteBuffer::operator =(const ByteBuffer& buf) {
50
51
if (this != &buf) {
Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ const char* kContent2 = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy world";
38
38
39
39
class ByteBufferTest : public ::testing::Test {};
40
40
41
+ TEST_F (ByteBufferTest, CopyCtor) {
42
+ ByteBuffer buffer1;
43
+ EXPECT_FALSE (buffer1.Valid ());
44
+ ByteBuffer buffer2 = buffer1;
45
+ EXPECT_FALSE (buffer2.Valid ());
46
+ }
47
+
41
48
TEST_F (ByteBufferTest, CreateFromSingleSlice) {
42
49
Slice s (kContent1 );
43
50
ByteBuffer buffer (&s, 1 );
You can’t perform that action at this time.
0 commit comments