From: Petr Štetiar Date: Wed, 10 Apr 2019 09:05:57 +0000 (+0200) Subject: Iron out all extra compiler warnings X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=24f9dc71a624cecd67c181cec77b4101038a39d9;p=oweals%2Fumbim.git Iron out all extra compiler warnings mbim-msg.c:83:17: error: comparison between signed and unsigned integer expressions cli.c:50:10: error: comparison between signed and unsigned integer expressions cli.c:81:10: error: comparison between signed and unsigned integer expressions cli.c:104:10: error: comparison between signed and unsigned integer expressions cli.c:140:10: error: comparison between signed and unsigned integer expressions cli.c:154:18: error: comparison between signed and unsigned integer expressions cli.c:171:10: error: comparison between signed and unsigned integer expressions cli.c:194:10: error: comparison between signed and unsigned integer expressions cli.c:223:10: error: comparison between signed and unsigned integer expressions cli.c:229:17: error: comparison between signed and unsigned integer expressions cli.c:241:17: error: comparison between signed and unsigned integer expressions cli.c:247:17: error: comparison between signed and unsigned integer expressions cli.c:259:17: error: comparison between signed and unsigned integer expressions cli.c:272:10: error: comparison between signed and unsigned integer expressions cli.c:549:16: error: comparison between signed and unsigned integer expressions mbim-dev.c:68:21: error: comparison between signed and unsigned integer expressions mbim-dev.c:97:10: error: comparison between signed and unsigned integer expressions Reviewed-by: Bjørn Mork Signed-off-by: Petr Štetiar --- diff --git a/cli.c b/cli.c index 3089d16..19f36f4 100644 --- a/cli.c +++ b/cli.c @@ -42,7 +42,7 @@ static int _argc; static char **_argv; static int -mbim_device_caps_response(void *buffer, int len) +mbim_device_caps_response(void *buffer, size_t len) { struct mbim_basic_connect_device_caps_r *caps = (struct mbim_basic_connect_device_caps_r *) buffer; char *deviceid, *firmwareinfo, *hardwareinfo; @@ -74,7 +74,7 @@ mbim_device_caps_response(void *buffer, int len) } static int -mbim_pin_state_response(void *buffer, int len) +mbim_pin_state_response(void *buffer, size_t len) { struct mbim_basic_connect_pin_r *pin = (struct mbim_basic_connect_pin_r *) buffer; @@ -96,7 +96,7 @@ mbim_pin_state_response(void *buffer, int len) } static int -mbim_registration_response(void *buffer, int len) +mbim_registration_response(void *buffer, size_t len) { struct mbim_basic_connect_register_state_r *state = (struct mbim_basic_connect_register_state_r *) buffer; char *provider_id, *provider_name, *roamingtext; @@ -131,11 +131,11 @@ mbim_registration_response(void *buffer, int len) } static int -mbim_subscriber_response(void *buffer, int len) +mbim_subscriber_response(void *buffer, size_t len) { struct mbim_basic_connect_subscriber_ready_status_r *state = (struct mbim_basic_connect_subscriber_ready_status_r *) buffer; char *subscriberid, *simiccid; - int nr; + unsigned int nr; if (len < sizeof(struct mbim_basic_connect_subscriber_ready_status_r)) { fprintf(stderr, "message not long enough\n"); @@ -164,7 +164,7 @@ mbim_subscriber_response(void *buffer, int len) } static int -mbim_attach_response(void *buffer, int len) +mbim_attach_response(void *buffer, size_t len) { struct mbim_basic_connect_packet_service_r *ps = (struct mbim_basic_connect_packet_service_r *) buffer; @@ -187,7 +187,7 @@ mbim_attach_response(void *buffer, int len) } static int -mbim_connect_response(void *buffer, int len) +mbim_connect_response(void *buffer, size_t len) { struct mbim_basic_connect_connect_r *c = (struct mbim_basic_connect_connect_r *) buffer; @@ -213,11 +213,11 @@ mbim_connect_response(void *buffer, int len) } static int -mbim_config_response(void *buffer, int len) +mbim_config_response(void *buffer, size_t len) { struct mbim_basic_connect_ip_configuration_r *ip = (struct mbim_basic_connect_ip_configuration_r *) buffer; char out[40]; - int i; + unsigned int i; uint32_t offset; if (len < sizeof(struct mbim_basic_connect_ip_configuration_r)) { @@ -265,7 +265,7 @@ mbim_config_response(void *buffer, int len) } static int -mbim_radio_response(void *buffer, int len) +mbim_radio_response(void *buffer, size_t len) { struct mbim_basic_connect_radio_state_r *r = (struct mbim_basic_connect_radio_state_r *) buffer; @@ -507,7 +507,8 @@ int main(int argc, char **argv) { char *cmd, *device = NULL; - int no_open = 0, ch, i; + int no_open = 0, ch; + unsigned int i; #ifdef LIBQMI_MBIM_PROXY int proxy = 0; #endif diff --git a/mbim-dev.c b/mbim-dev.c index 170de2d..2a94d49 100644 --- a/mbim-dev.c +++ b/mbim-dev.c @@ -56,7 +56,7 @@ int mbim_send(void) { struct mbim_message_header *hdr = (struct mbim_message_header *) mbim_buffer; - int ret = 0; + unsigned int ret = 0; if (le32toh(hdr->length) > mbim_bufsize) { fprintf(stderr, "message too big %d\n", le32toh(hdr->length)); @@ -94,7 +94,7 @@ mbim_recv(struct uloop_fd *u, unsigned int events) if (cnt < 0) return; - if (cnt < sizeof(struct mbim_message_header)) { + if (cnt < (ssize_t) sizeof(struct mbim_message_header)) { perror("failed to read() data: "); return; } diff --git a/mbim-msg.c b/mbim-msg.c index 3413f5d..5ec04f4 100644 --- a/mbim-msg.c +++ b/mbim-msg.c @@ -74,7 +74,7 @@ char * mbim_get_string(struct mbim_string *str, char *in) { char *p = &in[le32toh(str->offset)]; - int i; + unsigned int i; if (!le32toh(str->offset)) return NULL; diff --git a/mbim-msg.h b/mbim-msg.h index 2957abb..e22ff63 100644 --- a/mbim-msg.h +++ b/mbim-msg.h @@ -79,7 +79,7 @@ struct indicate_status_message { } __attribute__((packed)); typedef int (*_mbim_cmd_request)(void); -typedef int (*_mbim_cmd_response)(void *buffer, int len); +typedef int (*_mbim_cmd_response)(void *buffer, size_t len); extern uint8_t basic_connect[16]; extern int transaction_id;