clang-tidy: fix issues

Change-Id: I2e7154624ad712b97dfdc2942ab0e924c8c8c306
This commit is contained in:
Adrien Béraud
2019-04-03 16:15:51 -04:00
committed by Sébastien Blin
parent adafd963c0
commit 008c78225b
4 changed files with 6 additions and 10 deletions

View File

@ -108,13 +108,11 @@ class AccountFactory {
std::lock_guard<std::recursive_mutex> lock(mutex_);
std::vector<std::shared_ptr<T> > v;
const auto map = getMap_<T>();
if (map) {
if (const auto map = getMap_<T>()) {
v.reserve(map->size());
for (const auto& it : *map)
v.push_back(std::static_pointer_cast<T>(it.second));
}
v.shrink_to_fit();
return v;
}

View File

@ -77,7 +77,7 @@ accountToJsonValue(const std::map<std::string, std::string>& details) {
// replace paths by the files content
std::ifstream ifs(i.second);
std::string fileContent((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
root[i.first] = fileContent;
root[i.first] = std::move(fileContent);
} else
root[i.first] = i.second;
}
@ -95,7 +95,7 @@ exportAccounts(const std::vector<std::string>& accountIDs,
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 filename = filepath.substr(found+1);

View File

@ -51,7 +51,7 @@ namespace jami {
/// code \a errcode when the predicate return true.
/// The predicate should have <code>bool(Call*) signature</code>.
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),
[&](const std::shared_ptr<Call>& call_ptr) {
@ -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.
inline void
hangupCalls(Call::SubcallSet callptr_list, int errcode)
hangupCalls(const Call::SubcallSet& callptr_list, int errcode)
{
hangupCallsIf(callptr_list, errcode, [](Call*){ return true; });
}

View File

@ -345,8 +345,6 @@ class Call : public Recordable, public std::enable_shared_from_this<Call> {
mutable std::recursive_mutex callMutex_ {};
private:
friend void hangupCallsIf(Call::SubcallSet, int, const std::function<bool(Call*)>&);
bool validStateTransition(CallState newState);
void checkPendingIM();