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

Side by Side Diff: net/dns/dns_test_util.cc

Issue 1481403005: Fix size_t truncations in net for 64-bit VS 2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback Created 5 years 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 | « no previous file | net/quic/congestion_control/tcp_loss_algorithm_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/dns/dns_test_util.h" 5 #include "net/dns/dns_test_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/big_endian.h" 9 #include "base/big_endian.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // CLASS, TTL and RDLENGTH. 115 // CLASS, TTL and RDLENGTH.
116 size_t answer_size = 12 + rdata_size; 116 size_t answer_size = 12 + rdata_size;
117 117
118 // Write answer with loopback IP address. 118 // Write answer with loopback IP address.
119 header->ancount = base::HostToNet16(1); 119 header->ancount = base::HostToNet16(1);
120 base::BigEndianWriter writer(buffer + nbytes, answer_size); 120 base::BigEndianWriter writer(buffer + nbytes, answer_size);
121 writer.WriteU16(kPointerToQueryName); 121 writer.WriteU16(kPointerToQueryName);
122 writer.WriteU16(qtype_); 122 writer.WriteU16(qtype_);
123 writer.WriteU16(dns_protocol::kClassIN); 123 writer.WriteU16(dns_protocol::kClassIN);
124 writer.WriteU32(kTTL); 124 writer.WriteU32(kTTL);
125 writer.WriteU16(rdata_size); 125 writer.WriteU16(static_cast<uint16>(rdata_size));
126 if (qtype_ == dns_protocol::kTypeA) { 126 if (qtype_ == dns_protocol::kTypeA) {
127 char kIPv4Loopback[] = { 0x7f, 0, 0, 1 }; 127 char kIPv4Loopback[] = { 0x7f, 0, 0, 1 };
128 writer.WriteBytes(kIPv4Loopback, sizeof(kIPv4Loopback)); 128 writer.WriteBytes(kIPv4Loopback, sizeof(kIPv4Loopback));
129 } else { 129 } else {
130 char kIPv6Loopback[] = { 0, 0, 0, 0, 0, 0, 0, 0, 130 char kIPv6Loopback[] = { 0, 0, 0, 0, 0, 0, 0, 0,
131 0, 0, 0, 0, 0, 0, 0, 1 }; 131 0, 0, 0, 0, 0, 0, 0, 1 };
132 writer.WriteBytes(kIPv6Loopback, sizeof(kIPv6Loopback)); 132 writer.WriteBytes(kIPv6Loopback, sizeof(kIPv6Loopback));
133 } 133 }
134 nbytes += answer_size; 134 nbytes += answer_size;
135 } 135 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 AddressSorter* MockDnsClient::GetAddressSorter() { 219 AddressSorter* MockDnsClient::GetAddressSorter() {
220 return address_sorter_.get(); 220 return address_sorter_.get();
221 } 221 }
222 222
223 void MockDnsClient::CompleteDelayedTransactions() { 223 void MockDnsClient::CompleteDelayedTransactions() {
224 factory_->CompleteDelayedTransactions(); 224 factory_->CompleteDelayedTransactions();
225 } 225 }
226 226
227 } // namespace net 227 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/congestion_control/tcp_loss_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698