ntdll: qsort: comparator must not get the same pointer.
This commit is contained in:
parent
6f358ef867
commit
34d17c9ea1
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue