diff options
author | David Robillard <d@drobilla.net> | 2023-02-03 14:43:19 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-02-03 14:43:19 -0500 |
commit | ad4cec932249445160017cd2cf57917c1c2e2501 (patch) | |
tree | 0d09dd324f8f3f5411e567bbd1663decce1c6c04 /src/server | |
parent | f33d936ce99f9c175ed1171e93b0217258537bb1 (diff) | |
download | ingen-ad4cec932249445160017cd2cf57917c1c2e2501.tar.gz ingen-ad4cec932249445160017cd2cf57917c1c2e2501.tar.bz2 ingen-ad4cec932249445160017cd2cf57917c1c2e2501.zip |
Suppress/fix new warnings in clang-tidy 15
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/BlockImpl.cpp | 2 | ||||
-rw-r--r-- | src/server/Broadcaster.cpp | 8 | ||||
-rw-r--r-- | src/server/CompiledGraph.cpp | 2 | ||||
-rw-r--r-- | src/server/ControlBindings.cpp | 7 | ||||
-rw-r--r-- | src/server/LV2Block.cpp | 34 | ||||
-rw-r--r-- | src/server/LV2Plugin.cpp | 2 | ||||
-rw-r--r-- | src/server/PortImpl.cpp | 14 | ||||
-rw-r--r-- | src/server/PreProcessor.cpp | 4 | ||||
-rw-r--r-- | src/server/RunContext.cpp | 6 | ||||
-rw-r--r-- | src/server/UndoStack.cpp | 10 | ||||
-rw-r--r-- | src/server/Worker.cpp | 10 | ||||
-rw-r--r-- | src/server/events/Connect.cpp | 4 | ||||
-rw-r--r-- | src/server/events/Copy.cpp | 8 | ||||
-rw-r--r-- | src/server/events/CreateBlock.cpp | 2 | ||||
-rw-r--r-- | src/server/events/CreateGraph.cpp | 2 | ||||
-rw-r--r-- | src/server/events/CreatePort.cpp | 2 | ||||
-rw-r--r-- | src/server/events/Delete.cpp | 4 | ||||
-rw-r--r-- | src/server/events/Delta.cpp | 6 | ||||
-rw-r--r-- | src/server/events/Disconnect.cpp | 4 | ||||
-rw-r--r-- | src/server/events/DisconnectAll.cpp | 2 | ||||
-rw-r--r-- | src/server/events/Get.cpp | 4 | ||||
-rw-r--r-- | src/server/events/Move.cpp | 4 | ||||
-rw-r--r-- | src/server/events/SetPortValue.cpp | 8 | ||||
-rw-r--r-- | src/server/ingen_lv2.cpp | 36 | ||||
-rw-r--r-- | src/server/internals/Time.cpp | 4 |
25 files changed, 95 insertions, 94 deletions
diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp index 3fa7a1c3..cae6b252 100644 --- a/src/server/BlockImpl.cpp +++ b/src/server/BlockImpl.cpp @@ -200,7 +200,7 @@ BlockImpl::bypass(RunContext& ctx) } // Dumb bypass - for (PortType t : { PortType::AUDIO, PortType::CV, PortType::ATOM }) { + for (const PortType t : { PortType::AUDIO, PortType::CV, PortType::ATOM }) { for (uint32_t i = 0;; ++i) { PortImpl* in = nth_port_by_type(i, true, t); PortImpl* out = nth_port_by_type(i, false, t); diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp index 1d5cc843..e7406dc6 100644 --- a/src/server/Broadcaster.cpp +++ b/src/server/Broadcaster.cpp @@ -29,7 +29,7 @@ namespace ingen::server { Broadcaster::~Broadcaster() { - std::lock_guard<std::mutex> lock(_clients_mutex); + const std::lock_guard<std::mutex> lock{_clients_mutex}; _clients.clear(); _broadcastees.clear(); } @@ -39,7 +39,7 @@ Broadcaster::~Broadcaster() void Broadcaster::register_client(const std::shared_ptr<Interface>& client) { - std::lock_guard<std::mutex> lock(_clients_mutex); + const std::lock_guard<std::mutex> lock{_clients_mutex}; _clients.insert(client); } @@ -50,7 +50,7 @@ Broadcaster::register_client(const std::shared_ptr<Interface>& client) bool Broadcaster::unregister_client(const std::shared_ptr<Interface>& client) { - std::lock_guard<std::mutex> lock(_clients_mutex); + const std::lock_guard<std::mutex> lock{_clients_mutex}; const size_t erased = _clients.erase(client); _broadcastees.erase(client); return (erased > 0); @@ -71,7 +71,7 @@ Broadcaster::set_broadcast(const std::shared_ptr<Interface>& client, void Broadcaster::send_plugins(const BlockFactory::Plugins& plugins) { - std::lock_guard<std::mutex> lock(_clients_mutex); + const std::lock_guard<std::mutex> lock{_clients_mutex}; for (const auto& c : _clients) { send_plugins_to(c.get(), plugins); } diff --git a/src/server/CompiledGraph.cpp b/src/server/CompiledGraph.cpp index b453932b..3b023258 100644 --- a/src/server/CompiledGraph.cpp +++ b/src/server/CompiledGraph.cpp @@ -161,7 +161,7 @@ CompiledGraph::compile_graph(GraphImpl* graph) _master = Task::simplify(std::move(_master)); if (graph->engine().world().conf().option("trace").get<int32_t>()) { - ColorContext ctx(stderr, ColorContext::Color::YELLOW); + const ColorContext ctx{stderr, ColorContext::Color::YELLOW}; dump(graph->path()); } } diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index 265333d4..e8dd3554 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -198,8 +198,9 @@ ControlBindings::port_value_changed(RunContext& ctx, { const ingen::URIs& uris = ctx.engine().world().uris(); if (!!key) { - int16_t value = port_value_to_control( - ctx, port, key.type, value_atom); + const int16_t value = + port_value_to_control(ctx, port, key.type, value_atom); + uint16_t size = 0; uint8_t buf[4]; switch (key.type) { @@ -390,7 +391,7 @@ ControlBindings::set_port_value(RunContext& ctx, // TODO: Set port value property so it is saved port->set_control_value(ctx, ctx.start(), val); - URIs& uris = ctx.engine().world().uris(); + const URIs& uris = ctx.engine().world().uris(); ctx.notify(uris.ingen_value, ctx.start(), port, sizeof(float), _forge.Float, &val); } diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index 6dac1eec..5a1ee2ec 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -349,7 +349,7 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state) LILV_FOREACH (nodes, i, sizes) { const LilvNode* d = lilv_nodes_get(sizes, i); if (lilv_node_is_int(d)) { - uint32_t size_val = lilv_node_as_int(d); + const uint32_t size_val = lilv_node_as_int(d); port_buffer_size = std::max(port_buffer_size, size_val); } } @@ -481,7 +481,7 @@ LV2Block::save_state(const FilePath& dir) const World& world = _lv2_plugin->world(); LilvWorld* lworld = world.lilv_world(); - StatePtr state{ + const StatePtr state{ lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(), const_cast<LV2Block*>(this)->instance(0), &world.uri_map().urid_map(), @@ -521,7 +521,7 @@ LV2Block::duplicate(Engine& engine, const SampleRate rate = engine.sample_rate(); // Get current state - StatePtr state{ + const StatePtr state{ lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(), instance(0), &engine.world().uri_map().urid_map(), @@ -589,10 +589,10 @@ LV2_Worker_Status LV2Block::work(uint32_t size, const void* data) { if (_worker_iface) { - std::lock_guard<std::mutex> lock(_work_mutex); + const std::lock_guard<std::mutex> lock{_work_mutex}; - LV2_Handle inst = lilv_instance_get_handle(instance(0)); - LV2_Worker_Status st = _worker_iface->work(inst, work_respond, this, size, data); + LV2_Handle inst = lilv_instance_get_handle(instance(0)); + const LV2_Worker_Status st = _worker_iface->work(inst, work_respond, this, size, data); if (st) { parent_graph()->engine().log().error( "Error calling %1% work method\n", _path); @@ -717,17 +717,17 @@ LV2Block::save_preset(const URI& uri, const FilePath dirname = path.parent_path(); const FilePath basename = path.stem(); - StatePtr state{lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(), - instance(0), - lmap, - nullptr, - nullptr, - nullptr, - path.c_str(), - get_port_value, - this, - LV2_STATE_IS_NATIVE, - nullptr)}; + const StatePtr state{lilv_state_new_from_instance(_lv2_plugin->lilv_plugin(), + instance(0), + lmap, + nullptr, + nullptr, + nullptr, + path.c_str(), + get_port_value, + this, + LV2_STATE_IS_NATIVE, + nullptr)}; if (state) { const auto l = props.find(_uris.rdfs_label); diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index 25ae9294..fdf9f2e6 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -73,7 +73,7 @@ LV2Plugin::symbol() const } while (working.length() > 0) { - size_t last_slash = working.find_last_of('/'); + const size_t last_slash = working.find_last_of('/'); const std::string symbol = working.substr(last_slash+1); if ( (symbol[0] >= 'a' && symbol[0] <= 'z') || (symbol[0] >= 'A' && symbol[0] <= 'Z') ) { diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index 307d9b73..fa061640 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -289,9 +289,9 @@ PortImpl::set_voice_value(const RunContext& ctx, void PortImpl::update_set_state(const RunContext& ctx, uint32_t v) { - Voice& voice = _voices->at(v); - SetState& state = voice.set_state; - BufferRef buf = voice.buffer; + Voice& voice = _voices->at(v); + SetState& state = voice.set_state; + const BufferRef buf = voice.buffer; switch (state.state) { case SetState::State::SET: break; @@ -458,10 +458,10 @@ PortImpl::monitor(RunContext& ctx, bool send_now) return; } - Forge& forge = ctx.engine().world().forge(); - URIs& uris = ctx.engine().world().uris(); - LV2_URID key = 0; - float val = 0.0f; + const Forge& forge = ctx.engine().world().forge(); + const URIs& uris = ctx.engine().world().uris(); + LV2_URID key = 0; + float val = 0.0f; switch (_type.id()) { case PortType::UNKNOWN: break; diff --git a/src/server/PreProcessor.cpp b/src/server/PreProcessor.cpp index 5d719761..74550a3e 100644 --- a/src/server/PreProcessor.cpp +++ b/src/server/PreProcessor.cpp @@ -55,7 +55,7 @@ PreProcessor::event(Event* const ev, Event::Mode mode) { // TODO: Probably possible to make this lock-free with CAS ThreadManager::assert_not_thread(THREAD_IS_REAL_TIME); - std::lock_guard<std::mutex> lock(_mutex); + const std::lock_guard<std::mutex> lock{_mutex}; assert(!ev->is_prepared()); assert(!ev->next()); @@ -140,7 +140,7 @@ PreProcessor::process(RunContext& ctx, PostProcessor& dest, size_t limit) if (n_processed > 0) { #ifndef NDEBUG - Engine& engine = ctx.engine(); + const Engine& engine = ctx.engine(); if (engine.world().conf().option("trace").get<int32_t>()) { const uint64_t start = engine.cycle_start_time(ctx); const uint64_t end = engine.current_time(); diff --git a/src/server/RunContext.cpp b/src/server/RunContext.cpp index 2bac3140..95d68f57 100644 --- a/src/server/RunContext.cpp +++ b/src/server/RunContext.cpp @@ -160,9 +160,9 @@ void RunContext::set_priority(int priority) { if (_thread) { - pthread_t pthread = _thread->native_handle(); - const int policy = (priority > 0) ? SCHED_FIFO : SCHED_OTHER; - sched_param sp{}; + const pthread_t pthread = _thread->native_handle(); + const int policy = (priority > 0) ? SCHED_FIFO : SCHED_OTHER; + sched_param sp{}; sp.sched_priority = (priority > 0) ? priority : 0; if (pthread_setschedparam(pthread, policy, &sp)) { _engine.log().error( diff --git a/src/server/UndoStack.cpp b/src/server/UndoStack.cpp index 395a04cd..c8ce7d69 100644 --- a/src/server/UndoStack.cpp +++ b/src/server/UndoStack.cpp @@ -41,7 +41,7 @@ UndoStack::start_entry() if (_depth == 0) { time_t now = {}; time(&now); - _stack.emplace_back(Entry(now)); + _stack.emplace_back(now); } return ++_depth; } @@ -188,8 +188,8 @@ UndoStack::write_entry(Sratom* sratom, strftime(time_str, sizeof(time_str), "%FT%T", gmtime(&entry.time)); // entry rdf:type ingen:UndoEntry - SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "time")); - SerdNode o = serd_node_from_string(SERD_LITERAL, USTR(time_str)); + SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "time")); + const SerdNode o = serd_node_from_string(SERD_LITERAL, USTR(time_str)); serd_writer_write_statement(writer, SERD_ANON_CONT, nullptr, subject, &p, &o, nullptr, nullptr); p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "events")); @@ -245,8 +245,8 @@ UndoStack::save(FILE* stream, const char* name) reinterpret_cast<SerdEndSink>(serd_writer_end_anon), writer); - SerdNode s = serd_node_from_string(SERD_BLANK, USTR(name)); - SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "entries")); + const SerdNode s = serd_node_from_string(SERD_BLANK, USTR(name)); + const SerdNode p = serd_node_from_string(SERD_URI, USTR(INGEN_NS "entries")); BlankIDs ids('u'); ListContext ctx(ids, 0, &s, &p); diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index 5b4da498..c58fe89e 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -46,8 +46,8 @@ schedule(LV2_Worker_Schedule_Handle handle, uint32_t size, const void* data) { - auto* block = static_cast<LV2Block*>(handle); - Engine& engine = block->parent_graph()->engine(); + auto* block = static_cast<LV2Block*>(handle); + const Engine& engine = block->parent_graph()->engine(); return engine.worker()->request(block, size, data); } @@ -57,8 +57,8 @@ schedule_sync(LV2_Worker_Schedule_Handle handle, uint32_t size, const void* data) { - auto* block = static_cast<LV2Block*>(handle); - Engine& engine = block->parent_graph()->engine(); + auto* block = static_cast<LV2Block*>(handle); + const Engine& engine = block->parent_graph()->engine(); return engine.sync_worker()->request(block, size, data); } @@ -72,7 +72,7 @@ Worker::request(LV2Block* block, return block->work(size, data); } - Engine& engine = block->parent_graph()->engine(); + const Engine& engine = block->parent_graph()->engine(); if (_requests.write_space() < sizeof(MessageHeader) + size) { engine.log().error("Work request ring overflow\n"); return LV2_WORKER_ERR_NO_SPACE; diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 44c734a8..115d3e9c 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -57,7 +57,7 @@ Connect::~Connect() = default; bool Connect::pre_process(PreProcessContext& ctx) { - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; Node* tail = _engine.store()->get(_msg.tail); if (!tail) { @@ -173,7 +173,7 @@ Connect::execute(RunContext& ctx) void Connect::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->message(_msg); if (!_tail_remove.empty() || !_tail_add.empty()) { diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index f6bcc62a..24e7b339 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -57,7 +57,7 @@ Copy::~Copy() = default; bool Copy::pre_process(PreProcessContext& ctx) { - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; if (uri_is_path(_msg.old_uri)) { // Old URI is a path within the engine @@ -163,7 +163,7 @@ Copy::engine_to_filesystem(PreProcessContext&) return Event::pre_process_done(Status::INTERNAL_ERROR); } - std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex()); + const std::lock_guard<std::mutex> lock{_engine.world().rdf_mutex()}; if (ends_with(_msg.new_uri, ".ingen") || ends_with(_msg.new_uri, ".ingen/")) { _engine.world().serialiser()->write_bundle(graph, URI(_msg.new_uri)); @@ -184,7 +184,7 @@ Copy::filesystem_to_engine(PreProcessContext&) return Event::pre_process_done(Status::INTERNAL_ERROR); } - std::lock_guard<std::mutex> lock(_engine.world().rdf_mutex()); + const std::lock_guard<std::mutex> lock{_engine.world().rdf_mutex()}; // Old URI is a filesystem path and new URI is a path within the engine const std::string src_path(_msg.old_uri.path()); @@ -214,7 +214,7 @@ Copy::execute(RunContext&) void Copy::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->message(_msg); } diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 73834fcb..aa4cb1c0 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -187,7 +187,7 @@ CreateBlock::execute(RunContext&) void CreateBlock::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _update.send(*_engine.broadcaster()); } diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index bcc935bb..8864c1df 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -235,7 +235,7 @@ CreateGraph::execute(RunContext& ctx) void CreateGraph::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _update.send(*_engine.broadcaster()); } diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 7a01d0d9..937842a7 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -210,7 +210,7 @@ CreatePort::execute(RunContext& ctx) void CreatePort::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->put(path_to_uri(_path), _update); } diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index b64c81c0..192b0584 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -104,7 +104,7 @@ Delete::pre_process(PreProcessContext& ctx) } // Take a writer lock while we modify the store - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; _engine.store()->remove(iter, _removed_objects); @@ -189,7 +189,7 @@ Delete::execute(RunContext& ctx) void Delete::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS && (_block || _port)) { if (_block) { _block->deactivate(); diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 0b8cab39..1c972f1d 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -213,7 +213,7 @@ Delta::pre_process(PreProcessContext& ctx) return Event::pre_process_done(Status::FAILURE); } - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; _object = is_graph_object ? static_cast<ingen::Resource*>(_engine.store()->get(uri_to_path(_subject))) @@ -225,7 +225,7 @@ Delta::pre_process(PreProcessContext& ctx) } if (is_graph_object && !_object) { - raul::Path path(uri_to_path(_subject)); + const raul::Path path{uri_to_path(_subject)}; bool is_graph = false; bool is_block = false; @@ -594,7 +594,7 @@ Delta::post_process() _state.reset(); } - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (_create_event) { _create_event->post_process(); diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index ef0cbd0b..4b4bbfe9 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -117,7 +117,7 @@ Disconnect::Impl::Impl(Engine& e, bool Disconnect::pre_process(PreProcessContext& ctx) { - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; if (_msg.tail.parent().parent() != _msg.head.parent().parent() && _msg.tail.parent() != _msg.head.parent().parent() @@ -219,7 +219,7 @@ Disconnect::execute(RunContext& ctx) void Disconnect::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->message(_msg); } diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index 957c6a6f..296d6ddd 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -156,7 +156,7 @@ DisconnectAll::execute(RunContext& ctx) void DisconnectAll::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->message(_msg); } diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index f4cbb49d..9efef123 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -50,7 +50,7 @@ Get::Get(Engine& engine, bool Get::pre_process(PreProcessContext&) { - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; const auto& uri = _msg.subject; if (uri == "ingen:/plugins") { @@ -96,7 +96,7 @@ Get::execute(RunContext&) void Get::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS && _request_client) { if (_msg.subject == "ingen:/plugins") { _engine.broadcaster()->send_plugins_to(_request_client.get(), _plugins); diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index ea05d34c..3af0ce6c 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -46,7 +46,7 @@ Move::Move(Engine& engine, bool Move::pre_process(PreProcessContext&) { - std::lock_guard<Store::Mutex> lock(_engine.store()->mutex()); + const std::lock_guard<Store::Mutex> lock{_engine.store()->mutex()}; if (!_msg.old_path.parent().is_parent_of(_msg.new_path)) { return Event::pre_process_done(Status::PARENT_DIFFERS, _msg.new_path); @@ -78,7 +78,7 @@ Move::execute(RunContext&) void Move::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS) { _engine.broadcaster()->message(_msg); } diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index 8b599354..04da7338 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -54,7 +54,7 @@ SetPortValue::SetPortValue(Engine& engine, bool SetPortValue::pre_process(PreProcessContext&) { - ingen::URIs& uris = _engine.world().uris(); + const ingen::URIs& uris = _engine.world().uris(); if (_port->is_output()) { return Event::pre_process_done(Status::DIRECTION_MISMATCH, _port->path()); } @@ -92,8 +92,8 @@ SetPortValue::apply(RunContext& ctx) return; } - ingen::URIs& uris = _engine.world().uris(); - Buffer* buf = _port->buffer(0).get(); + const ingen::URIs& uris = _engine.world().uris(); + Buffer* buf = _port->buffer(0).get(); if (_buffer) { if (_port->user_buffer(ctx)) { @@ -127,7 +127,7 @@ SetPortValue::apply(RunContext& ctx) void SetPortValue::post_process() { - Broadcaster::Transfer t(*_engine.broadcaster()); + const Broadcaster::Transfer t{*_engine.broadcaster()}; if (respond() == Status::SUCCESS && !_activity) { _engine.broadcaster()->set_property( _port->uri(), diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 851a83fb..f253ee9b 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -512,7 +512,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, nullptr, true); - Lib::Graphs graphs = find_graphs(URI(reinterpret_cast<const char*>(manifest_node.buf))); + const Lib::Graphs graphs = find_graphs(URI(reinterpret_cast<const char*>(manifest_node.buf))); serd_node_free(&manifest_node); const LV2Graph* graph = nullptr; @@ -533,11 +533,11 @@ ingen_instantiate(const LV2_Descriptor* descriptor, plugin->world = std::make_unique<ingen::World>(map, unmap, log); plugin->world->load_configuration(plugin->argc, plugin->argv); - LV2_URID bufsz_max = map->map(map->handle, LV2_BUF_SIZE__maxBlockLength); - LV2_URID bufsz_seq = map->map(map->handle, LV2_BUF_SIZE__sequenceSize); - LV2_URID atom_Int = map->map(map->handle, LV2_ATOM__Int); - int32_t block_length = 0; - int32_t seq_size = 0; + const LV2_URID bufsz_max = map->map(map->handle, LV2_BUF_SIZE__maxBlockLength); + const LV2_URID bufsz_seq = map->map(map->handle, LV2_BUF_SIZE__sequenceSize); + const LV2_URID atom_Int = map->map(map->handle, LV2_ATOM__Int); + int32_t block_length = 0; + int32_t seq_size = 0; if (options) { for (const LV2_Options_Option* o = options; o->key; ++o) { if (o->key == bufsz_max && o->type == atom_Int) { @@ -567,7 +567,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, plugin->engine = engine; plugin->world->set_engine(engine); - std::shared_ptr<Interface> interface = engine->interface(); + const std::shared_ptr<Interface> interface = engine->interface(); plugin->world->set_interface(interface); @@ -580,7 +580,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, engine->activate(); ThreadManager::single_threaded = true; - std::lock_guard<std::mutex> lock(plugin->world->rdf_mutex()); + const std::lock_guard<std::mutex> lock{plugin->world->rdf_mutex()}; // Locate to time 0 to process initialization events engine->locate(0, block_length); @@ -602,7 +602,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, /* Register client after loading graph so the to-ui ring does not overflow. Since we are not yet rolling, it won't be drained, causing a deadlock. */ - std::shared_ptr<Interface> client(&driver->writer(), NullDeleter<Interface>); + const std::shared_ptr<Interface> client{&driver->writer(), NullDeleter<Interface>}; interface->set_respondee(client); engine->register_client(client); @@ -703,9 +703,9 @@ ingen_save(LV2_Handle instance, return LV2_STATE_ERR_NO_FEATURE; } - LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file); - LV2_URID atom_Path = plugin->map->map(plugin->map->handle, - LV2_ATOM__Path); + const LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file); + const LV2_URID atom_Path = plugin->map->map(plugin->map->handle, + LV2_ATOM__Path); char* real_path = make_path->path(make_path->handle, "main.ttl"); char* state_path = map_path->abstract_path(map_path->handle, real_path); @@ -713,7 +713,7 @@ ingen_save(LV2_Handle instance, auto root = plugin->world->store()->find(raul::Path("/")); { - std::lock_guard<std::mutex> lock(plugin->world->rdf_mutex()); + const std::lock_guard<std::mutex> lock{plugin->world->rdf_mutex()}; plugin->world->serialiser()->start_to_file( root->second->path(), FilePath{real_path}); @@ -749,10 +749,10 @@ ingen_restore(LV2_Handle instance, return LV2_STATE_ERR_NO_FEATURE; } - LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file); - size_t size = 0; - uint32_t type = 0; - uint32_t valflags = 0; + const LV2_URID ingen_file = plugin->map->map(plugin->map->handle, INGEN__file); + size_t size = 0; + uint32_t type = 0; + uint32_t valflags = 0; // Get abstract path to graph file const char* path = static_cast<const char*>( @@ -784,7 +784,7 @@ ingen_restore(LV2_Handle instance, #endif // Load new graph - std::lock_guard<std::mutex> lock(plugin->world->rdf_mutex()); + const std::lock_guard<std::mutex> lock{plugin->world->rdf_mutex()}; plugin->world->parser()->parse_file( *plugin->world, *plugin->world->interface(), real_path); diff --git a/src/server/internals/Time.cpp b/src/server/internals/Time.cpp index ee97ac84..0768285a 100644 --- a/src/server/internals/Time.cpp +++ b/src/server/internals/Time.cpp @@ -72,8 +72,8 @@ TimeNode::TimeNode(InternalPlugin* plugin, void TimeNode::run(RunContext& ctx) { - BufferRef buf = _notify_port->buffer(0); - auto* seq = buf->get<LV2_Atom_Sequence>(); + const BufferRef buf = _notify_port->buffer(0); + auto* const seq = buf->get<LV2_Atom_Sequence>(); // Initialise output to the empty sequence seq->atom.type = _notify_port->bufs().uris().atom_Sequence; |