| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/net_util.h" | 5 #include "net/base/net_util.h" |
| 6 | 6 |
| 7 #include <unicode/regex.h> | 7 #include <unicode/regex.h> |
| 8 #include <unicode/ucnv.h> | 8 #include <unicode/ucnv.h> |
| 9 #include <unicode/uidna.h> | 9 #include <unicode/uidna.h> |
| 10 #include <unicode/ulocdata.h> | 10 #include <unicode/ulocdata.h> |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 return false; | 1174 return false; |
| 1175 | 1175 |
| 1176 bool in_component = false; | 1176 bool in_component = false; |
| 1177 bool most_recent_component_started_alpha = false; | 1177 bool most_recent_component_started_alpha = false; |
| 1178 bool last_char_was_hyphen_or_underscore = false; | 1178 bool last_char_was_hyphen_or_underscore = false; |
| 1179 | 1179 |
| 1180 for (std::string::const_iterator i(host.begin()); i != host.end(); ++i) { | 1180 for (std::string::const_iterator i(host.begin()); i != host.end(); ++i) { |
| 1181 const char c = *i; | 1181 const char c = *i; |
| 1182 if (!in_component) { | 1182 if (!in_component) { |
| 1183 most_recent_component_started_alpha = IsHostCharAlpha(c); | 1183 most_recent_component_started_alpha = IsHostCharAlpha(c); |
| 1184 if (!most_recent_component_started_alpha && !IsHostCharDigit(c)) | 1184 if (!most_recent_component_started_alpha && !IsHostCharDigit(c) && |
| 1185 (c != '-')) |
| 1185 return false; | 1186 return false; |
| 1186 in_component = true; | 1187 in_component = true; |
| 1187 } else { | 1188 } else { |
| 1188 if (c == '.') { | 1189 if (c == '.') { |
| 1189 if (last_char_was_hyphen_or_underscore) | 1190 if (last_char_was_hyphen_or_underscore) |
| 1190 return false; | 1191 return false; |
| 1191 in_component = false; | 1192 in_component = false; |
| 1192 } else if (IsHostCharAlpha(c) || IsHostCharDigit(c)) { | 1193 } else if (IsHostCharAlpha(c) || IsHostCharDigit(c)) { |
| 1193 last_char_was_hyphen_or_underscore = false; | 1194 last_char_was_hyphen_or_underscore = false; |
| 1194 } else if ((c == '-') || (c == '_')) { | 1195 } else if ((c == '-') || (c == '_')) { |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2241 | 2242 |
| 2242 NetworkInterface::NetworkInterface(const std::string& name, | 2243 NetworkInterface::NetworkInterface(const std::string& name, |
| 2243 const IPAddressNumber& address) | 2244 const IPAddressNumber& address) |
| 2244 : name(name), address(address) { | 2245 : name(name), address(address) { |
| 2245 } | 2246 } |
| 2246 | 2247 |
| 2247 NetworkInterface::~NetworkInterface() { | 2248 NetworkInterface::~NetworkInterface() { |
| 2248 } | 2249 } |
| 2249 | 2250 |
| 2250 } // namespace net | 2251 } // namespace net |
| OLD | NEW |