Commit bb7de132 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32/tests: Fix pointer casting warnings on 64-bit.

parent d8e11632
......@@ -77,7 +77,7 @@ static BOOL unicode_OS;
static void test_add_atom(void)
{
ATOM atom, w_atom;
int i;
INT_PTR i;
SetLastError( 0xdeadbeef );
atom = GlobalAddAtomA( "foobar" );
......@@ -129,20 +129,20 @@ static void test_add_atom(void)
{
SetLastError( 0xdeadbeef );
ok( GlobalAddAtomA((LPCSTR)i) == i && GetLastError() == 0xdeadbeef,
"failed to add atom %x\n", i );
"failed to add atom %lx\n", i );
if (unicode_OS)
{
SetLastError( 0xdeadbeef );
ok( GlobalAddAtomW((LPCWSTR)i) == i && GetLastError() == 0xdeadbeef,
"failed to add atom %x\n", i );
"failed to add atom %lx\n", i );
}
}
for (i = 0xc000; i <= 0xffff; i++)
{
ok( !GlobalAddAtomA((LPCSTR)i), "succeeded adding %x\n", i );
ok( !GlobalAddAtomA((LPCSTR)i), "succeeded adding %lx\n", i );
if (unicode_OS)
ok( !GlobalAddAtomW((LPCWSTR)i), "succeeded adding %x\n", i );
ok( !GlobalAddAtomW((LPCWSTR)i), "succeeded adding %lx\n", i );
}
}
......@@ -349,7 +349,7 @@ static void test_error_handling(void)
static void test_local_add_atom(void)
{
ATOM atom, w_atom;
int i;
INT_PTR i;
SetLastError( 0xdeadbeef );
atom = AddAtomA( "foobar" );
......@@ -401,20 +401,20 @@ static void test_local_add_atom(void)
{
SetLastError( 0xdeadbeef );
ok( AddAtomA((LPCSTR)i) == i && GetLastError() == 0xdeadbeef,
"failed to add atom %x\n", i );
"failed to add atom %lx\n", i );
if (unicode_OS)
{
SetLastError( 0xdeadbeef );
ok( AddAtomW((LPCWSTR)i) == i && GetLastError() == 0xdeadbeef,
"failed to add atom %x\n", i );
"failed to add atom %lx\n", i );
}
}
for (i = 0xc000; i <= 0xffff; i++)
{
ok( !AddAtomA((LPCSTR)i), "succeeded adding %x\n", i );
ok( !AddAtomA((LPCSTR)i), "succeeded adding %lx\n", i );
if (unicode_OS)
ok( !AddAtomW((LPCWSTR)i), "succeeded adding %x\n", i );
ok( !AddAtomW((LPCWSTR)i), "succeeded adding %lx\n", i );
}
}
......
......@@ -1161,15 +1161,14 @@ static void test_WaitRx(HANDLE hcom)
*/
static DWORD CALLBACK toggle_ctlLine(LPVOID arg)
{
DWORD *args = (DWORD *) arg;
DWORD_PTR *args = (DWORD_PTR *) arg;
DWORD timeout = args[0];
DWORD ctl = args[1];
HANDLE hcom = (HANDLE) args[2];
HANDLE hComPortEvent = (HANDLE) args[3];
DWORD success, err;
trace("toggle_ctlLine timeout %d clt 0x%08x handle 0x%08x\n",
args[0], args[1], args[2]);
trace("toggle_ctlLine timeout %d ctl 0x%08x handle %p\n", timeout, ctl, hcom );
Sleep(timeout);
ok(EscapeCommFunction(hcom, ctl),"EscapeCommFunction 0x%08x failed\n", ctl);
trace("toggle_ctline done\n");
......@@ -1190,8 +1189,8 @@ static void test_WaitCts(HANDLE hcom)
OVERLAPPED overlapped;
HANDLE hComPortEvent;
HANDLE alarmThread;
DWORD args[4], defaultStat = 0;
DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
DWORD_PTR args[4];
DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0, defaultStat = 0;
ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
dcb.fRtsControl=RTS_CONTROL_ENABLE;
......@@ -1208,15 +1207,15 @@ static void test_WaitCts(HANDLE hcom)
args[1] = CLRRTS;
else
args[1] = SETRTS;
args[2]=(DWORD) hcom;
args[2]=(DWORD_PTR)hcom;
trace("test_WaitCts timeout %d clt 0x%08x handle 0x%08x\n",args[0], args[1], args[2]);
trace("test_WaitCts timeout %ld clt 0x%08lx handle %p\n",args[0], args[1], hcom);
ok(SetCommMask(hcom, EV_CTS), "SetCommMask failed\n");
hComPortEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
ok(hComPortEvent != 0, "CreateEvent failed\n");
args[3] = (DWORD) hComPortEvent;
alarmThread = CreateThread(NULL, 0, toggle_ctlLine, (void *) &args, 0, &alarmThreadId);
args[3] = (DWORD_PTR)hComPortEvent;
alarmThread = CreateThread(NULL, 0, toggle_ctlLine, args, 0, &alarmThreadId);
/* Wait a minimum to let the thread start up */
Sleep(10);
trace("Thread created\n");
......@@ -1265,7 +1264,7 @@ static void test_WaitCts(HANDLE hcom)
*/
static DWORD CALLBACK reset_CommMask(LPVOID arg)
{
DWORD *args = (DWORD *) arg;
DWORD_PTR *args = (DWORD_PTR *) arg;
DWORD timeout = args[0];
HANDLE hcom = (HANDLE) args[1];
......@@ -1287,7 +1286,7 @@ static void test_AbortWaitCts(HANDLE hcom)
OVERLAPPED overlapped;
HANDLE hComPortEvent;
HANDLE alarmThread;
DWORD args[2];
DWORD_PTR args[2];
DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
......@@ -1297,14 +1296,14 @@ static void test_AbortWaitCts(HANDLE hcom)
return;
}
args[0]= TIMEOUT >>1;
args[1]=(DWORD) hcom;
args[1]= (DWORD_PTR)hcom;
trace("test_AbortWaitCts timeout %d handle 0x%08x\n",args[0], args[1]);
trace("test_AbortWaitCts timeout %ld handle %p\n",args[0], hcom);
ok(SetCommMask(hcom, EV_CTS), "SetCommMask failed\n");
hComPortEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
ok(hComPortEvent != 0, "CreateEvent failed\n");
alarmThread = CreateThread(NULL, 0, reset_CommMask, (void *) &args, 0, &alarmThreadId);
alarmThread = CreateThread(NULL, 0, reset_CommMask, args, 0, &alarmThreadId);
/* Wait a minimum to let the thread start up */
Sleep(10);
trace("Thread created\n");
......@@ -1348,8 +1347,8 @@ static void test_WaitDsr(HANDLE hcom)
OVERLAPPED overlapped;
HANDLE hComPortEvent;
HANDLE alarmThread;
DWORD args[3], defaultStat = 0;
DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
DWORD_PTR args[3];
DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0, defaultStat = 0;
ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
if (dcb.fDtrControl == DTR_CONTROL_DISABLE)
......@@ -1363,14 +1362,14 @@ static void test_WaitDsr(HANDLE hcom)
args[1] = CLRDTR;
else
args[1] = SETDTR;
args[2]=(DWORD) hcom;
args[2]= (DWORD_PTR)hcom;
trace("test_WaitDsr timeout %d clt 0x%08x handle 0x%08x\n",args[0], args[1], args[2]);
trace("test_WaitDsr timeout %ld clt 0x%08lx handle %p\n",args[0], args[1], hcom);
ok(SetCommMask(hcom, EV_DSR), "SetCommMask failed\n");
hComPortEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
ok(hComPortEvent != 0, "CreateEvent failed\n");
alarmThread = CreateThread(NULL, 0, toggle_ctlLine, (void *) &args, 0, &alarmThreadId);
alarmThread = CreateThread(NULL, 0, toggle_ctlLine, args, 0, &alarmThreadId);
ok(alarmThread !=0 , "CreateThread Failed\n");
ZeroMemory( &overlapped, sizeof(overlapped));
......@@ -1421,8 +1420,8 @@ static void test_WaitRing(HANDLE hcom)
OVERLAPPED overlapped;
HANDLE hComPortEvent;
HANDLE alarmThread;
DWORD args[3], defaultStat;
DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
DWORD_PTR args[3];
DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0, defaultStat;
BOOL ret;
ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
......@@ -1441,14 +1440,14 @@ static void test_WaitRing(HANDLE hcom)
args[1] = CLRDTR;
else
args[1] = SETDTR;
args[2]=(DWORD) hcom;
args[2]=(DWORD_PTR) hcom;
trace("test_WaitRing timeout %d clt 0x%08x handle 0x%08x\n",args[0], args[1], args[2]);
trace("test_WaitRing timeout %ld clt 0x%08lx handle %p\n",args[0], args[1], hcom);
ok(SetCommMask(hcom, EV_RING), "SetCommMask failed\n");
hComPortEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
ok(hComPortEvent != 0, "CreateEvent failed\n");
alarmThread = CreateThread(NULL, 0, toggle_ctlLine, (void *) &args, 0, &alarmThreadId);
alarmThread = CreateThread(NULL, 0, toggle_ctlLine, args, 0, &alarmThreadId);
ok(alarmThread !=0 , "CreateThread Failed\n");
ZeroMemory( &overlapped, sizeof(overlapped));
......@@ -1498,8 +1497,8 @@ static void test_WaitDcd(HANDLE hcom)
OVERLAPPED overlapped;
HANDLE hComPortEvent;
HANDLE alarmThread;
DWORD args[3], defaultStat = 0;
DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
DWORD_PTR args[3];
DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0, defaultStat = 0;
ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
if (dcb.fDtrControl == DTR_CONTROL_DISABLE)
......@@ -1513,14 +1512,14 @@ static void test_WaitDcd(HANDLE hcom)
args[1] = CLRDTR;
else
args[1] = SETDTR;
args[2]=(DWORD) hcom;
args[2]= (DWORD_PTR)hcom;
trace("test_WaitDcd timeout %d clt 0x%08x handle 0x%08x\n",args[0], args[1], args[2]);
trace("test_WaitDcd timeout %ld clt 0x%08lx handle %p\n",args[0], args[1], hcom);
ok(SetCommMask(hcom, EV_RLSD), "SetCommMask failed\n");
hComPortEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
ok(hComPortEvent != 0, "CreateEvent failed\n");
alarmThread = CreateThread(NULL, 0, toggle_ctlLine, (void *) &args, 0, &alarmThreadId);
alarmThread = CreateThread(NULL, 0, toggle_ctlLine, args, 0, &alarmThreadId);
ok(alarmThread !=0 , "CreateThread Failed\n");
ZeroMemory( &overlapped, sizeof(overlapped));
......@@ -1566,7 +1565,7 @@ static void test_WaitDcd(HANDLE hcom)
*/
static DWORD CALLBACK set_CommBreak(LPVOID arg)
{
DWORD *args = (DWORD *) arg;
DWORD_PTR *args = (DWORD_PTR *) arg;
DWORD timeout = args[0];
HANDLE hcom = (HANDLE) args[1];
......@@ -1587,7 +1586,7 @@ static void test_WaitBreak(HANDLE hcom)
OVERLAPPED overlapped;
HANDLE hComPortEvent;
HANDLE alarmThread;
DWORD args[2];
DWORD_PTR args[2];
DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
ok(SetCommMask(hcom, EV_BREAK), "SetCommMask failed\n");
......@@ -1596,8 +1595,8 @@ static void test_WaitBreak(HANDLE hcom)
trace("test_WaitBreak\n");
args[0]= TIMEOUT >>1;
args[1]=(DWORD) hcom;
alarmThread = CreateThread(NULL, 0, set_CommBreak, (void *) &args, 0, &alarmThreadId);
args[1]= (DWORD_PTR)hcom;
alarmThread = CreateThread(NULL, 0, set_CommBreak, args, 0, &alarmThreadId);
/* Wait a minimum to let the thread start up */
Sleep(10);
trace("Thread created\n");
......
......@@ -147,7 +147,7 @@ static void doDebugger(int argc, char** argv)
else
blackbox.attach_rc=TRUE;
debug_event=(argc >= 6 ? (HANDLE)atol(argv[5]) : NULL);
debug_event=(argc >= 6 ? (HANDLE)(INT_PTR)atol(argv[5]) : NULL);
blackbox.debug_err=0;
if (debug_event && strstr(myARGV[2], "event"))
{
......
......@@ -389,7 +389,7 @@ static void test_CreateNamedPipe_instances_must_match(void)
/** implementation of alarm() */
static DWORD CALLBACK alarmThreadMain(LPVOID arg)
{
DWORD timeout = (DWORD) arg;
DWORD_PTR timeout = (DWORD_PTR) arg;
trace("alarmThreadMain\n");
if (WaitForSingleObject( alarm_event, timeout ) == WAIT_TIMEOUT)
{
......
......@@ -597,7 +597,7 @@ static void CALLBACK timer_queue_cb4(PVOID p, BOOLEAN timedOut)
static void CALLBACK timer_queue_cb5(PVOID p, BOOLEAN timedOut)
{
DWORD delay = (DWORD) p;
DWORD_PTR delay = (DWORD_PTR) p;
ok(timedOut, "Timer callbacks should always time out\n");
if (delay)
Sleep(delay);
......
......@@ -187,7 +187,7 @@ static DWORD WINAPI threadFunc1(LPVOID p)
int i;
/* write our thread # into shared memory */
tstruct->threadmem[tstruct->threadnum]=GetCurrentThreadId();
ok(TlsSetValue(tlsIndex,(LPVOID)(tstruct->threadnum+1))!=0,
ok(TlsSetValue(tlsIndex,(LPVOID)(INT_PTR)(tstruct->threadnum+1))!=0,
"TlsSetValue failed\n");
/* The threads synchronize before terminating. This is done by
Signaling an event, and waiting for all events to occur
......@@ -205,7 +205,7 @@ static DWORD WINAPI threadFunc1(LPVOID p)
ok( lstrlenA( (char *)0xdeadbeef ) == 0, "lstrlenA: unexpected success\n" );
/* Check that no one changed our tls memory */
ok((int)TlsGetValue(tlsIndex)-1==tstruct->threadnum,
ok((INT_PTR)TlsGetValue(tlsIndex)-1==tstruct->threadnum,
"TlsGetValue failed\n");
return NUM_THREADS+tstruct->threadnum;
}
......@@ -929,7 +929,7 @@ static DWORD CALLBACK work_function(void *p)
static void test_QueueUserWorkItem(void)
{
int i;
INT_PTR i;
DWORD wait_result;
DWORD before, after;
......@@ -1046,7 +1046,7 @@ static DWORD WINAPI TLS_InheritanceProc(LPVOID p)
inheritance with TLS_InheritanceProc. */
static DWORD WINAPI TLS_ThreadProc(LPVOID p)
{
LONG id = (LONG) p;
LONG_PTR id = (LONG_PTR) p;
LPVOID val;
BOOL ret;
......@@ -1166,7 +1166,7 @@ static DWORD WINAPI TLS_ThreadProc(LPVOID p)
static void test_TLS(void)
{
HANDLE threads[2];
LONG i;
LONG_PTR i;
DWORD ret;
BOOL suc;
......
......@@ -73,8 +73,8 @@ static int init(void)
case 2: /* the test program */
return 0;
case 4: /* the sub-process */
ev1 = (HANDLE)atoi(argv[2]);
ev2 = (HANDLE)atoi(argv[3]);
ev1 = (HANDLE)(INT_PTR)atoi(argv[2]);
ev2 = (HANDLE)(INT_PTR)atoi(argv[3]);
ev3 = CreateEvent(NULL, FALSE, FALSE, NULL);
if (ev3 == NULL) ExitProcess(WAIT_ABANDONED);
......@@ -324,7 +324,7 @@ START_TEST(toolhelp)
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = SW_SHOWNORMAL;
sprintf(buffer, "%s tests/toolhelp.c %u %u", selfname, (DWORD)ev1, (DWORD)ev2);
sprintf(buffer, "%s tests/toolhelp.c %lu %lu", selfname, (DWORD_PTR)ev1, (DWORD_PTR)ev2);
ok(CreateProcessA(NULL, buffer, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &info), "CreateProcess\n");
/* wait for child to be initialized */
w = WaitForSingleObject(ev1, WAIT_TIME);
......
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