Commit 34d17c9e authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

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

parent 6f358ef8
......@@ -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 {
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment