[v0.87][BUGFIX] Add checks to detect wrong ASCII arts. Fix ARM ASCII art

This commit is contained in:
Dr-Noob
2020-11-21 19:21:19 +01:00
parent 0b9f0e860c
commit 5b0cbd622f
2 changed files with 19 additions and 1 deletions

View File

@@ -52,6 +52,7 @@
\ \
\ \
\ \
\
############ ########## #### ###### ######## \ ############ ########## #### ###### ######## \
############### ######### ####################### \ ############### ######### ####################### \
#### #### #### ##### ####### ##### \ #### #### #### ##### ####### ##### \
@@ -63,6 +64,7 @@
\ \
\ \
\ \
\
" "
#define UNKNOWN_ASCII \ #define UNKNOWN_ASCII \
@@ -86,4 +88,11 @@
\ \
" "
static const char* ASCII_ARRAY [] = {
AMD_ASCII,
INTEL_ASCII,
ARM_ASCII,
UNKNOWN_ASCII
};
#endif #endif

View File

@@ -641,6 +641,15 @@ bool print_cpufetch_arm(struct ascii* art, struct cpuInfo* cpu, struct cache* ca
#endif #endif
bool print_cpufetch(struct cpuInfo* cpu, struct cache* cach, struct frequency* freq, struct topology* topo, STYLE s, struct colors* cs) { 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); struct ascii* art = set_ascii(get_cpu_vendor(cpu), s, cs);
if(art == NULL) if(art == NULL)
return false; return false;