From 048291dcb3ea6580699ff48b8d5614cbeb4ec3b0 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 15 Jan 2023 02:12:19 +0100 Subject: [PATCH] cppcheck: can add const on some params --- client/src/cmdhfmfdes.c | 4 ++-- client/src/cmdhftopaz.c | 2 +- client/src/util.c | 2 +- client/src/util.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index f3da73c2c..00c6306e7 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -306,7 +306,7 @@ static nxp_cardtype_t getCardType(uint8_t major, uint8_t minor) { } // ref: https://www.nxp.com/docs/en/application-note/AN12343.pdf p7 -static nxp_producttype_t getProductType(uint8_t *versionhw) { +static nxp_producttype_t getProductType(const uint8_t *versionhw) { uint8_t product = versionhw[2]; @@ -323,7 +323,7 @@ static nxp_producttype_t getProductType(uint8_t *versionhw) { return DESFIRE_UNKNOWN_PROD; } -static const char *getProductTypeStr(uint8_t *versionhw) { +static const char *getProductTypeStr(const uint8_t *versionhw) { uint8_t product = versionhw[2]; diff --git a/client/src/cmdhftopaz.c b/client/src/cmdhftopaz.c index a59cd02be..6311b50ed 100644 --- a/client/src/cmdhftopaz.c +++ b/client/src/cmdhftopaz.c @@ -292,7 +292,7 @@ static bool topaz_byte_is_locked(uint16_t byteno) { } } -static int topaz_set_cc_dynamic(uint8_t *data) { +static int topaz_set_cc_dynamic(const uint8_t *data) { if (data[0] != 0xE1) { topaz_tag.size = TOPAZ_STATIC_MEMORY; diff --git a/client/src/util.c b/client/src/util.c index dc58eef2c..63141d01c 100644 --- a/client/src/util.c +++ b/client/src/util.c @@ -1247,7 +1247,7 @@ inline uint64_t leadingzeros64(uint64_t a) { } -int byte_strstr(uint8_t *src, size_t srclen, uint8_t *pattern, size_t plen) { +int byte_strstr(const uint8_t *src, size_t srclen, const uint8_t *pattern, size_t plen) { size_t max = srclen - plen + 1; diff --git a/client/src/util.h b/client/src/util.h index d831a750b..c29fbd50f 100644 --- a/client/src/util.h +++ b/client/src/util.h @@ -148,7 +148,7 @@ uint64_t bitcount64(uint64_t a); uint32_t leadingzeros32(uint32_t a); uint64_t leadingzeros64(uint64_t a); -int byte_strstr(uint8_t *src, size_t srclen, uint8_t *pattern, size_t plen); +int byte_strstr(const uint8_t *src, size_t srclen, const uint8_t *pattern, size_t plen); struct smartbuf { char *ptr;