| 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_ls.h" | 5 #include "net/ftp/ftp_directory_listing_parser_ls.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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // (n is an integer). Allow such a line, but only once, and only if it's | 138 // (n is an integer). Allow such a line, but only once, and only if it's |
| 139 // the first non-empty line. Do not match the word exactly, because it may | 139 // the first non-empty line. Do not match the word exactly, because it may |
| 140 // be in different languages (at least English and German have been seen | 140 // be in different languages (at least English and German have been seen |
| 141 // in the field). | 141 // in the field). |
| 142 if (columns.size() == 2 && !received_total_line) { | 142 if (columns.size() == 2 && !received_total_line) { |
| 143 received_total_line = true; | 143 received_total_line = true; |
| 144 | 144 |
| 145 // Some FTP servers incorrectly return a negative integer for "n". Since | 145 // Some FTP servers incorrectly return a negative integer for "n". Since |
| 146 // this value is ignored anyway, just check any valid integer was | 146 // this value is ignored anyway, just check any valid integer was |
| 147 // provided. | 147 // provided. |
| 148 int64 total_number; | 148 int64_t total_number; |
| 149 if (!base::StringToInt64(columns[1], &total_number)) | 149 if (!base::StringToInt64(columns[1], &total_number)) |
| 150 return false; | 150 return false; |
| 151 | 151 |
| 152 continue; | 152 continue; |
| 153 } | 153 } |
| 154 | 154 |
| 155 FtpDirectoryListingEntry entry; | 155 FtpDirectoryListingEntry entry; |
| 156 | 156 |
| 157 size_t column_offset; | 157 size_t column_offset; |
| 158 base::string16 size; | 158 base::string16 size; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 entry.name = entry.name.substr(0, pos); | 222 entry.name = entry.name.substr(0, pos); |
| 223 } | 223 } |
| 224 | 224 |
| 225 entries->push_back(entry); | 225 entries->push_back(entry); |
| 226 } | 226 } |
| 227 | 227 |
| 228 return true; | 228 return true; |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace net | 231 } // namespace net |
| OLD | NEW |