summaryrefslogtreecommitdiffstats
path: root/src/ipsw.c
diff options
context:
space:
mode:
authorGravatar Joshua Hill2010-05-26 17:12:20 -0400
committerGravatar Joshua Hill2010-05-26 17:12:20 -0400
commit87de88ccc570b98040a356a411ed6a47f58a4d72 (patch)
treee064d7d52ed21c194b5d095ff02b4c5d10a59d5c /src/ipsw.c
parent8e62479ecbcf29a60bd6a03a08a3487955367f2a (diff)
downloadidevicerestore-87de88ccc570b98040a356a411ed6a47f58a4d72.tar.gz
idevicerestore-87de88ccc570b98040a356a411ed6a47f58a4d72.tar.bz2
Implemented NOR data request, it's ugly but it works! Successfully restored 4.0b4 to my device
Diffstat (limited to 'src/ipsw.c')
-rw-r--r--src/ipsw.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ipsw.c b/src/ipsw.c
index f602d16..ca28596 100644
--- a/src/ipsw.c
+++ b/src/ipsw.c
@@ -74,7 +74,7 @@ int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfi
}
char* buffer = (char*) malloc(BUFSIZE);
- if(buffer == NULL) {
+ if (buffer == NULL) {
error("ERROR: Unable to allocate memory\n");
return -1;
}
@@ -86,7 +86,7 @@ int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfi
}
FILE* fd = fopen(outfile, "wb");
- if(fd == NULL) {
+ if (fd == NULL) {
error("ERROR: Unable to open output file: %s\n", outfile);
zip_fclose(zfile);
return -1;
@@ -96,8 +96,10 @@ int ipsw_extract_to_file(const char* ipsw, const char* infile, const char* outfi
int size = 0;
int count = 0;
for (i = zstat.size; i > 0; i -= count) {
- if(i < BUFSIZE) size = i;
- else size = BUFSIZE;
+ if (i < BUFSIZE)
+ size = i;
+ else
+ size = BUFSIZE;
count = zip_fread(zfile, buffer, size);
if (count < 0) {
error("ERROR: zip_fread: %s\n", infile);