From 973db12fe33bab8e6efca80deca358b4998d5eb2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 17 Jul 2024 11:01:54 -0400 Subject: Remove redundant casts --- src/.clang-tidy | 1 - src/Configuration.cpp | 2 +- src/gui/GraphBox.cpp | 3 +-- src/gui/GraphTreeWindow.cpp | 2 +- src/gui/GraphView.cpp | 3 +-- src/gui/NewSubgraphWindow.cpp | 2 +- src/gui/NodeMenu.cpp | 2 +- src/gui/ObjectMenu.cpp | 2 +- src/server/Buffer.cpp | 5 ++--- src/server/PreProcessor.cpp | 4 ++-- src/server/ThreadManager.hpp | 4 ++-- src/server/events/Copy.cpp | 3 +-- src/server/events/Disconnect.cpp | 2 +- src/server/events/DisconnectAll.cpp | 4 ++-- 14 files changed, 17 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/.clang-tidy b/src/.clang-tidy index 32352d76..16ba6620 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -28,6 +28,5 @@ Checks: > -misc-no-recursion, -misc-unused-parameters, -readability-function-cognitive-complexity, - -readability-redundant-casting, -readability-use-anyofallof, InheritParentConfig: true diff --git a/src/Configuration.cpp b/src/Configuration.cpp index ac2b374b..5ee2ad2d 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -157,7 +157,7 @@ Configuration::set_value_from_string(Configuration::Option& option, option.value = _forge.alloc(value.c_str()); assert(option.value.type() == _forge.String); } else if (option.type == _forge.Bool) { - option.value = _forge.make(bool(!strcmp(value.c_str(), "true"))); + option.value = _forge.make(!strcmp(value.c_str(), "true")); assert(option.value.type() == _forge.Bool); } else { throw OptionError(fmt("Bad option type `%1%'", option.name)); diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 9efba2ee..2de4fa33 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -931,8 +931,7 @@ GraphBox::event_animate_signals_toggled() _app->interface()->set_property( URI("ingen:/clients/this"), _app->uris().ingen_broadcast, - _app->forge().make( - static_cast(_menu_animate_signals->get_active()))); + _app->forge().make(_menu_animate_signals->get_active())); } void diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp index b6c55b24..fa3318bf 100644 --- a/src/gui/GraphTreeWindow.cpp +++ b/src/gui/GraphTreeWindow.cpp @@ -217,7 +217,7 @@ GraphTreeWindow::event_graph_enabled_toggled(const Glib::ustring& path_str) if (_enable_signal) { _app->set_property(pm->uri(), _app->uris().ingen_enabled, - _app->forge().make(static_cast(!pm->enabled()))); + _app->forge().make(!pm->enabled())); } } diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp index 969e0add..7c01c3ae 100644 --- a/src/gui/GraphView.cpp +++ b/src/gui/GraphView.cpp @@ -143,8 +143,7 @@ GraphView::process_toggled() _app->set_property(_graph->uri(), _app->uris().ingen_enabled, - _app->forge().make( - static_cast(_process_but->get_active()))); + _app->forge().make(_process_but->get_active())); } void diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp index f10f8049..9ccb6904 100644 --- a/src/gui/NewSubgraphWindow.cpp +++ b/src/gui/NewSubgraphWindow.cpp @@ -119,7 +119,7 @@ NewSubgraphWindow::ok_clicked() Properties props; props.emplace(_app->uris().rdf_type, Property(_app->uris().ingen_Graph)); props.emplace(_app->uris().ingen_polyphony, _app->forge().make(int32_t(poly))); - props.emplace(_app->uris().ingen_enabled, _app->forge().make(bool(true))); + props.emplace(_app->uris().ingen_enabled, _app->forge().make(true)); _app->interface()->put( path_to_uri(path), props, Resource::Graph::INTERNAL); diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index 5559db71..83e88264 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -190,7 +190,7 @@ NodeMenu::on_menu_enabled() { _app->set_property(_object->uri(), _app->uris().ingen_enabled, - _app->forge().make(bool(_enabled_menuitem->get_active()))); + _app->forge().make(_enabled_menuitem->get_active())); } void diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 56055d1c..f6966bd8 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -118,7 +118,7 @@ ObjectMenu::on_menu_polyphonic() _app->set_property( _object->uri(), _app->uris().ingen_polyphonic, - _app->forge().make(bool(_polyphonic_menuitem->get_active()))); + _app->forge().make(_polyphonic_menuitem->get_active())); } } diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index 394d3323..553ae92e 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -207,8 +207,7 @@ Buffer::port_data(PortType port_type, SampleCount offset) const void* Buffer::port_data(PortType port_type, SampleCount offset) const { - return const_cast( - const_cast(this)->port_data(port_type, offset)); + return const_cast(this)->port_data(port_type, offset); } #ifdef __SSE__ @@ -435,7 +434,7 @@ void* Buffer::aligned_alloc(size_t size) { #if USE_POSIX_MEMALIGN void* buf = nullptr; - if (!posix_memalign(static_cast(&buf), 16, size)) { + if (!posix_memalign(&buf, 16, size)) { memset(buf, 0, size); return buf; } diff --git a/src/server/PreProcessor.cpp b/src/server/PreProcessor.cpp index f9d7ecb3..5d9d4660 100644 --- a/src/server/PreProcessor.cpp +++ b/src/server/PreProcessor.cpp @@ -150,7 +150,7 @@ PreProcessor::process(RunContext& ctx, PostProcessor& dest, size_t limit) } #endif - auto* next = static_cast(last->next()); + auto* next = last->next(); last->next(nullptr); dest.append(ctx, head, last); @@ -242,7 +242,7 @@ PreProcessor::run() wait_for_block_state(BlockState::UNBLOCKED); } - back = static_cast(ev->next()); + back = ev->next(); } } diff --git a/src/server/ThreadManager.hpp b/src/server/ThreadManager.hpp index 07a01c2b..2e0ad966 100644 --- a/src/server/ThreadManager.hpp +++ b/src/server/ThreadManager.hpp @@ -35,13 +35,13 @@ class INGEN_SERVER_API ThreadManager public: static void set_flag(ThreadFlag f) { #ifndef NDEBUG - flags = (static_cast(flags) | f); + flags |= static_cast(f); #endif } static void unset_flag(ThreadFlag f) { #ifndef NDEBUG - flags = (static_cast(flags) & (~f)); + flags &= ~static_cast(f); #endif } diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index f6529da3..74398ea4 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -125,8 +125,7 @@ Copy::engine_to_engine(PreProcessContext& ctx) } // Create new block - if (!(_block = dynamic_cast( - _old_block->duplicate(_engine, raul::Symbol(new_path.symbol()), _parent)))) { + if (!(_block = _old_block->duplicate(_engine, raul::Symbol(new_path.symbol()), _parent))) { return Event::pre_process_done(Status::INTERNAL_ERROR); } diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index e0db262a..bdb18ef9 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -168,7 +168,7 @@ Disconnect::pre_process(PreProcessContext& ctx) _impl = std::make_unique(_engine, _graph, - dynamic_cast(tail), + tail, dynamic_cast(head)); _compiled_graph = ctx.maybe_compile(*_graph); diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index 5f0e9a5e..87df61a5 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -112,7 +112,7 @@ DisconnectAll::pre_process(PreProcessContext& ctx) _impls.push_back( new Disconnect::Impl(_engine, _parent, - dynamic_cast(a->tail()), + a->tail(), dynamic_cast(a->head()))); } @@ -123,7 +123,7 @@ DisconnectAll::pre_process(PreProcessContext& ctx) _impls.push_back( new Disconnect::Impl(_engine, parent_parent, - dynamic_cast(a->tail()), + a->tail(), dynamic_cast(a->head()))); } } -- cgit v1.2.1