| OLD | NEW |
| 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 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 namespace net { | 36 namespace net { |
| 37 | 37 |
| 38 bool ParseFtpDirectoryListingNetware( | 38 bool ParseFtpDirectoryListingNetware( |
| 39 const std::vector<base::string16>& lines, | 39 const std::vector<base::string16>& lines, |
| 40 const base::Time& current_time, | 40 const base::Time& current_time, |
| 41 std::vector<FtpDirectoryListingEntry>* entries) { | 41 std::vector<FtpDirectoryListingEntry>* entries) { |
| 42 if (!lines.empty() && !StartsWith(lines[0], ASCIIToUTF16("total "), true)) | 42 if (!lines.empty() && |
| 43 !StartsWith(lines[0], base::ASCIIToUTF16("total "), true)) { |
| 43 return false; | 44 return false; |
| 45 } |
| 44 | 46 |
| 45 for (size_t i = 1U; i < lines.size(); i++) { | 47 for (size_t i = 1U; i < lines.size(); i++) { |
| 46 if (lines[i].empty()) | 48 if (lines[i].empty()) |
| 47 continue; | 49 continue; |
| 48 | 50 |
| 49 std::vector<base::string16> columns; | 51 std::vector<base::string16> columns; |
| 50 base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns); | 52 base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns); |
| 51 | 53 |
| 52 if (columns.size() < 8) | 54 if (columns.size() < 8) |
| 53 return false; | 55 return false; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 87 |
| 86 entry.name = FtpUtil::GetStringPartAfterColumns(lines[i], 7); | 88 entry.name = FtpUtil::GetStringPartAfterColumns(lines[i], 7); |
| 87 | 89 |
| 88 entries->push_back(entry); | 90 entries->push_back(entry); |
| 89 } | 91 } |
| 90 | 92 |
| 91 return true; | 93 return true; |
| 92 } | 94 } |
| 93 | 95 |
| 94 } // namespace net | 96 } // namespace net |
| OLD | NEW |