diff options
author | 2024-11-26 18:39:28 +0100 | |
---|---|---|
committer | 2024-11-28 17:32:39 +0100 | |
commit | 9bdf7fe983311e8c573d7c466c2006059645c4ba (patch) | |
tree | 293fe31fda5a98b03d83fe4fe6e821a4664264e6 /src/socket.c | |
parent | 7d3cc96077d859fcda6dfe2a6bd2b1eb589af66d (diff) | |
download | libimobiledevice-glue-9bdf7fe983311e8c573d7c466c2006059645c4ba.tar.gz libimobiledevice-glue-9bdf7fe983311e8c573d7c466c2006059645c4ba.tar.bz2 |
Fix compilation on MSVC
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/socket.c b/src/socket.c index b42d366..f09d3a5 100644 --- a/src/socket.c +++ b/src/socket.c @@ -26,10 +26,12 @@ #include <stddef.h> #include <stdlib.h> #include <string.h> -#include <unistd.h> #include <errno.h> +#ifndef _MSC_VER +#include <unistd.h> #include <sys/time.h> #include <sys/stat.h> +#endif #ifdef _WIN32 #include <winsock2.h> #include <ws2tcpip.h> @@ -154,8 +156,14 @@ enum poll_status poll_status_error }; +#ifdef _MSC_VER +#define ALWAYS_INLINE __forceinline +#else +#define ALWAYS_INLINE __attribute__((always_inline)) +#endif + #ifdef _WIN32 -static inline __attribute__((always_inline)) int WSAError_to_errno(int wsaerr) +static ALWAYS_INLINE int WSAError_to_errno(int wsaerr) { switch (wsaerr) { case WSAEINVAL: @@ -200,7 +208,7 @@ static inline __attribute__((always_inline)) int WSAError_to_errno(int wsaerr) #endif // timeout of -1 means infinity -static inline __attribute__((always_inline)) enum poll_status poll_wrapper(int fd, fd_mode mode, int timeout) +static ALWAYS_INLINE enum poll_status poll_wrapper(int fd, fd_mode mode, int timeout) { #ifdef HAVE_POLL // https://man7.org/linux/man-pages/man2/select.2.html |