From 9793f862467407e83aa5b5a2cc35c25de9bae17b Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Mon, 12 Jan 2009 17:31:56 -0800 Subject: Fix build warnings Fix various minor build warnings: lib/pb-protocol/pb-protocol.c:72: warning: comparison between signed and unsigned lib/pb-protocol/pb-protocol.c:78: warning: comparison between signed and unsigned lib/pb-protocol/pb-protocol.c:141: warning: unused parameter 'buf_len' lib/pb-protocol/pb-protocol.c:241: warning: comparison between signed and unsigned discover/pb-discover.c:14: warning: no previous prototype for 'sigint_handler' discover/pb-discover.c:13: warning: unused parameter 'signum' discover/log.c:22: warning: no previous prototype for 'pb_log_set_stream' discover/discover-server.c:159: warning: no previous prototype for 'discover_server_notify_add' discover/discover-server.c:169: warning: no previous prototype for 'discover_server_notify_remove' discover/discover-server.c:179: warning: no previous prototype for 'discover_server_set_device_source' discover/discover-server.c:184: warning: no previous prototype for 'discover_server_init' discover/discover-server.c:229: warning: no previous prototype for 'discover_server_destroy' discover/device-handler.c:395: warning: comparison between signed and unsigned discover/paths.c:44: warning: comparison between signed and unsigned Signed-off-by: Geoff Levand Signed-off-by: Jeremy Kerr --- lib/pb-protocol/pb-protocol.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/pb-protocol') diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 4981e95..d5f8b2f 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -1,4 +1,5 @@ +#include #include #include #include @@ -65,7 +66,7 @@ int pb_protocol_serialise_string(char *pos, const char *str) * @param[out] str Pointer to resuling string * @return zero on success, non-zero on failure */ -static int read_string(void *ctx, char **pos, int *len, char **str) +static int read_string(void *ctx, char **pos, unsigned int *len, char **str) { uint32_t str_len, read_len; @@ -96,7 +97,7 @@ char *pb_protocol_deserialise_string(void *ctx, struct pb_protocol_message *message) { char *buf, *str; - int len; + unsigned int len; len = message->payload_len; buf = message->payload; @@ -172,6 +173,8 @@ int pb_protocol_serialise_device(struct device *dev, char *buf, int buf_len) pos += pb_protocol_serialise_string(pos, opt->boot_args); } + assert(pos <= buf + buf_len); + return 0; } @@ -221,7 +224,8 @@ struct pb_protocol_message *pb_protocol_create_message(void *ctx, struct pb_protocol_message *pb_protocol_read_message(void *ctx, int fd) { struct pb_protocol_message *message, m; - int rc, len; + int rc; + unsigned int len; /* use the stack for the initial 8-byte read */ @@ -258,7 +262,8 @@ struct device *pb_protocol_deserialise_device(void *ctx, { struct device *dev; char *pos; - int i, n_options, len; + int i, n_options; + unsigned int len; len = message->payload_len; pos = message->payload; -- cgit v1.2.1