From 2011c515c8d3d50ca632d7663705e7cfe8103506 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 20 Jun 2012 18:37:13 -0300 Subject: [PATCH] fw/: pass limit also to "first" function of protocol handlers --- fw/dispatch.c | 2 +- fw/dispatch.h | 2 +- fw/image.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fw/dispatch.c b/fw/dispatch.c index a328a06..4190a01 100644 --- a/fw/dispatch.c +++ b/fw/dispatch.c @@ -79,7 +79,7 @@ bool dispatch(const uint8_t *buf, uint8_t len, const struct handler **protos) } if (!*protos) return 0; - if (!(*protos)->first(buf+3)) + if (!(*protos)->first(buf[2], buf+3)) return 0; curr_proto = *protos; type = buf[0]; diff --git a/fw/dispatch.h b/fw/dispatch.h index 57fb675..7529743 100644 --- a/fw/dispatch.h +++ b/fw/dispatch.h @@ -21,7 +21,7 @@ struct handler { enum pck_type type; - bool (*first)(const uint8_t *payload); + bool (*first)(uint8_t limit, const uint8_t *payload); bool (*more)(uint8_t seq, uint8_t limit, const uint8_t *payload); }; diff --git a/fw/image.c b/fw/image.c index f5961b9..e02d8f9 100644 --- a/fw/image.c +++ b/fw/image.c @@ -61,7 +61,7 @@ static void add_payload(const uint8_t *payload) } -static bool image_first(const uint8_t *payload) +static bool image_first(uint8_t limit, const uint8_t *payload) { hash_init(); hash_merge(image_secret, sizeof(image_secret));