vcpkg/ports/libimobiledevice/001_fix_msvc.patch

328 lines
7.2 KiB
Diff

diff --git a/common/userpref.c b/common/userpref.c
index b64c703..7ff325c 100644
--- a/common/userpref.c
+++ b/common/userpref.c
@@ -35,7 +35,9 @@
#ifndef WIN32
#include <pwd.h>
#endif
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <usbmuxd.h>
#if defined(HAVE_OPENSSL)
#include <openssl/bn.h>
@@ -65,7 +67,9 @@
#endif
#include <dirent.h>
+#ifndef _MSC_VER
#include <libgen.h>
+#endif
#include <sys/stat.h>
#include <errno.h>
diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h
index 6851145..55ef753 100644
--- a/include/libimobiledevice/libimobiledevice.h
+++ b/include/libimobiledevice/libimobiledevice.h
@@ -30,6 +30,11 @@
extern "C" {
#endif
+#if defined(_MSC_VER)
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#endif
+
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/src/afc.c b/src/afc.c
index d8c3db0..ab2c4ff 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -26,7 +26,9 @@
#endif
#include <stdio.h>
#include <stdlib.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <string.h>
#include "afc.h"
diff --git a/src/house_arrest.c b/src/house_arrest.c
index ac92130..e12bde5 100644
--- a/src/house_arrest.c
+++ b/src/house_arrest.c
@@ -24,7 +24,9 @@
#endif
#include <string.h>
#include <stdlib.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <plist/plist.h>
#include "house_arrest.h"
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index 9602876..2f02514 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -26,7 +26,9 @@
#include <string.h>
#include <stdlib.h>
#include <inttypes.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <plist/plist.h>
#include "installation_proxy.h"
diff --git a/src/lockdown-cu.c b/src/lockdown-cu.c
index d8d7f42..eb11afa 100644
--- a/src/lockdown-cu.c
+++ b/src/lockdown-cu.c
@@ -29,7 +29,9 @@
#define __USE_GNU 1
#include <stdio.h>
#include <ctype.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <plist/plist.h>
#include "idevice.h"
diff --git a/src/lockdown.c b/src/lockdown.c
index 92af186..a9b9b88 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -32,7 +32,9 @@
#define __USE_GNU 1
#include <stdio.h>
#include <ctype.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <plist/plist.h>
#include <libimobiledevice-glue/utils.h>
diff --git a/src/misagent.c b/src/misagent.c
index af925f9..5fe618e 100644
--- a/src/misagent.c
+++ b/src/misagent.c
@@ -24,7 +24,9 @@
#endif
#include <string.h>
#include <stdlib.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <plist/plist.h>
#include <stdio.h>
diff --git a/src/mobile_image_mounter.c b/src/mobile_image_mounter.c
index 9ccfd85..c4f540c 100644
--- a/src/mobile_image_mounter.c
+++ b/src/mobile_image_mounter.c
@@ -24,7 +24,9 @@
#endif
#include <string.h>
#include <stdlib.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <plist/plist.h>
#include "mobile_image_mounter.h"
diff --git a/src/notification_proxy.c b/src/notification_proxy.c
index e17e2fe..679739c 100644
--- a/src/notification_proxy.c
+++ b/src/notification_proxy.c
@@ -24,7 +24,9 @@
#endif
#include <string.h>
#include <stdlib.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <plist/plist.h>
#include "notification_proxy.h"
diff --git a/src/sbservices.c b/src/sbservices.c
index ccb7c4b..f0b832e 100644
--- a/src/sbservices.c
+++ b/src/sbservices.c
@@ -24,7 +24,9 @@
#endif
#include <string.h>
#include <stdlib.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <plist/plist.h>
#include "sbservices.h"
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index 5694c12..d360cd3 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -50,7 +50,9 @@
#else
#error No supported crypto library enabled
#endif
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <ctype.h>
#include <time.h>
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index c73b269..ffb35d1 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -31,9 +31,13 @@
#include <errno.h>
#include <stdlib.h>
#include <signal.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <dirent.h>
+#ifndef _MSC_VER
#include <libgen.h>
+#endif
#include <ctype.h>
#include <time.h>
#include <getopt.h>
diff --git a/tools/idevicebtlogger.c b/tools/idevicebtlogger.c
index 8de6b22..8fbf40d 100644
--- a/tools/idevicebtlogger.c
+++ b/tools/idevicebtlogger.c
@@ -31,7 +31,9 @@
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <getopt.h>
#include <assert.h>
#include <fcntl.h>
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c
index 09bd537..f75ad9d 100644
--- a/tools/idevicecrashreport.c
+++ b/tools/idevicecrashreport.c
@@ -29,7 +29,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <getopt.h>
#ifndef WIN32
#include <signal.h>
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index 36c594e..9c11781 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -30,8 +30,12 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
+#ifndef _MSC_VER
#include <libgen.h>
+#endif
#include <getopt.h>
#ifdef WIN32
diff --git a/tools/idevicedevmodectl.c b/tools/idevicedevmodectl.c
index ba9b935..8e28e4b 100644
--- a/tools/idevicedevmodectl.c
+++ b/tools/idevicedevmodectl.c
@@ -30,7 +30,9 @@
#include <string.h>
#include <getopt.h>
#include <sys/stat.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <errno.h>
#ifndef WIN32
#include <signal.h>
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c
index f551b6c..fe9e1c1 100644
--- a/tools/ideviceimagemounter.c
+++ b/tools/ideviceimagemounter.c
@@ -32,7 +32,9 @@
#include <string.h>
#include <getopt.h>
#include <errno.h>
+#ifndef _MSC_VER
#include <libgen.h>
+#endif
#include <time.h>
#include <sys/time.h>
#include <inttypes.h>
diff --git a/tools/idevicename.c b/tools/idevicename.c
index 69b76f6..cb8c9a6 100644
--- a/tools/idevicename.c
+++ b/tools/idevicename.c
@@ -27,7 +27,9 @@
#include <stdio.h>
#include <string.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <getopt.h>
#ifndef WIN32
diff --git a/tools/idevicepair.c b/tools/idevicepair.c
index 94d3f04..129c409 100644
--- a/tools/idevicepair.c
+++ b/tools/idevicepair.c
@@ -31,7 +31,9 @@
#include <stdlib.h>
#include <getopt.h>
#include <ctype.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#ifdef WIN32
#include <windows.h>
#include <conio.h>
diff --git a/tools/idevicescreenshot.c b/tools/idevicescreenshot.c
index 0e694c7..a4ca37d 100644
--- a/tools/idevicescreenshot.c
+++ b/tools/idevicescreenshot.c
@@ -31,7 +31,9 @@
#include <getopt.h>
#include <errno.h>
#include <time.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#ifndef WIN32
#include <signal.h>
#endif
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c
index 5600be2..69b7b03 100644
--- a/tools/idevicesyslog.c
+++ b/tools/idevicesyslog.c
@@ -31,7 +31,9 @@
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <getopt.h>
#ifdef WIN32