summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorРуслан Ижбулатов <lrn1986@gmail.com>2018-09-20 05:18:51 +0000
committerXavier Claessens <xavier.claessens@collabora.com>2018-10-10 13:51:06 -0400
commitb22f3bfa23335bb5fa0b98177f811c16934426ea (patch)
tree5f9b6fc138f06933cccfb7b44e941065188b6e05 /tests
parent12fe2cb7eadd91becb063ca2138c04f41311a6e2 (diff)
tests W32: Fix Windows values casting
LPARAM is LONG_PTR which is the same as INT_PTR on Windows. WPARAM is UINT_PTR. HWND is a pointer. (%p prints pointers without 0x prefix, hence the extra 0x).
Diffstat (limited to 'tests')
-rw-r--r--tests/gio-test.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/gio-test.c b/tests/gio-test.c
index c9523fba2..d9bd7e357 100644
--- a/tests/gio-test.c
+++ b/tests/gio-test.c
@@ -214,7 +214,7 @@ recv_windows_message (GIOChannel *channel,
{
GIOError error;
MSG msg;
- guint nb;
+ gsize nb;
while (1)
{
@@ -232,20 +232,25 @@ recv_windows_message (GIOChannel *channel,
break;
}
- g_print ("gio-test: ...Windows message for %#x: %d,%d,%d\n",
- msg.hwnd, msg.message, msg.wParam, msg.lParam);
+ g_print ("gio-test: ...Windows message for 0x%p: %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT "\n",
+ msg.hwnd, msg.message, msg.wParam, (gintptr)msg.lParam);
return TRUE;
}
+LRESULT CALLBACK window_procedure (HWND hwnd,
+ UINT message,
+ WPARAM wparam,
+ LPARAM lparam);
+
LRESULT CALLBACK
window_procedure (HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam)
{
- g_print ("gio-test: window_procedure for %#x: %d,%d,%d\n",
- hwnd, message, wparam, lparam);
+ g_print ("gio-test: window_procedure for 0x%p: %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT "\n",
+ hwnd, message, wparam, (gintptr)lparam);
return DefWindowProc (hwnd, message, wparam, lparam);
}
@@ -331,7 +336,7 @@ main (int argc,
nrunning++;
#ifdef G_OS_WIN32
- cmdline = g_strdup_printf ("%d:%d:%d",
+ cmdline = g_strdup_printf ("%d:%d:0x%p",
pipe_to_sub[0],
pipe_from_sub[1],
hwnd);
@@ -388,7 +393,7 @@ main (int argc,
sscanf (argv[2], "%d:%d%n", &readfd, &writefd, &n);
#ifdef G_OS_WIN32
- sscanf (argv[2] + n, ":%d", &hwnd);
+ sscanf (argv[2] + n, ":0x%p", &hwnd);
#endif
srand (tv.tv_sec ^ (tv.tv_usec / 1000) ^ readfd ^ (writefd << 4));
@@ -413,8 +418,8 @@ main (int argc,
int msg = WM_USER + (rand() % 100);
WPARAM wparam = rand ();
LPARAM lparam = rand ();
- g_print ("gio-test: child posting message %d,%d,%d to %#x\n",
- msg, wparam, lparam, hwnd);
+ g_print ("gio-test: child posting message %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT " to 0x%p\n",
+ msg, wparam, (gintptr)lparam, hwnd);
PostMessage (hwnd, msg, wparam, lparam);
}
#endif