diff options
author | janwillem32 <janwillem32@users.sourceforge.net> | 2012-05-15 01:18:03 +0400 |
---|---|---|
committer | janwillem32 <janwillem32@users.sourceforge.net> | 2012-05-15 01:18:03 +0400 |
commit | 015251270c1f7290125b40c8f4e11eba2a5fd223 (patch) | |
tree | 7dffa441a5f133bd74a838b6da3496088b7268c6 /src/DSUtil/DSMPropertyBag.h | |
parent | 9bb6085fa7366d77b637ffd837a94ebf15145a13 (diff) |
DSMPropertyBag.h: change integers to pointer size integers, as CAtlArray outputs them that way, and there's pointer logic done with these.
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@4731 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/DSUtil/DSMPropertyBag.h')
-rw-r--r-- | src/DSUtil/DSMPropertyBag.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/DSUtil/DSMPropertyBag.h b/src/DSUtil/DSMPropertyBag.h index 1600cb168..3a6e5c825 100644 --- a/src/DSUtil/DSMPropertyBag.h +++ b/src/DSUtil/DSMPropertyBag.h @@ -184,31 +184,31 @@ public: };
template<class T>
-int range_bsearch(const CAtlArray<T>& array, REFERENCE_TIME rt)
+ptrdiff_t range_bsearch(CAtlArray<T> const &tArray, REFERENCE_TIME rt)
{
- int i = 0, j = array.GetCount() - 1, ret = -1;
- if (j >= 0 && rt >= array[j].rt) {
+ ptrdiff_t i = 0, j = tArray.GetCount() - 1, ret = -1;
+ if (j >= 0 && rt >= tArray[j].rt) {
return j;
}
while (i < j) {
- int mid = (i + j) >> 1;
- REFERENCE_TIME midrt = array[mid].rt;
+ size_t mid = static_cast<size_t>(i + j) >> 1;
+ REFERENCE_TIME midrt = tArray[mid].rt;
if (rt == midrt) {
ret = mid;
break;
} else if (rt < midrt) {
ret = -1;
if (j == mid) {
- mid--;
+ --mid;
}
j = mid;
} else if (rt > midrt) {
ret = mid;
if (i == mid) {
- mid++;
+ ++mid;
}
i = mid;
}
}
- return ret;
+ return ret;// in general, the return is unsigned, only when tArray is empty, the return will be -1 for status invalid
}
|