| OLD | NEW |
| 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_win.h" | 5 #include "net/dns/dns_config_service_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 UINT rv = ERROR_BUFFER_OVERFLOW; | 121 UINT rv = ERROR_BUFFER_OVERFLOW; |
| 122 // Try up to three times. | 122 // Try up to three times. |
| 123 for (unsigned tries = 0; (tries < 3) && (rv == ERROR_BUFFER_OVERFLOW); | 123 for (unsigned tries = 0; (tries < 3) && (rv == ERROR_BUFFER_OVERFLOW); |
| 124 tries++) { | 124 tries++) { |
| 125 out.reset(static_cast<PIP_ADAPTER_ADDRESSES>(malloc(len))); | 125 out.reset(static_cast<PIP_ADAPTER_ADDRESSES>(malloc(len))); |
| 126 memset(out.get(), 0, len); | 126 memset(out.get(), 0, len); |
| 127 rv = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, out.get(), &len); | 127 rv = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, out.get(), &len); |
| 128 } | 128 } |
| 129 if (rv != NO_ERROR) | 129 if (rv != NO_ERROR) |
| 130 out.reset(); | 130 out.reset(); |
| 131 return out.Pass(); | 131 return out; |
| 132 } | 132 } |
| 133 | 133 |
| 134 // Converts a base::string16 domain name to ASCII, possibly using punycode. | 134 // Converts a base::string16 domain name to ASCII, possibly using punycode. |
| 135 // Returns true if the conversion succeeds and output is not empty. In case of | 135 // Returns true if the conversion succeeds and output is not empty. In case of |
| 136 // failure, |domain| might become dirty. | 136 // failure, |domain| might become dirty. |
| 137 bool ParseDomainASCII(base::StringPiece16 widestr, std::string* domain) { | 137 bool ParseDomainASCII(base::StringPiece16 widestr, std::string* domain) { |
| 138 DCHECK(domain); | 138 DCHECK(domain); |
| 139 if (widestr.empty()) | 139 if (widestr.empty()) |
| 140 return false; | 140 return false; |
| 141 | 141 |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 } | 779 } |
| 780 | 780 |
| 781 } // namespace internal | 781 } // namespace internal |
| 782 | 782 |
| 783 // static | 783 // static |
| 784 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { | 784 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { |
| 785 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); | 785 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); |
| 786 } | 786 } |
| 787 | 787 |
| 788 } // namespace net | 788 } // namespace net |
| OLD | NEW |