From 5c2bf06ce0300580d4e7878e4faf5a530344ff75 Mon Sep 17 00:00:00 2001 From: Adrian Bonislawski Date: Tue, 6 Feb 2024 13:17:23 +0100 Subject: [PATCH] logger: convert: fix variable type for negative value time_precision variable can be used as -1 Fixes commit ff9343aa4a59 ("logger: convert: Fix compile time error with newer toolchain") Signed-off-by: Adrian Bonislawski --- tools/logger/convert.c | 6 +++--- tools/logger/convert.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/logger/convert.c b/tools/logger/convert.c index 7de47f97075b..19824ac5a3b3 100644 --- a/tools/logger/convert.c +++ b/tools/logger/convert.c @@ -318,7 +318,7 @@ static double to_usecs(uint64_t time) } /** Justified timestamp width for printf format string */ -static uint8_t timestamp_width(uint8_t precision) +static int8_t timestamp_width(int8_t precision) { /* 64bits yields less than 20 digits precision. As reported by * gcc 9.3, this avoids a very long precision causing snprintf() @@ -352,7 +352,7 @@ static inline void print_table_header(void) } if (global_config->time_precision >= 0) { - const uint8_t ts_width = timestamp_width(global_config->time_precision); + const int8_t ts_width = timestamp_width(global_config->time_precision); fprintf(out_fd, "%*s(us)%*s ", -ts_width, " TIMESTAMP", ts_width, "DELTA"); } @@ -532,7 +532,7 @@ static void print_entry_params(const struct log_entry_header *dma_log, entry->header.line_idx); } else { if (time_precision >= 0) { - const unsigned int ts_width = timestamp_width(time_precision); + const int8_t ts_width = timestamp_width(time_precision); fprintf(out_fd, "%s[%*.*f] (%*.*f)%s ", use_colors ? KGRN : "", diff --git a/tools/logger/convert.h b/tools/logger/convert.h index 8117e023b2f9..a870c990b9e4 100644 --- a/tools/logger/convert.h +++ b/tools/logger/convert.h @@ -41,7 +41,7 @@ struct convert_config { int dump_ldc; int hide_location; int relative_timestamps; - uint8_t time_precision; + int8_t time_precision; struct snd_sof_uids_header *uids_dict; struct snd_sof_logs_header *logs_header; };