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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months 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 | Annotate | Revision Log
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_directory_listing_parser_netware.h" 5 #include "net/ftp/ftp_directory_listing_parser_netware.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_util.h" 10 #include "base/strings/string_util.h"
(...skipping 22 matching lines...) Expand all
33 33
34 } // namespace 34 } // namespace
35 35
36 namespace net { 36 namespace net {
37 37
38 bool ParseFtpDirectoryListingNetware( 38 bool ParseFtpDirectoryListingNetware(
39 const std::vector<base::string16>& lines, 39 const std::vector<base::string16>& lines,
40 const base::Time& current_time, 40 const base::Time& current_time,
41 std::vector<FtpDirectoryListingEntry>* entries) { 41 std::vector<FtpDirectoryListingEntry>* entries) {
42 if (!lines.empty() && 42 if (!lines.empty() &&
43 !StartsWith(lines[0], base::ASCIIToUTF16("total "), true)) { 43 !StartsWith(lines[0], base::ASCIIToUTF16("total "), true)) {
44 return false; 44 return false;
45 } 45 }
46 46
47 for (size_t i = 1U; i < lines.size(); i++) { 47 for (size_t i = 1U; i < lines.size(); i++) {
48 if (lines[i].empty()) 48 if (lines[i].empty())
49 continue; 49 continue;
50 50
51 std::vector<base::string16> columns; 51 std::vector<base::string16> columns;
52 base::SplitString(base::CollapseWhitespace(lines[i], false), ' ', &columns); 52 base::SplitString(base::CollapseWhitespace(lines[i], false), ' ', &columns);
53 53
(...skipping 19 matching lines...) Expand all
73 return false; 73 return false;
74 74
75 if (!base::StringToInt64(columns[3], &entry.size)) 75 if (!base::StringToInt64(columns[3], &entry.size))
76 return false; 76 return false;
77 if (entry.size < 0) 77 if (entry.size < 0)
78 return false; 78 return false;
79 if (entry.type != FtpDirectoryListingEntry::FILE) 79 if (entry.type != FtpDirectoryListingEntry::FILE)
80 entry.size = -1; 80 entry.size = -1;
81 81
82 // Netware uses the same date listing format as Unix "ls -l". 82 // Netware uses the same date listing format as Unix "ls -l".
83 if (!FtpUtil::LsDateListingToTime(columns[4], columns[5], columns[6], 83 if (!FtpUtil::LsDateListingToTime(columns[4],
84 current_time, &entry.last_modified)) { 84 columns[5],
85 columns[6],
86 current_time,
87 &entry.last_modified)) {
85 return false; 88 return false;
86 } 89 }
87 90
88 entry.name = FtpUtil::GetStringPartAfterColumns(lines[i], 7); 91 entry.name = FtpUtil::GetStringPartAfterColumns(lines[i], 7);
89 92
90 entries->push_back(entry); 93 entries->push_back(entry);
91 } 94 }
92 95
93 return true; 96 return true;
94 } 97 }
95 98
96 } // namespace net 99 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698