From b200ab6f8fdd6a07fdc4f6bd3152fa5319fd6cf0 Mon Sep 17 00:00:00 2001 From: LibretroAdmin Date: Sat, 27 Aug 2022 09:07:55 +0200 Subject: [PATCH] Simplify code, and no longer have to deal with GCC suppression of warnings --- menu/menu_displaylist.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 425795fb29..91e408ef97 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -7798,6 +7798,10 @@ unsigned menu_displaylist_build_list( &sys_info->disk_control, i, image_label, sizeof(image_label)); + snprintf( + current_image_str, sizeof(current_image_str), + "%0*u", num_digits, i + 1); + /* Get string representation of disk index * > Note that displayed index starts at '1', * not '0' */ @@ -7805,19 +7809,11 @@ unsigned menu_displaylist_build_list( { /* Note: 2-space gap is intentional * (for clarity) */ - int n = snprintf( - current_image_str, sizeof(current_image_str), - "%0*u: %s", num_digits, i + 1, image_label); - - /* Suppress GCC warnings... */ - if ((n < 0) || (n >= PATH_MAX_LENGTH)) - n = 0; - (void)n; + strlcat(current_image_str, + ": ", sizeof(current_image_str)); + strlcat(current_image_str, + image_label, sizeof(current_image_str)); } - else - snprintf( - current_image_str, sizeof(current_image_str), - "%0*u", num_digits, i + 1); /* Add menu entry */ if (menu_entries_append_enum(list,