diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-06-18 14:10:49 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-06-18 13:53:24 +0000 |
commit | 813fbf95af77a531c57a8c497345ad2c61d475b3 (patch) | |
tree | 821b2c8de8365f21b6c9ba17a236fb3006a1d506 /chromium/base/version.cc | |
parent | af6588f8d723931a298c995fa97259bb7f7deb55 (diff) | |
download | qtwebengine-chromium-813fbf95af77a531c57a8c497345ad2c61d475b3.tar.gz |
BASELINE: Update chromium to 44.0.2403.47
Change-Id: Ie056fedba95cf5e5c76b30c4b2c80fca4764aa2f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'chromium/base/version.cc')
-rw-r--r-- | chromium/base/version.cc | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/chromium/base/version.cc b/chromium/base/version.cc index 6318b350edc..ede8a4586eb 100644 --- a/chromium/base/version.cc +++ b/chromium/base/version.cc @@ -23,7 +23,7 @@ namespace { // is the resulting integer vector. Function returns true if all numbers were // parsed successfully, false otherwise. bool ParseVersionNumbers(const std::string& version_str, - std::vector<uint16>* parsed) { + std::vector<uint32_t>* parsed) { std::vector<std::string> numbers; SplitString(version_str, '.', &numbers); if (numbers.empty()) @@ -31,22 +31,20 @@ bool ParseVersionNumbers(const std::string& version_str, for (std::vector<std::string>::const_iterator it = numbers.begin(); it != numbers.end(); ++it) { - int num; - if (!StringToInt(*it, &num)) + if (StartsWithASCII(*it, "+", false)) return false; - - if (num < 0) - return false; - - const uint16 max = 0xFFFF; - if (num > max) + unsigned int num; + if (!StringToUint(*it, &num)) return false; - // This throws out things like +3, or 032. - if (IntToString(num) != *it) + // This throws out leading zeros for the first item only. + if (it == numbers.begin() && UintToString(num) != *it) return false; - parsed->push_back(static_cast<uint16>(num)); + // StringToUint returns unsigned int but Version fields are uint32_t. + static_assert(sizeof (uint32_t) == sizeof (unsigned int), + "uint32_t must be same as unsigned int"); + parsed->push_back(num); } return true; } @@ -54,8 +52,8 @@ bool ParseVersionNumbers(const std::string& version_str, // Compares version components in |components1| with components in // |components2|. Returns -1, 0 or 1 if |components1| is less than, equal to, // or greater than |components2|, respectively. -int CompareVersionComponents(const std::vector<uint16>& components1, - const std::vector<uint16>& components2) { +int CompareVersionComponents(const std::vector<uint32_t>& components1, + const std::vector<uint32_t>& components2) { const size_t count = std::min(components1.size(), components2.size()); for (size_t i = 0; i < count; ++i) { if (components1[i] > components2[i]) @@ -86,7 +84,7 @@ Version::~Version() { } Version::Version(const std::string& version_str) { - std::vector<uint16> parsed; + std::vector<uint32_t> parsed; if (!ParseVersionNumbers(version_str, &parsed)) return; @@ -125,7 +123,7 @@ int Version::CompareToWildcardString(const std::string& wildcard_string) const { return CompareTo(version); } - std::vector<uint16> parsed; + std::vector<uint32_t> parsed; const bool success = ParseVersionNumbers( wildcard_string.substr(0, wildcard_string.length() - 2), &parsed); DCHECK(success); |