summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-02-14 00:32:13 +0100
committerGravatar Nikias Bassen2019-02-14 00:32:13 +0100
commit15b85554808e51d3009f3742b1800620a217b149 (patch)
treeee967016fe79cf8d236a7f1e0473deea9e651083
parent4a1c7c75519ffe77d8540e056e31fcfe17f1d3fd (diff)
downloadidevicerestore-15b85554808e51d3009f3742b1800620a217b149.tar.gz
idevicerestore-15b85554808e51d3009f3742b1800620a217b149.tar.bz2
Use uint64_t instead of off_t for win32/MinGW compatibility
-rw-r--r--src/download.c4
-rw-r--r--src/idevicerestore.c4
-rw-r--r--src/ipsw.c4
-rw-r--r--src/ipsw.h2
-rw-r--r--src/restore.c2
5 files changed, 8 insertions, 8 deletions
diff --git a/src/download.c b/src/download.c
index e09d911..b50abc1 100644
--- a/src/download.c
+++ b/src/download.c
@@ -2,8 +2,8 @@
* download.c
* file download helper functions
*
+ * Copyright (c) 2012-2019 Nikias Bassen. All Rights Reserved.
* Copyright (c) 2012-2013 Martin Szulecki. All Rights Reserved.
- * Copyright (c) 2012 Nikias Bassen. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -146,7 +146,7 @@ int download_to_file(const char* url, const char* filename, int enable_progress)
#endif
fclose(f);
- if ((sz == 0) || (sz == (off_t)-1)) {
+ if ((sz == 0) || ((int64_t)sz == (int64_t)-1)) {
res = -1;
remove(filename);
}
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 66b1631..4c3c0e0 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -716,9 +716,9 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
memset(&st, '\0', sizeof(struct stat));
if (stat(tmpf, &st) == 0) {
- off_t fssize = 0;
+ uint64_t fssize = 0;
ipsw_get_file_size(client->ipsw, fsname, &fssize);
- if ((fssize > 0) && (st.st_size == fssize)) {
+ if ((fssize > 0) && ((uint64_t)st.st_size == fssize)) {
info("Using cached filesystem from '%s'\n", tmpf);
filesystem = strdup(tmpf);
}
diff --git a/src/ipsw.c b/src/ipsw.c
index 8ca6a8f..0dfd9c0 100644
--- a/src/ipsw.c
+++ b/src/ipsw.c
@@ -104,7 +104,7 @@ int ipsw_is_directory(const char* ipsw)
return S_ISDIR(fst.st_mode);
}
-int ipsw_get_file_size(const char* ipsw, const char* infile, off_t* size)
+int ipsw_get_file_size(const char* ipsw, const char* infile, uint64_t* size)
{
ipsw_archive* archive = ipsw_open(ipsw);
if (archive == NULL) {
@@ -188,7 +188,7 @@ int ipsw_extract_to_file_with_progress(const char* ipsw, const char* infile, con
return -1;
}
- off_t i, bytes = 0;
+ uint64_t i, bytes = 0;
int count, size = BUFSIZE;
double progress;
for(i = zstat.size; i > 0; i -= count) {
diff --git a/src/ipsw.h b/src/ipsw.h
index 4c0087f..1d00d6f 100644
--- a/src/ipsw.h
+++ b/src/ipsw.h
@@ -33,7 +33,7 @@ extern "C" {
int ipsw_is_directory(const char* ipsw);
int ipsw_file_exists(const char* ipsw, const char* infile);
-int ipsw_get_file_size(const char* ipsw, const char* infile, off_t* size);
+int ipsw_get_file_size(const char* ipsw, const char* infile, uint64_t* size);
int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfile);
int ipsw_extract_to_file_with_progress(const char* ipsw, const char* infile, const char* outfile, int print_progress);
int ipsw_extract_to_memory(const char* ipsw, const char* infile, unsigned char** pbuffer, unsigned int* psize);
diff --git a/src/restore.c b/src/restore.c
index 0f2ce89..c6ca34a 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -1207,7 +1207,7 @@ static int restore_sign_bbfw(const char* bbfwtmp, plist_t bbtss, const unsigned
unsigned char* buffer = NULL;
unsigned char* blob = NULL;
unsigned char* fdata = NULL;
- off_t fsize = 0;
+ uint64_t fsize = 0;
uint64_t blob_size = 0;
int zerr = 0;
int zindex = -1;