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

Unified Diff: base/version.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « base/values.cc ('k') | base/win/iat_patch_function.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/version.cc
diff --git a/base/version.cc b/base/version.cc
index ede8a4586eb9bb8685b05a00939772cd7eaaefdb..228dcb8aef20e4a33d9dd03269ceaa5195ba1a32 100644
--- a/base/version.cc
+++ b/base/version.cc
@@ -24,15 +24,17 @@ namespace {
// parsed successfully, false otherwise.
bool ParseVersionNumbers(const std::string& version_str,
std::vector<uint32_t>* parsed) {
- std::vector<std::string> numbers;
- SplitString(version_str, '.', &numbers);
+ std::vector<StringPiece> numbers =
+ SplitStringPiece(version_str, ".", KEEP_WHITESPACE, SPLIT_WANT_ALL);
if (numbers.empty())
return false;
- for (std::vector<std::string>::const_iterator it = numbers.begin();
- it != numbers.end(); ++it) {
- if (StartsWithASCII(*it, "+", false))
+ for (auto it = numbers.begin(); it != numbers.end(); ++it) {
+ if (StartsWith(*it, "+", CompareCase::SENSITIVE))
return false;
+
+ // TODO(brettw) when we have a StringPiece version of StringToUint, delete
+ // this string conversion.
unsigned int num;
if (!StringToUint(*it, &num))
return false;
@@ -98,8 +100,8 @@ bool Version::IsValid() const {
// static
bool Version::IsValidWildcardString(const std::string& wildcard_string) {
std::string version_string = wildcard_string;
- if (EndsWith(wildcard_string.c_str(), ".*", false))
- version_string = wildcard_string.substr(0, wildcard_string.size() - 2);
+ if (EndsWith(version_string, ".*", CompareCase::SENSITIVE))
+ version_string.resize(version_string.size() - 2);
Version version(version_string);
return version.IsValid();
@@ -117,7 +119,7 @@ int Version::CompareToWildcardString(const std::string& wildcard_string) const {
DCHECK(Version::IsValidWildcardString(wildcard_string));
// Default behavior if the string doesn't end with a wildcard.
- if (!EndsWith(wildcard_string.c_str(), ".*", false)) {
+ if (!EndsWith(wildcard_string, ".*", CompareCase::SENSITIVE)) {
Version version(wildcard_string);
DCHECK(version.IsValid());
return CompareTo(version);
« no previous file with comments | « base/values.cc ('k') | base/win/iat_patch_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698