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

Side by Side Diff: net/ftp/ftp_directory_listing_parser_ls.cc

Issue 6718043: FTP: Multiple fixes for localized directory listings: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trying to make things more clear Created 9 years, 8 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 | Annotate | Revision Log
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_ls.h" 5 #include "net/ftp/ftp_directory_listing_parser_ls.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 if (net::FtpUtil::LsDateListingToTime(columns[i - 2], 91 if (net::FtpUtil::LsDateListingToTime(columns[i - 2],
92 columns[i - 1], 92 columns[i - 1],
93 columns[i], 93 columns[i],
94 current_time, 94 current_time,
95 modification_time)) { 95 modification_time)) {
96 *offset = i; 96 *offset = i;
97 return true; 97 return true;
98 } 98 }
99 } 99 }
100 100
101 // Some FTP listings have swapped the "month" and "day of month" columns
102 // (for example Russian listings). We try to recognize them only after making
103 // sure no column offset works above (this is a more strict way).
jungshik at Google 2011/04/01 18:28:41 the other day, the order would be always the same
104 for (size_t i = 5U; i < columns.size(); i++) {
105 if (net::FtpUtil::LsDateListingToTime(columns[i - 1],
106 columns[i - 2],
107 columns[i],
108 current_time,
109 modification_time)) {
110 *offset = i;
111 return true;
112 }
113 }
114
101 return false; 115 return false;
102 } 116 }
103 117
104 } // namespace 118 } // namespace
105 119
106 namespace net { 120 namespace net {
107 121
108 bool ParseFtpDirectoryListingLs( 122 bool ParseFtpDirectoryListingLs(
109 const std::vector<string16>& lines, 123 const std::vector<string16>& lines,
110 const base::Time& current_time, 124 const base::Time& current_time,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 entry.name = entry.name.substr(0, pos); 212 entry.name = entry.name.substr(0, pos);
199 } 213 }
200 214
201 entries->push_back(entry); 215 entries->push_back(entry);
202 } 216 }
203 217
204 return true; 218 return true;
205 } 219 }
206 220
207 } // namespace net 221 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698