Skip to content

Commit

Permalink
Fix compatibility with MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Nov 28, 2024
1 parent a0bb950 commit 3e68529
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/libusbmuxd.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ static char* stpncpy(char *dst, const char *src, size_t len)
}
#endif

#ifdef _MSC_VER
#define strcasecmp _stricmp
#endif

#include <plist/plist.h>

#define PLIST_LIBUSBMUX_VERSION 3
Expand Down
16 changes: 12 additions & 4 deletions tools/inetcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,32 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <fcntl.h>
#include <stddef.h>
#include <unistd.h>
#include <errno.h>
#include <getopt.h>

#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#else
#include <fcntl.h>
#include <unistd.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/ioctl.h>
#include <signal.h>
#endif

#include "usbmuxd.h"
#ifdef _MSC_VER
#include <basetsd.h>
typedef SSIZE_T ssize_t;
#define STDIN_FILENO _fileno(stdin)
#define STDOUT_FILENO _fileno(stdout)
#endif

#include <getopt.h>
#include <libimobiledevice-glue/socket.h>
#include "usbmuxd.h"

static int debug_level = 0;

Expand Down
8 changes: 5 additions & 3 deletions tools/iproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <stddef.h>
#include <unistd.h>
#include <errno.h>
#include <getopt.h>

#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
typedef unsigned int socklen_t;
#else
#include <fcntl.h>
#include <unistd.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <signal.h>
#endif

#include <getopt.h>
#include <libimobiledevice-glue/socket.h>
#include <libimobiledevice-glue/thread.h>
#include "usbmuxd.h"
Expand Down

0 comments on commit 3e68529

Please sign in to comment.