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

Unified Diff: src/core/SkPtrRecorder.cpp

Issue 15070011: One SkTSearch to rule them all. Allow key to be of different type than the array. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fixes to compile on gcc Created 7 years, 7 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 | « src/core/SkPtrRecorder.h ('k') | src/core/SkTSort.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPtrRecorder.cpp
diff --git a/src/core/SkPtrRecorder.cpp b/src/core/SkPtrRecorder.cpp
index d473cab8c1bf5fd0c006cca9a00a4fe6bdcbacb8..2acb5af9398b2c38e155d17cb6627be07da61b6f 100644
--- a/src/core/SkPtrRecorder.cpp
+++ b/src/core/SkPtrRecorder.cpp
@@ -21,8 +21,8 @@ void SkPtrSet::reset() {
fList.reset();
}
-int SkPtrSet::Cmp(const Pair* a, const Pair* b) {
- return (char*)a->fPtr - (char*)b->fPtr;
+bool SkPtrSet::Less(const Pair& a, const Pair& b) {
+ return (char*)a.fPtr < (char*)b.fPtr;
}
uint32_t SkPtrSet::find(void* ptr) const {
@@ -34,7 +34,7 @@ uint32_t SkPtrSet::find(void* ptr) const {
Pair pair;
pair.fPtr = ptr;
- int index = SkTSearch<Pair, Cmp>(fList.begin(), count, pair, sizeof(pair));
+ int index = SkTSearch<Pair, Less>(fList.begin(), count, pair, sizeof(pair));
if (index < 0) {
return 0;
}
@@ -50,7 +50,7 @@ uint32_t SkPtrSet::add(void* ptr) {
Pair pair;
pair.fPtr = ptr;
- int index = SkTSearch<Pair, Cmp>(fList.begin(), count, pair, sizeof(pair));
+ int index = SkTSearch<Pair, Less>(fList.begin(), count, pair, sizeof(pair));
if (index < 0) {
index = ~index; // turn it back into an index for insertion
this->incPtr(ptr);
« no previous file with comments | « src/core/SkPtrRecorder.h ('k') | src/core/SkTSort.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698