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

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

Issue 11377096: Change from re-transmitting an packet with a retransmit number to sending a new packet with a new s… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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_framer.h » ('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 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 if (!dest) { 87 if (!dest) {
88 return false; 88 return false;
89 } 89 }
90 90
91 memcpy(dest, data, data_len); 91 memcpy(dest, data, data_len);
92 92
93 length_ += data_len; 93 length_ += data_len;
94 return true; 94 return true;
95 } 95 }
96 96
97 void QuicDataWriter::WriteUint8ToBuffer(uint8 value, char* buffer) {
98 memcpy(buffer, &value, sizeof(value));
99 }
100
101 void QuicDataWriter::WriteUint16ToBuffer(uint16 value, char* buffer) {
102 memcpy(buffer, &value, sizeof(value));
103 }
104
105 void QuicDataWriter::WriteUint32ToBuffer(uint32 value, char* buffer) {
106 memcpy(buffer, &value, sizeof(value));
107 }
108
109 void QuicDataWriter::WriteUint48ToBuffer(uint64 value, char* buffer) {
110 uint16 hi = value >> 32;
111 uint32 lo = value & 0x00000000FFFFFFFF;
112 WriteUint32ToBuffer(lo, buffer);
113 WriteUint16ToBuffer(hi, buffer + sizeof(lo));
114 }
115
97 void QuicDataWriter::WriteUint64ToBuffer(uint64 value, char* buffer) { 116 void QuicDataWriter::WriteUint64ToBuffer(uint64 value, char* buffer) {
98 memcpy(buffer, &value, sizeof(value)); 117 memcpy(buffer, &value, sizeof(value));
99 } 118 }
100 119
101 void QuicDataWriter::WriteUint128ToBuffer(uint128 value, char* buffer) { 120 void QuicDataWriter::WriteUint128ToBuffer(uint128 value, char* buffer) {
102 WriteUint64ToBuffer(value.lo, buffer); 121 WriteUint64ToBuffer(value.lo, buffer);
103 WriteUint64ToBuffer(value.hi, buffer + sizeof(value.lo)); 122 WriteUint64ToBuffer(value.hi, buffer + sizeof(value.lo));
104 } 123 }
105 124
106 } // namespace net 125 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_data_writer.h ('k') | net/quic/quic_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698