From 50120deb0159fcb53ee1a6caffb2bb81a1ecd990 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Mon, 24 Jun 2019 00:12:38 +0300 Subject: [PATCH] xz: list.c: Fix some warnings from -Wsign-conversion. --- src/xz/list.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/xz/list.c b/src/xz/list.c index 7d2df876..364e2c14 100644 --- a/src/xz/list.c +++ b/src/xz/list.c @@ -292,7 +292,7 @@ init_headings(void) // Calculate the field width for printf("%*s") so that // the string uses .columns number of columns on a terminal. - headings[i].fw = (int)(len + headings[i].columns - w); + headings[i].fw = (int)(len + (size_t)headings[i].columns - w); } return; @@ -870,9 +870,10 @@ print_info_adv(xz_file_info *xfi, file_pair *pair) // the actual check value as it is hexadecimal. However, to // print the column heading, further calculation is needed // to handle a translated string (it's done a few lines later). + assert(check_max <= LZMA_CHECK_SIZE_MAX); const int checkval_width = my_max( - (uint32_t)(headings[HEADING_CHECKVAL].columns), - 2 * check_max); + headings[HEADING_CHECKVAL].columns, + (int)(2 * check_max)); // All except Check are right aligned; Check is left aligned. printf(" %s\n %*s %*s %*s %*s %*s %*s %*s %-*s",