diff options
author | Jonathan Beck | 2009-01-04 22:21:15 +0100 |
---|---|---|
committer | Jonathan Beck | 2009-01-04 22:21:15 +0100 |
commit | 5514a3b2a9734d311e4f6014585f922e0b748cab (patch) | |
tree | ca88a32519d6a07da72d15632de7af04461f7ba8 /src | |
parent | 4301ef9bb8e9d06ffa4e9172191d58ede5e16f5d (diff) | |
parent | 5cde55426112a8cb79d809dae5f61e347c007212 (diff) | |
download | libimobiledevice-5514a3b2a9734d311e4f6014585f922e0b748cab.tar.gz libimobiledevice-5514a3b2a9734d311e4f6014585f922e0b748cab.tar.bz2 |
Merge branch 'master' into plist
Conflicts:
src/AFC.c
src/lockdown.c
src/lockdown.h
src/plist.c
src/plist.h
Diffstat (limited to 'src')
-rw-r--r-- | src/AFC.c | 13 | ||||
-rw-r--r-- | src/initconf.c | 4 | ||||
-rw-r--r-- | src/iphone.c | 6 | ||||
-rw-r--r-- | src/lockdown.c | 5 | ||||
-rw-r--r-- | src/lockdown.h | 2 | ||||
-rw-r--r-- | src/usbmux.c | 9 | ||||
-rw-r--r-- | src/usbmux.h | 2 | ||||
-rw-r--r-- | src/userpref.c | 9 | ||||
-rw-r--r-- | src/userpref.h | 2 |
9 files changed, 27 insertions, 25 deletions
@@ -23,6 +23,7 @@ #include "AFC.h" + // This is the maximum size an AFC data packet can be const int MAXIMUM_PACKET_SIZE = (2 << 15) - 32; @@ -555,7 +556,7 @@ iphone_error_t iphone_afc_mkdir(iphone_afc_client_t client, const char *dir) * @return A pointer to an AFCFile struct containing the information received, * or NULL on failure. */ -iphone_afc_file_t afc_get_file_info(iphone_afc_client_t client, const char *path) +static iphone_afc_file_t afc_get_file_info(iphone_afc_client_t client, const char *path) { char *received, **list; iphone_afc_file_t my_file; @@ -794,7 +795,9 @@ 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_t zero = 0, bytes_loc = 0, segments = (length / MAXIMUM_WRITE_SIZE), current_count = 0, i = 0; + uint32_t zero = 0, current_count = 0, i = 0; + uint32_t segments = (length / MAXIMUM_WRITE_SIZE); + int bytes_loc = 0; char *out_buffer = NULL; if (!client || !client->afc_packet || !client->connection || !file || !bytes) @@ -925,7 +928,8 @@ 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_t seekto = 0, bytes = 0, zero = 0; + uint32_t seekto = 0, zero = 0; + int bytes = 0; if (seekpos < 0) seekpos = file->size - abs(seekpos); @@ -978,7 +982,8 @@ 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_t bytes = 0, zero = 0; + int bytes = 0; + uint32_t zero = 0; afc_lock(client); diff --git a/src/initconf.c b/src/initconf.c index 00d78e2..538f344 100644 --- a/src/initconf.c +++ b/src/initconf.c @@ -35,7 +35,7 @@ * * @param key The pointer to the desired location of the new key. */ -void generate_key(gpointer key) +static void generate_key(gpointer key) { gnutls_x509_privkey_generate(*((gnutls_x509_privkey_t *) key), GNUTLS_PK_RSA, 2048, 0); g_thread_exit(0); @@ -43,7 +43,7 @@ void generate_key(gpointer key) /** Simple function that generates a spinner until the mutex is released. */ -void progress_bar(gpointer mutex) +static void progress_bar(gpointer mutex) { const char *spinner = "|/-\\|/-\\"; int i = 0; diff --git a/src/iphone.c b/src/iphone.c index b7f6cc4..32d27f6 100644 --- a/src/iphone.c +++ b/src/iphone.c @@ -42,7 +42,7 @@ * descriptor on return. * @return IPHONE_E_SUCCESS if ok, otherwise an error code. */ -iphone_error_t iphone_get_specific_device(int bus_n, int dev_n, iphone_device_t * device) +static iphone_error_t iphone_get_specific_device(unsigned int bus_n, int dev_n, iphone_device_t * device) { struct usb_bus *bus, *busses; struct usb_device *dev; @@ -146,7 +146,7 @@ iphone_error_t iphone_get_specific_device(int bus_n, int dev_n, iphone_device_t */ iphone_error_t iphone_get_device(iphone_device_t * device) { - struct usb_bus *bus, *busses; + struct usb_bus *bus; struct usb_device *dev; usb_init(); @@ -214,7 +214,7 @@ int send_to_phone(iphone_device_t phone, char *data, int datalen) } else { return bytes; } - + /* Should not be reached */ return -1; } diff --git a/src/lockdown.c b/src/lockdown.c index 5b83fb9..c6d5f80 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -20,6 +20,7 @@ */ #include "usbmux.h" +#include "utils.h" #include "iphone.h" #include "lockdown.h" #include "userpref.h" @@ -41,8 +42,6 @@ const ASN1_ARRAY_TYPE pkcs1_asn1_tab[] = { {0, 0, 0} }; - - /** Creates a lockdownd client for the give iPhone. * * @param phone The iPhone to create a lockdownd client for @@ -235,7 +234,7 @@ iphone_error_t lockdownd_hello(iphone_lckd_client_t control) * * @return IPHONE_E_SUCCESS on success. */ -iphone_error_t lockdownd_generic_get_value(iphone_lckd_client_t control, char *req_key, char *req_string, +iphone_error_t lockdownd_generic_get_value(iphone_lckd_client_t control, const char *req_key, char *req_string, gnutls_datum_t * value) { if (!control || !req_key || !value || value->data) diff --git a/src/lockdown.h b/src/lockdown.h index 18e13aa..8ca8a7f 100644 --- a/src/lockdown.h +++ b/src/lockdown.h @@ -41,7 +41,7 @@ struct iphone_lckd_client_int { iphone_lckd_client_t new_lockdownd_client(iphone_device_t phone); iphone_error_t lockdownd_hello(iphone_lckd_client_t control); -iphone_error_t lockdownd_generic_get_value(iphone_lckd_client_t control, char *req_key, char *req_string, +iphone_error_t lockdownd_generic_get_value(iphone_lckd_client_t control, const char *req_key, char *req_string, gnutls_datum_t * value); iphone_error_t lockdownd_get_device_uid(iphone_lckd_client_t control, char **uid); iphone_error_t lockdownd_get_device_public_key(iphone_lckd_client_t control, gnutls_datum_t * public_key); diff --git a/src/usbmux.c b/src/usbmux.c index f0499fa..427b880 100644 --- a/src/usbmux.c +++ b/src/usbmux.c @@ -26,6 +26,7 @@ #include <string.h> #include "usbmux.h" +#include "utils.h" static iphone_umux_client_t *connlist = NULL; static int clients = 0; @@ -57,7 +58,7 @@ usbmux_tcp_header *new_mux_packet(uint16_t s_port, uint16_t d_port) * * @return A USBMux header */ -usbmux_version_header *version_header() +usbmux_version_header *version_header(void) { usbmux_version_header *version = (usbmux_version_header *) malloc(sizeof(usbmux_version_header)); version->type = 0; @@ -76,7 +77,7 @@ usbmux_version_header *version_header() * * @param connection The connection to delete from the tracking list. */ -void delete_connection(iphone_umux_client_t connection) +static void delete_connection(iphone_umux_client_t connection) { iphone_umux_client_t *newlist = (iphone_umux_client_t *) malloc(sizeof(iphone_umux_client_t) * (clients - 1)); int i = 0, j = 0; @@ -105,7 +106,7 @@ void delete_connection(iphone_umux_client_t connection) * @param connection The connection to add to the global list of connections. */ -void add_connection(iphone_umux_client_t connection) +static void add_connection(iphone_umux_client_t connection) { iphone_umux_client_t *newlist = (iphone_umux_client_t *) realloc(connlist, sizeof(iphone_umux_client_t) * (clients + 1)); @@ -178,7 +179,7 @@ iphone_error_t iphone_mux_new_client(iphone_device_t device, uint16_t src_port, iphone_error_t iphone_mux_free_client(iphone_umux_client_t client) { if (!client || !client->phone) - return; + return IPHONE_E_INVALID_ARG; client->header->tcp_flags = 0x04; client->header->scnt = htonl(client->header->scnt); diff --git a/src/usbmux.h b/src/usbmux.h index 4b18e07..bea83f7 100644 --- a/src/usbmux.h +++ b/src/usbmux.h @@ -52,7 +52,7 @@ typedef struct { uint32_t type, length, major, minor, allnull; } usbmux_version_header; -usbmux_version_header *version_header(); +usbmux_version_header *version_header(void); #endif diff --git a/src/userpref.c b/src/userpref.c index b707957..3e5eb06 100644 --- a/src/userpref.c +++ b/src/userpref.c @@ -39,7 +39,7 @@ /** Creates a freedesktop compatible configuration directory for libiphone. */ -inline void create_config_dir() +static void create_config_dir(void) { gchar *config_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, NULL); @@ -56,7 +56,7 @@ inline void create_config_dir() * * @return The string containing the HostID or NULL */ -char *get_host_id() +char *get_host_id(void) { char *host_id = NULL; gchar *config_file; @@ -92,9 +92,6 @@ int is_device_known(char *uid) { int ret = 0; gchar *config_file; - GKeyFile *key_file; - gchar **devices_list, **pcur, *keyfilepath, *stored_key; - GIOChannel *keyfile; /* first get config file */ gchar *device_file = g_strconcat(uid, ".pem", NULL); @@ -143,7 +140,7 @@ int store_device_public_key(char *uid, gnutls_datum_t public_key) * * @return 1 if the file contents where read successfully and 0 otherwise. */ -int read_file_in_confdir(char *file, gnutls_datum_t * data) +static int read_file_in_confdir(const char *file, gnutls_datum_t * data) { gboolean success; gsize size; diff --git a/src/userpref.h b/src/userpref.h index 450549f..7e606eb 100644 --- a/src/userpref.h +++ b/src/userpref.h @@ -28,7 +28,7 @@ * * @return the HostID if exist in config file. Returns NULL otherwise. */ -char *get_host_id(); +char *get_host_id(void); /** * Determine if we already paired this device. |