summaryrefslogtreecommitdiffstats
path: root/tools/idevicebackup2.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevicebackup2.c')
-rw-r--r--tools/idevicebackup2.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index 19d21a6..804f9f4 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -54,7 +54,7 @@
54#define LOCK_ATTEMPTS 50 54#define LOCK_ATTEMPTS 50
55#define LOCK_WAIT 200000 55#define LOCK_WAIT 200000
56 56
57#ifdef WIN32 57#ifdef _WIN32
58#include <windows.h> 58#include <windows.h>
59#include <conio.h> 59#include <conio.h>
60#define sleep(x) Sleep(x*1000) 60#define sleep(x) Sleep(x*1000)
@@ -178,7 +178,7 @@ static void mobilebackup_afc_get_file_contents(afc_client_t afc, const char *fil
178 178
179static int __mkdir(const char* path, int mode) 179static int __mkdir(const char* path, int mode)
180{ 180{
181#ifdef WIN32 181#ifdef _WIN32
182 return mkdir(path); 182 return mkdir(path);
183#else 183#else
184 return mkdir(path, mode); 184 return mkdir(path, mode);
@@ -207,7 +207,7 @@ static int mkdir_with_parents(const char *dir, int mode)
207 return res; 207 return res;
208} 208}
209 209
210#ifdef WIN32 210#ifdef _WIN32
211static int win32err_to_errno(int err_value) 211static int win32err_to_errno(int err_value)
212{ 212{
213 switch (err_value) { 213 switch (err_value) {
@@ -224,7 +224,7 @@ static int win32err_to_errno(int err_value)
224static int remove_file(const char* path) 224static int remove_file(const char* path)
225{ 225{
226 int e = 0; 226 int e = 0;
227#ifdef WIN32 227#ifdef _WIN32
228 if (!DeleteFile(path)) { 228 if (!DeleteFile(path)) {
229 e = win32err_to_errno(GetLastError()); 229 e = win32err_to_errno(GetLastError());
230 } 230 }
@@ -239,7 +239,7 @@ static int remove_file(const char* path)
239static int remove_directory(const char* path) 239static int remove_directory(const char* path)
240{ 240{
241 int e = 0; 241 int e = 0;
242#ifdef WIN32 242#ifdef _WIN32
243 if (!RemoveDirectory(path)) { 243 if (!RemoveDirectory(path)) {
244 e = win32err_to_errno(GetLastError()); 244 e = win32err_to_errno(GetLastError());
245 } 245 }
@@ -773,7 +773,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
773 uint32_t bytes = 0; 773 uint32_t bytes = 0;
774 char *localfile = string_build_path(backup_dir, path, NULL); 774 char *localfile = string_build_path(backup_dir, path, NULL);
775 char buf[32768]; 775 char buf[32768];
776#ifdef WIN32 776#ifdef _WIN32
777 struct _stati64 fst; 777 struct _stati64 fst;
778#else 778#else
779 struct stat fst; 779 struct stat fst;
@@ -784,7 +784,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
784 int errcode = -1; 784 int errcode = -1;
785 int result = -1; 785 int result = -1;
786 uint32_t length; 786 uint32_t length;
787#ifdef WIN32 787#ifdef _WIN32
788 uint64_t total; 788 uint64_t total;
789 uint64_t sent; 789 uint64_t sent;
790#else 790#else
@@ -815,7 +815,7 @@ static int mb2_handle_send_file(mobilebackup2_client_t mobilebackup2, const char
815 goto leave_proto_err; 815 goto leave_proto_err;
816 } 816 }
817 817
818#ifdef WIN32 818#ifdef _WIN32
819 if (_stati64(localfile, &fst) < 0) 819 if (_stati64(localfile, &fst) < 0)
820#else 820#else
821 if (stat(localfile, &fst) < 0) 821 if (stat(localfile, &fst) < 0)
@@ -1348,7 +1348,7 @@ static void mb2_copy_directory_by_path(const char *src, const char *dst)
1348 } 1348 }
1349} 1349}
1350 1350
1351#ifdef WIN32 1351#ifdef _WIN32
1352#define BS_CC '\b' 1352#define BS_CC '\b'
1353#define my_getch getch 1353#define my_getch getch
1354#else 1354#else
@@ -1535,7 +1535,7 @@ int main(int argc, char *argv[])
1535 /* we need to exit cleanly on running backups and restores or we cause havok */ 1535 /* we need to exit cleanly on running backups and restores or we cause havok */
1536 signal(SIGINT, clean_exit); 1536 signal(SIGINT, clean_exit);
1537 signal(SIGTERM, clean_exit); 1537 signal(SIGTERM, clean_exit);
1538#ifndef WIN32 1538#ifndef _WIN32
1539 signal(SIGQUIT, clean_exit); 1539 signal(SIGQUIT, clean_exit);
1540 signal(SIGPIPE, SIG_IGN); 1540 signal(SIGPIPE, SIG_IGN);
1541#endif 1541#endif
@@ -2324,7 +2324,7 @@ checkpoint:
2324 /* device wants to know how much disk space is available on the computer */ 2324 /* device wants to know how much disk space is available on the computer */
2325 uint64_t freespace = 0; 2325 uint64_t freespace = 0;
2326 int res = -1; 2326 int res = -1;
2327#ifdef WIN32 2327#ifdef _WIN32
2328 if (GetDiskFreeSpaceEx(backup_directory, (PULARGE_INTEGER)&freespace, NULL, NULL)) { 2328 if (GetDiskFreeSpaceEx(backup_directory, (PULARGE_INTEGER)&freespace, NULL, NULL)) {
2329 res = 0; 2329 res = 0;
2330 } 2330 }