summaryrefslogtreecommitdiffstats
path: root/src/img3.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-10-02 17:02:33 +0200
committerGravatar Nikias Bassen2013-10-02 17:02:33 +0200
commitce2363cbb3361b7e34a0150a92d806573dfef9be (patch)
treefc00c7b674a3973d1e208e79b81b16c13fe1346f /src/img3.c
parent02a500231ff77dd7f1eb2e35fb29ee2aff287658 (diff)
downloadidevicerestore-ce2363cbb3361b7e34a0150a92d806573dfef9be.tar.gz
idevicerestore-ce2363cbb3361b7e34a0150a92d806573dfef9be.tar.bz2
img3: make buffers and sizes unsigned
Diffstat (limited to 'src/img3.c')
-rw-r--r--src/img3.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/img3.c b/src/img3.c
index e23a74c..1fa1c66 100644
--- a/src/img3.c
+++ b/src/img3.c
@@ -29,8 +29,8 @@
#include "common.h"
#include "idevicerestore.h"
-img3_file* img3_parse_file(char* data, int size) {
- int data_offset = 0;
+img3_file* img3_parse_file(unsigned char* data, unsigned int size) {
+ unsigned int data_offset = 0;
img3_element* element;
img3_header* header = (img3_header*) data;
if (header->signature != kImg3Container) {
@@ -196,7 +196,7 @@ img3_file* img3_parse_file(char* data, int size) {
return image;
}
-img3_element* img3_parse_element(char* data) {
+img3_element* img3_parse_element(unsigned char* data) {
img3_element_header* element_header = (img3_element_header*) data;
img3_element* element = (img3_element*) malloc(sizeof(img3_element));
if (element == NULL) {
@@ -205,7 +205,7 @@ img3_element* img3_parse_element(char* data) {
}
memset(element, '\0', sizeof(img3_element));
- element->data = (char*) malloc(element_header->full_size);
+ element->data = (unsigned char*) malloc(element_header->full_size);
if (element->data == NULL) {
error("ERROR: Unable to allocate memory for IMG3 element data\n");
free(element);
@@ -245,7 +245,7 @@ void img3_free_element(img3_element* element) {
}
}
-int img3_replace_signature(img3_file* image, char* signature) {
+int img3_replace_signature(img3_file* image, unsigned char* signature) {
int i, oldidx;
int offset = 0;
img3_element* ecid = img3_parse_element(&signature[offset]);
@@ -350,7 +350,7 @@ int img3_replace_signature(img3_file* image, char* signature) {
return 0;
}
-int img3_get_data(img3_file* image, char** pdata, int* psize) {
+int img3_get_data(img3_file* image, unsigned char** pdata, unsigned int* psize) {
int i;
int offset = 0;
int size = sizeof(img3_header);
@@ -362,7 +362,7 @@ int img3_get_data(img3_file* image, char** pdata, int* psize) {
info("reconstructed size: %d\n", size);
- char* data = (char*) malloc(size);
+ unsigned char* data = (unsigned char*) malloc(size);
if (data == NULL) {
error("ERROR: Unable to allocate memory for IMG3 data\n");
return -1;