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

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

Issue 826973002: replace COMPILE_ASSERT with static_assert in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply fixups Created 5 years, 11 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/disk_cache/simple/simple_test_util.h ('k') | net/dns/dns_session.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_config_service_posix.h" 5 #include "net/dns/dns_config_service_posix.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 for (int i = 0; i < nscount; ++i) { 404 for (int i = 0; i < nscount; ++i) {
405 IPEndPoint ipe; 405 IPEndPoint ipe;
406 if (!ipe.FromSockAddr( 406 if (!ipe.FromSockAddr(
407 reinterpret_cast<const struct sockaddr*>(&addresses[i]), 407 reinterpret_cast<const struct sockaddr*>(&addresses[i]),
408 sizeof addresses[i])) { 408 sizeof addresses[i])) {
409 return CONFIG_PARSE_POSIX_BAD_ADDRESS; 409 return CONFIG_PARSE_POSIX_BAD_ADDRESS;
410 } 410 }
411 dns_config->nameservers.push_back(ipe); 411 dns_config->nameservers.push_back(ipe);
412 } 412 }
413 #elif defined(OS_LINUX) 413 #elif defined(OS_LINUX)
414 COMPILE_ASSERT(arraysize(res.nsaddr_list) >= MAXNS && 414 static_assert(arraysize(res.nsaddr_list) >= MAXNS &&
415 arraysize(res._u._ext.nsaddrs) >= MAXNS, 415 arraysize(res._u._ext.nsaddrs) >= MAXNS,
416 incompatible_libresolv_res_state); 416 "incompatible libresolv res_state");
417 DCHECK_LE(res.nscount, MAXNS); 417 DCHECK_LE(res.nscount, MAXNS);
418 // Initially, glibc stores IPv6 in |_ext.nsaddrs| and IPv4 in |nsaddr_list|. 418 // Initially, glibc stores IPv6 in |_ext.nsaddrs| and IPv4 in |nsaddr_list|.
419 // In res_send.c:res_nsend, it merges |nsaddr_list| into |nsaddrs|, 419 // In res_send.c:res_nsend, it merges |nsaddr_list| into |nsaddrs|,
420 // but we have to combine the two arrays ourselves. 420 // but we have to combine the two arrays ourselves.
421 for (int i = 0; i < res.nscount; ++i) { 421 for (int i = 0; i < res.nscount; ++i) {
422 IPEndPoint ipe; 422 IPEndPoint ipe;
423 const struct sockaddr* addr = NULL; 423 const struct sockaddr* addr = NULL;
424 size_t addr_len = 0; 424 size_t addr_len = 0;
425 if (res.nsaddr_list[i].sin_family) { // The indicator used by res_nsend. 425 if (res.nsaddr_list[i].sin_family) { // The indicator used by res_nsend.
426 addr = reinterpret_cast<const struct sockaddr*>(&res.nsaddr_list[i]); 426 addr = reinterpret_cast<const struct sockaddr*>(&res.nsaddr_list[i]);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 #endif // !defined(OS_ANDROID) 490 #endif // !defined(OS_ANDROID)
491 491
492 } // namespace internal 492 } // namespace internal
493 493
494 // static 494 // static
495 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { 495 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() {
496 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServicePosix()); 496 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServicePosix());
497 } 497 }
498 498
499 } // namespace net 499 } // namespace net
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_test_util.h ('k') | net/dns/dns_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698