#include <libserialport.h>
#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"
+#ifdef G_OS_WIN32
+#include <windows.h> /* for HANDLE */
+#endif
/** @cond PRIVATE */
#define LOG_PREFIX "serial"
}
/** @cond PRIVATE */
-#ifdef _WIN32
+#ifdef G_OS_WIN32
typedef HANDLE event_handle;
#else
typedef int event_handle;
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)