summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-10-23 12:24:36 (GMT)
committerTobias Markmann <tm@ayena.de>2014-10-23 12:24:36 (GMT)
commitfa67c2b239d9c7fc508205ea17724322011194f4 (patch)
tree33c09d0a38bbf2a61b9f0dbadc048d7665542972
parent052190912463d8ea36979fd5a5e9a298588dce4f (diff)
downloadswift-fa67c2b239d9c7fc508205ea17724322011194f4.zip
swift-fa67c2b239d9c7fc508205ea17724322011194f4.tar.bz2
Fix code in response to clang warnings.
Removes some unused private members and restructure switch statement to handle all cases. Test-Information: Fixed code does not emit the clang warnings anymore. Change-Id: I06a9036b307014e2f882e3cee45a6881b24c3f70
-rw-r--r--Sluift/ElementConvertors/StatusShowConvertor.cpp14
-rw-r--r--Sluift/Helpers.cpp35
-rw-r--r--Sluift/Helpers.h1
-rw-r--r--Sluift/SluiftComponent.cpp2
-rw-r--r--Sluift/SluiftComponent.h1
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp1
6 files changed, 27 insertions, 27 deletions
diff --git a/Sluift/ElementConvertors/StatusShowConvertor.cpp b/Sluift/ElementConvertors/StatusShowConvertor.cpp
index d8e24ab..27876ff 100644
--- a/Sluift/ElementConvertors/StatusShowConvertor.cpp
+++ b/Sluift/ElementConvertors/StatusShowConvertor.cpp
@@ -32,7 +32,7 @@ boost::shared_ptr<StatusShow> StatusShowConvertor::doConvertFromLua(lua_State* L
void StatusShowConvertor::doConvertToLua(lua_State* L, boost::shared_ptr<StatusShow> payload) {
lua_createtable(L, 0, 0);
- const std::string show = convertStatusShowTypeToString(payload->getType());
+ const std::string show = convertStatusShowTypeToString(payload->getType());
if (!show.empty()) {
lua_pushstring(L, show.c_str());
lua_setfield(L, -2, "type");
@@ -41,12 +41,12 @@ void StatusShowConvertor::doConvertToLua(lua_State* L, boost::shared_ptr<StatusS
std::string StatusShowConvertor::convertStatusShowTypeToString(const StatusShow::Type &show) {
switch (show) {
- case StatusShow::Online: return "online"; break;
- case StatusShow::FFC: return "ffc"; break;
- case StatusShow::Away: return "away"; break;
- case StatusShow::XA: return "xa"; break;
- case StatusShow::DND: return "dnd"; break;
- case StatusShow::None: return ""; break;
+ case StatusShow::Online: return "online";
+ case StatusShow::FFC: return "ffc";
+ case StatusShow::Away: return "away";
+ case StatusShow::XA: return "xa";
+ case StatusShow::DND: return "dnd";
+ case StatusShow::None: return "";
}
assert(false);
return "";
diff --git a/Sluift/Helpers.cpp b/Sluift/Helpers.cpp
index 29e2b04..756ae59 100644
--- a/Sluift/Helpers.cpp
+++ b/Sluift/Helpers.cpp
@@ -11,23 +11,16 @@
using namespace Swift;
-template<class T> std::string Swift::getCommonErrorString(T& error) {
- std::string reason = "Disconnected: ";
- switch(error.getType()) {
- case T::UnknownError: reason += "Unknown Error"; break;
- case T::ConnectionError: reason += "Error connecting to server"; break;
- case T::ConnectionReadError: reason += "Error while receiving server data"; break;
- case T::ConnectionWriteError: reason += "Error while sending data to the server"; break;
- case T::XMLError: reason += "Error parsing server data"; break;
- case T::AuthenticationFailedError: reason += "Login/password invalid"; break;
- case T::UnexpectedElementError: reason += "Unexpected response"; break;
- }
- return reason;
-}
-
std::string Swift::getErrorString(const ClientError& error) {
- std::string reason = getCommonErrorString(error);
+ std::string reason = "Disconnected: ";
switch(error.getType()) {
+ case ClientError::UnknownError: reason += "Unknown Error"; break;
+ case ClientError::ConnectionError: reason += "Error connecting to server"; break;
+ case ClientError::ConnectionReadError: reason += "Error while receiving server data"; break;
+ case ClientError::ConnectionWriteError: reason += "Error while sending data to the server"; break;
+ case ClientError::XMLError: reason += "Error parsing server data"; break;
+ case ClientError::AuthenticationFailedError: reason += "Login/password invalid"; break;
+ case ClientError::UnexpectedElementError: reason += "Unexpected response"; break;
case ClientError::DomainNameResolveError: reason += "Unable to find server"; break;
case ClientError::CompressionFailedError: reason += "Error while compressing stream"; break;
case ClientError::ServerVerificationFailedError: reason += "Server verification failed"; break;
@@ -57,6 +50,16 @@ std::string Swift::getErrorString(const ClientError& error) {
}
std::string Swift::getErrorString(const ComponentError& error) {
- return getCommonErrorString(error);
+ std::string reason = "Disconnected: ";
+ switch(error.getType()) {
+ case ComponentError::UnknownError: reason += "Unknown Error"; break;
+ case ComponentError::ConnectionError: reason += "Error connecting to server"; break;
+ case ComponentError::ConnectionReadError: reason += "Error while receiving server data"; break;
+ case ComponentError::ConnectionWriteError: reason += "Error while sending data to the server"; break;
+ case ComponentError::XMLError: reason += "Error parsing server data"; break;
+ case ComponentError::AuthenticationFailedError: reason += "Login/password invalid"; break;
+ case ComponentError::UnexpectedElementError: reason += "Unexpected response"; break;
+ }
+ return reason;
}
diff --git a/Sluift/Helpers.h b/Sluift/Helpers.h
index d04a610..157e116 100644
--- a/Sluift/Helpers.h
+++ b/Sluift/Helpers.h
@@ -15,7 +15,6 @@ namespace Swift {
class ClientError;
class ComponentError;
- template<typename T> std::string getCommonErrorString(T& error);
std::string getErrorString(const ClientError& error);
std::string getErrorString(const ComponentError& error);
}
diff --git a/Sluift/SluiftComponent.cpp b/Sluift/SluiftComponent.cpp
index c08a103..c8a17a7 100644
--- a/Sluift/SluiftComponent.cpp
+++ b/Sluift/SluiftComponent.cpp
@@ -79,7 +79,7 @@ void SluiftComponent::disconnect() {
}
}
-void SluiftComponent::setSoftwareVersion(const std::string& name, const std::string& version, const std::string& os) {
+void SluiftComponent::setSoftwareVersion(const std::string& name, const std::string& version, const std::string& /* os */) {
component->setSoftwareVersion(name, version);
}
diff --git a/Sluift/SluiftComponent.h b/Sluift/SluiftComponent.h
index 3d5792b..ba848e1 100644
--- a/Sluift/SluiftComponent.h
+++ b/Sluift/SluiftComponent.h
@@ -98,7 +98,6 @@ namespace Swift {
SimpleEventLoop* eventLoop;
Component* component;
ComponentXMLTracer* tracer;
- bool rosterReceived;
std::deque<Event> pendingEvents;
boost::optional<ComponentError> disconnectedError;
bool requestResponseReceived;
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 32e25a2..3ff2a3d 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -397,7 +397,6 @@ ChatListWindow::Chat ChatsManager::createChatListChatItem(const JID& jid, const
if (controller->isImpromptu()) {
ChatListWindow::Chat chat = ChatListWindow::Chat(jid, jid.toString(), activity, unreadCount, type, boost::filesystem::path(), true, privateMessage, nick, password);
- typedef std::pair<std::string, JID> StringJIDPair;
std::map<std::string, JID> participants = controller->getParticipantJIDs();
chat.impromptuJIDs = participants;
return chat;