| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/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 25 matching lines...) Expand all Loading... |
| 36 return false; | 36 return false; |
| 37 | 37 |
| 38 // Even directories have extensions in the listings. Don't display extensions | 38 // Even directories have extensions in the listings. Don't display extensions |
| 39 // for directories; it's awkward for non-VMS users. Also, VMS is | 39 // for directories; it's awkward for non-VMS users. Also, VMS is |
| 40 // case-insensitive, but generally uses uppercase characters. This may look | 40 // case-insensitive, but generally uses uppercase characters. This may look |
| 41 // awkward, so we convert them to lower case. | 41 // awkward, so we convert them to lower case. |
| 42 std::vector<base::string16> filename_parts; | 42 std::vector<base::string16> filename_parts; |
| 43 base::SplitString(listing_parts[0], '.', &filename_parts); | 43 base::SplitString(listing_parts[0], '.', &filename_parts); |
| 44 if (filename_parts.size() != 2) | 44 if (filename_parts.size() != 2) |
| 45 return false; | 45 return false; |
| 46 if (EqualsASCII(filename_parts[1], "DIR")) { | 46 if (base::EqualsASCII(filename_parts[1], "DIR")) { |
| 47 *parsed_filename = base::StringToLowerASCII(filename_parts[0]); | 47 *parsed_filename = base::StringToLowerASCII(filename_parts[0]); |
| 48 *type = FtpDirectoryListingEntry::DIRECTORY; | 48 *type = FtpDirectoryListingEntry::DIRECTORY; |
| 49 } else { | 49 } else { |
| 50 *parsed_filename = base::StringToLowerASCII(listing_parts[0]); | 50 *parsed_filename = base::StringToLowerASCII(listing_parts[0]); |
| 51 *type = FtpDirectoryListingEntry::FILE; | 51 *type = FtpDirectoryListingEntry::FILE; |
| 52 } | 52 } |
| 53 return true; | 53 return true; |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool ParseVmsFilesize(const base::string16& input, int64* size) { | 56 bool ParseVmsFilesize(const base::string16& input, int64* size) { |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 entries->push_back(entry); | 284 entries->push_back(entry); |
| 285 } | 285 } |
| 286 | 286 |
| 287 // The only place where we return true is after receiving the "Total" line, | 287 // The only place where we return true is after receiving the "Total" line, |
| 288 // that should be present in every VMS listing. Alternatively, if the listing | 288 // that should be present in every VMS listing. Alternatively, if the listing |
| 289 // contains error messages, it's OK not to have the "Total" line. | 289 // contains error messages, it's OK not to have the "Total" line. |
| 290 return seen_error; | 290 return seen_error; |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace net | 293 } // namespace net |
| OLD | NEW |