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

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

Issue 8921006: Standardize StringToInt{,64} interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix call syntax of StringToInt() in Chrome OS code. Created 9 years 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 | « chrome_frame/utils.cc ('k') | net/base/x509_cert_types.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) 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 <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 10
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 1978
1979 // Overflow is still possible for evil user inputs. 1979 // Overflow is still possible for evil user inputs.
1980 for (size_t i = 0; i <= size; ++i) { 1980 for (size_t i = 0; i <= size; ++i) {
1981 // The string should be composed of only digits and commas. 1981 // The string should be composed of only digits and commas.
1982 if (i != size && !IsAsciiDigit(allowed_ports[i]) && 1982 if (i != size && !IsAsciiDigit(allowed_ports[i]) &&
1983 (allowed_ports[i] != kComma)) 1983 (allowed_ports[i] != kComma))
1984 return; 1984 return;
1985 if (i == size || allowed_ports[i] == kComma) { 1985 if (i == size || allowed_ports[i] == kComma) {
1986 if (i > last) { 1986 if (i > last) {
1987 int port; 1987 int port;
1988 base::StringToInt(allowed_ports.begin() + last, 1988 base::StringToInt(base::StringPiece(allowed_ports.begin() + last,
1989 allowed_ports.begin() + i, 1989 allowed_ports.begin() + i),
1990 &port); 1990 &port);
1991 ports.insert(port); 1991 ports.insert(port);
1992 } 1992 }
1993 last = i + 1; 1993 last = i + 1;
1994 } 1994 }
1995 } 1995 }
1996 g_explicitly_allowed_ports.Get() = ports; 1996 g_explicitly_allowed_ports.Get() = ports;
1997 } 1997 }
1998 1998
1999 ScopedPortException::ScopedPortException(int port) : port_(port) { 1999 ScopedPortException::ScopedPortException(int port) : port_(port) {
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 2454
2455 NetworkInterface::NetworkInterface(const std::string& name, 2455 NetworkInterface::NetworkInterface(const std::string& name,
2456 const IPAddressNumber& address) 2456 const IPAddressNumber& address)
2457 : name(name), address(address) { 2457 : name(name), address(address) {
2458 } 2458 }
2459 2459
2460 NetworkInterface::~NetworkInterface() { 2460 NetworkInterface::~NetworkInterface() {
2461 } 2461 }
2462 2462
2463 } // namespace net 2463 } // namespace net
OLDNEW
« no previous file with comments | « chrome_frame/utils.cc ('k') | net/base/x509_cert_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698