| 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_os2.h" | 5 #include "net/ftp/ftp_directory_listing_parser_os2.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_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 entry.type = FtpDirectoryListingEntry::DIRECTORY; | 46 entry.type = FtpDirectoryListingEntry::DIRECTORY; |
| 47 entry.size = -1; | 47 entry.size = -1; |
| 48 } else if (EqualsASCII(columns[1], "A")) { | 48 } else if (EqualsASCII(columns[1], "A")) { |
| 49 entry.type = FtpDirectoryListingEntry::FILE; | 49 entry.type = FtpDirectoryListingEntry::FILE; |
| 50 if (entry.size < 0) | 50 if (entry.size < 0) |
| 51 return false; | 51 return false; |
| 52 } else { | 52 } else { |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 | 55 |
| 56 if (!FtpUtil::WindowsDateListingToTime(columns[2], | 56 if (!FtpUtil::WindowsDateListingToTime( |
| 57 columns[3], | 57 columns[2], columns[3], &entry.last_modified)) { |
| 58 &entry.last_modified)) { | |
| 59 return false; | 58 return false; |
| 60 } | 59 } |
| 61 | 60 |
| 62 entry.name = FtpUtil::GetStringPartAfterColumns(lines[i], 4); | 61 entry.name = FtpUtil::GetStringPartAfterColumns(lines[i], 4); |
| 63 if (entry.name.empty()) { | 62 if (entry.name.empty()) { |
| 64 // Some FTP servers send listing entries with empty names. | 63 // Some FTP servers send listing entries with empty names. |
| 65 // It's not obvious how to display such an entry, so ignore them. | 64 // It's not obvious how to display such an entry, so ignore them. |
| 66 // We don't want to make the parsing fail at this point though. | 65 // We don't want to make the parsing fail at this point though. |
| 67 // Other entries can still be useful. | 66 // Other entries can still be useful. |
| 68 continue; | 67 continue; |
| 69 } | 68 } |
| 70 | 69 |
| 71 entries->push_back(entry); | 70 entries->push_back(entry); |
| 72 } | 71 } |
| 73 | 72 |
| 74 return true; | 73 return true; |
| 75 } | 74 } |
| 76 | 75 |
| 77 } // namespace net | 76 } // namespace net |
| OLD | NEW |