From 0435f257c9a193e2ee4b3bd0fd1fea4ebf03c381 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Mon, 31 Dec 2018 22:11:54 +1100 Subject: [PATCH] add braces to some multi-line if() and for() Coverity complained about this code --- fills.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fills.c b/fills.c index ea586476..52c51c8e 100644 --- a/fills.c +++ b/fills.c @@ -758,14 +758,16 @@ static i_color interp_i_color(i_color before, i_color after, double pos, pos -= floor(pos); for (ch = 0; ch < channels; ++ch) out.channel[ch] = (1-pos) * before.channel[ch] + pos * after.channel[ch]; - if (channels > 3 && out.channel[3]) - for (ch = 0; ch < channels; ++ch) + if (channels > 3 && out.channel[3]) { + for (ch = 0; ch < channels; ++ch) { if (ch != 3) { int temp = out.channel[ch] * 255 / out.channel[3]; if (temp > 255) temp = 255; out.channel[ch] = temp; } + } + } return out; } @@ -780,14 +782,16 @@ static i_fcolor interp_i_fcolor(i_fcolor before, i_fcolor after, double pos, pos -= floor(pos); for (ch = 0; ch < channels; ++ch) out.channel[ch] = (1-pos) * before.channel[ch] + pos * after.channel[ch]; - if (out.channel[3]) - for (ch = 0; ch < channels; ++ch) + if (out.channel[3]) { + for (ch = 0; ch < channels; ++ch) { if (ch != 3) { int temp = out.channel[ch] / out.channel[3]; if (temp > 1.0) temp = 1.0; out.channel[ch] = temp; } + } + } return out; } -- 2.30.2