1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

UMPIterator: Fix misleading variable naming

This commit is contained in:
reuk 2025-03-05 20:31:49 +00:00
parent 51e5820cd3
commit 85191fa50a
No known key found for this signature in database
2 changed files with 8 additions and 8 deletions

View file

@ -35,10 +35,10 @@
namespace juce::universal_midi_packets namespace juce::universal_midi_packets
{ {
Iterator::Iterator (const uint32_t* ptr, [[maybe_unused]] size_t bytes) noexcept Iterator::Iterator (const uint32_t* ptr, [[maybe_unused]] size_t words) noexcept
: view (ptr) : view (ptr)
#if JUCE_DEBUG #if JUCE_DEBUG
, bytesRemaining (bytes) , wordsRemaining (words)
#endif #endif
{ {
} }

View file

@ -52,7 +52,7 @@ public:
Iterator() noexcept = default; Iterator() noexcept = default;
/** Creates an iterator pointing at `ptr`. */ /** Creates an iterator pointing at `ptr`. */
explicit Iterator (const uint32_t* ptr, size_t bytes) noexcept; explicit Iterator (const uint32_t* ptr, size_t words) noexcept;
using difference_type = std::iterator_traits<const uint32_t*>::difference_type; using difference_type = std::iterator_traits<const uint32_t*>::difference_type;
using value_type = View; using value_type = View;
@ -69,8 +69,8 @@ public:
// If you hit this, the memory region contained a truncated or otherwise // If you hit this, the memory region contained a truncated or otherwise
// malformed Universal MIDI Packet. // malformed Universal MIDI Packet.
// The Iterator can only be used on regions containing complete packets! // The Iterator can only be used on regions containing complete packets!
jassert (increment <= bytesRemaining); jassert (increment <= wordsRemaining);
bytesRemaining -= increment; wordsRemaining -= increment;
#endif #endif
view = View (view.data() + increment); view = View (view.data() + increment);
@ -109,20 +109,20 @@ public:
The View can be queried for its size and content. The View can be queried for its size and content.
*/ */
reference operator*() noexcept { return view; } reference operator*() const noexcept { return view; }
/** Returns a pointer to a View of the packet currently /** Returns a pointer to a View of the packet currently
pointed-to by this iterator. pointed-to by this iterator.
The View can be queried for its size and content. The View can be queried for its size and content.
*/ */
pointer operator->() noexcept { return &view; } pointer operator->() const noexcept { return &view; }
private: private:
View view; View view;
#if JUCE_DEBUG #if JUCE_DEBUG
size_t bytesRemaining = 0; size_t wordsRemaining = 0;
#endif #endif
}; };