ntdll: qsort: comparator must not get the same pointer.

This commit is contained in:
Marcus Meissner 2010-05-23 13:33:40 +02:00 committed by Alexandre Julliard
parent 6f358ef867
commit 34d17c9ea1
2 changed files with 4 additions and 1 deletions

View File

@ -272,7 +272,7 @@ NTDLL_mergesort( void *arr, void *barr, int elemsize, int(__cdecl *compar)(const
for (k=left; k<=right; k++) {
/*arr[k]=(barr[i]<barr[j])?barr[i++]:barr[j--];*/
if (compar(X(barr,i),X(barr,j))<0) {
if (i != j && compar(X(barr,i),X(barr,j))<0) {
memcpy(X(arr,k),X(barr,i),elemsize);
i++;
} else {

View File

@ -1145,16 +1145,19 @@ static void test_wcsrchr(void)
static __cdecl int intcomparefunc(const void *a, const void*b)
{
ok (a != b, "must never get the same pointer\n");
return (*(int*)a) - (*(int*)b);
}
static __cdecl int charcomparefunc(const void *a, const void*b)
{
ok (a != b, "must never get the same pointer\n");
return (*(char*)a) - (*(char*)b);
}
static __cdecl int strcomparefunc(const void *a, const void*b)
{
ok (a != b, "must never get the same pointer\n");
return lstrcmpA(*(char**)a,*(char**)b);
}