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

Unified Diff: chromeos/system/version_loader.cc

Issue 1284833004: Remove remaining legacy SplitString calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/system/version_loader.cc
diff --git a/chromeos/system/version_loader.cc b/chromeos/system/version_loader.cc
index a5604d8f16d176160598ea8d3adcce314bfb2766..ab9505b6274f27040faa0a60f6764ffd5bedb42f 100644
--- a/chromeos/system/version_loader.cc
+++ b/chromeos/system/version_loader.cc
@@ -75,12 +75,12 @@ std::string ParseFirmware(const std::string& contents) {
// fixed. So we just match kFirmwarePrefix at the start of the line and find
// the first character that is not "|" or space
- std::vector<std::string> lines;
- base::SplitString(contents, '\n', &lines);
- for (size_t i = 0; i < lines.size(); ++i) {
- if (base::StartsWith(lines[i], kFirmwarePrefix,
+ base::StringPiece firmware_prefix(kFirmwarePrefix);
+ for (const std::string& line : base::SplitString(
+ contents, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
+ if (base::StartsWith(line, firmware_prefix,
base::CompareCase::INSENSITIVE_ASCII)) {
- std::string str = lines[i].substr(std::string(kFirmwarePrefix).size());
+ std::string str = line.substr(firmware_prefix.size());
size_t found = str.find_first_not_of("| ");
if (found != std::string::npos)
return str.substr(found);

Powered by Google App Engine
This is Rietveld 408576698