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

Unified Diff: remoting/base/compound_buffer.cc

Issue 1273233002: Implement QuicChannel and QuicChannelFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « net/quic/p2p/quic_p2p_stream.cc ('k') | remoting/base/constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/compound_buffer.cc
diff --git a/remoting/base/compound_buffer.cc b/remoting/base/compound_buffer.cc
index 79b4d32818b9f65127ab93bcc59768c084f9640f..3c599d363b9360ad35f0e0d768b36fae3ec64c07 100644
--- a/remoting/base/compound_buffer.cc
+++ b/remoting/base/compound_buffer.cc
@@ -144,12 +144,12 @@ net::IOBufferWithSize* CompoundBuffer::ToIOBufferWithSize() const {
}
void CompoundBuffer::CopyTo(char* data, int size) const {
- char* pos = data;
+ int pos = 0;
for (DataChunkList::const_iterator it = chunks_.begin();
- it != chunks_.end(); ++it) {
- CHECK_LE(pos + it->size, data + size);
- memcpy(pos, it->start, it->size);
- pos += it->size;
+ it != chunks_.end() && pos < size; ++it) {
+ int bytes_to_copy = std::min(size - pos, it->size);
+ memcpy(data + pos, it->start, bytes_to_copy);
+ pos += bytes_to_copy;
}
}
« no previous file with comments | « net/quic/p2p/quic_p2p_stream.cc ('k') | remoting/base/constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698