From bcc8a059783c11fa66bd97eea8556df07444d8fb Mon Sep 17 00:00:00 2001 From: Thomas Stibor Date: Mon, 13 Apr 2020 19:21:22 +0200 Subject: [PATCH] Determine correct size of TICKER_CHARACTER_COUNT Since tickerCharacters is a char pointer rather than a char array the result is: sizeof(8) / sizeof(1). However, desired result is: sizeof(5) / sizeof(1). See also following example: const char *tickerCharacters = "|/-\\"; const char _tickerCharacters[] = "|/-\\"; int main(void) { printf("%zu\n", (sizeof(tickerCharacters) / sizeof(char))); printf("%zu\n", (sizeof(_tickerCharacters) / sizeof(char))); return 0; } > gcc test.c -o test && ./test 8 5 --- src/main/io/dashboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/dashboard.c b/src/main/io/dashboard.c index bbb53b3d24..384de9cde3 100644 --- a/src/main/io/dashboard.c +++ b/src/main/io/dashboard.c @@ -104,7 +104,7 @@ typedef struct pageEntry_s { uint8_t flags; } pageEntry_t; -static const char* tickerCharacters = "|/-\\"; // use 2/4/8 characters so that the divide is optimal. +static const char tickerCharacters[] = "|/-\\"; // use 2/4/8 characters so that the divide is optimal. #define TICKER_CHARACTER_COUNT (sizeof(tickerCharacters) / sizeof(char)) typedef enum {