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 <m.santullo@posteo.net>

Co-authored-by: Michele Santullo <m.santullo@posteo.net>
This commit is contained in:
King_DuckZ 2020-05-16 13:34:42 +02:00 committed by GitHub
parent ec3d11fb27
commit ef73add05a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -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];