diff options
author | David Robillard <d@drobilla.net> | 2024-07-17 09:14:30 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-07-17 09:14:30 -0400 |
commit | 395cd74dcdb12ca8f16e1ec74802e11049e4f6cf (patch) | |
tree | 09f2aab1df5afaeb3171875fb6b97fc00c4a7dfb | |
parent | 3408d25a7a1042adc8c9387ea18ee06ba8ec0536 (diff) | |
download | patchage-395cd74dcdb12ca8f16e1ec74802e11049e4f6cf.tar.gz patchage-395cd74dcdb12ca8f16e1ec74802e11049e4f6cf.tar.bz2 patchage-395cd74dcdb12ca8f16e1ec74802e11049e4f6cf.zip |
Use uppercase integer literal suffixes
-rw-r--r-- | .clang-tidy | 6 | ||||
-rw-r--r-- | src/Configuration.cpp | 2 | ||||
-rw-r--r-- | src/Configuration.hpp | 2 | ||||
-rw-r--r-- | src/JackDbusDriver.cpp | 38 | ||||
-rw-r--r-- | src/JackLibDriver.cpp | 14 | ||||
-rw-r--r-- | src/Patchage.cpp | 8 |
6 files changed, 37 insertions, 33 deletions
diff --git a/.clang-tidy b/.clang-tidy index 06983bb..20de2e5 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -10,7 +10,6 @@ Checks: > -*-no-malloc, -*-non-private-member-variables-in-classes, -*-unused-macros, - -*-uppercase-literal-suffix, -*-vararg, -abseil-string-find-str-contains, -altera-*, @@ -53,6 +52,11 @@ Checks: > -readability-function-cognitive-complexity, -readability-identifier-length, -readability-implicit-bool-conversion, +CheckOptions: + - key: hicpp-uppercase-literal-suffix.NewSuffixes + value: 'L;U;UL;ULL' + - key: readability-uppercase-literal-suffix.NewSuffixes + value: 'L;U;UL;ULL' FormatStyle: file WarningsAsErrors: '*' HeaderFilterRegex: '.*' diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 814660d..86d60f8 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -236,7 +236,7 @@ Configuration::load() file >> std::get<setting::HumanNames>(_settings).value; } else if (key == "port_color") { std::string type_name; - uint32_t rgba = 0u; + uint32_t rgba = 0U; file >> type_name; file.ignore(1, '#'); file >> std::hex >> std::uppercase; diff --git a/src/Configuration.hpp b/src/Configuration.hpp index 4afbc4d..d956bd8 100644 --- a/src/Configuration.hpp +++ b/src/Configuration.hpp @@ -103,7 +103,7 @@ public: visitor(std::get<setting::WindowSize>(_settings)); visitor(std::get<setting::Zoom>(_settings)); - for (auto i = 0u; i < n_port_types; ++i) { + for (auto i = 0U; i < n_port_types; ++i) { visitor(setting::PortColor{static_cast<PortType>(i), _port_colors[i]}); } } diff --git a/src/JackDbusDriver.cpp b/src/JackDbusDriver.cpp index 71f725d..e7e6830 100644 --- a/src/JackDbusDriver.cpp +++ b/src/JackDbusDriver.cpp @@ -206,14 +206,14 @@ JackDriver::dbus_message_hook(DBusConnection* /*connection*/, const char* old_owner = nullptr; const char* port2_name = nullptr; const char* port_name = nullptr; - dbus_uint32_t port_flags = 0u; - dbus_uint32_t port_type = 0u; - dbus_uint64_t client2_id = 0u; - dbus_uint64_t client_id = 0u; - dbus_uint64_t connection_id = 0u; - dbus_uint64_t new_graph_version = 0u; - dbus_uint64_t port2_id = 0u; - dbus_uint64_t port_id = 0u; + dbus_uint32_t port_flags = 0U; + dbus_uint32_t port_type = 0U; + dbus_uint64_t client2_id = 0U; + dbus_uint64_t client_id = 0U; + dbus_uint64_t connection_id = 0U; + dbus_uint64_t new_graph_version = 0U; + dbus_uint64_t port2_id = 0U; + dbus_uint64_t port_id = 0U; assert(jack_driver); auto* me = static_cast<JackDriver*>(jack_driver); @@ -584,7 +584,7 @@ JackDriver::refresh(const EventSink& sink) { DBusMessage* reply_ptr = nullptr; DBusMessageIter iter = {}; - dbus_uint64_t version = 0u; + dbus_uint64_t version = 0U; const char* reply_signature = nullptr; DBusMessageIter clients_array_iter = {}; DBusMessageIter client_struct_iter = {}; @@ -592,17 +592,17 @@ JackDriver::refresh(const EventSink& sink) DBusMessageIter port_struct_iter = {}; DBusMessageIter connections_array_iter = {}; DBusMessageIter connection_struct_iter = {}; - dbus_uint64_t client_id = 0u; + dbus_uint64_t client_id = 0U; const char* client_name = nullptr; - dbus_uint64_t port_id = 0u; + dbus_uint64_t port_id = 0U; const char* port_name = nullptr; - dbus_uint32_t port_flags = 0u; - dbus_uint32_t port_type = 0u; - dbus_uint64_t client2_id = 0u; + dbus_uint32_t port_flags = 0U; + dbus_uint32_t port_type = 0U; + dbus_uint64_t client2_id = 0U; const char* client2_name = nullptr; - dbus_uint64_t port2_id = 0u; + dbus_uint64_t port2_id = 0U; const char* port2_name = nullptr; - dbus_uint64_t connection_id = 0u; + dbus_uint64_t connection_id = 0U; if (!call(true, JACKDBUS_IFACE_PATCHBAY, @@ -779,7 +779,7 @@ uint32_t JackDriver::xruns() { DBusMessage* reply_ptr = nullptr; - dbus_uint32_t xruns = 0u; + dbus_uint32_t xruns = 0U; if (_server_responding && !_server_started) { return 0; @@ -826,7 +826,7 @@ uint32_t JackDriver::buffer_size() { DBusMessage* reply_ptr = nullptr; - dbus_uint32_t buffer_size = 0u; + dbus_uint32_t buffer_size = 0U; if (_server_responding && !_server_started) { return 4096; @@ -881,7 +881,7 @@ uint32_t JackDriver::sample_rate() { DBusMessage* reply_ptr = nullptr; - dbus_uint32_t sample_rate = 0u; + dbus_uint32_t sample_rate = 0U; if (!call(true, JACKDBUS_IFACE_CONTROL, diff --git a/src/JackLibDriver.cpp b/src/JackLibDriver.cpp index be5a8bc..b0b96a5 100644 --- a/src/JackLibDriver.cpp +++ b/src/JackLibDriver.cpp @@ -94,8 +94,8 @@ private: std::mutex _shutdown_mutex; jack_client_t* _client = nullptr; - jack_nframes_t _buffer_size = 0u; - uint32_t _xruns = 0u; + jack_nframes_t _buffer_size = 0U; + uint32_t _xruns = 0U; bool _is_activated = false; }; @@ -257,7 +257,7 @@ JackLibDriver::refresh(const EventSink& sink) // Get all client names (to only send a creation event once for each) std::unordered_set<std::string> client_names; - for (auto i = 0u; ports[i]; ++i) { + for (auto i = 0U; ports[i]; ++i) { client_names.insert(PortID::jack(ports[i]).client().jack_name()); } @@ -268,7 +268,7 @@ JackLibDriver::refresh(const EventSink& sink) } // Emit all ports - for (auto i = 0u; ports[i]; ++i) { + for (auto i = 0U; ports[i]; ++i) { const jack_port_t* const port = jack_port_by_name(_client, ports[i]); sink({event::PortCreated{PortID::jack(ports[i]), get_port_info(port)}}); @@ -276,17 +276,17 @@ JackLibDriver::refresh(const EventSink& sink) // Get all connections (again to only create them once) std::set<std::pair<std::string, std::string>> connections; - for (auto i = 0u; ports[i]; ++i) { + for (auto i = 0U; ports[i]; ++i) { const jack_port_t* const port = jack_port_by_name(_client, ports[i]); const char** const peers = jack_port_get_all_connections(_client, port); if (peers) { if (jack_port_flags(port) & JackPortIsInput) { - for (auto j = 0u; peers[j]; ++j) { + for (auto j = 0U; peers[j]; ++j) { connections.emplace(peers[j], ports[i]); } } else { - for (auto j = 0u; peers[j]; ++j) { + for (auto j = 0U; peers[j]; ++j) { connections.emplace(ports[i], peers[j]); } } diff --git a/src/Patchage.cpp b/src/Patchage.cpp index 0a1650d..d4026a3 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -193,7 +193,7 @@ highlight_color(guint c, guint delta) const guint b = MIN(((c >> 8) & 0xFF) + delta, max_char); const guint a = c & 0xFF; - return ((r << 24u) | (g << 16u) | (b << 8u) | a); + return ((r << 24U) | (g << 16U) | (b << 8U) | a); } void @@ -545,7 +545,7 @@ Patchage::update_load() _dropouts_label->set_text(" " + fmt::format(T("Dropouts: {}"), xruns)); - if (xruns > 0u) { + if (xruns > 0U) { _dropouts_label->show(); _clear_load_but->show(); } else { @@ -903,10 +903,10 @@ Patchage::buffer_size_changed() if (_drivers.jack()) { const int selected = _buf_size_combo->get_active_row_number(); - if (selected == -1) { + if (selected < 0) { update_toolbar(); } else { - const uint32_t buffer_size = 1u << (selected + 5); + const uint32_t buffer_size = 1U << (static_cast<unsigned>(selected) + 5U); _drivers.jack()->set_buffer_size(buffer_size); update_toolbar(); } |