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

Side by Side Diff: net/quic/quic_data_writer.cc

Issue 14287009: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with Tot Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_data_writer.h ('k') | net/quic/quic_data_writer_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_data_writer.h" 5 #include "net/quic/quic_data_writer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 DCHECK_LE(length_, capacity_); 102 DCHECK_LE(length_, capacity_);
103 if (length_ > capacity_) { 103 if (length_ > capacity_) {
104 return; 104 return;
105 } 105 }
106 memset(buffer_ + length_, 0x00, capacity_ - length_); 106 memset(buffer_ + length_, 0x00, capacity_ - length_);
107 length_ = capacity_; 107 length_ = capacity_;
108 } 108 }
109 109
110 bool QuicDataWriter::WriteUInt8ToOffset(uint8 value, size_t offset) { 110 bool QuicDataWriter::WriteUInt8ToOffset(uint8 value, size_t offset) {
111 DCHECK_LT(offset, capacity_); 111 DCHECK_LT(offset, capacity_);
112 int latched_length = length_; 112 size_t latched_length = length_;
113 length_ = offset; 113 length_ = offset;
114 bool success = WriteUInt8(value); 114 bool success = WriteUInt8(value);
115 DCHECK_LE(length_, latched_length);
116 length_ = latched_length;
117 return success;
118 }
119
120 bool QuicDataWriter::WriteUInt32ToOffset(uint32 value, size_t offset) {
121 DCHECK_LT(offset, capacity_);
122 size_t latched_length = length_;
123 length_ = offset;
124 bool success = WriteUInt32(value);
125 DCHECK_LE(length_, latched_length);
115 length_ = latched_length; 126 length_ = latched_length;
116 return success; 127 return success;
117 } 128 }
118 129
119 bool QuicDataWriter::WriteUInt48ToOffset(uint64 value, size_t offset) { 130 bool QuicDataWriter::WriteUInt48ToOffset(uint64 value, size_t offset) {
120 DCHECK_LT(offset, capacity_); 131 DCHECK_LT(offset, capacity_);
121 int latched_length = length_; 132 size_t latched_length = length_;
122 length_ = offset; 133 length_ = offset;
123 bool success = WriteUInt48(value); 134 bool success = WriteUInt48(value);
135 DCHECK_LE(length_, latched_length);
124 length_ = latched_length; 136 length_ = latched_length;
125 return success; 137 return success;
126 } 138 }
127 139
128 } // namespace net 140 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_data_writer.h ('k') | net/quic/quic_data_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698