ntdll/tests: Avoid casting away const in comparison functions.

This commit is contained in:
Andrew Nguyen 2011-02-01 04:40:44 -06:00 committed by Alexandre Julliard
parent 39eb51f978
commit f7385699a9
1 changed files with 19 additions and 9 deletions

View File

@ -1143,22 +1143,32 @@ static void test_wcsrchr(void)
"wcsrchr should have returned NULL\n"); "wcsrchr should have returned NULL\n");
} }
static __cdecl int intcomparefunc(const void *a, const void*b) static __cdecl int intcomparefunc(const void *a, const void *b)
{ {
const int *p = a, *q = b;
ok (a != b, "must never get the same pointer\n"); ok (a != b, "must never get the same pointer\n");
return (*(int*)a) - (*(int*)b);
return *p - *q;
} }
static __cdecl int charcomparefunc(const void *a, const void*b) static __cdecl int charcomparefunc(const void *a, const void *b)
{ {
const char *p = a, *q = b;
ok (a != b, "must never get the same pointer\n"); ok (a != b, "must never get the same pointer\n");
return (*(char*)a) - (*(char*)b);
return *p - *q;
} }
static __cdecl int strcomparefunc(const void *a, const void*b) static __cdecl int strcomparefunc(const void *a, const void *b)
{ {
const char * const *p = a;
const char * const *q = b;
ok (a != b, "must never get the same pointer\n"); ok (a != b, "must never get the same pointer\n");
return lstrcmpA(*(char**)a,*(char**)b);
return lstrcmpA(*p, *q);
} }
static void test_qsort(void) static void test_qsort(void)