From ef73add05ae2f59494204e1055af5beacad791b8 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sat, 16 May 2020 13:34:42 +0200 Subject: [PATCH] Warning fix on gcc 8.3.0 (#439) Fixes warning: assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow] Signed-off-by: Michele Santullo Co-authored-by: Michele Santullo --- src/moodbar/moodbarbuilder.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/moodbar/moodbarbuilder.cpp b/src/moodbar/moodbarbuilder.cpp index 3aaf74908..6dcbaf6bc 100644 --- a/src/moodbar/moodbarbuilder.cpp +++ b/src/moodbar/moodbarbuilder.cpp @@ -175,11 +175,8 @@ QByteArray MoodbarBuilder::Finish(int width) { for (int i = 0; i < width; ++i) { Rgb rgb; - int start = i * frames_.count() / width; - int end = (i + 1) * frames_.count() / width; - if (start == end) { - end = start + 1; - } + const int start = i * frames_.count() / width; + const int end = std::max((i + 1) * frames_.count() / width, start + 1); for (int j = start; j < end; j++) { const Rgb& frame = frames_[j];