From c076e93136799096da613950eb14e7d5fbe9375a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 12 May 2023 09:58:30 -0400 Subject: Fix const correctness --- include/ingen/QueuedInterface.hpp | 4 ++-- include/ingen/Tee.hpp | 2 +- include/ingen/client/SocketClient.hpp | 2 +- include/ingen/fmt.hpp | 8 +++++--- 4 files changed, 9 insertions(+), 7 deletions(-) (limited to 'include/ingen') diff --git a/include/ingen/QueuedInterface.hpp b/include/ingen/QueuedInterface.hpp index fc3e539c..4bb6baea 100644 --- a/include/ingen/QueuedInterface.hpp +++ b/include/ingen/QueuedInterface.hpp @@ -42,14 +42,14 @@ public: URI uri() const override { return URI("ingen:/QueuedInterface"); } void message(const Message& message) override { - std::lock_guard lock(_mutex); + const std::lock_guard lock{_mutex}; _messages.emplace_back(message); } void emit() { std::vector messages; { - std::lock_guard lock(_mutex); + const std::lock_guard lock{_mutex}; _messages.swap(messages); } diff --git a/include/ingen/Tee.hpp b/include/ingen/Tee.hpp index 2158190f..562ff298 100644 --- a/include/ingen/Tee.hpp +++ b/include/ingen/Tee.hpp @@ -46,7 +46,7 @@ public: } void message(const Message& message) override { - std::lock_guard lock(_sinks_mutex); + const std::lock_guard lock{_sinks_mutex}; for (const auto& s : _sinks) { s->message(message); } diff --git a/include/ingen/client/SocketClient.hpp b/include/ingen/client/SocketClient.hpp index 3dc00d6f..7434da90 100644 --- a/include/ingen/client/SocketClient.hpp +++ b/include/ingen/client/SocketClient.hpp @@ -66,7 +66,7 @@ public: ? raul::Socket::Type::UNIX : raul::Socket::Type::TCP); - std::shared_ptr sock(new raul::Socket(type)); + const std::shared_ptr sock{new raul::Socket(type)}; if (!sock->connect(uri)) { world.log().error("Failed to connect <%1%> (%2%)\n", sock->uri(), strerror(errno)); diff --git a/include/ingen/fmt.hpp b/include/ingen/fmt.hpp index b2924d29..7ca5de9f 100644 --- a/include/ingen/fmt.hpp +++ b/include/ingen/fmt.hpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2016 David Robillard + Copyright 2007-2023 David Robillard Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -27,8 +27,10 @@ template std::string fmt(const char* fmt, Args&&... args) { - boost::format f(fmt); - std::initializer_list l{(static_cast(f % args), char{})...}; + boost::format f{fmt}; // NOLINT(misc-const-correctness) + const std::initializer_list l{ + (static_cast(f % args), char{})...}; + (void)l; return boost::str(f); } -- cgit v1.2.1