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

Unified Diff: ui/gfx/range/range.cc

Issue 1671403002: Switch gfx::Range to use uint32_t instead of size_t. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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: ui/gfx/range/range.cc
diff --git a/ui/gfx/range/range.cc b/ui/gfx/range/range.cc
index 1c3968aa6e2f82d561f068434abba3d52869a999..f190a51d1885ded0c0d5ee3c6a3d583e51b371fa 100644
--- a/ui/gfx/range/range.cc
+++ b/ui/gfx/range/range.cc
@@ -18,30 +18,30 @@ Range::Range()
end_(0) {
}
-Range::Range(size_t start, size_t end)
+Range::Range(uint32_t start, uint32_t end)
: start_(start),
end_(end) {
}
-Range::Range(size_t position)
+Range::Range(uint32_t position)
: start_(position),
end_(position) {
}
// static
const Range Range::InvalidRange() {
- return Range(std::numeric_limits<size_t>::max());
+ return Range(std::numeric_limits<uint32_t>::max());
}
bool Range::IsValid() const {
return *this != InvalidRange();
}
-size_t Range::GetMin() const {
+uint32_t Range::GetMin() const {
return std::min(start(), end());
}
-size_t Range::GetMax() const {
+uint32_t Range::GetMax() const {
return std::max(start(), end());
}
@@ -68,8 +68,8 @@ bool Range::Contains(const Range& range) const {
}
Range Range::Intersect(const Range& range) const {
- size_t min = std::max(GetMin(), range.GetMin());
- size_t max = std::min(GetMax(), range.GetMax());
+ uint32_t min = std::max(GetMin(), range.GetMin());
+ uint32_t max = std::min(GetMax(), range.GetMax());
if (min >= max) // No intersection.
return InvalidRange();
@@ -78,7 +78,7 @@ Range Range::Intersect(const Range& range) const {
}
std::string Range::ToString() const {
- return base::StringPrintf("{%" PRIuS ",%" PRIuS "}", start(), end());
+ return base::StringPrintf("{%d,%d}", start(), end());
}
std::ostream& operator<<(std::ostream& os, const Range& range) {

Powered by Google App Engine
This is Rietveld 408576698