summaryrefslogtreecommitdiffstats
path: root/src/AFC.c
diff options
context:
space:
mode:
authorGravatar Zach C2008-08-31 11:25:22 -0700
committerGravatar Jonathan Beck2008-11-24 22:49:07 +0100
commitf4c4b783c8dbe2fe8e7e6f6b5f19f0d44b489c9a (patch)
tree9ef8c57fe298a4ae9e0a443d7103e6126c869020 /src/AFC.c
parent8c3a01e11bb9c74e2a1bb7da143cb35469f29fba (diff)
downloadlibplist-f4c4b783c8dbe2fe8e7e6f6b5f19f0d44b489c9a.tar.gz
libplist-f4c4b783c8dbe2fe8e7e6f6b5f19f0d44b489c9a.tar.bz2
Added binary-plist support (tweaked slightly to move stuff around)
Signed-off-by: Matt Colyer <matt@colyer.name> fix makefile to take correct main function into account
Diffstat (limited to 'src/AFC.c')
-rw-r--r--src/AFC.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/AFC.c b/src/AFC.c
index 54ea1bb..899bd47 100644
--- a/src/AFC.c
+++ b/src/AFC.c
@@ -245,7 +245,7 @@ static int receive_AFC_data(iphone_afc_client_t client, char **dump_here)
return retval;
}
- uint32 param1 = buffer[sizeof(AFCPacket)];
+ uint32_t param1 = buffer[sizeof(AFCPacket)];
free(buffer);
if (r_packet->operation == AFC_ERROR && !(client->afc_packet->operation == AFC_DELETE && param1 == 7)) {
@@ -474,7 +474,7 @@ iphone_error_t iphone_afc_delete_file(iphone_afc_client_t client, const char *pa
iphone_error_t iphone_afc_rename_file(iphone_afc_client_t client, const char *from, const char *to)
{
char *response = NULL;
- char *send = (char *) malloc(sizeof(char) * (strlen(from) + strlen(to) + 1 + sizeof(uint32)));
+ char *send = (char *) malloc(sizeof(char) * (strlen(from) + strlen(to) + 1 + sizeof(uint32_t)));
int bytes = 0;
if (!client || !from || !to || !client->afc_packet || !client->connection)
@@ -660,7 +660,7 @@ iphone_afc_open_file(iphone_afc_client_t client, const char *filename,
iphone_afc_file_mode_t file_mode, iphone_afc_file_t * file)
{
iphone_afc_file_t file_loc = NULL;
- uint32 ag = 0;
+ uint32_t ag = 0;
int bytes = 0, length = 0;
char *data = (char *) malloc(sizeof(char) * (8 + strlen(filename) + 1));
@@ -795,7 +795,7 @@ iphone_afc_write_file(iphone_afc_client_t client, iphone_afc_file_t file,
{
char *acknowledgement = NULL;
const int MAXIMUM_WRITE_SIZE = 1 << 15;
- uint32 zero = 0, bytes_loc = 0, segments = (length / MAXIMUM_WRITE_SIZE), current_count = 0, i = 0;
+ uint32_t zero = 0, bytes_loc = 0, segments = (length / MAXIMUM_WRITE_SIZE), current_count = 0, i = 0;
char *out_buffer = NULL;
if (!client || !client->afc_packet || !client->connection || !file || !bytes)
@@ -812,8 +812,8 @@ iphone_afc_write_file(iphone_afc_client_t client, iphone_afc_file_t file,
client->afc_packet->entire_length = client->afc_packet->this_length + MAXIMUM_WRITE_SIZE;
client->afc_packet->operation = AFC_WRITE;
out_buffer = (char *) malloc(sizeof(char) * client->afc_packet->entire_length - sizeof(AFCPacket));
- memcpy(out_buffer, (char *) &file->filehandle, sizeof(uint32));
- memcpy(out_buffer + 4, (char *) &zero, sizeof(uint32));
+ memcpy(out_buffer, (char *) &file->filehandle, sizeof(uint32_t));
+ memcpy(out_buffer + 4, (char *) &zero, sizeof(uint32_t));
memcpy(out_buffer + 8, data + current_count, MAXIMUM_WRITE_SIZE);
bytes_loc = dispatch_AFC_packet(client, out_buffer, MAXIMUM_WRITE_SIZE + 8);
if (bytes_loc < 0) {
@@ -845,8 +845,8 @@ iphone_afc_write_file(iphone_afc_client_t client, iphone_afc_file_t file,
client->afc_packet->entire_length = client->afc_packet->this_length + (length - current_count);
client->afc_packet->operation = AFC_WRITE;
out_buffer = (char *) malloc(sizeof(char) * client->afc_packet->entire_length - sizeof(AFCPacket));
- memcpy(out_buffer, (char *) &file->filehandle, sizeof(uint32));
- memcpy(out_buffer + 4, (char *) &zero, sizeof(uint32));
+ memcpy(out_buffer, (char *) &file->filehandle, sizeof(uint32_t));
+ memcpy(out_buffer + 4, (char *) &zero, sizeof(uint32_t));
memcpy(out_buffer + 8, data + current_count, (length - current_count));
bytes_loc = dispatch_AFC_packet(client, out_buffer, (length - current_count) + 8);
free(out_buffer);
@@ -881,7 +881,7 @@ iphone_error_t iphone_afc_close_file(iphone_afc_client_t client, iphone_afc_file
if (!client || !file)
return IPHONE_E_INVALID_ARG;
char *buffer = malloc(sizeof(char) * 8);
- uint32 zero = 0;
+ uint32_t zero = 0;
int bytes = 0;
afc_lock(client);
@@ -889,8 +889,8 @@ iphone_error_t iphone_afc_close_file(iphone_afc_client_t client, iphone_afc_file
log_debug_msg("afc_close_file: File handle %i\n", file->filehandle);
// Send command
- memcpy(buffer, &file->filehandle, sizeof(uint32));
- memcpy(buffer + sizeof(uint32), &zero, sizeof(zero));
+ memcpy(buffer, &file->filehandle, sizeof(uint32_t));
+ memcpy(buffer + sizeof(uint32_t), &zero, sizeof(zero));
client->afc_packet->operation = AFC_FILE_CLOSE;
client->afc_packet->entire_length = client->afc_packet->this_length = 0;
bytes = dispatch_AFC_packet(client, buffer, sizeof(char) * 8);
@@ -926,7 +926,7 @@ iphone_error_t iphone_afc_close_file(iphone_afc_client_t client, iphone_afc_file
iphone_error_t iphone_afc_seek_file(iphone_afc_client_t client, iphone_afc_file_t file, int seekpos)
{
char *buffer = (char *) malloc(sizeof(char) * 24);
- uint32 seekto = 0, bytes = 0, zero = 0;
+ uint32_t seekto = 0, bytes = 0, zero = 0;
if (seekpos < 0)
seekpos = file->size - abs(seekpos);
@@ -935,12 +935,12 @@ iphone_error_t iphone_afc_seek_file(iphone_afc_client_t client, iphone_afc_file_
// Send the command
seekto = seekpos;
- memcpy(buffer, &file->filehandle, sizeof(uint32)); // handle
- memcpy(buffer + 4, &zero, sizeof(uint32)); // pad
- memcpy(buffer + 8, &zero, sizeof(uint32)); // fromwhere
- memcpy(buffer + 12, &zero, sizeof(uint32)); // pad
- memcpy(buffer + 16, &seekto, sizeof(uint32)); // offset
- memcpy(buffer + 20, &zero, sizeof(uint32)); // pad
+ memcpy(buffer, &file->filehandle, sizeof(uint32_t)); // handle
+ memcpy(buffer + 4, &zero, sizeof(uint32_t)); // pad
+ memcpy(buffer + 8, &zero, sizeof(uint32_t)); // fromwhere
+ memcpy(buffer + 12, &zero, sizeof(uint32_t)); // pad
+ memcpy(buffer + 16, &seekto, sizeof(uint32_t)); // offset
+ memcpy(buffer + 20, &zero, sizeof(uint32_t)); // pad
client->afc_packet->operation = AFC_FILE_SEEK;
client->afc_packet->this_length = client->afc_packet->entire_length = 0;
bytes = dispatch_AFC_packet(client, buffer, 23);
@@ -979,14 +979,14 @@ iphone_error_t iphone_afc_seek_file(iphone_afc_client_t client, iphone_afc_file_
iphone_error_t iphone_afc_truncate_file(iphone_afc_client_t client, iphone_afc_file_t file, uint32_t newsize)
{
char *buffer = (char *) malloc(sizeof(char) * 16);
- uint32 bytes = 0, zero = 0;
+ uint32_t bytes = 0, zero = 0;
afc_lock(client);
// Send command
- memcpy(buffer, &file->filehandle, sizeof(uint32)); // handle
- memcpy(buffer + 4, &zero, sizeof(uint32)); // pad
- memcpy(buffer + 8, &newsize, sizeof(uint32)); // newsize
+ memcpy(buffer, &file->filehandle, sizeof(uint32_t)); // handle
+ memcpy(buffer + 4, &zero, sizeof(uint32_t)); // pad
+ memcpy(buffer + 8, &newsize, sizeof(uint32_t)); // newsize
memcpy(buffer + 12, &zero, 3); // pad
client->afc_packet->operation = AFC_FILE_TRUNCATE;
client->afc_packet->this_length = client->afc_packet->entire_length = 0;
@@ -1012,7 +1012,7 @@ iphone_error_t iphone_afc_truncate_file(iphone_afc_client_t client, iphone_afc_f
}
}
-uint32 iphone_afc_get_file_handle(iphone_afc_file_t file)
+uint32_t iphone_afc_get_file_handle(iphone_afc_file_t file)
{
return file->filehandle;
}