From eea922593e61a71d3f231578f1e8c4c7f035ec9c Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Sun, 10 Aug 2008 23:36:33 +0200 Subject: Fix compilation with gcc 4.3 -Wall -Werror -Wno-pointer-sign Signed-off-by: Matt Colyer --- src/AFC.c | 4 ++-- src/ifuse.c | 3 +-- src/initconf.c | 26 ++++++++++++++++++-------- src/iphone.c | 5 +++-- src/lockdown.c | 15 ++++++++++----- src/usbmux.c | 2 +- src/userpref.c | 3 ++- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/AFC.c b/src/AFC.c index 18e7cf9..e3f0bba 100644 --- a/src/AFC.c +++ b/src/AFC.c @@ -20,7 +20,7 @@ */ #include "AFC.h" - +#include "plist.h" // This is the maximum size an AFC data packet can be const int MAXIMUM_PACKET_SIZE = (2 << 15) - 32; @@ -211,7 +211,7 @@ static int receive_AFC_data(AFClient *client, char **dump_here) { break; } if (strstr(buffer, "CFA6LPAA")) { - if (debug) printf("receive_AFC_data: WARNING: there is AFC data in this packet at %i\n", strstr(buffer, "CFA6LPAA") - buffer); + if (debug) printf("receive_AFC_data: WARNING: there is AFC data in this packet at %ti\n", strstr(buffer, "CFA6LPAA") - buffer); if (debug) printf("receive_AFC_data: the total packet length is %i\n", bytes); //continue; // but we do need to continue because packets/headers != data } diff --git a/src/ifuse.c b/src/ifuse.c index aa06070..6a24bad 100644 --- a/src/ifuse.c +++ b/src/ifuse.c @@ -194,7 +194,7 @@ void *ifuse_init(struct fuse_conn_info *conn) { } host_id = get_host_id(); - if (host_id && !lockdownd_start_SSL_session(control, host_id) || !host_id) { + if ((host_id && !lockdownd_start_SSL_session(control, host_id)) || !host_id) { fprintf(stderr, "Something went wrong in GnuTLS. Is your HostID configured in .config/libiphone/libiphonerc?\n"); return NULL; } @@ -263,7 +263,6 @@ int ifuse_truncate(const char *path, off_t size) { } int ifuse_ftruncate(const char *path, off_t size, struct fuse_file_info *fi) { - int result = 0; AFClient *afc = fuse_get_context()->private_data; AFCFile *file = g_hash_table_lookup(file_handles, &fi->fh); if (!file) return -ENOENT; diff --git a/src/initconf.c b/src/initconf.c index be697e8..0149ac9 100644 --- a/src/initconf.c +++ b/src/initconf.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "userpref.h" @@ -54,6 +55,7 @@ int main(int argc, char *argv[]) { gnutls_global_init(); + size_t size; char* host_id = NULL; //"29942970-207913891623273984" gnutls_x509_privkey_t root_privkey; gnutls_x509_privkey_t host_privkey; @@ -99,26 +101,34 @@ int main(int argc, char *argv[]) { gnutls_datum_t root_key_pem = {NULL, 0}; gnutls_datum_t host_key_pem = {NULL, 0}; - gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, NULL, &root_key_pem.size); - gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, NULL, &host_key_pem.size); + gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, NULL, &size); + root_key_pem.size = size; + gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, NULL, &size); + host_key_pem.size = size; root_key_pem.data = gnutls_malloc(root_key_pem.size); host_key_pem.data = gnutls_malloc(host_key_pem.size); - gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &root_key_pem.size); - gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &host_key_pem.size); + gnutls_x509_privkey_export (root_privkey, GNUTLS_X509_FMT_PEM, root_key_pem.data, &size); + root_key_pem.size = size; + gnutls_x509_privkey_export (host_privkey, GNUTLS_X509_FMT_PEM, host_key_pem.data, &size); + host_key_pem.size = size; gnutls_datum_t root_cert_pem = {NULL, 0}; gnutls_datum_t host_cert_pem = {NULL, 0}; - gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, NULL, &root_cert_pem.size); - gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, NULL, &host_cert_pem.size); + gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, NULL, &size); + root_cert_pem.size = size; + gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, NULL, &size); + host_cert_pem.size = size; root_cert_pem.data = gnutls_malloc(root_cert_pem.size); host_cert_pem.data = gnutls_malloc(host_cert_pem.size); - gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &root_cert_pem.size); - gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &host_cert_pem.size); + gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &size); + root_cert_pem.size = size; + gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &size); + host_cert_pem.size = size; /* store values in config file */ diff --git a/src/iphone.c b/src/iphone.c index 426b629..558dd9a 100644 --- a/src/iphone.c +++ b/src/iphone.c @@ -21,6 +21,7 @@ #include "usbmux.h" #include "iphone.h" +#include #include #include #include @@ -141,13 +142,13 @@ int send_to_phone(iPhone *phone, char *data, int datalen) { if (!phone) return -1; int bytes = 0; // it may die here - if (debug) printf("dying here?\ndatalen = %i\ndata = %x\n", datalen, data); + if (debug) printf("dying here?\ndatalen = %i\ndata = %p\n", datalen, data); bytes = usb_bulk_write(phone->device, BULKOUT, data, datalen, 800); if (debug) printf("noooo...?\n"); if (bytes < datalen) { if(debug && bytes < 0) - printf("send_to_iphone(): libusb gave me the error %d: %s\n", bytes, usb_strerror(), strerror(-bytes)); + printf("send_to_iphone(): libusb gave me the error %d: %s - %s\n", bytes, usb_strerror(), strerror(-bytes)); return -1; } else { return bytes; diff --git a/src/lockdown.c b/src/lockdown.c index 78ab6a9..7f938fb 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -23,10 +23,12 @@ #include "iphone.h" #include "lockdown.h" #include "userpref.h" +#include #include #include #include #include +#include extern int debug; @@ -446,9 +448,12 @@ int lockdownd_gen_pair_cert(char *public_key_b64, char **device_cert_b64, char * /* if everything went well, export in PEM format */ gnutls_datum_t dev_pem = {NULL, 0}; - gnutls_x509_crt_export(dev_cert, GNUTLS_X509_FMT_PEM, NULL, &dev_pem.size); + size_t crt_size; + gnutls_x509_crt_export(dev_cert, GNUTLS_X509_FMT_PEM, NULL, &crt_size); + dev_pem.size = crt_size; dev_pem.data = gnutls_malloc(dev_pem.size); - gnutls_x509_crt_export(dev_cert, GNUTLS_X509_FMT_PEM, dev_pem.data, &dev_pem.size); + gnutls_x509_crt_export(dev_cert, GNUTLS_X509_FMT_PEM, dev_pem.data, &crt_size); + dev_pem.size = crt_size; /* now encode certificates for output */ *device_cert_b64 = g_base64_encode(dev_pem.data, dev_pem.size); @@ -583,7 +588,7 @@ ssize_t lockdownd_secuwrite(gnutls_transport_ptr_t transport, char *buffer, size lockdownd_client *control; control = (lockdownd_client*)transport; if (debug) printf("lockdownd_secuwrite() called\n"); - if (debug) printf("pre-send\nlength = %i\n", length); + if (debug) printf("pre-send\nlength = %zi\n", length); bytes = mux_send(control->connection, buffer, length); if (debug) printf("post-send\nsent %i bytes\n", bytes); if (debug) { @@ -602,7 +607,7 @@ ssize_t lockdownd_securead(gnutls_transport_ptr_t transport, char *buffer, size_ char *hackhackhack = NULL; lockdownd_client *control; control = (lockdownd_client*)transport; - if (debug) printf("lockdownd_securead() called\nlength = %i\n", length); + if (debug) printf("lockdownd_securead() called\nlength = %zi\n", length); // Buffering hack! Throw what we've got in our "buffer" into the stream first, then get more. if (control->gtls_buffer_hack_len > 0) { if (length > control->gtls_buffer_hack_len) { // If it's asking for more than we got @@ -633,7 +638,7 @@ ssize_t lockdownd_securead(gnutls_transport_ptr_t transport, char *buffer, size_ // End buffering hack! char *recv_buffer = (char*)malloc(sizeof(char) * (length * 1000)); // ensuring nothing stupid happens - if (debug) printf("pre-read\nclient wants %i bytes\n", length); + if (debug) printf("pre-read\nclient wants %zi bytes\n", length); bytes = mux_recv(control->connection, recv_buffer, (length * 1000)); if (debug) printf("post-read\nwe got %i bytes\n", bytes); if (debug && bytes < 0) { diff --git a/src/usbmux.c b/src/usbmux.c index d79ee47..83797dd 100644 --- a/src/usbmux.c +++ b/src/usbmux.c @@ -200,7 +200,7 @@ int mux_send(usbmux_connection *connection, const char *data, uint32 datalen) { memcpy(buffer+sizeof(usbmux_tcp_header), data, datalen); // We have a buffer full of data, we should now send it to the phone. - if (debug) printf("actually sending %i bytes of data at %x\n", sizeof(usbmux_tcp_header)+datalen, buffer); + if (debug) printf("actually sending %zi bytes of data at %p\n", sizeof(usbmux_tcp_header)+datalen, buffer); bytes = send_to_phone(connection->phone, buffer, sizeof(usbmux_tcp_header)+datalen); diff --git a/src/userpref.c b/src/userpref.c index cd29c43..49a3c45 100644 --- a/src/userpref.c +++ b/src/userpref.c @@ -20,6 +20,7 @@ */ #include +#include #include #include #include "userpref.h" @@ -140,7 +141,7 @@ int store_device_public_key(char* public_key) g_io_channel_shutdown(file, TRUE, NULL); /* append device to list */ - gchar** new_devices_list = (gchar**)g_malloc(sizeof(gchar*)* (length + 2)); + const gchar** new_devices_list = (const gchar**)g_malloc(sizeof(gchar*)* (length + 2)); int i; for( i = 0; i < length; i++) new_devices_list[i] = devices_list[i]; -- cgit v1.1-32-gdbae