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

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: Updated StringPiece constructor interface to use iterators. 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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 #endif 65 #endif
66 #include "unicode/datefmt.h" 66 #include "unicode/datefmt.h"
67 #include "unicode/regex.h" 67 #include "unicode/regex.h"
68 #include "unicode/ucnv.h" 68 #include "unicode/ucnv.h"
69 #include "unicode/uidna.h" 69 #include "unicode/uidna.h"
70 #include "unicode/ulocdata.h" 70 #include "unicode/ulocdata.h"
71 #include "unicode/uniset.h" 71 #include "unicode/uniset.h"
72 #include "unicode/uscript.h" 72 #include "unicode/uscript.h"
73 #include "unicode/uset.h" 73 #include "unicode/uset.h"
74 74
75 using base::StringPiece;
75 using base::Time; 76 using base::Time;
76 77
77 namespace net { 78 namespace net {
78 79
79 namespace { 80 namespace {
80 81
81 // what we prepend to get a file URL 82 // what we prepend to get a file URL
82 static const FilePath::CharType kFileURLPrefix[] = 83 static const FilePath::CharType kFileURLPrefix[] =
83 FILE_PATH_LITERAL("file:///"); 84 FILE_PATH_LITERAL("file:///");
84 85
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 1979
1979 // Overflow is still possible for evil user inputs. 1980 // Overflow is still possible for evil user inputs.
1980 for (size_t i = 0; i <= size; ++i) { 1981 for (size_t i = 0; i <= size; ++i) {
1981 // The string should be composed of only digits and commas. 1982 // The string should be composed of only digits and commas.
1982 if (i != size && !IsAsciiDigit(allowed_ports[i]) && 1983 if (i != size && !IsAsciiDigit(allowed_ports[i]) &&
1983 (allowed_ports[i] != kComma)) 1984 (allowed_ports[i] != kComma))
1984 return; 1985 return;
1985 if (i == size || allowed_ports[i] == kComma) { 1986 if (i == size || allowed_ports[i] == kComma) {
1986 if (i > last) { 1987 if (i > last) {
1987 int port; 1988 int port;
1988 base::StringToInt(allowed_ports.begin() + last, 1989 base::StringToInt(StringPiece(allowed_ports.begin() + last,
1989 allowed_ports.begin() + i, 1990 allowed_ports.begin() + i), &port);
erikwright (departed) 2011/12/13 20:20:45 Wrapping.
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) {
2000 g_explicitly_allowed_ports.Get().insert(port); 2000 g_explicitly_allowed_ports.Get().insert(port);
(...skipping 453 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

Powered by Google App Engine
This is Rietveld 408576698