From: Uwe Hermann Date: Sat, 1 Sep 2018 19:11:45 +0000 (+0200) Subject: Consistently use the _WIN32 #define. X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=00f0016cc361008cd9eb2e52fd2a01f333c0e3cd Consistently use the _WIN32 #define. 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 --- diff --git a/src/hardware/ipdbg-la/protocol.c b/src/hardware/ipdbg-la/protocol.c index 963a83ea..4c8f33b4 100644 --- a/src/hardware/ipdbg-la/protocol.c +++ b/src/hardware/ipdbg-la/protocol.c @@ -23,19 +23,15 @@ #define _WIN32_WINNT 0x0501 #include #include -#endif - -#include -#include - -#ifndef _WIN32 +#else #include #include #include #include #include #endif - +#include +#include #include #include "protocol.h" @@ -69,7 +65,7 @@ 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); diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index bd308472..50f83bd1 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -745,7 +745,7 @@ struct drv_context { /*--- 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. diff --git a/src/serial.c b/src/serial.c index aa8d4dde..3c7ab643 100644 --- a/src/serial.c +++ b/src/serial.c @@ -28,7 +28,7 @@ #include #include #include "libsigrok-internal.h" -#ifdef G_OS_WIN32 +#ifdef _WIN32 #include /* for HANDLE */ #endif @@ -788,7 +788,7 @@ SR_PRIV int sr_serial_extract_options(GSList *options, const char **serial_devic } /** @cond PRIVATE */ -#ifdef G_OS_WIN32 +#ifdef _WIN32 typedef HANDLE event_handle; #else typedef int event_handle; diff --git a/src/session.c b/src/session.c index fc7d0bc4..16fdfffa 100644 --- a/src/session.c +++ b/src/session.c @@ -1294,7 +1294,7 @@ SR_PRIV int sr_session_source_add_channel(struct sr_session *session, /* 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); diff --git a/src/usb.c b/src/usb.c index 8073f869..b453c04c 100644 --- a/src/usb.c +++ b/src/usb.c @@ -184,7 +184,7 @@ static LIBUSB_CALL void usb_pollfd_added(libusb_os_handle fd, return; pollfd = g_slice_new(GPollFD); -#ifdef G_OS_WIN32 +#ifdef _WIN32 events = G_IO_IN; #endif pollfd->fd = (gintptr)fd;