aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-10 21:03:23 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-10 21:03:23 +0000
commitc967795b8f63bda26b76694e08a642136e22cb5b (patch)
treeefa6337d2b7ec7da6dafee3615e1f41c4337da18 /include
parent99a5ac0b67a14048a1db3f429878775854d29397 (diff)
Make it possible to share a comparison func with both SkTSearch and SkQSort
Review URL: http://codereview.appspot.com/6006043/ git-svn-id: http://skia.googlecode.com/svn/trunk@3648 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkPtrRecorder.h2
-rw-r--r--include/core/SkTSearch.h6
2 files changed, 4 insertions, 4 deletions
diff --git a/include/core/SkPtrRecorder.h b/include/core/SkPtrRecorder.h
index 11fd17043e..2df84b245a 100644
--- a/include/core/SkPtrRecorder.h
+++ b/include/core/SkPtrRecorder.h
@@ -71,7 +71,7 @@ private:
// is not related to its "index".
SkTDArray<Pair> fList;
- static int Cmp(const Pair& a, const Pair& b);
+ static int Cmp(const Pair* a, const Pair* b);
typedef SkRefCnt INHERITED;
};
diff --git a/include/core/SkTSearch.h b/include/core/SkTSearch.h
index d5ab18ceda..abe727fe03 100644
--- a/include/core/SkTSearch.h
+++ b/include/core/SkTSearch.h
@@ -47,7 +47,7 @@ int SkTSearch(const T* base, int count, const T& target, size_t elemSize)
template <typename T>
int SkTSearch(const T* base, int count, const T& target, size_t elemSize,
- int (*compare)(const T&, const T&))
+ int (*compare)(const T*, const T*))
{
SkASSERT(count >= 0);
if (count <= 0) {
@@ -63,14 +63,14 @@ int SkTSearch(const T* base, int count, const T& target, size_t elemSize,
int mid = (hi + lo) >> 1;
const T* elem = (const T*)((const char*)base + mid * elemSize);
- if ((*compare)(*elem, target) < 0)
+ if ((*compare)(elem, &target) < 0)
lo = mid + 1;
else
hi = mid;
}
const T* elem = (const T*)((const char*)base + hi * elemSize);
- int pred = (*compare)(*elem, target);
+ int pred = (*compare)(elem, &target);
if (pred != 0) {
if (pred < 0)
hi += 1;