Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: webrtc/base/bytebuffer.cc

Issue 2440083002: Delete always-zero ByteBufferWriter::start_. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/bytebuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/bytebuffer.cc
diff --git a/webrtc/base/bytebuffer.cc b/webrtc/base/bytebuffer.cc
index c2ffe609341fbb74339d2c2101cfc298741bf342..caeb396aee3cbf19c6f19543539987c75b4f8b95 100644
--- a/webrtc/base/bytebuffer.cc
+++ b/webrtc/base/bytebuffer.cc
@@ -43,7 +43,6 @@ ByteBufferWriter::ByteBufferWriter(const char* bytes, size_t len,
}
void ByteBufferWriter::Construct(const char* bytes, size_t len) {
- start_ = 0;
size_ = len;
bytes_ = new char[size_];
@@ -119,25 +118,24 @@ char* ByteBufferWriter::ReserveWriteBuffer(size_t len) {
}
void ByteBufferWriter::Resize(size_t size) {
- size_t len = std::min(end_ - start_, size);
+ size_t len = std::min(end_, size);
if (size <= size_) {
// Don't reallocate, just move data backwards
- memmove(bytes_, bytes_ + start_, len);
+ memmove(bytes_, bytes_, len);
joachim 2016/10/21 13:11:19 Sorry, didn't notice this in the first place, but
kwiberg-webrtc 2016/10/21 15:08:42 So it DOES take three people to review this... :-)
tommi (sloooow) - chröme 2016/10/21 15:15:39 Indeed!
nisse-chromium (ooo August 14) 2016/10/24 06:51:06 Done.
} else {
// Reallocate a larger buffer.
size_ = std::max(size, 3 * size_ / 2);
char* new_bytes = new char[size_];
- memcpy(new_bytes, bytes_ + start_, len);
+ memcpy(new_bytes, bytes_, len);
delete [] bytes_;
bytes_ = new_bytes;
}
- start_ = 0;
end_ = len;
}
void ByteBufferWriter::Clear() {
memset(bytes_, 0, size_);
- start_ = end_ = 0;
+ end_ = 0;
}
« no previous file with comments | « webrtc/base/bytebuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698