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

Unified Diff: net/ftp/ftp_directory_listing_parser_ls.cc

Issue 1215933004: New new versions of Starts/EndsWith and SplitString in net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/filter/filter.cc ('k') | net/ftp/ftp_directory_listing_parser_netware.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_directory_listing_parser_ls.cc
diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc
index 7fb92073236d2c6a9c64aeeb3fcf2dae50f02f59..caca122e20837163e0672350a6deb1bd9de3fa85 100644
--- a/net/ftp/ftp_directory_listing_parser_ls.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls.cc
@@ -24,8 +24,9 @@ bool TwoColumnDateListingToTime(const base::string16& date,
base::Time::Exploded time_exploded = { 0 };
// Date should be in format YYYY-MM-DD.
- std::vector<base::string16> date_parts;
- base::SplitString(date, '-', &date_parts);
+ std::vector<base::string16> date_parts =
+ base::SplitString(date, base::ASCIIToUTF16("-"), base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_ALL);
if (date_parts.size() != 3)
return false;
if (!base::StringToInt(date_parts[0], &time_exploded.year))
@@ -39,8 +40,9 @@ bool TwoColumnDateListingToTime(const base::string16& date,
if (time.length() != 5)
return false;
- std::vector<base::string16> time_parts;
- base::SplitString(time, ':', &time_parts);
+ std::vector<base::string16> time_parts =
+ base::SplitString(time, base::ASCIIToUTF16(":"), base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_ALL);
if (time_parts.size() != 2)
return false;
if (!base::StringToInt(time_parts[0], &time_exploded.hour))
@@ -128,8 +130,9 @@ bool ParseFtpDirectoryListingLs(
if (lines[i].empty())
continue;
- std::vector<base::string16> columns;
- base::SplitString(base::CollapseWhitespace(lines[i], false), ' ', &columns);
+ std::vector<base::string16> columns = base::SplitString(
+ base::CollapseWhitespace(lines[i], false), base::ASCIIToUTF16(" "),
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
// Some FTP servers put a "total n" line at the beginning of the listing
// (n is an integer). Allow such a line, but only once, and only if it's
« no previous file with comments | « net/filter/filter.cc ('k') | net/ftp/ftp_directory_listing_parser_netware.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698