Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: net/ftp/ftp_util.cc

Issue 2090713003: Make callers of FromUTC(Local)Exploded in net/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove redundant line Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 if (time_exploded.hour < 12) 341 if (time_exploded.hour < 12)
342 time_exploded.hour += 12; 342 time_exploded.hour += 12;
343 } else if (base::EqualsASCII(am_or_pm, "AM")) { 343 } else if (base::EqualsASCII(am_or_pm, "AM")) {
344 if (time_exploded.hour == 12) 344 if (time_exploded.hour == 12)
345 time_exploded.hour = 0; 345 time_exploded.hour = 0;
346 } else { 346 } else {
347 return false; 347 return false;
348 } 348 }
349 } 349 }
350 350
351 // We don't know the time zone of the server, so just use local time. 351 // We don't know the time zone of the listing, so just use local time.
352 *result = base::Time::FromLocalExploded(time_exploded); 352 *result = base::Time::FromLocalExploded(time_exploded);
353 return true; 353 return true;
354 } 354 }
355 355
356 // static 356 // static
357 base::string16 FtpUtil::GetStringPartAfterColumns(const base::string16& text, 357 base::string16 FtpUtil::GetStringPartAfterColumns(const base::string16& text,
358 int columns) { 358 int columns) {
359 base::i18n::UTF16CharIterator iter(&text); 359 base::i18n::UTF16CharIterator iter(&text);
360 360
361 for (int i = 0; i < columns; i++) { 361 for (int i = 0; i < columns; i++) {
362 // Skip the leading whitespace. 362 // Skip the leading whitespace.
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 // Skip the actual text of i-th column. 366 // Skip the actual text of i-th column.
367 while (!iter.end() && !u_isspace(iter.get())) 367 while (!iter.end() && !u_isspace(iter.get()))
368 iter.Advance(); 368 iter.Advance();
369 } 369 }
370 370
371 base::string16 result(text.substr(iter.array_pos())); 371 base::string16 result(text.substr(iter.array_pos()));
372 base::TrimWhitespace(result, base::TRIM_ALL, &result); 372 base::TrimWhitespace(result, base::TRIM_ALL, &result);
373 return result; 373 return result;
374 } 374 }
375 375
376 } // namespace net 376 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698