From fa67c2b239d9c7fc508205ea17724322011194f4 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Thu, 23 Oct 2014 14:24:36 +0200 Subject: 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 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 StatusShowConvertor::doConvertFromLua(lua_State* L void StatusShowConvertor::doConvertToLua(lua_State* L, boost::shared_ptr 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 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 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 pendingEvents; boost::optional 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 StringJIDPair; std::map participants = controller->getParticipantJIDs(); chat.impromptuJIDs = participants; return chat; -- cgit v0.10.2-6-g49f6