| Index: webrtc/base/copyonwritebuffer.h
|
| diff --git a/webrtc/base/copyonwritebuffer.h b/webrtc/base/copyonwritebuffer.h
|
| index 87f24bf51d6db78aecc44442c810d0d0887d8dec..17f2710f3ecbd404646268d4af9a003d7c2e5465 100644
|
| --- a/webrtc/base/copyonwritebuffer.h
|
| +++ b/webrtc/base/copyonwritebuffer.h
|
| @@ -42,9 +42,7 @@
|
| template <typename T, typename internal::ByteType<T>::t = 0>
|
| CopyOnWriteBuffer(const T* data, size_t size, size_t capacity)
|
| : CopyOnWriteBuffer(size, capacity) {
|
| - if (buffer_) {
|
| - std::memcpy(buffer_->data(), data, size);
|
| - }
|
| + std::memcpy(buffer_->data(), data, size);
|
| }
|
|
|
| // Construct a buffer from the contents of an array.
|
| @@ -125,24 +123,13 @@
|
| return !(*this == buf);
|
| }
|
|
|
| - uint8_t& operator[](size_t index) {
|
| - RTC_DCHECK_LT(index, size());
|
| - return data()[index];
|
| - }
|
| -
|
| - uint8_t operator[](size_t index) const {
|
| - RTC_DCHECK_LT(index, size());
|
| - return cdata()[index];
|
| - }
|
| -
|
| // Replace the contents of the buffer. Accepts the same types as the
|
| // constructors.
|
| template <typename T, typename internal::ByteType<T>::t = 0>
|
| void SetData(const T* data, size_t size) {
|
| RTC_DCHECK(IsConsistent());
|
| if (!buffer_ || !buffer_->HasOneRef()) {
|
| - buffer_ = size > 0 ? new RefCountedObject<Buffer>(data, size)
|
| - : nullptr;
|
| + buffer_ = new RefCountedObject<Buffer>(data, size, size);
|
| } else {
|
| buffer_->SetData(data, size);
|
| }
|
|
|