| OLD | NEW |
| 1 // Copyright (c) 2010 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_vms.h" | 5 #include "net/ftp/ftp_directory_listing_parser_vms.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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 base::Time::Exploded time_exploded = { 0 }; | 124 base::Time::Exploded time_exploded = { 0 }; |
| 125 | 125 |
| 126 // Date should be in format DD-MMM-YYYY. | 126 // Date should be in format DD-MMM-YYYY. |
| 127 std::vector<string16> date_parts; | 127 std::vector<string16> date_parts; |
| 128 base::SplitString(columns[1], '-', &date_parts); | 128 base::SplitString(columns[1], '-', &date_parts); |
| 129 if (date_parts.size() != 3) | 129 if (date_parts.size() != 3) |
| 130 return false; | 130 return false; |
| 131 if (!base::StringToInt(date_parts[0], &time_exploded.day_of_month)) | 131 if (!base::StringToInt(date_parts[0], &time_exploded.day_of_month)) |
| 132 return false; | 132 return false; |
| 133 if (!net::FtpUtil::ThreeLetterMonthToNumber(date_parts[1], | 133 if (!net::FtpUtil::AbbreviatedMonthToNumber(date_parts[1], |
| 134 &time_exploded.month)) | 134 &time_exploded.month)) |
| 135 return false; | 135 return false; |
| 136 if (!base::StringToInt(date_parts[2], &time_exploded.year)) | 136 if (!base::StringToInt(date_parts[2], &time_exploded.year)) |
| 137 return false; | 137 return false; |
| 138 | 138 |
| 139 // Time can be in format HH:MM, HH:MM:SS, or HH:MM:SS.mm. Try to recognize the | 139 // Time can be in format HH:MM, HH:MM:SS, or HH:MM:SS.mm. Try to recognize the |
| 140 // last type first. Do not parse the seconds, they will be ignored anyway. | 140 // last type first. Do not parse the seconds, they will be ignored anyway. |
| 141 string16 time_column(columns[2]); | 141 string16 time_column(columns[2]); |
| 142 if (time_column.length() == 11 && time_column[8] == '.') | 142 if (time_column.length() == 11 && time_column[8] == '.') |
| 143 time_column = time_column.substr(0, 8); | 143 time_column = time_column.substr(0, 8); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 if (entry.type != FtpDirectoryListingEntry::FILE) | 295 if (entry.type != FtpDirectoryListingEntry::FILE) |
| 296 entry.size = -1; | 296 entry.size = -1; |
| 297 if (!VmsDateListingToTime(columns, &entry.last_modified)) | 297 if (!VmsDateListingToTime(columns, &entry.last_modified)) |
| 298 return false; | 298 return false; |
| 299 | 299 |
| 300 entries_.push(entry); | 300 entries_.push(entry); |
| 301 return true; | 301 return true; |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace net | 304 } // namespace net |
| OLD | NEW |