| 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_util.h" | 5 #include "net/ftp/ftp_util.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (time_exploded.day_of_month > 31) | 244 if (time_exploded.day_of_month > 31) |
| 245 return false; | 245 return false; |
| 246 | 246 |
| 247 if (!base::StringToInt(rest, &time_exploded.year)) { | 247 if (!base::StringToInt(rest, &time_exploded.year)) { |
| 248 // Maybe it's time. Does it look like time? Note that it can be any of | 248 // Maybe it's time. Does it look like time? Note that it can be any of |
| 249 // "HH:MM", "H:MM", "HH:M" or maybe even "H:M". | 249 // "HH:MM", "H:MM", "HH:M" or maybe even "H:M". |
| 250 if (rest.length() > 5) | 250 if (rest.length() > 5) |
| 251 return false; | 251 return false; |
| 252 | 252 |
| 253 size_t colon_pos = rest.find(':'); | 253 size_t colon_pos = rest.find(':'); |
| 254 if (colon_pos == string16::npos) | 254 if (colon_pos == base::string16::npos) |
| 255 return false; | 255 return false; |
| 256 if (colon_pos > 2) | 256 if (colon_pos > 2) |
| 257 return false; | 257 return false; |
| 258 | 258 |
| 259 if (!base::StringToInt( | 259 if (!base::StringToInt( |
| 260 StringPiece16(rest.begin(), rest.begin() + colon_pos), | 260 StringPiece16(rest.begin(), rest.begin() + colon_pos), |
| 261 &time_exploded.hour)) { | 261 &time_exploded.hour)) { |
| 262 return false; | 262 return false; |
| 263 } | 263 } |
| 264 if (!base::StringToInt( | 264 if (!base::StringToInt( |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 while (!iter.end() && !u_isspace(iter.get())) | 363 while (!iter.end() && !u_isspace(iter.get())) |
| 364 iter.Advance(); | 364 iter.Advance(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 base::string16 result(text.substr(iter.array_pos())); | 367 base::string16 result(text.substr(iter.array_pos())); |
| 368 TrimWhitespace(result, TRIM_ALL, &result); | 368 TrimWhitespace(result, TRIM_ALL, &result); |
| 369 return result; | 369 return result; |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace | 372 } // namespace |
| OLD | NEW |