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

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

Issue 973683003: CL generated with data from dead-code analysis using (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Change_PrrSender_TimeUntilSend_87535917
Patch Set: Created 5 years, 9 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
« 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 void QuicDataWriter::WritePadding() { 153 void QuicDataWriter::WritePadding() {
154 DCHECK_LE(length_, capacity_); 154 DCHECK_LE(length_, capacity_);
155 if (length_ > capacity_) { 155 if (length_ > capacity_) {
156 return; 156 return;
157 } 157 }
158 memset(buffer_ + length_, 0x00, capacity_ - length_); 158 memset(buffer_ + length_, 0x00, capacity_ - length_);
159 length_ = capacity_; 159 length_ = capacity_;
160 } 160 }
161 161
162 bool QuicDataWriter::WriteUInt8ToOffset(uint8 value, size_t offset) {
163 if (offset >= capacity_) {
164 LOG(DFATAL) << "offset: " << offset << " >= capacity: " << capacity_;
165 return false;
166 }
167 size_t latched_length = length_;
168 length_ = offset;
169 bool success = WriteUInt8(value);
170 DCHECK_LE(length_, latched_length);
171 length_ = latched_length;
172 return success;
173 }
174
175 bool QuicDataWriter::WriteUInt32ToOffset(uint32 value, size_t offset) {
176 DCHECK_LT(offset, capacity_);
177 size_t latched_length = length_;
178 length_ = offset;
179 bool success = WriteUInt32(value);
180 DCHECK_LE(length_, latched_length);
181 length_ = latched_length;
182 return success;
183 }
184
185 bool QuicDataWriter::WriteUInt48ToOffset(uint64 value, size_t offset) {
186 DCHECK_LT(offset, capacity_);
187 size_t latched_length = length_;
188 length_ = offset;
189 bool success = WriteUInt48(value);
190 DCHECK_LE(length_, latched_length);
191 length_ = latched_length;
192 return success;
193 }
194 162
195 } // namespace net 163 } // 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