From 4ef41be9596cf997cd80175cfc7de2074a182d0d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 1 Aug 2020 15:20:45 +0200 Subject: Use auto with casts and allocations to remove redundancy --- src/client/PluginUI.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/client/PluginUI.cpp') diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 6fdf76c5..9c759696 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -52,7 +52,7 @@ lv2_ui_write(SuilController controller, uint32_t format, const void* buffer) { - PluginUI* const ui = static_cast(controller); + auto* const ui = static_cast(controller); const URIs& uris = ui->world().uris(); SPtr port = get_port(ui, port_index); if (!port) { @@ -80,9 +80,10 @@ lv2_ui_write(SuilController controller, Resource::Graph::DEFAULT); } else if (format == uris.atom_eventTransfer.urid()) { - const LV2_Atom* atom = static_cast(buffer); - Atom val = ui->world().forge().alloc( - atom->size, atom->type, LV2_ATOM_BODY_CONST(atom)); + const auto* atom = static_cast(buffer); + Atom val = ui->world().forge().alloc(atom->size, + atom->type, + LV2_ATOM_BODY_CONST(atom)); ui->signal_property_changed()(port->uri(), uris.ingen_activity, val, @@ -97,7 +98,7 @@ lv2_ui_write(SuilController controller, static uint32_t lv2_ui_port_index(SuilController controller, const char* port_symbol) { - PluginUI* const ui = static_cast(controller); + auto* const ui = static_cast(controller); const BlockModel::Ports& ports = ui->block()->ports(); for (uint32_t i = 0; i < ports.size(); ++i) { @@ -114,7 +115,7 @@ lv2_ui_subscribe(SuilController controller, uint32_t protocol, const LV2_Feature* const* features) { - PluginUI* const ui = static_cast(controller); + auto* const ui = static_cast(controller); SPtr port = get_port(ui, port_index); if (!port) { return 1; @@ -135,7 +136,7 @@ lv2_ui_unsubscribe(SuilController controller, uint32_t protocol, const LV2_Feature* const* features) { - PluginUI* const ui = static_cast(controller); + auto* const ui = static_cast(controller); SPtr port = get_port(ui, port_index); if (!port) { return 1; -- cgit v1.2.1