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

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

Issue 10684003: Make SplitString() and variants clear their outparam vector. (Note that SplitStringIntoKeyValues()… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « base/string_split_unittest.cc ('k') | webkit/plugins/npapi/plugin_list_win.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) 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_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/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 210
211 std::vector<string16> columns; 211 std::vector<string16> columns;
212 base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns); 212 base::SplitString(CollapseWhitespace(lines[i], false), ' ', &columns);
213 213
214 if (columns.size() == 1) { 214 if (columns.size() == 1) {
215 // There can be no continuation if the current line is the last one. 215 // There can be no continuation if the current line is the last one.
216 if (i == lines.size() - 1) 216 if (i == lines.size() - 1)
217 return false; 217 return false;
218 218
219 // Join the current and next line and split them into columns. 219 // Join the current and next line and split them into columns.
220 columns.clear();
221 base::SplitString( 220 base::SplitString(
222 CollapseWhitespace(lines[i] + ASCIIToUTF16(" ") + lines[i + 1], 221 CollapseWhitespace(lines[i] + ASCIIToUTF16(" ") + lines[i + 1],
223 false), 222 false),
224 ' ', 223 ' ',
225 &columns); 224 &columns);
226 i++; 225 i++;
227 } 226 }
228 227
229 FtpDirectoryListingEntry entry; 228 FtpDirectoryListingEntry entry;
230 if (!ParseVmsFilename(columns[0], &entry.name, &entry.type)) 229 if (!ParseVmsFilename(columns[0], &entry.name, &entry.type))
(...skipping 26 matching lines...) Expand all
257 256
258 entries->push_back(entry); 257 entries->push_back(entry);
259 } 258 }
260 259
261 // The only place where we return true is after receiving the "Total" line, 260 // The only place where we return true is after receiving the "Total" line,
262 // that should be present in every VMS listing. 261 // that should be present in every VMS listing.
263 return false; 262 return false;
264 } 263 }
265 264
266 } // namespace net 265 } // namespace net
OLDNEW
« no previous file with comments | « base/string_split_unittest.cc ('k') | webkit/plugins/npapi/plugin_list_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698