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

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

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/ipc/gfx_param_traits.cc ('k') | ui/gfx/range/range.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/range/range.h
diff --git a/ui/gfx/range/range.h b/ui/gfx/range/range.h
index 741b318138d53488c318f33acc30f7ea771c5927..c99ca22041e40eef0398cca027233dea81c557e9 100644
--- a/ui/gfx/range/range.h
+++ b/ui/gfx/range/range.h
@@ -6,6 +6,7 @@
#define UI_GFX_RANGE_RANGE_H_
#include <stddef.h>
+#include <stdint.h>
#include <ostream>
#include <string>
@@ -39,10 +40,10 @@ class GFX_EXPORT Range {
Range();
// Initializes the range with a start and end.
- Range(size_t start, size_t end);
+ Range(uint32_t start, uint32_t end);
// Initializes the range with the same start and end positions.
- explicit Range(size_t position);
+ explicit Range(uint32_t position);
// Platform constructors.
#if defined(OS_MACOSX)
@@ -53,31 +54,30 @@ class GFX_EXPORT Range {
Range(const CHARRANGE& range, LONG total_length = -1);
#endif
- // Returns a range that is invalid, which is {size_t_max,size_t_max}.
+ // Returns a range that is invalid, which is {UINT32_MAX,UINT32_MAX}.
static const Range InvalidRange();
// Checks if the range is valid through comparison to InvalidRange().
bool IsValid() const;
// Getters and setters.
- size_t start() const { return start_; }
- void set_start(size_t start) { start_ = start; }
+ uint32_t start() const { return start_; }
+ void set_start(uint32_t start) { start_ = start; }
- size_t end() const { return end_; }
- void set_end(size_t end) { end_ = end; }
+ uint32_t end() const { return end_; }
+ void set_end(uint32_t end) { end_ = end; }
// Returns the absolute value of the length.
- size_t length() const {
- ptrdiff_t length = end() - start();
- return length >= 0 ? length : -length;
+ uint32_t length() const {
+ return GetMax() - GetMin();
}
bool is_reversed() const { return start() > end(); }
bool is_empty() const { return start() == end(); }
// Returns the minimum and maximum values.
- size_t GetMin() const;
- size_t GetMax() const;
+ uint32_t GetMin() const;
+ uint32_t GetMax() const;
bool operator==(const Range& other) const;
bool operator!=(const Range& other) const;
@@ -108,8 +108,8 @@ class GFX_EXPORT Range {
std::string ToString() const;
private:
- size_t start_;
- size_t end_;
+ uint32_t start_;
+ uint32_t end_;
};
GFX_EXPORT std::ostream& operator<<(std::ostream& os, const Range& range);
« no previous file with comments | « ui/gfx/ipc/gfx_param_traits.cc ('k') | ui/gfx/range/range.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698