Commit f7385699 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

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

parent 39eb51f9
...@@ -1143,22 +1143,32 @@ static void test_wcsrchr(void) ...@@ -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)
{ {
ok (a != b, "must never get the same pointer\n"); const int *p = a, *q = b;
return (*(int*)a) - (*(int*)b);
ok (a != b, "must never get the same pointer\n");
return *p - *q;
} }
static __cdecl int charcomparefunc(const void *a, const void*b) static __cdecl int charcomparefunc(const void *a, const void *b)
{ {
ok (a != b, "must never get the same pointer\n"); const char *p = a, *q = b;
return (*(char*)a) - (*(char*)b);
ok (a != b, "must never get the same pointer\n");
return *p - *q;
} }
static __cdecl int strcomparefunc(const void *a, const void*b) static __cdecl int strcomparefunc(const void *a, const void *b)
{ {
ok (a != b, "must never get the same pointer\n"); const char * const *p = a;
return lstrcmpA(*(char**)a,*(char**)b); const char * const *q = b;
ok (a != b, "must never get the same pointer\n");
return lstrcmpA(*p, *q);
} }
static void test_qsort(void) static void test_qsort(void)
......
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