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

Side by Side Diff: net/ftp/ftp_directory_listing_parser_netware.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 unified diff | Download patch
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_ls.cc ('k') | net/ftp/ftp_directory_listing_parser_os2.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/ftp/ftp_directory_listing_parser_netware.h" 5 #include "net/ftp/ftp_directory_listing_parser_netware.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 if (!lines.empty() && 42 if (!lines.empty() &&
43 !base::StartsWith(lines[0], base::ASCIIToUTF16("total "), 43 !base::StartsWith(lines[0], base::ASCIIToUTF16("total "),
44 base::CompareCase::SENSITIVE)) { 44 base::CompareCase::SENSITIVE)) {
45 return false; 45 return false;
46 } 46 }
47 47
48 for (size_t i = 1U; i < lines.size(); i++) { 48 for (size_t i = 1U; i < lines.size(); i++) {
49 if (lines[i].empty()) 49 if (lines[i].empty())
50 continue; 50 continue;
51 51
52 std::vector<base::string16> columns; 52 std::vector<base::string16> columns = base::SplitString(
53 base::SplitString(base::CollapseWhitespace(lines[i], false), ' ', &columns); 53 base::CollapseWhitespace(lines[i], false), base::ASCIIToUTF16(" "),
54 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
54 55
55 if (columns.size() < 8) 56 if (columns.size() < 8)
56 return false; 57 return false;
57 58
58 FtpDirectoryListingEntry entry; 59 FtpDirectoryListingEntry entry;
59 60
60 if (columns[0].length() != 1) 61 if (columns[0].length() != 1)
61 return false; 62 return false;
62 if (columns[0][0] == 'd') { 63 if (columns[0][0] == 'd') {
63 entry.type = FtpDirectoryListingEntry::DIRECTORY; 64 entry.type = FtpDirectoryListingEntry::DIRECTORY;
(...skipping 24 matching lines...) Expand all
88 89
89 entry.name = FtpUtil::GetStringPartAfterColumns(lines[i], 7); 90 entry.name = FtpUtil::GetStringPartAfterColumns(lines[i], 7);
90 91
91 entries->push_back(entry); 92 entries->push_back(entry);
92 } 93 }
93 94
94 return true; 95 return true;
95 } 96 }
96 97
97 } // namespace net 98 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_ls.cc ('k') | net/ftp/ftp_directory_listing_parser_os2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698