diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-06-13 15:33:13 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-06-13 16:57:09 (GMT) |
commit | 790134ceb34ab6047fe204517d263f343dbeb920 (patch) | |
tree | d8002133de67108f380248a0ec7d063c8f1956b7 /Swiften | |
parent | a03cedb3942e4c7c90e62fe9a73c6d15e38fbb68 (diff) | |
download | swift-790134ceb34ab6047fe204517d263f343dbeb920.zip swift-790134ceb34ab6047fe204517d263f343dbeb920.tar.bz2 |
Added CppCheck script.
Tweaked the sources to satisfy cppcheck.
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Component/UnitTest/ComponentSessionTest.cpp | 2 | ||||
-rw-r--r-- | Swiften/Elements/Last.h | 3 | ||||
-rw-r--r-- | Swiften/Elements/RosterItemExchangePayload.cpp | 2 | ||||
-rw-r--r-- | Swiften/Elements/RosterItemExchangePayload.h | 2 | ||||
-rw-r--r-- | Swiften/Elements/VCard.cpp | 2 | ||||
-rw-r--r-- | Swiften/EventLoop/DummyEventLoop.h | 2 | ||||
-rw-r--r-- | Swiften/EventLoop/SimpleEventLoop.cpp | 2 | ||||
-rw-r--r-- | Swiften/History/SQLiteHistoryManager.cpp | 2 | ||||
-rw-r--r-- | Swiften/LinkLocal/LinkLocalServiceInfo.cpp | 3 | ||||
-rw-r--r-- | Swiften/MUC/MUCBookmarkManager.cpp | 2 | ||||
-rw-r--r-- | Swiften/Network/MacOSXProxyProvider.cpp | 2 | ||||
-rw-r--r-- | Swiften/Presence/PresenceOracle.cpp | 4 | ||||
-rw-r--r-- | Swiften/QA/DNSSDTest/DNSSDTest.cpp | 2 | ||||
-rw-r--r-- | Swiften/SASL/DIGESTMD5Properties.cpp | 2 | ||||
-rw-r--r-- | Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp | 2 | ||||
-rw-r--r-- | Swiften/Serializer/PresenceSerializer.cpp | 2 | ||||
-rw-r--r-- | Swiften/Serializer/XML/XMLElement.cpp | 2 | ||||
-rw-r--r-- | Swiften/StreamManagement/StanzaAckRequester.cpp | 2 | ||||
-rw-r--r-- | Swiften/StringCodecs/MD5.cpp | 8 |
19 files changed, 24 insertions, 24 deletions
diff --git a/Swiften/Component/UnitTest/ComponentSessionTest.cpp b/Swiften/Component/UnitTest/ComponentSessionTest.cpp index c486d6d..c27ade5 100644 --- a/Swiften/Component/UnitTest/ComponentSessionTest.cpp +++ b/Swiften/Component/UnitTest/ComponentSessionTest.cpp @@ -187,7 +187,7 @@ class ComponentSessionTest : public CppUnit::TestFixture { } Event popEvent() { - CPPUNIT_ASSERT(receivedEvents.size() > 0); + CPPUNIT_ASSERT(!receivedEvents.empty()); Event event = receivedEvents.front(); receivedEvents.pop_front(); return event; diff --git a/Swiften/Elements/Last.h b/Swiften/Elements/Last.h index ba302e3..fe0323a 100644 --- a/Swiften/Elements/Last.h +++ b/Swiften/Elements/Last.h @@ -11,8 +11,7 @@ namespace Swift { class Last : public Payload { public: - Last() {}; - Last(int seconds) : seconds_(seconds) {}; + Last(int seconds = 0) : seconds_(seconds) {}; int getSeconds() const {return seconds_;} void setSeconds(int seconds) {seconds_ = seconds;} diff --git a/Swiften/Elements/RosterItemExchangePayload.cpp b/Swiften/Elements/RosterItemExchangePayload.cpp index a425551..abd5296 100644 --- a/Swiften/Elements/RosterItemExchangePayload.cpp +++ b/Swiften/Elements/RosterItemExchangePayload.cpp @@ -9,7 +9,7 @@ namespace Swift { -RosterItemExchangePayload::Item::Item() { +RosterItemExchangePayload::Item::Item(Action action) : action(action) { } RosterItemExchangePayload::RosterItemExchangePayload() { diff --git a/Swiften/Elements/RosterItemExchangePayload.h b/Swiften/Elements/RosterItemExchangePayload.h index cbe9ffa..c39c084 100644 --- a/Swiften/Elements/RosterItemExchangePayload.h +++ b/Swiften/Elements/RosterItemExchangePayload.h @@ -23,7 +23,7 @@ namespace Swift { public: enum Action { Add, Modify, Delete }; - Item(); + Item(Action action = Add); Action getAction() const { return action; diff --git a/Swiften/Elements/VCard.cpp b/Swiften/Elements/VCard.cpp index 4f7700e..8bf3eb9 100644 --- a/Swiften/Elements/VCard.cpp +++ b/Swiften/Elements/VCard.cpp @@ -16,7 +16,7 @@ VCard::EMailAddress VCard::getPreferredEMailAddress() const { return address; } } - if (emailAddresses_.size() > 0) { + if (!emailAddresses_.empty()) { return emailAddresses_[0]; } return EMailAddress(); diff --git a/Swiften/EventLoop/DummyEventLoop.h b/Swiften/EventLoop/DummyEventLoop.h index f814ed9..4c01c16 100644 --- a/Swiften/EventLoop/DummyEventLoop.h +++ b/Swiften/EventLoop/DummyEventLoop.h @@ -24,7 +24,7 @@ namespace Swift { } bool hasEvents() { - return events_.size() > 0; + return !events_.empty(); } virtual void post(const Event& event) { diff --git a/Swiften/EventLoop/SimpleEventLoop.cpp b/Swiften/EventLoop/SimpleEventLoop.cpp index 74fea01..63b8ba5 100644 --- a/Swiften/EventLoop/SimpleEventLoop.cpp +++ b/Swiften/EventLoop/SimpleEventLoop.cpp @@ -30,7 +30,7 @@ void SimpleEventLoop::doRun(bool breakAfterEvents) { std::vector<Event> events; { boost::unique_lock<boost::mutex> lock(eventsMutex_); - while (events_.size() == 0) { + while (events_.empty()) { eventsAvailable_.wait(lock); } events.swap(events_); diff --git a/Swiften/History/SQLiteHistoryManager.cpp b/Swiften/History/SQLiteHistoryManager.cpp index 8a809bd..3b65f62 100644 --- a/Swiften/History/SQLiteHistoryManager.cpp +++ b/Swiften/History/SQLiteHistoryManager.cpp @@ -7,7 +7,7 @@ #include <iostream> #include <boost/lexical_cast.hpp> -#include "sqlite3.h" +#include <sqlite3.h> #include <Swiften/History/SQLiteHistoryManager.h> namespace { diff --git a/Swiften/LinkLocal/LinkLocalServiceInfo.cpp b/Swiften/LinkLocal/LinkLocalServiceInfo.cpp index f437fc2..516d303 100644 --- a/Swiften/LinkLocal/LinkLocalServiceInfo.cpp +++ b/Swiften/LinkLocal/LinkLocalServiceInfo.cpp @@ -56,7 +56,8 @@ ByteArray LinkLocalServiceInfo::getEncoded(const std::string& s) { LinkLocalServiceInfo LinkLocalServiceInfo::createFromTXTRecord(const ByteArray& record) { LinkLocalServiceInfo info; size_t i = 0; - while (i < record.size()) { + size_t recordCount = record.size(); + while (i < recordCount) { std::pair<std::string,std::string> entry = readEntry(record, &i); if (entry.first.empty()) { break; diff --git a/Swiften/MUC/MUCBookmarkManager.cpp b/Swiften/MUC/MUCBookmarkManager.cpp index 2e0b79e..643a8c4 100644 --- a/Swiften/MUC/MUCBookmarkManager.cpp +++ b/Swiften/MUC/MUCBookmarkManager.cpp @@ -86,7 +86,7 @@ void MUCBookmarkManager::addBookmark(const MUCBookmark& bookmark) { void MUCBookmarkManager::removeBookmark(const MUCBookmark& bookmark) { if (!ready_) return; std::vector<MUCBookmark>::iterator it; - for (it = bookmarks_.begin(); it != bookmarks_.end(); it++) { + for (it = bookmarks_.begin(); it != bookmarks_.end(); ++it) { if ((*it) == bookmark) { bookmarks_.erase(it); onBookmarkRemoved(bookmark); diff --git a/Swiften/Network/MacOSXProxyProvider.cpp b/Swiften/Network/MacOSXProxyProvider.cpp index dd44eff..eaadd28 100644 --- a/Swiften/Network/MacOSXProxyProvider.cpp +++ b/Swiften/Network/MacOSXProxyProvider.cpp @@ -48,7 +48,7 @@ static HostAddressPort getFromDictionary(CFDictionaryRef dict, CFStringRef enabl CFIndex length = CFStringGetLength(stringValue) + 1; buffer.resize(length); if(CFStringGetCString(stringValue, &buffer[0], length, kCFStringEncodingMacRoman)) { - for(std::vector<char>::iterator iter = buffer.begin(); iter != buffer.end(); iter++) { + for(std::vector<char>::iterator iter = buffer.begin(); iter != buffer.end(); ++iter) { host += *iter; } } diff --git a/Swiften/Presence/PresenceOracle.cpp b/Swiften/Presence/PresenceOracle.cpp index 1ad6fbf..bfb5a3d 100644 --- a/Swiften/Presence/PresenceOracle.cpp +++ b/Swiften/Presence/PresenceOracle.cpp @@ -84,7 +84,7 @@ std::vector<Presence::ref> PresenceOracle::getAllPresence(const JID& bareJID) co } PresenceMap presenceMap = i->second; PresenceMap::const_iterator j = presenceMap.begin(); - for (; j != presenceMap.end(); j++) { + for (; j != presenceMap.end(); ++j) { Presence::ref current = j->second; results.push_back(current); } @@ -99,7 +99,7 @@ Presence::ref PresenceOracle::getHighestPriorityPresence(const JID& bareJID) con PresenceMap presenceMap = i->second; PresenceMap::const_iterator j = presenceMap.begin(); Presence::ref highest; - for (; j != presenceMap.end(); j++) { + for (; j != presenceMap.end(); ++j) { Presence::ref current = j->second; if (!highest || current->getPriority() > highest->getPriority() diff --git a/Swiften/QA/DNSSDTest/DNSSDTest.cpp b/Swiften/QA/DNSSDTest/DNSSDTest.cpp index 2409f66..7e2a189 100644 --- a/Swiften/QA/DNSSDTest/DNSSDTest.cpp +++ b/Swiften/QA/DNSSDTest/DNSSDTest.cpp @@ -94,7 +94,7 @@ class DNSSDTest : public CppUnit::TestFixture { toRemove.clear(); toRemove.insert(toRemove.begin(), added.begin(), added.end()); registerQuery->unregisterService(); - while (toRemove.size() > 0) { + while (!toRemove.empty()) { Swift::sleep(100); eventLoop->processEvents(); } diff --git a/Swiften/SASL/DIGESTMD5Properties.cpp b/Swiften/SASL/DIGESTMD5Properties.cpp index 9eb2680..6d406e0 100644 --- a/Swiften/SASL/DIGESTMD5Properties.cpp +++ b/Swiften/SASL/DIGESTMD5Properties.cpp @@ -11,7 +11,7 @@ namespace Swift { namespace { bool insideQuotes(const ByteArray& v) { - if (v.size() == 0) { + if (v.empty()) { return false; } else if (v.size() == 1) { diff --git a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp index 1d0ad70..5fa1f05 100644 --- a/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp +++ b/Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp @@ -132,7 +132,7 @@ std::map<char, std::string> SCRAMSHA1ClientAuthenticator::parseMap(const std::st i++; } else if (s[i] == ',') { - result[key] = value; + result[static_cast<size_t>(key)] = value; value = ""; expectKey = true; } diff --git a/Swiften/Serializer/PresenceSerializer.cpp b/Swiften/Serializer/PresenceSerializer.cpp index ae1f88c..20eda4b 100644 --- a/Swiften/Serializer/PresenceSerializer.cpp +++ b/Swiften/Serializer/PresenceSerializer.cpp @@ -7,7 +7,7 @@ #include <Swiften/Serializer/PresenceSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> -#include "boost/shared_ptr.hpp" +#include <boost/shared_ptr.hpp> namespace Swift { diff --git a/Swiften/Serializer/XML/XMLElement.cpp b/Swiften/Serializer/XML/XMLElement.cpp index be90406..d39ec39 100644 --- a/Swiften/Serializer/XML/XMLElement.cpp +++ b/Swiften/Serializer/XML/XMLElement.cpp @@ -28,7 +28,7 @@ std::string XMLElement::serialize() { result += " " + p.first + "=\"" + p.second + "\""; } - if (childNodes_.size() > 0) { + if (!childNodes_.empty()) { result += ">"; foreach (boost::shared_ptr<XMLNode> node, childNodes_) { result += node->serialize(); diff --git a/Swiften/StreamManagement/StanzaAckRequester.cpp b/Swiften/StreamManagement/StanzaAckRequester.cpp index 47f67a6..b60b9b0 100644 --- a/Swiften/StreamManagement/StanzaAckRequester.cpp +++ b/Swiften/StreamManagement/StanzaAckRequester.cpp @@ -29,7 +29,7 @@ void StanzaAckRequester::handleStanzaSent(boost::shared_ptr<Stanza> stanza) { void StanzaAckRequester::handleAckReceived(unsigned int handledStanzasCount) { unsigned int i = lastHandledStanzasCount; while (i != handledStanzasCount) { - if (unackedStanzas.size() == 0) { + if (unackedStanzas.empty()) { std::cerr << "Warning: Server acked more stanzas than we sent" << std::endl; break; } diff --git a/Swiften/StringCodecs/MD5.cpp b/Swiften/StringCodecs/MD5.cpp index 159eb87..0d36254 100644 --- a/Swiften/StringCodecs/MD5.cpp +++ b/Swiften/StringCodecs/MD5.cpp @@ -125,13 +125,13 @@ static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) { a = pms->abcd[0], b = pms->abcd[1], c = pms->abcd[2], d = pms->abcd[3]; md5_word_t t; -#ifdef SWIFTEN_BIG_ENDIAN - /* Define storage only for big-endian CPUs. */ - md5_word_t X[16]; -#else +#ifdef SWIFTEN_LITTLE_ENDIAN /* Define storage for little-endian or both types of CPUs. */ md5_word_t xbuf[16]; const md5_word_t *X; +#else + /* Define storage only for big-endian CPUs. */ + md5_word_t X[16]; #endif { |