Skip to content

Commit ff9343a

Browse files
marc-hbdbaluta
authored andcommitted
logger: convert: Fix compile time error with newer toolchain
Using Compiler version: aarch64-poky-linux-gcc (GCC) 13.2.0 we get the following error: tools/logger/convert.c: In function 'convert': tools/logger/convert.c:357:34: error: '%*s' directive output between 4294967264 and 4294967284 bytes exceeds 'INT_MAX' [-Werror=format-overflow=] | 357 | fprintf(out_fd, "%*s(us)%*s ", -ts_width, " TIMESTAMP", ts_width, "DELTA"); | | ^~~ ~~~~~~~~~~~~ | In file included from /opt/builds/OBNand/build/tmp/work/armv8a-poky-linux/sof-tools/2.8.0/recipe-sysroot/usr/include/stdio.h:964, | from /opt/builds/OBNand/build/tmp/work/armv8a-poky-linux/sof-tools/2.8.0/git/tools/logger/convert.h:13, | from /opt/builds/OBNand/build/tmp/work/armv8a-poky-linux/sof-tools/2.8.0/git/tools/logger/convert.c:21: | In function 'fprintf', Signed-off-by: Daniel Baluta <[email protected]> Signed-off-by: Marc Herbert <[email protected]>
1 parent c27eda7 commit ff9343a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tools/logger/convert.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static double to_usecs(uint64_t time)
318318
}
319319

320320
/** Justified timestamp width for printf format string */
321-
static unsigned int timestamp_width(unsigned int precision)
321+
static uint8_t timestamp_width(uint8_t precision)
322322
{
323323
/* 64bits yields less than 20 digits precision. As reported by
324324
* gcc 9.3, this avoids a very long precision causing snprintf()
@@ -352,7 +352,7 @@ static inline void print_table_header(void)
352352
}
353353

354354
if (global_config->time_precision >= 0) {
355-
const unsigned int ts_width = timestamp_width(global_config->time_precision);
355+
const uint8_t ts_width = timestamp_width(global_config->time_precision);
356356

357357
fprintf(out_fd, "%*s(us)%*s ", -ts_width, " TIMESTAMP", ts_width, "DELTA");
358358
}

tools/logger/convert.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct convert_config {
4141
int dump_ldc;
4242
int hide_location;
4343
int relative_timestamps;
44-
int time_precision;
44+
uint8_t time_precision;
4545
struct snd_sof_uids_header *uids_dict;
4646
struct snd_sof_logs_header *logs_header;
4747
};

0 commit comments

Comments
 (0)