Skip to content
Snippets Groups Projects
Commit d9b5182f authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee
Browse files

[ #36391 ] Fix cppcheck warnings

parent 118a2e58
Branches
No related tags found
No related merge requests found
...@@ -241,13 +241,12 @@ void AccountListModel::slotVoiceMailNotify(const QString &accountID, int count) ...@@ -241,13 +241,12 @@ void AccountListModel::slotVoiceMailNotify(const QString &accountID, int count)
void AccountListModel::update() void AccountListModel::update()
{ {
ConfigurationManagerInterface & configurationManager = DBus::ConfigurationManager::instance(); ConfigurationManagerInterface & configurationManager = DBus::ConfigurationManager::instance();
Account* current;
QList<Account*> tmp; QList<Account*> tmp;
for (int i = 0; i < m_lAccounts.size(); i++) for (int i = 0; i < m_lAccounts.size(); i++)
tmp << m_lAccounts[i]; tmp << m_lAccounts[i];
for (int i = 0; i < tmp.size(); i++) { for (int i = 0; i < tmp.size(); i++) {
current = tmp[i]; Account* current = tmp[i];
if (!current->isNew() && (current->state() != Account::AccountEditState::NEW if (!current->isNew() && (current->state() != Account::AccountEditState::NEW
&& current->state() != Account::AccountEditState::MODIFIED && current->state() != Account::AccountEditState::MODIFIED
&& current->state() != Account::AccountEditState::OUTDATED)) && current->state() != Account::AccountEditState::OUTDATED))
...@@ -297,7 +296,6 @@ void AccountListModel::save() ...@@ -297,7 +296,6 @@ void AccountListModel::save()
//create or update each account from accountList //create or update each account from accountList
for (int i = 0; i < size(); i++) { for (int i = 0; i < size(); i++) {
Account* current = (*this)[i]; Account* current = (*this)[i];
//current->save();
current->performAction(Account::AccountEditAction::SAVE); current->performAction(Account::AccountEditAction::SAVE);
} }
...@@ -406,9 +404,8 @@ QVector<Account*> AccountListModel::getAccountsByState(const QString& state) ...@@ -406,9 +404,8 @@ QVector<Account*> AccountListModel::getAccountsByState(const QString& state)
///Get the first registerred account (default account) ///Get the first registerred account (default account)
Account* AccountListModel::firstRegisteredAccount() const Account* AccountListModel::firstRegisteredAccount() const
{ {
Account* current;
for (int i = 0; i < m_lAccounts.count(); ++i) { for (int i = 0; i < m_lAccounts.count(); ++i) {
current = m_lAccounts[i]; Account* current = m_lAccounts[i];
if(current && current->registrationStatus() == Account::State::REGISTERED && current->isEnabled()) if(current && current->registrationStatus() == Account::State::REGISTERED && current->isEnabled())
return current; return current;
else if (current && (current->registrationStatus() == Account::State::READY) && m_lAccounts.count() == 1) else if (current && (current->registrationStatus() == Account::State::READY) && m_lAccounts.count() == 1)
......
...@@ -808,7 +808,7 @@ Call::State Call::performAction(Call::Action action) ...@@ -808,7 +808,7 @@ Call::State Call::performAction(Call::Action action)
try { try {
changeCurrentState(actionPerformedStateMap[previousState][action]); changeCurrentState(actionPerformedStateMap[previousState][action]);
} }
catch(Call::State state) { catch(Call::State& state) {
qDebug() << "State change failed (actionPerformedStateMap)" << state; qDebug() << "State change failed (actionPerformedStateMap)" << state;
m_CurrentState = Call::State::ERROR; m_CurrentState = Call::State::ERROR;
emit stateChanged(); emit stateChanged();
......
...@@ -70,7 +70,7 @@ TopLevelItem::~TopLevelItem() { ...@@ -70,7 +70,7 @@ TopLevelItem::~TopLevelItem() {
} }
ContactTreeNode::ContactTreeNode(Contact* ct, ContactProxyModel* parent) : CategorizedCompositeNode(CategorizedCompositeNode::Type::CONTACT), ContactTreeNode::ContactTreeNode(Contact* ct, ContactProxyModel* parent) : CategorizedCompositeNode(CategorizedCompositeNode::Type::CONTACT),
m_pContact(ct) m_pContact(ct),m_pParent3(nullptr)
{ {
m_pBinder = new ContactTreeBinder(parent,this); m_pBinder = new ContactTreeBinder(parent,this);
} }
......
...@@ -217,8 +217,8 @@ void NumberCompletionModel::getRange(QMap<QString,PhoneDirectoryModel::NumberWra ...@@ -217,8 +217,8 @@ void NumberCompletionModel::getRange(QMap<QString,PhoneDirectoryModel::NumberWra
int toAdd = size-1; int toAdd = size-1;
mid = iBeg; mid = iBeg;
while (toAdd && mid != map.end()) { while (toAdd && mid != map.end()) {
mid++; ++mid;
toAdd--; --toAdd;
} }
} }
if (mid != map.end() && mid.key().left(prefixLen) == pref && iBeg.key().left(prefixLen) < pref) { if (mid != map.end() && mid.key().left(prefixLen) == pref && iBeg.key().left(prefixLen) < pref) {
...@@ -236,7 +236,7 @@ void NumberCompletionModel::getRange(QMap<QString,PhoneDirectoryModel::NumberWra ...@@ -236,7 +236,7 @@ void NumberCompletionModel::getRange(QMap<QString,PhoneDirectoryModel::NumberWra
} }
while ((iEnd).key().left(prefixLen) == pref && iEnd+1 != map.end()) { while ((iEnd).key().left(prefixLen) == pref && iEnd+1 != map.end()) {
iEnd++; ++iEnd;
} }
endOk = (iEnd.key().left(prefixLen) == pref); endOk = (iEnd.key().left(prefixLen) == pref);
...@@ -245,7 +245,7 @@ void NumberCompletionModel::getRange(QMap<QString,PhoneDirectoryModel::NumberWra ...@@ -245,7 +245,7 @@ void NumberCompletionModel::getRange(QMap<QString,PhoneDirectoryModel::NumberWra
} }
while (iBeg.key().left(prefixLen) != pref && iBeg != iEnd) while (iBeg.key().left(prefixLen) != pref && iBeg != iEnd)
iBeg++; ++iBeg;
if (iEnd == iBeg && iBeg.key().left(prefixLen) != pref) { if (iEnd == iBeg && iBeg.key().left(prefixLen) != pref) {
iEnd = map.end(); iEnd = map.end();
...@@ -257,7 +257,7 @@ void NumberCompletionModel::getRange(QMap<QString,PhoneDirectoryModel::NumberWra ...@@ -257,7 +257,7 @@ void NumberCompletionModel::getRange(QMap<QString,PhoneDirectoryModel::NumberWra
set << n; set << n;
} }
} }
iBeg++; ++iBeg;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment