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

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

Issue 10544054: Fix wierd string iteration problem in ParseDomainASCII under VS2010 debug builds (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 6 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 | « no previous file | no next file » | 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_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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // Converts a string16 domain name to ASCII, possibly using punycode. 105 // Converts a string16 domain name to ASCII, possibly using punycode.
106 // Returns true if the conversion succeeds and output is not empty. In case of 106 // Returns true if the conversion succeeds and output is not empty. In case of
107 // failure, |domain| might become dirty. 107 // failure, |domain| might become dirty.
108 bool ParseDomainASCII(const string16& widestr, std::string* domain) { 108 bool ParseDomainASCII(const string16& widestr, std::string* domain) {
109 DCHECK(domain); 109 DCHECK(domain);
110 if (widestr.empty()) 110 if (widestr.empty())
111 return false; 111 return false;
112 112
113 // Check if already ASCII. 113 // Check if already ASCII.
114 if (IsStringASCII(widestr)) { 114 if (IsStringASCII(widestr)) {
115 // http://crbug.com/131599
116 #if defined(OS_WIN) && !defined(NDEBUG)
cbentzel 2012/06/07 17:38:46 Can this be fixed with a pragma directive instead?
szym 2012/06/07 17:40:49 Hmm, how about: http://msdn.microsoft.com/en-us/li
117 *domain = UTF16ToASCII(string16(widestr));
118 #else
115 *domain = UTF16ToASCII(widestr); 119 *domain = UTF16ToASCII(widestr);
120 #endif
116 return true; 121 return true;
117 } 122 }
118 123
119 // Otherwise try to convert it from IDN to punycode. 124 // Otherwise try to convert it from IDN to punycode.
120 const int kInitialBufferSize = 256; 125 const int kInitialBufferSize = 256;
121 url_canon::RawCanonOutputT<char16, kInitialBufferSize> punycode; 126 url_canon::RawCanonOutputT<char16, kInitialBufferSize> punycode;
122 if (!url_canon::IDNToASCII(widestr.data(), widestr.length(), &punycode)) 127 if (!url_canon::IDNToASCII(widestr.data(), widestr.length(), &punycode))
123 return false; 128 return false;
124 129
125 // |punycode_output| should now be ASCII; convert it to a std::string. 130 // |punycode_output| should now be ASCII; convert it to a std::string.
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 555
551 } // namespace internal 556 } // namespace internal
552 557
553 // static 558 // static
554 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { 559 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() {
555 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); 560 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin());
556 } 561 }
557 562
558 } // namespace net 563 } // namespace net
559 564
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698