From 5b0cbd622f07e702dce2713e47e8483a7f006979 Mon Sep 17 00:00:00 2001 From: Dr-Noob Date: Sat, 21 Nov 2020 19:21:19 +0100 Subject: [PATCH] [v0.87][BUGFIX] Add checks to detect wrong ASCII arts. Fix ARM ASCII art --- src/common/ascii.h | 11 ++++++++++- src/common/printer.c | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/common/ascii.h b/src/common/ascii.h index 1dec889..cb97c74 100644 --- a/src/common/ascii.h +++ b/src/common/ascii.h @@ -52,6 +52,7 @@ \ \ \ + \ ############ ########## #### ###### ######## \ ############### ######### ####################### \ #### #### #### ##### ####### ##### \ @@ -63,7 +64,8 @@ \ \ \ - " + \ + " #define UNKNOWN_ASCII \ " \ @@ -85,5 +87,12 @@ \ \ " + +static const char* ASCII_ARRAY [] = { + AMD_ASCII, + INTEL_ASCII, + ARM_ASCII, + UNKNOWN_ASCII +}; #endif diff --git a/src/common/printer.c b/src/common/printer.c index ace28c8..317191a 100644 --- a/src/common/printer.c +++ b/src/common/printer.c @@ -641,6 +641,15 @@ bool print_cpufetch_arm(struct ascii* art, struct cpuInfo* cpu, struct cache* ca #endif bool print_cpufetch(struct cpuInfo* cpu, struct cache* cach, struct frequency* freq, struct topology* topo, STYLE s, struct colors* cs) { + // Sanity check of ASCII arts + for(int i=0; i < 4; i++) { + const char* ascii = ASCII_ARRAY[i]; + if(strlen(ascii) != (NUMBER_OF_LINES * LINE_SIZE)-1) { + printBug("ASCII art %d is wrong! ASCII length: %d, expected length: %d", i, strlen(ascii), (NUMBER_OF_LINES * LINE_SIZE)-1); + return false; + } + } + struct ascii* art = set_ascii(get_cpu_vendor(cpu), s, cs); if(art == NULL) return false;