summaryrefslogtreecommitdiffstats
path: root/src
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
parent02a500231ff77dd7f1eb2e35fb29ee2aff287658 (diff)
downloadidevicerestore-ce2363cbb3361b7e34a0150a92d806573dfef9be.tar.gz
idevicerestore-ce2363cbb3361b7e34a0150a92d806573dfef9be.tar.bz2
img3: make buffers and sizes unsigned
Diffstat (limited to 'src')
-rw-r--r--src/idevicerestore.c8
-rw-r--r--src/img3.c14
-rw-r--r--src/img3.h10
3 files changed, 16 insertions, 16 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 6b3e5d7..f64db02 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -195,7 +195,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
info("Found device in %s mode\n", client->mode->string);
if (client->mode->index == MODE_WTF) {
- int cpid = 0;
+ unsigned int cpid = 0;
if (dfu_client_new(client) != 0) {
error("ERROR: Could not open device in WTF mode\n");
@@ -1427,9 +1427,9 @@ int build_manifest_get_identity_count(plist_t build_manifest) {
int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* component, const char* path, char** data, uint32_t* size) {
img3_file* img3 = NULL;
- uint32_t component_size = 0;
- char* component_data = NULL;
- char* component_blob = NULL;
+ unsigned int component_size = 0;
+ unsigned char* component_data = NULL;
+ unsigned char* component_blob = NULL;
char* component_name = NULL;
component_name = strrchr(path, '/');
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;
diff --git a/src/img3.h b/src/img3.h
index 527e6eb..1132162 100644
--- a/src/img3.h
+++ b/src/img3.h
@@ -72,7 +72,7 @@ typedef struct {
} img3_element;
typedef struct {
- char* data;
+ unsigned char* data;
img3_header* header;
int num_elements;
img3_element* elements[16];
@@ -96,11 +96,11 @@ typedef struct {
} img3_file;
void img3_free(img3_file* image);
-img3_element* img3_parse_element(char* data);
+img3_element* img3_parse_element(unsigned char* data);
void img3_free_element(img3_element* element);
-img3_file* img3_parse_file(char* data, int size);
-int img3_get_data(img3_file* image, char** pdata, int* psize);
-int img3_replace_signature(img3_file* image, char* signature);
+img3_file* img3_parse_file(unsigned char* data, unsigned int size);
+int img3_get_data(img3_file* image, unsigned char** pdata, unsigned int* psize);
+int img3_replace_signature(img3_file* image, unsigned char* signature);
#ifdef __cplusplus