From 3cc56c5900e7f79cb66108f7e3310588b30c9576 Mon Sep 17 00:00:00 2001 From: Dr-Noob Date: Tue, 10 Aug 2021 11:22:30 +0200 Subject: [PATCH] [v0.99][ARM] Special case of longest_field_length for ARM, which adds two spaces in some fields --- src/common/printer.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/common/printer.c b/src/common/printer.c index a3d42db..3a7026f 100644 --- a/src/common/printer.c +++ b/src/common/printer.c @@ -515,6 +515,27 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct color** cs, struct #endif #ifdef ARCH_ARM +uint32_t longest_field_length_arm(struct ascii* art, int la) { + uint32_t max = 0; + uint64_t len = 0; + + for(uint32_t i=0; i < art->n_attributes_set; i++) { + if(art->attributes[i]->value != NULL) { + // longest attribute + 1 (space) + longest value + len = la + 1 + strlen(art->attributes[i]->value); + if(art->attributes[i]->type == ATTRIBUTE_UARCH || + art->attributes[i]->type == ATTRIBUTE_FREQUENCY || + art->attributes[i]->type == ATTRIBUTE_NCORES || + art->attributes[i]->type == ATTRIBUTE_FEATURES) { + len += 2; + } + if(len > max) max = len; + } + } + + return max; +} + void print_ascii_arm(struct ascii* art, uint32_t la) { struct ascii_logo* logo = art->art; int attr_to_print = 0; @@ -658,7 +679,7 @@ bool print_cpufetch_arm(struct cpuInfo* cpu, STYLE s, struct color** cs, struct } uint32_t longest_attribute = longest_attribute_length(art); - uint32_t longest_field = longest_field_length(art, longest_attribute); + uint32_t longest_field = longest_field_length_arm(art, longest_attribute); choose_ascii_art(art, cs, term, longest_field); struct ascii_logo* logo = art->art;