From: Daniel Elstner Date: Thu, 10 Sep 2015 18:41:55 +0000 (+0200) Subject: serial: On Windows, include for HANDLE X-Git-Tag: libsigrok-0.4.0~313 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=041b579d530af4c9bbdb534d0c932c177f1b9014;p=libsigrok.git serial: On Windows, include for HANDLE --- diff --git a/src/serial.c b/src/serial.c index 25e2b97b..b0ae07f0 100644 --- a/src/serial.c +++ b/src/serial.c @@ -27,6 +27,9 @@ #include #include #include "libsigrok-internal.h" +#ifdef G_OS_WIN32 +#include /* for HANDLE */ +#endif /** @cond PRIVATE */ #define LOG_PREFIX "serial" @@ -784,7 +787,7 @@ SR_PRIV int sr_serial_extract_options(GSList *options, const char **serial_devic } /** @cond PRIVATE */ -#ifdef _WIN32 +#ifdef G_OS_WIN32 typedef HANDLE event_handle; #else typedef int event_handle; @@ -814,12 +817,12 @@ SR_PRIV int serial_source_add(struct sr_session *session, return SR_ERR; } - serial->pollfds = (GPollFD *) g_malloc0(sizeof(GPollFD) * serial->event_set->count); + serial->pollfds = g_new0(GPollFD, serial->event_set->count); for (i = 0; i < serial->event_set->count; i++) { - serial->pollfds[i].fd = ((event_handle *) serial->event_set->handles)[i]; - + serial->pollfds[i].fd = (gintptr) + ((event_handle *)serial->event_set->handles)[i]; mask = serial->event_set->masks[i]; if (mask & SP_EVENT_RX_READY)