From: Karel Zak Date: Fri, 3 Jul 2020 11:17:51 +0000 (+0200) Subject: cal: use size_t to calculate width [lgtm scan] X-Git-Tag: v2.36-rc2~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7586e9d1aa3d054efc0a4c959c41be98660072b0;p=thirdparty%2Futil-linux.git cal: use size_t to calculate width [lgtm scan] We use size_t for width. This patch makes it consistent for years_width too. Signed-off-by: Karel Zak --- diff --git a/misc-utils/cal.c b/misc-utils/cal.c index d2d68162a0..0834be2bd5 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -1057,10 +1057,10 @@ static void monthly(const struct cal_control *ctl) static void yearly(const struct cal_control *ctl) { char out[FMT_ST_CHARS]; - int year_width; + size_t year_width; - year_width = ctl->months_in_row * (ctl->week_width) + - (ctl->months_in_row - 1) * ctl->gutter_width; + year_width = (size_t) ctl->months_in_row * ctl->week_width + + ((size_t) ctl->months_in_row - 1) * ctl->gutter_width; if (ctl->header_year) { snprintf(out, sizeof(out), "%04d", ctl->req.year);