From b34b89e7f5e16abf794559d375b37791e272b1d2 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 7 Nov 2023 13:36:16 +0800 Subject: [PATCH] pre-commit: updates * fix readme * update clang-format to 17.0.4 * update pre-commit --- .pre-commit-config.yaml | 4 ++-- CONTRIBUTING.md | 4 ---- inc/midi/extended_data_message.h | 20 ++++++++++++-------- inc/midi/types.h | 4 ++-- tests/sysex_tests.cpp | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9d55039..2e95350 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 96474c7..51aed89 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/inc/midi/extended_data_message.h b/inc/midi/extended_data_message.h index 6abb4f5..7196377 100644 --- a/inc/midi/extended_data_message.h +++ b/inc/midi/extended_data_message.h @@ -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); }; @@ -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); } @@ -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) @@ -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) @@ -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); } //-------------------------------------------------------------------------- diff --git a/inc/midi/types.h b/inc/midi/types.h index 9c90990..0efa211 100644 --- a/inc/midi/types.h +++ b/inc/midi/types.h @@ -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&); diff --git a/tests/sysex_tests.cpp b/tests/sysex_tests.cpp index 5af0f7c..b3da465 100644 --- a/tests/sysex_tests.cpp +++ b/tests/sysex_tests.cpp @@ -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