[cogl/cogl.windows.fixes: 7/8] cogl-crate.c: Fix running on 64-bit Windows
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/cogl.windows.fixes: 7/8] cogl-crate.c: Fix running on 64-bit Windows
- Date: Wed, 13 Feb 2019 10:34:07 +0000 (UTC)
commit f99994e59ae69c2d130eb34ff57cd63139b4283c
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Tue Feb 12 12:39:31 2019 +0800
cogl-crate.c: Fix running on 64-bit Windows
CoglPollFD uses an int type for its fd member but the GPollFD that
g_poll() expects uses a gint64 type (a.k.a int64_t, __in64 on Windows)
for its fd member on 64-bit Windows, which will cause loads of
"WaitForMultipleObjectsEx failed:..." to be spewed from GLib on 64-bit
Windows.
This updates the example to use the correct types for the g_poll() call,
which will avoid this kind of situation.
examples/cogl-crate.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/examples/cogl-crate.c b/examples/cogl-crate.c
index d04e3085..7b5256f0 100644
--- a/examples/cogl-crate.c
+++ b/examples/cogl-crate.c
@@ -276,6 +276,7 @@ main (int argc, char **argv)
while (1)
{
CoglPollFD *poll_fds;
+ GPollFD gpoll_fds;
int n_poll_fds;
int64_t timeout;
@@ -288,9 +289,18 @@ main (int argc, char **argv)
cogl_poll_renderer_get_info (cogl_context_get_renderer (ctx),
&poll_fds, &n_poll_fds, &timeout);
- g_poll ((GPollFD *) poll_fds, n_poll_fds,
+#if !defined G_OS_WIN32 || (GLIB_SIZEOF_VOID_P == 4)
+ gpoll_fds.fd = (int) poll_fds->fd;
+#else
+ gpoll_fds.fd = (int64_t) poll_fds->fd;
+#endif
+ gpoll_fds.events = poll_fds->events;
+ gpoll_fds.revents = poll_fds->revents;
+
+ g_poll (&gpoll_fds, n_poll_fds,
timeout == -1 ? -1 : timeout / 1000);
+
cogl_poll_renderer_dispatch (cogl_context_get_renderer (ctx),
poll_fds, n_poll_fds);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]