From 9f66347bd3871f5bdefdeffc9c9b0ec44f44efd3 Mon Sep 17 00:00:00 2001 From: George Psimenos Date: Tue, 28 May 2019 15:58:19 +0100 Subject: [PATCH 1/2] Make buffer parameter const --- drivers/MbedCRC.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/MbedCRC.h b/drivers/MbedCRC.h index 60227e0826..a559627a79 100644 --- a/drivers/MbedCRC.h +++ b/drivers/MbedCRC.h @@ -146,7 +146,7 @@ public: * @param crc CRC is the output value * @return 0 on success, negative error code on failure */ - int32_t compute(void *buffer, crc_data_size_t size, uint32_t *crc) + int32_t compute(const void *buffer, crc_data_size_t size, uint32_t *crc) { MBED_ASSERT(crc != NULL); int32_t status = 0; @@ -193,7 +193,7 @@ public: * @note: CRC as output in compute_partial is not final CRC value, call `compute_partial_stop` * to get final correct CRC value. */ - int32_t compute_partial(void *buffer, crc_data_size_t size, uint32_t *crc) + int32_t compute_partial(const void *buffer, crc_data_size_t size, uint32_t *crc) { int32_t status = 0; From f82b7d8229136807421e9554edd344e5c55b4857 Mon Sep 17 00:00:00 2001 From: George Psimenos Date: Fri, 31 May 2019 13:59:40 +0100 Subject: [PATCH 2/2] Improve type cast --- drivers/MbedCRC.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/MbedCRC.h b/drivers/MbedCRC.h index a559627a79..3070f12c4a 100644 --- a/drivers/MbedCRC.h +++ b/drivers/MbedCRC.h @@ -200,7 +200,7 @@ public: switch (_mode) { #if DEVICE_CRC case HARDWARE: - hal_crc_compute_partial((uint8_t *)buffer, size); + hal_crc_compute_partial(static_cast(buffer), size); *crc = 0; break; #endif