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;
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);
+#include <assert.h>
#include <string.h>
#include <stdint.h>
#include <asm/byteorder.h>
* @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;
struct pb_protocol_message *message)
{
char *buf, *str;
- int len;
+ unsigned int len;
len = message->payload_len;
buf = message->payload;
pos += pb_protocol_serialise_string(pos, opt->boot_args);
}
+ assert(pos <= buf + buf_len);
+
return 0;
}
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 */
{
struct device *dev;
char *pos;
- int i, n_options, len;
+ int i, n_options;
+ unsigned int len;
len = message->payload_len;
pos = message->payload;