From 60aa76794a6bb16f24cd40915ed338f2a8144dfa Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:30:50 -0800 Subject: [PATCH] actually fix msvc compile issue --- app/dialog/speedduration/speeddurationdialog.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/dialog/speedduration/speeddurationdialog.cpp b/app/dialog/speedduration/speeddurationdialog.cpp index 56921b4c8..cf6af022a 100644 --- a/app/dialog/speedduration/speeddurationdialog.cpp +++ b/app/dialog/speedduration/speeddurationdialog.cpp @@ -95,20 +95,25 @@ SpeedDurationDialog::SpeedDurationDialog(const QVector &clips, cons start_reverse_ = clips.first()->reverse(); start_maintain_audio_pitch_ = clips.first()->maintain_audio_pitch(); for (int i=1; ispeed())) { + ClipBlock *c = clips.at(i); + + if (!qIsNaN(start_speed_) && !qFuzzyCompare(start_speed_, c->speed())) { // Speed differs per clip start_speed_ = qSNaN(); } - if (start_duration_ != -1 && clips.at(i)->length() != start_duration_) { + if (start_duration_ != -1 && c->length() != start_duration_) { start_duration_ = -1; } - if (clips.at(i)->reverse() != static_cast(start_reverse_)) { + // Yes, in theory a bool should only ever be 0 or 1 anyway, but MSVC complained and it is + // *possible* that a bool could be something else, so this code is safer + int clip_reverse = c->reverse() ? 1 : 0; + int clip_maintain_pitch = c->maintain_audio_pitch() ? 1 : 0; + if (start_reverse_ != -1 && clip_reverse != start_reverse_) { start_reverse_ = -1; } - - if (clips.at(i)->maintain_audio_pitch() != static_cast(start_maintain_audio_pitch_)) { + if (start_maintain_audio_pitch_ != -1 && clip_maintain_pitch != start_maintain_audio_pitch_) { start_maintain_audio_pitch_ = -1; } }