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

Unified Diff: net/ftp/ftp_directory_listing_parser_vms.cc

Issue 1220653002: Fix some case-insensitive cases for StartsWith (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: grt's review comments, Mac fix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_netware.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_directory_listing_parser_vms.cc
diff --git a/net/ftp/ftp_directory_listing_parser_vms.cc b/net/ftp/ftp_directory_listing_parser_vms.cc
index fb5ee478b68f703afe1af78d43ae06df1b704722..d05446c179cc3e5c41564b9bf9e6adee352e932e 100644
--- a/net/ftp/ftp_directory_listing_parser_vms.cc
+++ b/net/ftp/ftp_directory_listing_parser_vms.cc
@@ -206,11 +206,13 @@ bool ParseFtpDirectoryListingVms(
// to distinguish it from "ls -l" format).
bool seen_error = false;
+ base::string16 total_of = base::ASCIIToUTF16("Total of ");
+ base::char16 space[2] = { ' ', 0 };
for (size_t i = 0; i < lines.size(); i++) {
if (lines[i].empty())
continue;
- if (base::StartsWith(lines[i], base::ASCIIToUTF16("Total of "), true)) {
+ if (base::StartsWith(lines[i], total_of, base::CompareCase::SENSITIVE)) {
// After the "total" line, all following lines must be empty.
for (size_t j = i + 1; j < lines.size(); j++)
if (!lines[j].empty())
@@ -229,8 +231,9 @@ bool ParseFtpDirectoryListingVms(
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), space,
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (columns.size() == 1) {
// There can be no continuation if the current line is the last one.
@@ -247,11 +250,10 @@ bool ParseFtpDirectoryListingVms(
}
// Join the current and next line and split them into columns.
- base::SplitString(
+ columns = base::SplitString(
base::CollapseWhitespace(
- lines[i - 1] + base::ASCIIToUTF16(" ") + lines[i], false),
- ' ',
- &columns);
+ lines[i - 1] + space + lines[i], false),
+ space, base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
}
FtpDirectoryListingEntry entry;
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_netware.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698