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

Side by Side Diff: net/base/net_util.cc

Issue 1200053004: Move more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « net/base/mime_sniffer.cc ('k') | net/base/net_util_icu.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/base/net_util.h" 5 #include "net/base/net_util.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 334
335 std::multiset<int> ports; 335 std::multiset<int> ports;
336 size_t last = 0; 336 size_t last = 0;
337 size_t size = allowed_ports.size(); 337 size_t size = allowed_ports.size();
338 // The comma delimiter. 338 // The comma delimiter.
339 const std::string::value_type kComma = ','; 339 const std::string::value_type kComma = ',';
340 340
341 // Overflow is still possible for evil user inputs. 341 // Overflow is still possible for evil user inputs.
342 for (size_t i = 0; i <= size; ++i) { 342 for (size_t i = 0; i <= size; ++i) {
343 // The string should be composed of only digits and commas. 343 // The string should be composed of only digits and commas.
344 if (i != size && !IsAsciiDigit(allowed_ports[i]) && 344 if (i != size && !base::IsAsciiDigit(allowed_ports[i]) &&
345 (allowed_ports[i] != kComma)) 345 (allowed_ports[i] != kComma))
346 return; 346 return;
347 if (i == size || allowed_ports[i] == kComma) { 347 if (i == size || allowed_ports[i] == kComma) {
348 if (i > last) { 348 if (i > last) {
349 int port; 349 int port;
350 base::StringToInt(base::StringPiece(allowed_ports.begin() + last, 350 base::StringToInt(base::StringPiece(allowed_ports.begin() + last,
351 allowed_ports.begin() + i), 351 allowed_ports.begin() + i),
352 &port); 352 &port);
353 ports.insert(port); 353 ports.insert(port);
354 } 354 }
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 }; 831 };
832 const std::string& host = url.host(); 832 const std::string& host = url.host();
833 for (const char* suffix : kGoogleHostSuffixes) { 833 for (const char* suffix : kGoogleHostSuffixes) {
834 if (base::EndsWith(host, suffix, false)) 834 if (base::EndsWith(host, suffix, false))
835 return true; 835 return true;
836 } 836 }
837 return false; 837 return false;
838 } 838 }
839 839
840 } // namespace net 840 } // namespace net
OLDNEW
« no previous file with comments | « net/base/mime_sniffer.cc ('k') | net/base/net_util_icu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698