summaryrefslogtreecommitdiffstats
path: root/src/asr.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-01-22 00:49:54 +0100
committerGravatar Nikias Bassen2019-01-22 00:49:54 +0100
commite0b44cfb99c7e400c0fc51474f240dba3facd412 (patch)
treea1b53f6d3d144de5b71b2fc6b54a4107ecd70066 /src/asr.c
parent95916028d8596727311509f75a599816c7689ee8 (diff)
downloadidevicerestore-e0b44cfb99c7e400c0fc51474f240dba3facd412.tar.gz
idevicerestore-e0b44cfb99c7e400c0fc51474f240dba3facd412.tar.bz2
win32: Use _fseeki64/_ftelli64 instead of fseeko/ftello
Diffstat (limited to 'src/asr.c')
-rw-r--r--src/asr.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/asr.c b/src/asr.c
index e4c24c4..9fcb6b3 100644
--- a/src/asr.c
+++ b/src/asr.c
@@ -204,9 +204,15 @@ int asr_perform_validation(asr_client_t asr, const char* filesystem) {
return -1;
}
+#ifdef WIN32
+ _fseeki64(file, 0, SEEK_END);
+ length = _ftelli64(file);
+ _fseeki64(file, 0, SEEK_SET);
+#else
fseeko(file, 0, SEEK_END);
length = ftello(file);
fseeko(file, 0, SEEK_SET);
+#endif
payload_info = plist_new_dict();
plist_dict_set_item(payload_info, "Port", plist_new_uint(1));
@@ -300,7 +306,11 @@ int asr_handle_oob_data_request(asr_client_t asr, plist_t packet, FILE* file) {
return -1;
}
+#ifdef WIN32
+ _fseeki64(file, oob_offset, SEEK_SET);
+#else
fseeko(file, oob_offset, SEEK_SET);
+#endif
if (fread(oob_data, 1, oob_length, file) != oob_length) {
error("ERROR: Unable to read OOB data from filesystem offset: %s\n",
strerror(errno));
@@ -320,7 +330,7 @@ int asr_handle_oob_data_request(asr_client_t asr, plist_t packet, FILE* file) {
int asr_send_payload(asr_client_t asr, const char* filesystem) {
char data[ASR_PAYLOAD_PACKET_SIZE];
FILE* file = NULL;
- off_t i, length, bytes = 0;
+ uint64_t i, length, bytes = 0;
double progress = 0;
file = fopen(filesystem, "rb");
@@ -330,9 +340,15 @@ int asr_send_payload(asr_client_t asr, const char* filesystem) {
return -1;
}
+#ifdef WIN32
+ _fseeki64(file, 0, SEEK_END);
+ length = _ftelli64(file);
+ _fseeki64(file, 0, SEEK_SET);
+#else
fseeko(file, 0, SEEK_END);
length = ftello(file);
fseeko(file, 0, SEEK_SET);
+#endif
int chunk = 0;
int add_checksum = 0;