kernel/util: Fix MinMaxHeap::_GrowHeap()

This commit is contained in:
Pawel Dziepak 2013-10-24 00:59:58 +02:00
parent 7e1ecb9315
commit ed8627e535

View File

@ -335,8 +335,8 @@ MIN_MAX_HEAP_CLASS_NAME::_GrowHeap(int minimalSize)
fMinElements = newBuffer; fMinElements = newBuffer;
newBuffer += newSize / 2; newBuffer += newSize / 2;
if (fMaxElements != NULL) if (fMaxLastElement > 0)
memcpy(newBuffer, fMaxElements, fSize * sizeof(Element*)); memcpy(newBuffer, fMinElements + fSize, fSize * sizeof(Element*));
fMaxElements = newBuffer; fMaxElements = newBuffer;
fSize = newSize / 2; fSize = newSize / 2;
@ -426,7 +426,7 @@ MIN_MAX_HEAP_CLASS_NAME::_ChangeTree(MinMaxHeapLink<Element, Key>* link)
if (otherLastElement <= 0) { if (otherLastElement <= 0) {
ASSERT(currentLastElement == 1); ASSERT(currentLastElement == 1);
return true; return false;
} }
ASSERT((link->fIndex - 1) / 2 < otherLastElement); ASSERT((link->fIndex - 1) / 2 < otherLastElement);