less hardcoded sizes and more ARRAYLEN

This commit is contained in:
Philippe Teuwen
2019-07-31 23:44:53 +02:00
parent 74288ad128
commit f276dca3f1
16 changed files with 43 additions and 53 deletions

View File

@@ -40,10 +40,9 @@ static const PlusErrorsElm PlusErrors[] = {
{0x0f, "General Manipulation Error. Failure in the operation of the PICC (cannot write to the data block), etc."},
{0x90, "OK"},
};
int PlusErrorsLen = sizeof(PlusErrors) / sizeof(PlusErrorsElm);
const char *mfpGetErrorDescription(uint8_t errorCode) {
for (int i = 0; i < PlusErrorsLen; i++)
for (int i = 0; i < ARRAYLEN(PlusErrors); i++)
if (errorCode == PlusErrors[i].Code)
return PlusErrors[i].Description;

View File

@@ -13,8 +13,6 @@
#include <inttypes.h>
#define MIFARE_DEFAULTKEYS_SIZE sizeof(g_mifare_default_keys) / sizeof(uint64_t)
static const uint64_t g_mifare_default_keys[] = {
0xffffffffffff, // Default key (first key used by program if no user defined key)
0x000000000000, // Blank key