summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-06-13 15:33:13 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-06-13 16:57:09 (GMT)
commit790134ceb34ab6047fe204517d263f343dbeb920 (patch)
treed8002133de67108f380248a0ec7d063c8f1956b7 /Swift/Controllers
parenta03cedb3942e4c7c90e62fe9a73c6d15e38fbb68 (diff)
downloadswift-contrib-790134ceb34ab6047fe204517d263f343dbeb920.zip
swift-contrib-790134ceb34ab6047fe204517d263f343dbeb920.tar.bz2
Added CppCheck script.
Tweaked the sources to satisfy cppcheck.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp2
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp2
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp2
-rw-r--r--Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp2
-rw-r--r--Swift/Controllers/ChatMessageSummarizer.cpp2
-rw-r--r--Swift/Controllers/DiscoServiceWalker.cpp2
-rw-r--r--Swift/Controllers/PreviousStatusStore.cpp2
-rw-r--r--Swift/Controllers/Roster/ContactRosterItem.cpp2
-rw-r--r--Swift/Controllers/Roster/GroupRosterItem.cpp6
-rw-r--r--Swift/Controllers/Roster/Roster.cpp6
-rw-r--r--Swift/Controllers/SystemTrayController.cpp2
-rw-r--r--Swift/Controllers/UIInterfaces/EventWindow.h3
-rw-r--r--Swift/Controllers/UnitTest/MockChatWindow.h2
13 files changed, 18 insertions, 17 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index a735ed9..513b446 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -143,7 +143,7 @@ void ChatController::handleStanzaAcked(boost::shared_ptr<Stanza> stanza) {
void ChatController::setOnline(bool online) {
if (!online) {
std::map<boost::shared_ptr<Stanza>, std::string>::iterator it = unackedStanzas_.begin();
- for ( ; it != unackedStanzas_.end(); it++) {
+ for ( ; it != unackedStanzas_.end(); ++it) {
chatWindow_->setAckState(it->second, ChatWindow::Failed);
}
unackedStanzas_.clear();
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 0af1a81..ef85107 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -188,7 +188,7 @@ void ChatsManager::prependRecent(const ChatListWindow::Chat& chat) {
void ChatsManager::handleUserLeftMUC(MUCController* mucController) {
std::map<JID, MUCController*>::iterator it;
- for (it = mucControllers_.begin(); it != mucControllers_.end(); it++) {
+ for (it = mucControllers_.begin(); it != mucControllers_.end(); ++it) {
if ((*it).second == mucController) {
mucControllers_.erase(it);
delete mucController;
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index e43dc52..ac4689f 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -426,7 +426,7 @@ void MUCController::updateJoinParts() {
void MUCController::appendToJoinParts(std::vector<NickJoinPart>& joinParts, const NickJoinPart& newEvent) {
std::vector<NickJoinPart>::iterator it = joinParts.begin();
bool matched = false;
- for (; it != joinParts.end(); it++) {
+ for (; it != joinParts.end(); ++it) {
if ((*it).nick == newEvent.nick) {
matched = true;
JoinPart type = (*it).type;
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
index f8fda9a..07afc73 100644
--- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
@@ -97,7 +97,6 @@ public:
//delete chatListWindowFactory_;
delete settings_;
delete profileSettings_;
- delete mocks_;
delete avatarManager_;
delete manager_;
delete directedPresenceSender_;
@@ -115,6 +114,7 @@ public:
delete entityCapsManager_;
delete capsProvider_;
delete chatListWindow_;
+ delete mocks_;
}
void testFirstOpenWindowIncoming() {
diff --git a/Swift/Controllers/ChatMessageSummarizer.cpp b/Swift/Controllers/ChatMessageSummarizer.cpp
index 682d88b..d95a177 100644
--- a/Swift/Controllers/ChatMessageSummarizer.cpp
+++ b/Swift/Controllers/ChatMessageSummarizer.cpp
@@ -37,7 +37,7 @@ string ChatMessageSummarizer::getSummary(const string& current, const vector<Unr
if (others.size() > 1) {
string result(QT_TRANSLATE_NOOP("", "%1% and %2% others (%3%)"));
myString = str(format(result) % myString % others.size() % otherCount);
- } else if (others.size() > 0) {
+ } else if (!others.empty()) {
string result(QT_TRANSLATE_NOOP("", "%1%, %2% (%3%)"));
myString = str(format(result) % myString % others[0].first % otherCount);
}
diff --git a/Swift/Controllers/DiscoServiceWalker.cpp b/Swift/Controllers/DiscoServiceWalker.cpp
index 6aed6eb..1ca4930 100644
--- a/Swift/Controllers/DiscoServiceWalker.cpp
+++ b/Swift/Controllers/DiscoServiceWalker.cpp
@@ -141,7 +141,7 @@ void DiscoServiceWalker::markNodeCompleted(const JID& jid) {
servicesBeingSearched_.erase(jid);
/* All results are in */
- if (servicesBeingSearched_.size() == 0) {
+ if (servicesBeingSearched_.empty()) {
active_ = false;
onWalkComplete();
}
diff --git a/Swift/Controllers/PreviousStatusStore.cpp b/Swift/Controllers/PreviousStatusStore.cpp
index 947cdc7..ca0a12e 100644
--- a/Swift/Controllers/PreviousStatusStore.cpp
+++ b/Swift/Controllers/PreviousStatusStore.cpp
@@ -40,7 +40,7 @@ std::vector<TypeStringPair> PreviousStatusStore::getSuggestions(const std::strin
suggestions.push_back(status);
}
}
- if (suggestions.size() == 0) {
+ if (suggestions.empty()) {
TypeStringPair suggestion(StatusShow::Online, message);
suggestions.push_back(suggestion);
}
diff --git a/Swift/Controllers/Roster/ContactRosterItem.cpp b/Swift/Controllers/Roster/ContactRosterItem.cpp
index 894f64b..bbe81e6 100644
--- a/Swift/Controllers/Roster/ContactRosterItem.cpp
+++ b/Swift/Controllers/Roster/ContactRosterItem.cpp
@@ -91,7 +91,7 @@ void ContactRosterItem::applyPresence(const std::string& resource, boost::shared
presences_.erase(resource);
}
}
- if (presences_.size() == 0) {
+ if (presences_.empty()) {
offlinePresence_ = presence;
}
} else {
diff --git a/Swift/Controllers/Roster/GroupRosterItem.cpp b/Swift/Controllers/Roster/GroupRosterItem.cpp
index 2b56d1f..2a7bfa5 100644
--- a/Swift/Controllers/Roster/GroupRosterItem.cpp
+++ b/Swift/Controllers/Roster/GroupRosterItem.cpp
@@ -89,7 +89,7 @@ void GroupRosterItem::removeAll() {
delete group;
}
}
- it++;
+ ++it;
}
children_.clear();
}
@@ -117,7 +117,7 @@ ContactRosterItem* GroupRosterItem::removeChild(const JID& jid) {
removed = groupRemoved;
}
}
- it++;
+ ++it;
}
onChildrenChanged();
onDataChanged();
@@ -136,7 +136,7 @@ GroupRosterItem* GroupRosterItem::removeGroupChild(const std::string& groupName)
it = children_.erase(it);
continue;
}
- it++;
+ ++it;
}
onChildrenChanged();
onDataChanged();
diff --git a/Swift/Controllers/Roster/Roster.cpp b/Swift/Controllers/Roster/Roster.cpp
index 4e34105..a62a18a 100644
--- a/Swift/Controllers/Roster/Roster.cpp
+++ b/Swift/Controllers/Roster/Roster.cpp
@@ -107,7 +107,7 @@ void Roster::removeAll() {
void Roster::removeContact(const JID& jid) {
std::vector<ContactRosterItem*>* items = &itemMap_[fullJIDMapping_ ? jid : jid.toBare()];
items->erase(std::remove_if(items->begin(), items->end(), JIDEqualsTo(jid)), items->end());
- if (items->size() == 0) {
+ if (items->empty()) {
itemMap_.erase(fullJIDMapping_ ? jid : jid.toBare());
}
//Causes the delete
@@ -124,7 +124,7 @@ void Roster::removeContactFromGroup(const JID& jid, const std::string& groupName
std::vector<ContactRosterItem*>* items = &itemMap_[fullJIDMapping_ ? jid : jid.toBare()];
items->erase(std::remove(items->begin(), items->end(), deleted), items->end());
}
- it++;
+ ++it;
}
foreach (ContactRosterItem* item, itemMap_[fullJIDMapping_ ? jid : jid.toBare()]) {
item->removeGroup(groupName);
@@ -179,7 +179,7 @@ void Roster::filterContact(ContactRosterItem* contact, GroupRosterItem* group) {
foreach (RosterFilter *filter, filters_) {
hide &= (*filter)(contact);
}
- group->setDisplayed(contact, filters_.size() == 0 || !hide);
+ group->setDisplayed(contact, filters_.empty() || !hide);
int newDisplayedSize = group->getDisplayedChildren().size();
if (oldDisplayedSize == 0 && newDisplayedSize > 0) {
onGroupAdded(group);
diff --git a/Swift/Controllers/SystemTrayController.cpp b/Swift/Controllers/SystemTrayController.cpp
index 598771c..31fd4ff 100644
--- a/Swift/Controllers/SystemTrayController.cpp
+++ b/Swift/Controllers/SystemTrayController.cpp
@@ -22,7 +22,7 @@ SystemTrayController::SystemTrayController(EventController* eventController, Sys
void SystemTrayController::handleEventQueueLengthChange(int /*length*/) {
EventList events = eventController_->getEvents();
bool found = false;
- for (EventList::iterator it = events.begin(); it != events.end(); it++) {
+ for (EventList::iterator it = events.begin(); it != events.end(); ++it) {
if (boost::dynamic_pointer_cast<MessageEvent>(*it)) {
found = true;
break;
diff --git a/Swift/Controllers/UIInterfaces/EventWindow.h b/Swift/Controllers/UIInterfaces/EventWindow.h
index e756655..3ca2c82 100644
--- a/Swift/Controllers/UIInterfaces/EventWindow.h
+++ b/Swift/Controllers/UIInterfaces/EventWindow.h
@@ -6,7 +6,8 @@
#pragma once
-#include "boost/shared_ptr.hpp"
+#include <boost/shared_ptr.hpp>
+
#include "Swift/Controllers/XMPPEvents/StanzaEvent.h"
namespace Swift {
diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h
index 82c5b52..a5765fd 100644
--- a/Swift/Controllers/UnitTest/MockChatWindow.h
+++ b/Swift/Controllers/UnitTest/MockChatWindow.h
@@ -11,7 +11,7 @@
namespace Swift {
class MockChatWindow : public ChatWindow {
public:
- MockChatWindow() {};
+ MockChatWindow() : labelsEnabled_(false) {};
virtual ~MockChatWindow();
virtual std::string addMessage(const std::string& message, const std::string& /*senderName*/, bool /*senderIsSelf*/, boost::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime&) {lastMessageBody_ = message; return "";};