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

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: review comments 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
« no previous file with comments | « ui/gfx/range/range.h ('k') | ui/gfx/render_text.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/range/range.cc
diff --git a/ui/gfx/range/range.cc b/ui/gfx/range/range.cc
index 1c3968aa6e2f82d561f068434abba3d52869a999..a6475cba2ec8a01ea144bf1c425772ad2420491b 100644
--- a/ui/gfx/range/range.cc
+++ b/ui/gfx/range/range.cc
@@ -7,7 +7,6 @@
#include <algorithm>
#include <limits>
-#include "base/format_macros.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
@@ -18,30 +17,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 +67,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 +77,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) {
« no previous file with comments | « ui/gfx/range/range.h ('k') | ui/gfx/render_text.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698