summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-04-07 19:01:49 +0200
committerlouiz’ <louiz@louiz.org>2017-04-07 19:01:49 +0200
commitbe9c577de840c7f0dc08b9f5b9ba9bd522d0e2ea (patch)
tree7b3c18d8c0b6a1b0f5c3a56a44cb7ed3b2ff2739
parentb82a14f20effad351cd2b1f344d526202ef11caf (diff)
downloadbiboumi-be9c577de840c7f0dc08b9f5b9ba9bd522d0e2ea.tar.gz
biboumi-be9c577de840c7f0dc08b9f5b9ba9bd522d0e2ea.tar.bz2
biboumi-be9c577de840c7f0dc08b9f5b9ba9bd522d0e2ea.tar.xz
biboumi-be9c577de840c7f0dc08b9f5b9ba9bd522d0e2ea.zip
Apply all the clang-tidy performance-* fixes
-rw-r--r--src/bridge/bridge.cpp6
-rw-r--r--src/bridge/bridge.hpp2
-rw-r--r--src/irc/irc_client.cpp4
-rw-r--r--src/network/credentials_manager.cpp2
-rw-r--r--src/network/credentials_manager.hpp2
-rw-r--r--src/xmpp/xmpp_component.cpp2
-rw-r--r--src/xmpp/xmpp_stanza.cpp2
7 files changed, 10 insertions, 10 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index 4966b0d..591e947 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -988,16 +988,16 @@ void Bridge::send_room_history(const std::string& hostname, const std::string& c
this->send_room_history(hostname, chan_name, resource);
}
-void Bridge::send_room_history(const std::string& hostname, const std::string& chan_name, const std::string& resource)
+void Bridge::send_room_history(const std::string& hostname, std::string chan_name, const std::string& resource)
{
#ifdef USE_DATABASE
const auto coptions = Database::get_irc_channel_options_with_server_and_global_default(this->user_jid, hostname, chan_name);
const auto lines = Database::get_muc_logs(this->user_jid, chan_name, hostname, coptions.maxHistoryLength.value());
+ chan_name.append(utils::empty_if_fixed_server("%" + hostname));
for (const auto& line: lines)
{
const auto seconds = line.date.value().timeStamp();
- this->xmpp.send_history_message(chan_name + utils::empty_if_fixed_server("%" + hostname), line.nick.value(),
- line.body.value(),
+ this->xmpp.send_history_message(chan_name, line.nick.value(), line.body.value(),
this->user_jid + "/" + resource, seconds);
}
#endif
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index 53d2136..f192545 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -157,7 +157,7 @@ public:
* Send the MUC history to the user
*/
void send_room_history(const std::string& hostname, const std::string& chan_name);
- void send_room_history(const std::string& hostname, const std::string& chan_name, const std::string& resource);
+ void send_room_history(const std::string& hostname, std::string chan_name, const std::string& resource);
/**
* Send a MUC message from some participant
*/
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 1d025f2..1f562fe 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -385,7 +385,7 @@ void IrcClient::send_message(IrcMessage&& message)
res += message.command;
for (const std::string& arg: message.arguments)
{
- if (arg.find(" ") != std::string::npos ||
+ if (arg.find(' ') != std::string::npos ||
(!arg.empty() && arg[0] == ':'))
{
res += " :" + arg;
@@ -1080,7 +1080,7 @@ void IrcClient::on_channel_mode(const IrcMessage& message)
{
// That mode can also be of type B if it is present in the
// prefix_to_mode map
- for (const std::pair<char, char>& pair: this->prefix_to_mode)
+ for (const auto& pair: this->prefix_to_mode)
if (pair.second == c)
{
type = 1;
diff --git a/src/network/credentials_manager.cpp b/src/network/credentials_manager.cpp
index 0908a2f..ea76627 100644
--- a/src/network/credentials_manager.cpp
+++ b/src/network/credentials_manager.cpp
@@ -44,7 +44,7 @@ const std::string& BasicCredentialsManager::get_trusted_fingerprint() const
void check_tls_certificate(const std::vector<Botan::X509_Certificate>& certs,
const std::string& hostname, const std::string& trusted_fingerprint,
- std::exception_ptr exc)
+ const std::exception_ptr& exc)
{
if (!trusted_fingerprint.empty() && !certs.empty() &&
diff --git a/src/network/credentials_manager.hpp b/src/network/credentials_manager.hpp
index c463ad4..e7c247d 100644
--- a/src/network/credentials_manager.hpp
+++ b/src/network/credentials_manager.hpp
@@ -19,7 +19,7 @@ class TCPSocketHandler;
*/
void check_tls_certificate(const std::vector<Botan::X509_Certificate>& certs,
const std::string& hostname, const std::string& trusted_fingerprint,
- std::exception_ptr exc);
+ const std::exception_ptr& exc);
class BasicCredentialsManager: public Botan::Credentials_Manager
{
diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp
index 8335c8a..35abbee 100644
--- a/src/xmpp/xmpp_component.cpp
+++ b/src/xmpp/xmpp_component.cpp
@@ -445,7 +445,7 @@ void XmppComponent::send_muc_leave(const std::string& muc_name, const std::strin
presence["to"] = jid_to;
presence["from"] = muc_name + "@" + this->served_hostname + "/" + nick;
presence["type"] = "unavailable";
- const std::string message_str = std::get<0>(message);
+ const std::string& message_str = std::get<0>(message);
XmlSubNode x(presence, "x");
x["xmlns"] = MUC_USER_NS;
if (self)
diff --git a/src/xmpp/xmpp_stanza.cpp b/src/xmpp/xmpp_stanza.cpp
index 4999851..435f333 100644
--- a/src/xmpp/xmpp_stanza.cpp
+++ b/src/xmpp/xmpp_stanza.cpp
@@ -52,7 +52,7 @@ XmlNode::XmlNode(const std::string& name, XmlNode* parent):
parent(parent)
{
// split the namespace and the name
- auto n = name.rfind(":");
+ auto n = name.rfind(':');
if (n == std::string::npos)
this->name = name;
else