From ea007ada057a1fb687c8987b12acf401eec85c64 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Mon, 28 Sep 2020 23:01:42 +0200 Subject: [PATCH] suit: Mark conversion function arguments as const Small cleanup to mark arguments of the conversion functions for param to cbor and vice versa as const where possible --- sys/include/suit/handlers.h | 8 ++++---- sys/suit/handlers.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/include/suit/handlers.h b/sys/include/suit/handlers.h index 95529f927d..8ffdcd021a 100644 --- a/sys/include/suit/handlers.h +++ b/sys/include/suit/handlers.h @@ -207,8 +207,8 @@ int suit_handle_manifest_structure_bstr(suit_manifest_t *manifest, * @returns The offset of the nanocbor value inside the manifest * bytestring */ -uint16_t suit_param_ref_to_cbor(suit_manifest_t *manifest, - suit_param_ref_t *ref, +uint16_t suit_param_ref_to_cbor(const suit_manifest_t *manifest, + const suit_param_ref_t *ref, nanocbor_value_t *val); /** @@ -219,9 +219,9 @@ uint16_t suit_param_ref_to_cbor(suit_manifest_t *manifest, * @param ref reference to parse * @param val NanoCBOR value to restore */ -void suit_param_cbor_to_ref(suit_manifest_t *manifest, +void suit_param_cbor_to_ref(const suit_manifest_t *manifest, suit_param_ref_t *ref, - nanocbor_value_t *val); + const nanocbor_value_t *val); #ifdef __cplusplus } diff --git a/sys/suit/handlers.c b/sys/suit/handlers.c index e83782c05d..3bb68bba65 100644 --- a/sys/suit/handlers.c +++ b/sys/suit/handlers.c @@ -37,8 +37,8 @@ static suit_manifest_handler_t _get_handler(int key, return map[key]; } -uint16_t suit_param_ref_to_cbor(suit_manifest_t *manifest, - suit_param_ref_t *ref, +uint16_t suit_param_ref_to_cbor(const suit_manifest_t *manifest, + const suit_param_ref_t *ref, nanocbor_value_t *val) { size_t len = manifest->len - ref->offset; @@ -47,9 +47,9 @@ uint16_t suit_param_ref_to_cbor(suit_manifest_t *manifest, return ref->offset; } -void suit_param_cbor_to_ref(suit_manifest_t *manifest, +void suit_param_cbor_to_ref(const suit_manifest_t *manifest, suit_param_ref_t *ref, - nanocbor_value_t *val) + const nanocbor_value_t *val) { assert(val->cur >= manifest->buf); ref->offset = val->cur - manifest->buf;