diff options
author | Joshua Hill | 2010-06-21 05:03:27 -0400 |
---|---|---|
committer | Joshua Hill | 2010-06-21 05:03:27 -0400 |
commit | ef2a1037524ad559658a31793d4a96e07773cebc (patch) | |
tree | 45416d3eadabe83df85c97a7ce326f27258376c3 /src/ipsw.c | |
parent | 8708123ecfd708239137445c9f83c86a96ae63b7 (diff) | |
parent | b39abb66ffa5e26f38cb2ba03562d091decafc84 (diff) | |
download | idevicerestore-ef2a1037524ad559658a31793d4a96e07773cebc.tar.gz idevicerestore-ef2a1037524ad559658a31793d4a96e07773cebc.tar.bz2 |
Merge branch 'rcg'
Diffstat (limited to 'src/ipsw.c')
-rw-r--r-- | src/ipsw.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -20,6 +20,7 @@ */ #include <zip.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -94,8 +95,10 @@ int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfi int i = 0; int size = 0; + int bytes = 0; int count = 0; - for (i = zstat.size; i > 0; i -= count) { + double progress = 0; + for(i = zstat.size; i > 0; i -= count) { if (i < BUFSIZE) size = i; else @@ -108,9 +111,11 @@ int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfi return -1; } fwrite(buffer, 1, count, fd); - debug("."); + + bytes += size; + progress = ((double) bytes/ (double) zstat.size) * 100.0; + print_progress_bar("Extracting", progress); } - debug("\n"); fclose(fd); zip_fclose(zfile); @@ -119,7 +124,7 @@ int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfi return 0; } -int ipsw_extract_to_memory(const char* ipsw, const char* infile, char** pbuffer, int* psize) { +int ipsw_extract_to_memory(const char* ipsw, const char* infile, char** pbuffer, uint32_t* psize) { ipsw_archive* archive = ipsw_open(ipsw); if (archive == NULL || archive->zip == NULL) { error("ERROR: Invalid archive\n"); |