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

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

Issue 1120012: Fix the "ls -l" style date parser to correctly guess the year if it is not provided. (Closed)
Patch Set: better comments Created 10 years, 9 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "net/ftp/ftp_directory_listing_buffer.h" 5 #include "net/ftp/ftp_directory_listing_buffer.h"
6 6
7 #include "base/i18n/icu_string_conversions.h" 7 #include "base/i18n/icu_string_conversions.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 25 matching lines...) Expand all
36 // assigned by ICU and it's hard to come up with a lower limit. 36 // assigned by ICU and it's hard to come up with a lower limit.
37 if (U_FAILURE(status)) 37 if (U_FAILURE(status))
38 return std::string(); 38 return std::string();
39 return encoding; 39 return encoding;
40 } 40 }
41 41
42 } // namespace 42 } // namespace
43 43
44 namespace net { 44 namespace net {
45 45
46 FtpDirectoryListingBuffer::FtpDirectoryListingBuffer() 46 FtpDirectoryListingBuffer::FtpDirectoryListingBuffer(
47 const base::Time& current_time)
47 : current_parser_(NULL) { 48 : current_parser_(NULL) {
48 parsers_.insert(new FtpDirectoryListingParserLs()); 49 parsers_.insert(new FtpDirectoryListingParserLs(current_time));
49 parsers_.insert(new FtpDirectoryListingParserMlsd()); 50 parsers_.insert(new FtpDirectoryListingParserMlsd());
50 parsers_.insert(new FtpDirectoryListingParserNetware()); 51 parsers_.insert(new FtpDirectoryListingParserNetware(current_time));
51 parsers_.insert(new FtpDirectoryListingParserVms()); 52 parsers_.insert(new FtpDirectoryListingParserVms());
52 parsers_.insert(new FtpDirectoryListingParserWindows()); 53 parsers_.insert(new FtpDirectoryListingParserWindows());
53 } 54 }
54 55
55 FtpDirectoryListingBuffer::~FtpDirectoryListingBuffer() { 56 FtpDirectoryListingBuffer::~FtpDirectoryListingBuffer() {
56 STLDeleteElements(&parsers_); 57 STLDeleteElements(&parsers_);
57 } 58 }
58 59
59 int FtpDirectoryListingBuffer::ConsumeData(const char* data, int data_length) { 60 int FtpDirectoryListingBuffer::ConsumeData(const char* data, int data_length) {
60 buffer_.append(data, data_length); 61 buffer_.append(data, data_length);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 return OK; 186 return OK;
186 187
187 return ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT; 188 return ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT;
188 } 189 }
189 190
190 current_parser_ = *parsers_.begin(); 191 current_parser_ = *parsers_.begin();
191 return OK; 192 return OK;
192 } 193 }
193 194
194 } // namespace net 195 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_directory_listing_buffer.h ('k') | net/ftp/ftp_directory_listing_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698