fix overflow in qsort compare proc

git-svn-id: http://skia.googlecode.com/svn/trunk@335 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-08-25 18:14:50 +00:00
parent 0da41dbf5b
commit 593847a0e0

View File

@ -383,7 +383,11 @@ extern "C" {
valuea = edgea->fX; valuea = edgea->fX;
valueb = edgeb->fX; valueb = edgeb->fX;
} }
return valuea - valueb;
// this overflows if valuea >>> valueb or vice-versa
// return valuea - valueb;
// do perform the slower but safe compares
return (valuea < valueb) ? -1 : (valuea > valueb);
} }
} }