From 5b0506e9de356f915138711b62f3e414a8c1b2bb Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sun, 18 Sep 2022 20:07:12 +0100 Subject: gui: Constify list title text Use const char* pointers for list titles. Only one debug menu actually modifies the title, and in that case it's legal to cast away const because the title points to a known mutable buffer on the stack. Change-Id: Idb8ab307b9a6ec23a93d8420c5e19fafd9f59c30 --- apps/debug_menu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apps/debug_menu.c') diff --git a/apps/debug_menu.c b/apps/debug_menu.c index f510597ad2..9c911eea4d 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1247,7 +1247,8 @@ static int disk_callback(int btn, struct gui_synclist *lists) int *cardnum = (int*)lists->data; unsigned char card_name[6]; unsigned char pbuf[32]; - char *title = lists->title; + /* Casting away const is safe; the buffer is defined as non-const. */ + char *title = (char *)lists->title; static const unsigned char i_vmin[] = { 0, 1, 5, 10, 25, 35, 60, 100 }; static const unsigned char i_vmax[] = { 1, 5, 10, 25, 35, 45, 80, 200 }; static const unsigned char * const kbit_units[] = { "kBit/s", "MBit/s", "GBit/s" }; -- cgit v1.2.3