summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-06-13 13:52:30 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-06-13 13:52:30 (GMT)
commit645876deedb72aa8ebd2a56773f7dd5bb0133b71 (patch)
treefe1820b9e5aebe5b8f69359a2f0ea1a8f4b9a71c /Swiften
parent643999af94c4fede5e1348da91ad539235b9d60f (diff)
downloadswift-contrib-645876deedb72aa8ebd2a56773f7dd5bb0133b71.zip
swift-contrib-645876deedb72aa8ebd2a56773f7dd5bb0133b71.tar.bz2
Fixed some CppCheck warnings.
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Client/UnitTest/ClientSessionTest.cpp2
-rw-r--r--Swiften/Component/ComponentConnector.h2
-rw-r--r--Swiften/Elements/ChatState.h2
-rw-r--r--Swiften/Elements/ErrorPayload.h2
-rw-r--r--Swiften/Elements/Form.h6
-rw-r--r--Swiften/Elements/IBB.h7
-rw-r--r--Swiften/Elements/MUCPayload.h8
-rw-r--r--Swiften/Elements/VCard.h4
-rw-r--r--Swiften/Elements/VCardUpdate.h2
-rw-r--r--Swiften/EventLoop/EventLoop.h2
-rw-r--r--Swiften/Network/BoostIOServiceThread.h2
-rw-r--r--Swiften/Network/Connector.h2
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp2
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelParser.h2
-rw-r--r--Swiften/TLS/ServerIdentityVerifier.cpp4
-rw-r--r--Swiften/TLS/ServerIdentityVerifier.h4
16 files changed, 27 insertions, 26 deletions
diff --git a/Swiften/Client/UnitTest/ClientSessionTest.cpp b/Swiften/Client/UnitTest/ClientSessionTest.cpp
index 8fc869b..57e53e4 100644
--- a/Swiften/Client/UnitTest/ClientSessionTest.cpp
+++ b/Swiften/Client/UnitTest/ClientSessionTest.cpp
@@ -527,7 +527,7 @@ class ClientSessionTest : 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/Component/ComponentConnector.h b/Swiften/Component/ComponentConnector.h
index 34451d7..b47f5da 100644
--- a/Swiften/Component/ComponentConnector.h
+++ b/Swiften/Component/ComponentConnector.h
@@ -27,7 +27,7 @@ namespace Swift {
typedef boost::shared_ptr<ComponentConnector> ref;
static ComponentConnector::ref create(const std::string& hostname, int port, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) {
- return ComponentConnector::ref(new ComponentConnector(hostname, port, resolver, connectionFactory, timerFactory));
+ return ref(new ComponentConnector(hostname, port, resolver, connectionFactory, timerFactory));
}
void setTimeoutMilliseconds(int milliseconds);
diff --git a/Swiften/Elements/ChatState.h b/Swiften/Elements/ChatState.h
index 5c83318..477fd27 100644
--- a/Swiften/Elements/ChatState.h
+++ b/Swiften/Elements/ChatState.h
@@ -18,7 +18,7 @@ namespace Swift {
state_ = state;
}
- ChatStateType getChatState() { return state_; }
+ ChatStateType getChatState() const { return state_; }
void setChatState(ChatStateType state) {state_ = state;}
private:
diff --git a/Swiften/Elements/ErrorPayload.h b/Swiften/Elements/ErrorPayload.h
index 6d31a98..f21ba98 100644
--- a/Swiften/Elements/ErrorPayload.h
+++ b/Swiften/Elements/ErrorPayload.h
@@ -73,7 +73,7 @@ namespace Swift {
payload_ = payload;
}
- boost::shared_ptr<Payload> getPayload() {
+ boost::shared_ptr<Payload> getPayload() const {
return payload_;
}
diff --git a/Swiften/Elements/Form.h b/Swiften/Elements/Form.h
index 3b93be4..47ff7d4 100644
--- a/Swiften/Elements/Form.h
+++ b/Swiften/Elements/Form.h
@@ -31,12 +31,12 @@ namespace Swift {
void addField(boost::shared_ptr<FormField> field) { fields_.push_back(field); }
const std::vector<boost::shared_ptr<FormField> >& getFields() const { return fields_; }
void setTitle(const std::string& title) { title_ = title; }
- const std::string& getTitle() { return title_; }
+ const std::string& getTitle() const { return title_; }
void setInstructions(const std::string& instructions) { instructions_ = instructions; }
- const std::string& getInstructions() { return instructions_; }
+ const std::string& getInstructions() const { return instructions_; }
- Type getType() { return type_; }
+ Type getType() const { return type_; }
void setType(Type type) { type_ = type; }
std::string getFormType() const;
diff --git a/Swiften/Elements/IBB.h b/Swiften/Elements/IBB.h
index 8138e83..64c9f14 100644
--- a/Swiften/Elements/IBB.h
+++ b/Swiften/Elements/IBB.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/Elements/Payload.h>
@@ -31,20 +32,20 @@ namespace Swift {
}
static IBB::ref createIBBOpen(const std::string& streamID, int blockSize) {
- IBB::ref result(new IBB(Open, streamID));
+ IBB::ref result = boost::make_shared<IBB>(Open, streamID);
result->setBlockSize(blockSize);
return result;
}
static IBB::ref createIBBData(const std::string& streamID, int sequenceNumber, const std::vector<unsigned char>& data) {
- IBB::ref result(new IBB(Data, streamID));
+ IBB::ref result = boost::make_shared<IBB>(Data, streamID);
result->setSequenceNumber(sequenceNumber);
result->setData(data);
return result;
}
static IBB::ref createIBBClose(const std::string& streamID) {
- return IBB::ref(new IBB(Close, streamID));
+ return boost::make_shared<IBB>(Close, streamID);
}
void setAction(Action action) {
diff --git a/Swiften/Elements/MUCPayload.h b/Swiften/Elements/MUCPayload.h
index 8b75bd4..3b99111 100644
--- a/Swiften/Elements/MUCPayload.h
+++ b/Swiften/Elements/MUCPayload.h
@@ -40,19 +40,19 @@ namespace Swift {
since_ = since;
}
- int getMaxChars() {
+ int getMaxChars() const{
return maxChars_;
}
- int getMaxStanzas() {
+ int getMaxStanzas() const{
return maxStanzas_;
}
- int getSeconds() {
+ int getSeconds() const {
return seconds_;
}
- boost::posix_time::ptime getSince() {
+ const boost::posix_time::ptime& getSince() const {
return since_;
}
diff --git a/Swiften/Elements/VCard.h b/Swiften/Elements/VCard.h
index cb05056..f9822c9 100644
--- a/Swiften/Elements/VCard.h
+++ b/Swiften/Elements/VCard.h
@@ -60,10 +60,10 @@ namespace Swift {
const std::string& getNickname() const { return nick_; }
void setPhoto(const ByteArray& photo) { photo_ = photo; }
- const ByteArray& getPhoto() { return photo_; }
+ const ByteArray& getPhoto() const { return photo_; }
void setPhotoType(const std::string& photoType) { photoType_ = photoType; }
- const std::string& getPhotoType() { return photoType_; }
+ const std::string& getPhotoType() const { return photoType_; }
const std::string& getUnknownContent() const { return unknownContent_; }
void addUnknownContent(const std::string& c) {
diff --git a/Swiften/Elements/VCardUpdate.h b/Swiften/Elements/VCardUpdate.h
index e225a4a..782106c 100644
--- a/Swiften/Elements/VCardUpdate.h
+++ b/Swiften/Elements/VCardUpdate.h
@@ -15,7 +15,7 @@ namespace Swift {
VCardUpdate(const std::string& photoHash = "") : photoHash_(photoHash) {}
void setPhotoHash(const std::string& photoHash) { photoHash_ = photoHash; }
- const std::string& getPhotoHash() { return photoHash_; }
+ const std::string& getPhotoHash() const { return photoHash_; }
private:
std::string photoHash_;
diff --git a/Swiften/EventLoop/EventLoop.h b/Swiften/EventLoop/EventLoop.h
index 69ec68e..9e47112 100644
--- a/Swiften/EventLoop/EventLoop.h
+++ b/Swiften/EventLoop/EventLoop.h
@@ -35,7 +35,7 @@ namespace Swift {
private:
struct HasOwner {
HasOwner(boost::shared_ptr<EventOwner> owner) : owner(owner) {}
- bool operator()(const Event& event) { return event.owner == owner; }
+ bool operator()(const Event& event) const { return event.owner == owner; }
boost::shared_ptr<EventOwner> owner;
};
boost::mutex eventsMutex_;
diff --git a/Swiften/Network/BoostIOServiceThread.h b/Swiften/Network/BoostIOServiceThread.h
index ea04b02..00fb397 100644
--- a/Swiften/Network/BoostIOServiceThread.h
+++ b/Swiften/Network/BoostIOServiceThread.h
@@ -16,7 +16,7 @@ namespace Swift {
BoostIOServiceThread();
~BoostIOServiceThread();
- boost::shared_ptr<boost::asio::io_service> getIOService() {
+ boost::shared_ptr<boost::asio::io_service> getIOService() const {
return ioService_;
}
diff --git a/Swiften/Network/Connector.h b/Swiften/Network/Connector.h
index 42dca77..8336299 100644
--- a/Swiften/Network/Connector.h
+++ b/Swiften/Network/Connector.h
@@ -28,7 +28,7 @@ namespace Swift {
typedef boost::shared_ptr<Connector> ref;
static Connector::ref create(const std::string& hostname, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) {
- return Connector::ref(new Connector(hostname, resolver, connectionFactory, timerFactory));
+ return ref(new Connector(hostname, resolver, connectionFactory, timerFactory));
}
void setTimeoutMilliseconds(int milliseconds);
diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp
index 0b0f104..4177baa 100644
--- a/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp
+++ b/Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp
@@ -62,7 +62,7 @@ void SecurityLabelParser::handleCharacterData(const std::string& data) {
}
}
-boost::shared_ptr<SecurityLabel> SecurityLabelParser::getLabelPayload() {
+boost::shared_ptr<SecurityLabel> SecurityLabelParser::getLabelPayload() const {
return getPayloadInternal();
}
diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelParser.h b/Swiften/Parser/PayloadParsers/SecurityLabelParser.h
index 676cebc..5357028 100644
--- a/Swiften/Parser/PayloadParsers/SecurityLabelParser.h
+++ b/Swiften/Parser/PayloadParsers/SecurityLabelParser.h
@@ -19,7 +19,7 @@ namespace Swift {
virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
virtual void handleEndElement(const std::string& element, const std::string&);
virtual void handleCharacterData(const std::string& data);
- boost::shared_ptr<SecurityLabel> getLabelPayload();
+ boost::shared_ptr<SecurityLabel> getLabelPayload() const;
private:
enum Level {
TopLevel = 0,
diff --git a/Swiften/TLS/ServerIdentityVerifier.cpp b/Swiften/TLS/ServerIdentityVerifier.cpp
index 7c68774..a908ad0 100644
--- a/Swiften/TLS/ServerIdentityVerifier.cpp
+++ b/Swiften/TLS/ServerIdentityVerifier.cpp
@@ -63,7 +63,7 @@ bool ServerIdentityVerifier::certificateVerifies(Certificate::ref certificate) {
return false;
}
-bool ServerIdentityVerifier::matchesDomain(const std::string& s) {
+bool ServerIdentityVerifier::matchesDomain(const std::string& s) const {
if (boost::starts_with(s, "*.")) {
std::string matchString(s.substr(2, s.npos));
std::string matchDomain = encodedDomain;
@@ -78,7 +78,7 @@ bool ServerIdentityVerifier::matchesDomain(const std::string& s) {
}
}
-bool ServerIdentityVerifier::matchesAddress(const std::string& s) {
+bool ServerIdentityVerifier::matchesAddress(const std::string& s) const {
return s == domain;
}
diff --git a/Swiften/TLS/ServerIdentityVerifier.h b/Swiften/TLS/ServerIdentityVerifier.h
index c1abd5e..b09abd9 100644
--- a/Swiften/TLS/ServerIdentityVerifier.h
+++ b/Swiften/TLS/ServerIdentityVerifier.h
@@ -20,8 +20,8 @@ namespace Swift {
bool certificateVerifies(Certificate::ref);
private:
- bool matchesDomain(const std::string&);
- bool matchesAddress(const std::string&);
+ bool matchesDomain(const std::string&) const ;
+ bool matchesAddress(const std::string&) const;
private:
std::string domain;