From fc662e02781122b29c03bceccd353ef1dc4ee850 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 14 May 2014 12:13:40 -0700 Subject: [PATCH] Use INT_MIN as the invalid click position sentinel rather than -1 --- src/audio_timing_dialogue.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/audio_timing_dialogue.cpp b/src/audio_timing_dialogue.cpp index b88696e44..1ad360e8b 100644 --- a/src/audio_timing_dialogue.cpp +++ b/src/audio_timing_dialogue.cpp @@ -616,7 +616,7 @@ std::vector AudioTimingControllerDialogue::OnLeftClick(int ms, boo std::vector ret; - clicked_ms = -1; + clicked_ms = INT_MIN; if (alt_down) { clicked_ms = ms; @@ -668,7 +668,7 @@ std::vector AudioTimingControllerDialogue::OnLeftClick(int ms, boo std::vector AudioTimingControllerDialogue::OnRightClick(int ms, bool, int sensitivity, int snap_range) { - clicked_ms = -1; + clicked_ms = INT_MIN; std::vector ret = GetRightMarkers(); SetMarkers(ret, ms, snap_range); return ret; @@ -689,7 +689,7 @@ void AudioTimingControllerDialogue::SetMarkers(std::vector const& { if (upd_markers.empty()) return; - int shift = clicked_ms >= 0 ? ms - clicked_ms : 0; + int shift = clicked_ms != INT_MIN ? ms - clicked_ms : 0; if (shift) clicked_ms = ms; // Since we're moving markers, the sorted list of markers will need to be @@ -717,12 +717,12 @@ void AudioTimingControllerDialogue::SetMarkers(std::vector const& for (auto upd_marker : upd_markers) { auto marker = static_cast(upd_marker); - marker->SetPosition(clicked_ms >= 0 ? *marker + shift : ms); + marker->SetPosition(clicked_ms != INT_MIN ? *marker + shift : ms); modified_lines.insert(marker->GetLine()); } int snap = SnapMarkers(snap_range, upd_markers); - if (clicked_ms >= 0) + if (clicked_ms != INT_MIN) clicked_ms += snap; // Resort the range