From 175c04323ad1aaaa1e0c949b8de411d5e2cece74 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 17 Jul 2024 11:33:25 -0400 Subject: Avoid C-style casts and some size type conversions Aside from the syntactic cast changes, reduces some size types to 32-bits, since they can never be so large in practice. This eliminates some type conversions and shaves a few bytes. --- src/gui/.clang-tidy | 1 - src/gui/ConnectWindow.cpp | 2 +- src/gui/GraphBox.cpp | 2 +- src/gui/GraphCanvas.cpp | 2 +- src/gui/NewSubgraphWindow.cpp | 2 +- src/gui/Port.cpp | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) (limited to 'src/gui') diff --git a/src/gui/.clang-tidy b/src/gui/.clang-tidy index 4dc4facc..99bd2aba 100644 --- a/src/gui/.clang-tidy +++ b/src/gui/.clang-tidy @@ -15,7 +15,6 @@ Checks: > -clang-analyzer-core.CallAndMessage, -cppcoreguidelines-macro-usage, -cppcoreguidelines-pro-bounds-constant-array-index, - -cppcoreguidelines-pro-type-cstyle-cast, -cppcoreguidelines-pro-type-static-cast-downcast, -cppcoreguidelines-pro-type-vararg, -cppcoreguidelines-slicing, diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 82447888..f645bb30 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -111,7 +111,7 @@ ConnectWindow::start(App& app, ingen::World& world) } set_connected_to(world.interface()); - connect(bool(world.interface())); + connect(!!world.interface()); } void diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 2de4fa33..e4a95bed 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -390,7 +390,7 @@ GraphBox::set_graph(const std::shared_ptr& graph, } } - _menu_parent->property_sensitive() = bool(graph->parent()); + _menu_parent->property_sensitive() = !!graph->parent(); new_port_connection = graph->signal_new_port().connect( sigc::mem_fun(this, &GraphBox::graph_port_added)); diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 5ea39de0..e02c4e5b 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -876,7 +876,7 @@ GraphCanvas::menu_add_port(const string& sym_base, uris.rdf_type, Property(is_output ? uris.lv2_OutputPort : uris.lv2_InputPort)); props.emplace(uris.lv2_index, - _app.forge().make(int32_t(_graph->num_ports()))); + _app.forge().make(static_cast(_graph->num_ports()))); props.emplace(uris.lv2_name, _app.forge().alloc(name.c_str())); _app.interface()->put(path_to_uri(path), props); } diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp index 9ccb6904..28a5afa7 100644 --- a/src/gui/NewSubgraphWindow.cpp +++ b/src/gui/NewSubgraphWindow.cpp @@ -118,7 +118,7 @@ NewSubgraphWindow::ok_clicked() // Create graph 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_polyphony, _app->forge().make(static_cast(poly))); 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/Port.cpp b/src/gui/Port.cpp index 36e03c5c..3925ed0c 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -230,7 +230,7 @@ Port::on_value_changed(double value) return; // No change } - const Atom atom = _app.forge().make(float(value)); + const Atom atom = _app.forge().make(static_cast(value)); _app.set_property(model()->uri(), _app.world().uris().ingen_value, atom); -- cgit v1.2.1