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 3750001: base: Move SplitString functions into the base namespace and update the callers. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: brett review, reverted changes in o3d due to it's using an old base revision Created 10 years, 2 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_util.cc ('k') | net/ftp/ftp_directory_listing_parser_ls.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <map> 8 #include <map>
9 #include <unicode/regex.h> 9 #include <unicode/regex.h>
10 #include <unicode/ucnv.h> 10 #include <unicode/ucnv.h>
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 } 1897 }
1898 1898
1899 bool ParseCIDRBlock(const std::string& cidr_literal, 1899 bool ParseCIDRBlock(const std::string& cidr_literal,
1900 IPAddressNumber* ip_number, 1900 IPAddressNumber* ip_number,
1901 size_t* prefix_length_in_bits) { 1901 size_t* prefix_length_in_bits) {
1902 // We expect CIDR notation to match one of these two templates: 1902 // We expect CIDR notation to match one of these two templates:
1903 // <IPv4-literal> "/" <number of bits> 1903 // <IPv4-literal> "/" <number of bits>
1904 // <IPv6-literal> "/" <number of bits> 1904 // <IPv6-literal> "/" <number of bits>
1905 1905
1906 std::vector<std::string> parts; 1906 std::vector<std::string> parts;
1907 SplitString(cidr_literal, '/', &parts); 1907 base::SplitString(cidr_literal, '/', &parts);
1908 if (parts.size() != 2) 1908 if (parts.size() != 2)
1909 return false; 1909 return false;
1910 1910
1911 // Parse the IP address. 1911 // Parse the IP address.
1912 if (!ParseIPLiteralToNumber(parts[0], ip_number)) 1912 if (!ParseIPLiteralToNumber(parts[0], ip_number))
1913 return false; 1913 return false;
1914 1914
1915 // Parse the prefix length. 1915 // Parse the prefix length.
1916 int number_of_bits = -1; 1916 int number_of_bits = -1;
1917 if (!base::StringToInt(parts[1], &number_of_bits)) 1917 if (!base::StringToInt(parts[1], &number_of_bits))
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 } 1989 }
1990 1990
1991 int GetPortFromAddrinfo(const struct addrinfo* info) { 1991 int GetPortFromAddrinfo(const struct addrinfo* info) {
1992 uint16* port_field = GetPortFieldFromAddrinfo(info); 1992 uint16* port_field = GetPortFieldFromAddrinfo(info);
1993 if (!port_field) 1993 if (!port_field)
1994 return -1; 1994 return -1;
1995 return ntohs(*port_field); 1995 return ntohs(*port_field);
1996 } 1996 }
1997 1997
1998 } // namespace net 1998 } // namespace net
OLDNEW
« no previous file with comments | « net/base/mime_util.cc ('k') | net/ftp/ftp_directory_listing_parser_ls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698