attempt to be compliant with gcc 4.6 (assuming that its more compliant with standards...
[ardour.git] / libs / evoral / src / Sequence.cpp
index d7ae73c0569e976b6dff9137d0bbe0ed9c53b82b..3c1bda9b964f0d62af7c549ca35aa0bcb5d05698 100644 (file)
@@ -75,13 +75,11 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t
 {
        DEBUG_TRACE (DEBUG::Sequence, string_compose ("Created Iterator @ %1 (is end: %2)\n)", t, _is_end));
 
-       if (!_is_end) {
-               _lock = seq.read_lock();
-       } else {
+       if (_is_end) {
                return;
        }
 
-       typename Sequence<Time>::ReadLock lock(seq.read_lock());
+       _lock = seq.read_lock();
 
        // Find first note which begins at or after t
        _note_iter = seq.note_lower_bound(t);
@@ -434,10 +432,11 @@ Sequence<Time>::const_iterator::operator=(const const_iterator& other)
        _force_discrete = other._force_discrete;
        _active_patch_change_message = other._active_patch_change_message;
 
-       if (other._lock)
+       if (other._lock) {
                _lock = _seq->read_lock();
-       else
+       } else {
                _lock.reset();
+       }
 
        if (other._control_iter == other._control_iters.end()) {
                _control_iter = _control_iters.end();
@@ -819,10 +818,10 @@ Sequence<Time>::append(const Event<Time>& event, event_id_t evid)
        } else if (ev.is_cc() && (ev.cc_number() == MIDI_CTL_MSB_BANK || ev.cc_number() == MIDI_CTL_LSB_BANK)) {
                /* note bank numbers in our _bank[] array, so that we can write an event when the program change arrives */
                if (ev.cc_number() == MIDI_CTL_MSB_BANK) {
-                       _bank[ev.channel()] &= (0x7f << 7);
+                       _bank[ev.channel()] &= ~(0x7f << 7);
                        _bank[ev.channel()] |= ev.cc_value() << 7;
                } else {
-                       _bank[ev.channel()] &= 0x7f;
+                       _bank[ev.channel()] &= ~0x7f;
                        _bank[ev.channel()] |= ev.cc_value();
                }
         } else if (ev.is_cc()) {