Skip to content

Commit

Permalink
Fix compatibility with MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia authored and nikias committed Nov 29, 2024
1 parent 5d71858 commit c3ca555
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_CLIENT_VERSION_STRING PACKAGE_STRING
#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 c3ca555

Please sign in to comment.