]> git.ozlabs.org Git - petitboot/commitdiff
Fix build warnings
authorGeoff Levand <geoffrey.levand@am.sony.com>
Tue, 13 Jan 2009 01:31:56 +0000 (17:31 -0800)
committerJeremy Kerr <jk@ozlabs.org>
Sun, 1 Feb 2009 00:16:36 +0000 (11:16 +1100)
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 <geoffrey.levand@am.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/device-handler.c
discover/discover-server.c
discover/log.c
discover/log.h
discover/paths.c
discover/pb-discover.c
lib/pb-protocol/pb-protocol.c

index c7e0227f242529d0673c22655c4064a5daf8e930..8d3e877ad2379b661379a13fa28998127b3e5ecc 100644 (file)
@@ -377,7 +377,7 @@ int device_handler_event(struct device_handler *handler,
 struct device_handler *device_handler_init(struct discover_server *server)
 {
        struct device_handler *handler;
-       int i;
+       unsigned int i;
 
        handler = talloc(NULL, struct device_handler);
        handler->devices = NULL;
index 8ec1949121fd76f89819fc635c7b530f4ecd03c1..8d7283811eb0af721404f85c90a7891cb522a157 100644 (file)
@@ -18,6 +18,7 @@
 #include "log.h"
 #include "waiter.h"
 #include "device-handler.h"
+#include "discover-server.h"
 
 struct discover_server {
        int socket;
index 189f31eb401890d9bf53af6a56e810694b9b7856..e006fd0b1495c34867648ae58ff047113de751a6 100644 (file)
@@ -1,6 +1,5 @@
 
 #include <stdarg.h>
-#include <stdio.h>
 
 #include "log.h"
 
index 7f9b01fdbfa3bf6e68cc2f9d59f75de6e001ee8e..3e92555a12c62a104694860faa3fa9419c1bfec4 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef _LOG_H
 #define _LOG_H
 
+#include <stdio.h>
+
 void pb_log(const char *fmt, ...);
+void pb_log_set_stream(FILE *stream);
 
 #endif /* _LOG_H */
index 72d07b20c4cee09b354510558e4558e405e4b828..5b550fabb2460537a868c33ed784fed1ff7c9582 100644 (file)
@@ -35,7 +35,7 @@ const char *mount_base(void)
 char *encode_label(void *alloc_ctx, const char *label)
 {
        char *str, *c;
-       int i;
+       unsigned int i;
 
        /* the label can be expanded by up to four times */
        str = talloc_size(alloc_ctx, strlen(label) * 4 + 1);
index 024cb303fb9f6da4dfb4dd0204c59d12425a213a..56602d95d015b24b74c6976b60099993823ef745 100644 (file)
@@ -10,7 +10,7 @@
 
 static int running;
 
-void sigint_handler(int signum)
+static void sigint_handler(int __attribute__((unused)) signum)
 {
        running = 0;
 }
index 4981e95ef5a7b152d8a2f4d8b09f6c91c2adb4a0..d5f8b2f80a667fe058b27dec706a33f0bd6f86f6 100644 (file)
@@ -1,4 +1,5 @@
 
+#include <assert.h>
 #include <string.h>
 #include <stdint.h>
 #include <asm/byteorder.h>
@@ -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;