Skip to content
Snippets Groups Projects
Commit 008c7822 authored by Adrien Béraud's avatar Adrien Béraud Committed by Sébastien Blin
Browse files

clang-tidy: fix issues

Change-Id: I2e7154624ad712b97dfdc2942ab0e924c8c8c306
parent adafd963
No related branches found
No related tags found
No related merge requests found
...@@ -108,13 +108,11 @@ class AccountFactory { ...@@ -108,13 +108,11 @@ class AccountFactory {
std::lock_guard<std::recursive_mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_);
std::vector<std::shared_ptr<T> > v; std::vector<std::shared_ptr<T> > v;
const auto map = getMap_<T>(); if (const auto map = getMap_<T>()) {
if (map) { v.reserve(map->size());
for (const auto& it : *map) for (const auto& it : *map)
v.push_back(std::static_pointer_cast<T>(it.second)); v.push_back(std::static_pointer_cast<T>(it.second));
} }
v.shrink_to_fit();
return v; return v;
} }
......
...@@ -77,7 +77,7 @@ accountToJsonValue(const std::map<std::string, std::string>& details) { ...@@ -77,7 +77,7 @@ accountToJsonValue(const std::map<std::string, std::string>& details) {
// replace paths by the files content // replace paths by the files content
std::ifstream ifs(i.second); std::ifstream ifs(i.second);
std::string fileContent((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>()); std::string fileContent((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
root[i.first] = fileContent; root[i.first] = std::move(fileContent);
} else } else
root[i.first] = i.second; root[i.first] = i.second;
} }
...@@ -95,7 +95,7 @@ exportAccounts(const std::vector<std::string>& accountIDs, ...@@ -95,7 +95,7 @@ exportAccounts(const std::vector<std::string>& accountIDs,
return EINVAL; return EINVAL;
} }
std::size_t found = filepath.find_last_of(DIR_SEPARATOR_STR); std::size_t found = filepath.find_last_of(DIR_SEPARATOR_CH);
auto toDir = filepath.substr(0,found); auto toDir = filepath.substr(0,found);
auto filename = filepath.substr(found+1); auto filename = filepath.substr(found+1);
......
...@@ -51,7 +51,7 @@ namespace jami { ...@@ -51,7 +51,7 @@ namespace jami {
/// code \a errcode when the predicate return true. /// code \a errcode when the predicate return true.
/// The predicate should have <code>bool(Call*) signature</code>. /// The predicate should have <code>bool(Call*) signature</code>.
inline void inline void
hangupCallsIf(Call::SubcallSet callptr_list, int errcode, const std::function<bool(Call*)>& pred) hangupCallsIf(const Call::SubcallSet& callptr_list, int errcode, const std::function<bool(Call*)>& pred)
{ {
std::for_each(std::begin(callptr_list), std::end(callptr_list), std::for_each(std::begin(callptr_list), std::end(callptr_list),
[&](const std::shared_ptr<Call>& call_ptr) { [&](const std::shared_ptr<Call>& call_ptr) {
...@@ -70,7 +70,7 @@ hangupCallsIf(Call::SubcallSet callptr_list, int errcode, const std::function<bo ...@@ -70,7 +70,7 @@ hangupCallsIf(Call::SubcallSet callptr_list, int errcode, const std::function<bo
/// ///
/// Works as hangupCallsIf() with a predicate that always return true. /// Works as hangupCallsIf() with a predicate that always return true.
inline void inline void
hangupCalls(Call::SubcallSet callptr_list, int errcode) hangupCalls(const Call::SubcallSet& callptr_list, int errcode)
{ {
hangupCallsIf(callptr_list, errcode, [](Call*){ return true; }); hangupCallsIf(callptr_list, errcode, [](Call*){ return true; });
} }
......
...@@ -345,8 +345,6 @@ class Call : public Recordable, public std::enable_shared_from_this<Call> { ...@@ -345,8 +345,6 @@ class Call : public Recordable, public std::enable_shared_from_this<Call> {
mutable std::recursive_mutex callMutex_ {}; mutable std::recursive_mutex callMutex_ {};
private: private:
friend void hangupCallsIf(Call::SubcallSet, int, const std::function<bool(Call*)>&);
bool validStateTransition(CallState newState); bool validStateTransition(CallState newState);
void checkPendingIM(); void checkPendingIM();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment