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_windows.h" | 5 #include "net/ftp/ftp_directory_listing_parser_windows.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 19 matching lines...) Expand all Loading... |
30 // 1. date | 30 // 1. date |
31 // 2. time | 31 // 2. time |
32 // 3. size in bytes (or "<DIR>" for directories) | 32 // 3. size in bytes (or "<DIR>" for directories) |
33 // 4. filename (may be empty or contain spaces) | 33 // 4. filename (may be empty or contain spaces) |
34 // | 34 // |
35 // For now, make sure we have 1-3, and handle 4 later. | 35 // For now, make sure we have 1-3, and handle 4 later. |
36 if (columns.size() < 3) | 36 if (columns.size() < 3) |
37 return false; | 37 return false; |
38 | 38 |
39 FtpDirectoryListingEntry entry; | 39 FtpDirectoryListingEntry entry; |
40 if (EqualsASCII(columns[2], "<DIR>")) { | 40 if (base::EqualsASCII(columns[2], "<DIR>")) { |
41 entry.type = FtpDirectoryListingEntry::DIRECTORY; | 41 entry.type = FtpDirectoryListingEntry::DIRECTORY; |
42 entry.size = -1; | 42 entry.size = -1; |
43 } else { | 43 } else { |
44 entry.type = FtpDirectoryListingEntry::FILE; | 44 entry.type = FtpDirectoryListingEntry::FILE; |
45 if (!base::StringToInt64(columns[2], &entry.size)) | 45 if (!base::StringToInt64(columns[2], &entry.size)) |
46 return false; | 46 return false; |
47 if (entry.size < 0) | 47 if (entry.size < 0) |
48 return false; | 48 return false; |
49 } | 49 } |
50 | 50 |
(...skipping 12 matching lines...) Expand all Loading... |
63 continue; | 63 continue; |
64 } | 64 } |
65 | 65 |
66 entries->push_back(entry); | 66 entries->push_back(entry); |
67 } | 67 } |
68 | 68 |
69 return true; | 69 return true; |
70 } | 70 } |
71 | 71 |
72 } // namespace net | 72 } // namespace net |
OLD | NEW |