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

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

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_netware.cc ('k') | net/http/http_auth_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_vms.h" 5 #include "net/ftp/ftp_directory_listing_parser_vms.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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 // Sometimes the listing doesn't end with a "Total" line, but 204 // Sometimes the listing doesn't end with a "Total" line, but
205 // it's only okay when it contains some errors (it's needed 205 // it's only okay when it contains some errors (it's needed
206 // to distinguish it from "ls -l" format). 206 // to distinguish it from "ls -l" format).
207 bool seen_error = false; 207 bool seen_error = false;
208 208
209 for (size_t i = 0; i < lines.size(); i++) { 209 for (size_t i = 0; i < lines.size(); i++) {
210 if (lines[i].empty()) 210 if (lines[i].empty())
211 continue; 211 continue;
212 212
213 if (StartsWith(lines[i], base::ASCIIToUTF16("Total of "), true)) { 213 if (base::StartsWith(lines[i], base::ASCIIToUTF16("Total of "), true)) {
214 // After the "total" line, all following lines must be empty. 214 // After the "total" line, all following lines must be empty.
215 for (size_t j = i + 1; j < lines.size(); j++) 215 for (size_t j = i + 1; j < lines.size(); j++)
216 if (!lines[j].empty()) 216 if (!lines[j].empty())
217 return false; 217 return false;
218 218
219 return true; 219 return true;
220 } 220 }
221 221
222 if (!seen_header) { 222 if (!seen_header) {
223 seen_header = true; 223 seen_header = true;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 entries->push_back(entry); 284 entries->push_back(entry);
285 } 285 }
286 286
287 // The only place where we return true is after receiving the "Total" line, 287 // The only place where we return true is after receiving the "Total" line,
288 // that should be present in every VMS listing. Alternatively, if the listing 288 // that should be present in every VMS listing. Alternatively, if the listing
289 // contains error messages, it's OK not to have the "Total" line. 289 // contains error messages, it's OK not to have the "Total" line.
290 return seen_error; 290 return seen_error;
291 } 291 }
292 292
293 } // namespace net 293 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_netware.cc ('k') | net/http/http_auth_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698