From 3e68529a46e89b00b2657c9e8afef072e61a7b7a Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Thu, 28 Nov 2024 18:42:42 +0100 Subject: [PATCH] Fix compatibility with MSVC --- src/libusbmuxd.c | 4 ++++ tools/inetcat.c | 16 ++++++++++++---- tools/iproxy.c | 8 +++++--- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c index f0700ab..3dedaae 100644 --- a/src/libusbmuxd.c +++ b/src/libusbmuxd.c @@ -92,6 +92,10 @@ static char* stpncpy(char *dst, const char *src, size_t len) } #endif +#ifdef _MSC_VER +#define strcasecmp _stricmp +#endif + #include #define PLIST_LIBUSBMUX_VERSION 3 diff --git a/tools/inetcat.c b/tools/inetcat.c index 1d52341..5db9349 100644 --- a/tools/inetcat.c +++ b/tools/inetcat.c @@ -31,15 +31,15 @@ #include #include #include -#include #include -#include #include -#include + #ifdef _WIN32 #include #include #else +#include +#include #include #include #include @@ -47,8 +47,16 @@ #include #endif -#include "usbmuxd.h" +#ifdef _MSC_VER +#include +typedef SSIZE_T ssize_t; +#define STDIN_FILENO _fileno(stdin) +#define STDOUT_FILENO _fileno(stdout) +#endif + +#include #include +#include "usbmuxd.h" static int debug_level = 0; diff --git a/tools/iproxy.c b/tools/iproxy.c index 1a8e5b8..7427a54 100644 --- a/tools/iproxy.c +++ b/tools/iproxy.c @@ -32,20 +32,22 @@ #include #include #include -#include #include -#include #include -#include + #ifdef _WIN32 #include #include typedef unsigned int socklen_t; #else +#include +#include #include #include #include #endif + +#include #include #include #include "usbmuxd.h"