Skip to content

Commit

Permalink
pre-commit: updates
Browse files Browse the repository at this point in the history
* fix readme
* update clang-format to 17.0.4
* update pre-commit
  • Loading branch information
timblechmann committed Nov 7, 2023
1 parent 84cc0aa commit b34b89e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
Expand All @@ -10,7 +10,7 @@ repos:


- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
rev: v17.0.4
hooks:
- id: clang-format
types_or: [c++, c]
4 changes: 0 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ Install `pre-commit` using Python `pip` or the packet manager of your choice:
# apt on Ubuntu
apt install pre-commit

Additionally you have to install the clang-format wheel:

pip install clang-format

Install the pre-commit hooks in the local checkout:

cd path/to/ni-midi2
Expand Down
20 changes: 12 additions & 8 deletions inc/midi/extended_data_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ struct sysex8_packet : extended_data_message
constexpr packet_format format() const { return packet_format((status() >> 4) & 0b11); }

constexpr uint8_t stream_id() const { return get_byte(2); }
constexpr void set_stream_id(uint8_t);
constexpr void set_stream_id(uint8_t);

constexpr uint8_t payload_byte(size_t b) const { return get_byte(3 + b); }
constexpr void set_payload_byte(size_t, uint8_t);
constexpr void set_payload_byte(size_t, uint8_t);

constexpr size_t payload_size() const;
constexpr void set_payload_size(size_t);
constexpr void set_payload_size(size_t);

constexpr void add_payload_byte(uint8_t);
};
Expand All @@ -84,7 +84,7 @@ struct sysex8_packet_view

constexpr group_t group() const { return p.group(); }
constexpr packet_format format() const { return packet_format((p.status() >> 4) & 0b11); }
constexpr uint8_t stream_id() const { return p.get_byte(2); }
constexpr uint8_t stream_id() const { return p.get_byte(2); }
constexpr size_t payload_size() const;
constexpr uint8_t payload_byte(size_t b) const { return p.get_byte(3 + b); }

Expand Down Expand Up @@ -118,10 +118,13 @@ constexpr extended_data_message::extended_data_message(status_t status)

//--------------------------------------------------------------------------

constexpr sysex8_packet::sysex8_packet() { data[0] |= 0x00010000u; }
constexpr sysex8_packet::sysex8_packet()
{
data[0] |= 0x00010000u;
}
constexpr sysex8_packet::sysex8_packet(status_t status, uint8_t stream_id, group_t group)
{
data[0] = 0x50010000u | (group << 24)| (status << 16) | (stream_id << 8);
data[0] = 0x50010000u | (group << 24) | (status << 16) | (stream_id << 8);
}

constexpr void sysex8_packet::set_stream_id(uint8_t i)
Expand All @@ -138,7 +141,7 @@ constexpr size_t sysex8_packet::payload_size() const
constexpr void sysex8_packet::set_payload_size(size_t size)
{
assert(size <= 13);
set_byte(1, (status() & 0xF0) + ((size+1) & 0x0F));
set_byte(1, (status() & 0xF0) + ((size + 1) & 0x0F));
}

constexpr void sysex8_packet::set_payload_byte(size_t b, uint8_t data)
Expand All @@ -163,7 +166,8 @@ constexpr bool is_extended_data_message(const universal_packet& p)

constexpr bool is_sysex8_packet(const universal_packet& p)
{
return is_extended_data_message(p) && ((p.status() & 0xF0) <= extended_data_status::sysex8_end) && ((p.status() & 0x0F) > 0) && ((p.status() & 0x0F) <= 14);
return is_extended_data_message(p) && ((p.status() & 0xF0) <= extended_data_status::sysex8_end) &&
((p.status() & 0x0F) > 0) && ((p.status() & 0x0F) <= 14);
}

//--------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions inc/midi/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ struct pitch_7_25
constexpr note_nr_t note_nr() const;

constexpr pitch_7_25& operator=(pitch_7_9);
constexpr pitch_7_25 operator+(const pitch_increment&) const;
constexpr pitch_7_25 operator+(float) const;
constexpr pitch_7_25 operator+(const pitch_increment&) const;
constexpr pitch_7_25 operator+(float) const;

constexpr void operator+=(const pitch_increment&);

Expand Down
2 changes: 1 addition & 1 deletion tests/sysex_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ midi::sysex::data_allocator::value_type* midi::sysex::data_allocator::allocate(s

void midi::sysex::data_allocator::deallocate(value_type* p, std::size_t) noexcept
{
return delete[](p);
return delete[] (p);
}

#endif // NIMIDI2_CUSTOM_SYSEX_DATA_ALLOCATOR
Expand Down

0 comments on commit b34b89e

Please sign in to comment.