Skip to content

Commit

Permalink
Merge branch 'fix-multiplexer-iterator'
Browse files Browse the repository at this point in the history
* fix-multiplexer-iterator:
  ASE: queuemux.hh: properly check for more() in iterator equality operator
  ASE: midievent.cc: show hex dump for unknown events

Signed-off-by: Tim Janik <[email protected]>
  • Loading branch information
tim-janik committed Nov 17, 2023
2 parents 8f23a2d + b63bb57 commit 4756546
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion ase/midievent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ MidiEvent::to_string () const
case SYSEX: if (!et) et = "SYSEX";
return string_format ("%+4d %s (unhandled)", frame, et);
}
return string_format ("%+4d MidiEvent-%u (unhandled)", frame, type);
static_assert (sizeof (MidiEvent) >= 2 * sizeof (uint64_t));
const uint64_t *uu = reinterpret_cast<const uint64_t*> (this);
return string_format ("%+4d MidiEvent-%u (%08x %08x)", frame, type, uu[0], uu[1]);
}

MidiEvent
Expand Down
4 changes: 2 additions & 2 deletions ase/queuemux.hh
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ struct QueueMultiplexer {
using reference = const value_type&;
using iterator_category = std::input_iterator_tag;
/*ctor*/ Iter (QueueMultiplexer *u = nullptr) : mux_ (u && u->more() ? u : nullptr) {}
bool oob () const { return !mux_; }
friend bool operator== (const Iter &a, const Iter &b) { return a.mux_ == b.mux_; }
bool more () const { return mux_ && mux_->more(); }
friend bool operator== (const Iter &a, const Iter &b) { return a.more() == b.more(); }
value_type& operator* () const { return mux_ ? mux_->peek() : empty(); }
Iter operator++ (int) { Iter copy (*this); this->operator++(); return copy; }
Iter& operator++ ()
Expand Down

0 comments on commit 4756546

Please sign in to comment.