The _WIN32 variant is available pretty much on all compilers, others
might not be. G_OS_WIN32 would probably be an equally well-suited
alternative, but for now we standardize on _WIN32.
http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system#WindowswithCygwinPOSIX
#define _WIN32_WINNT 0x0501
#include <winsock2.h>
#include <ws2tcpip.h>
-#endif
-
-#include <string.h>
-#include <unistd.h>
-
-#ifndef _WIN32
+#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/ioctl.h>
#endif
-
+#include <string.h>
+#include <unistd.h>
#include <errno.h>
#include "protocol.h"
static gboolean data_available(struct ipdbg_la_tcp *tcp)
{
-#ifdef __WIN32__
+#ifdef _WIN32
u_long bytes_available;
ioctlsocket(tcp->socket, FIONREAD, &bytes_available);
return (bytes_available > 0);
/*--- log.c -----------------------------------------------------------------*/
-#if defined(G_OS_WIN32) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+#if defined(_WIN32) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
/*
* On MinGW, we need to specify the gnu_printf format flavor or GCC
* will assume non-standard Microsoft printf syntax.
#include <libserialport.h>
#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"
-#ifdef G_OS_WIN32
+#ifdef _WIN32
#include <windows.h> /* for HANDLE */
#endif
}
/** @cond PRIVATE */
-#ifdef G_OS_WIN32
+#ifdef _WIN32
typedef HANDLE event_handle;
#else
typedef int event_handle;
/* We should be using g_io_create_watch(), but can't without
* changing the driver API, as the callback signature is different.
*/
-#ifdef G_OS_WIN32
+#ifdef _WIN32
g_io_channel_win32_make_pollfd(channel, events, &pollfd);
#else
pollfd.fd = g_io_channel_unix_get_fd(channel);
return;
pollfd = g_slice_new(GPollFD);
-#ifdef G_OS_WIN32
+#ifdef _WIN32
events = G_IO_IN;
#endif
pollfd->fd = (gintptr)fd;