From: Mateusz Malicki Date: Tue, 16 Dec 2014 10:40:03 +0000 (+0100) Subject: Some cppcheck fixes X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=21d934cb08890c90816f9f94cbdc096599c548e2;p=platform%2Fcore%2Fsecurity%2Fvasum.git Some cppcheck fixes [Bug] Some cppcheck fixes (const, uniused variable) [Cause] N/A [Solution] N/A [Verification] Build, install, run cppcheck Change-Id: I58fa2e3434c6a7546441ba310bb437b59c7fd6de --- diff --git a/client/vasum-client-impl.cpp b/client/vasum-client-impl.cpp index 3c9448b..23270e4 100644 --- a/client/vasum-client-impl.cpp +++ b/client/vasum-client-impl.cpp @@ -307,12 +307,12 @@ VsmStatus Client::signalUnsubscribe(VsmSubscriptionId id) return vsm_get_status(); } -const char* Client::vsm_get_status_message() noexcept +const char* Client::vsm_get_status_message() const noexcept { return mStatus.mMsg.c_str(); } -VsmStatus Client::vsm_get_status() noexcept +VsmStatus Client::vsm_get_status() const noexcept { return mStatus.mVsmStatus; } diff --git a/client/vasum-client-impl.hpp b/client/vasum-client-impl.hpp index 18eb726..66ffa82 100644 --- a/client/vasum-client-impl.hpp +++ b/client/vasum-client-impl.hpp @@ -96,12 +96,12 @@ public: /** * @see ::vsm_get_status_message */ - const char* vsm_get_status_message() noexcept; + const char* vsm_get_status_message() const noexcept; /** * @see ::vsm_get_status */ - VsmStatus vsm_get_status() noexcept; + VsmStatus vsm_get_status() const noexcept; /** * @see ::vsm_get_zone_dbuses diff --git a/server/input-monitor.cpp b/server/input-monitor.cpp index 8d641b1..7937840 100644 --- a/server/input-monitor.cpp +++ b/server/input-monitor.cpp @@ -148,7 +148,7 @@ bool isDeviceWithName(const boost::regex& deviceNameRegex, } } // namespace -std::string InputMonitor::getDevicePath() +std::string InputMonitor::getDevicePath() const { std::string device = mConfig.device; if (fs::path(device).is_absolute() diff --git a/server/input-monitor.hpp b/server/input-monitor.hpp index 93c2d75..2b0ed45 100644 --- a/server/input-monitor.hpp +++ b/server/input-monitor.hpp @@ -56,7 +56,7 @@ private: std::list mEventTimes; GIOChannel* mChannelPtr; - std::string getDevicePath(); + std::string getDevicePath() const; void createGIOChannel(const std::string& devicePath); // Internal callback to be registered at glib g_io_add_watch() diff --git a/server/proxy-call-policy.cpp b/server/proxy-call-policy.cpp index 281cb3a..9fed52b 100644 --- a/server/proxy-call-policy.cpp +++ b/server/proxy-call-policy.cpp @@ -51,7 +51,7 @@ bool ProxyCallPolicy::isProxyCallAllowed(const std::string& caller, const std::string& targetBusName, const std::string& targetObjectPath, const std::string& targetInterface, - const std::string& targetMethod) + const std::string& targetMethod) const { for (const ProxyCallRule& rule : mProxyCallRules) { if (match(rule.caller, caller) diff --git a/server/proxy-call-policy.hpp b/server/proxy-call-policy.hpp index 4176979..d6fbaed 100644 --- a/server/proxy-call-policy.hpp +++ b/server/proxy-call-policy.hpp @@ -44,7 +44,7 @@ public: const std::string& targetBusName, const std::string& targetObjectPath, const std::string& targetInterface, - const std::string& targetMethod); + const std::string& targetMethod) const; private: std::vector mProxyCallRules; diff --git a/server/zone-connection-transport.cpp b/server/zone-connection-transport.cpp index d209705..0757241 100644 --- a/server/zone-connection-transport.cpp +++ b/server/zone-connection-transport.cpp @@ -100,7 +100,7 @@ ZoneConnectionTransport::~ZoneConnectionTransport() } -std::string ZoneConnectionTransport::acquireAddress() +std::string ZoneConnectionTransport::acquireAddress() const { if (mRunMountPoint.empty()) { return std::string(); diff --git a/server/zone-connection-transport.hpp b/server/zone-connection-transport.hpp index 5729389..d651f3c 100644 --- a/server/zone-connection-transport.hpp +++ b/server/zone-connection-transport.hpp @@ -44,7 +44,7 @@ public: /** * Gets dbus addres. Will block until address is available. */ - std::string acquireAddress(); + std::string acquireAddress() const; /** * Set whether object should detach from transport filesystem on exit diff --git a/server/zone.cpp b/server/zone.cpp index 5f6dce0..199ecff 100644 --- a/server/zone.cpp +++ b/server/zone.cpp @@ -200,7 +200,7 @@ void Zone::disconnect() } } -std::string Zone::getDbusAddress() +std::string Zone::getDbusAddress() const { Lock lock(mReconnectMutex); return mDbusAddress; diff --git a/server/zone.hpp b/server/zone.hpp index 1fdc588..fba9399 100644 --- a/server/zone.hpp +++ b/server/zone.hpp @@ -226,7 +226,7 @@ public: /** * Get a dbus address */ - std::string getDbusAddress(); + std::string getDbusAddress() const; /** * Get id of VT diff --git a/server/zones-manager.cpp b/server/zones-manager.cpp index 2ce03d7..a1dcc71 100644 --- a/server/zones-manager.cpp +++ b/server/zones-manager.cpp @@ -305,7 +305,7 @@ bool ZonesManager::isRunning(const std::string& zoneId) return iter->second->isRunning(); } -std::string ZonesManager::getRunningForegroundZoneId() +std::string ZonesManager::getRunningForegroundZoneId() const { for (auto& zone : mZones) { if (zone.first == mConfig.foregroundId && @@ -523,7 +523,7 @@ void ZonesManager::handleProxyCall(const std::string& caller, asyncResultCallback); } -void ZonesManager::handleGetZoneDbuses(dbus::MethodResultBuilder::Pointer result) +void ZonesManager::handleGetZoneDbuses(dbus::MethodResultBuilder::Pointer result) const { std::vector entries; for (auto& zone : mZones) { @@ -542,7 +542,7 @@ void ZonesManager::handleDbusStateChanged(const std::string& zoneId, mHostConnection.signalZoneDbusState(zoneId, dbusAddress); } -void ZonesManager::handleGetZoneIdsCall(dbus::MethodResultBuilder::Pointer result) +void ZonesManager::handleGetZoneIdsCall(dbus::MethodResultBuilder::Pointer result) const { std::vector zoneIds; for(auto& zone: mZones){ diff --git a/server/zones-manager.hpp b/server/zones-manager.hpp index b58da86..41a3e7c 100644 --- a/server/zones-manager.hpp +++ b/server/zones-manager.hpp @@ -92,7 +92,7 @@ public: /** * @return id of the currently focused/foreground zone */ - std::string getRunningForegroundZoneId(); + std::string getRunningForegroundZoneId() const; /** * @return id of next to currently focused/foreground zone. If currently focused zone @@ -138,9 +138,9 @@ private: const std::string& targetMethod, GVariant* parameters, dbus::MethodResultBuilder::Pointer result); - void handleGetZoneDbuses(dbus::MethodResultBuilder::Pointer result); + void handleGetZoneDbuses(dbus::MethodResultBuilder::Pointer result) const; void handleDbusStateChanged(const std::string& zoneId, const std::string& dbusAddress); - void handleGetZoneIdsCall(dbus::MethodResultBuilder::Pointer result); + void handleGetZoneIdsCall(dbus::MethodResultBuilder::Pointer result) const; void handleGetActiveZoneIdCall(dbus::MethodResultBuilder::Pointer result); void handleGetZoneInfoCall(const std::string& id, dbus::MethodResultBuilder::Pointer result); void handleDeclareFileCall(const std::string& zone, diff --git a/tests/unit_tests/config/ut-configuration.cpp b/tests/unit_tests/config/ut-configuration.cpp index e46bfd8..4e6bedc 100644 --- a/tests/unit_tests/config/ut-configuration.cpp +++ b/tests/unit_tests/config/ut-configuration.cpp @@ -50,7 +50,7 @@ struct TestConfig { ( intVal ) - SubSubConfig() : moved(false) {} + SubSubConfig() : intVal(), moved(false) {} SubSubConfig(const SubSubConfig& config) : intVal(config.intVal), moved(false) {} SubSubConfig(SubSubConfig&& config) : intVal(std::move(config.intVal)), moved(false) { config.moved = true; diff --git a/zone-daemon/main.cpp b/zone-daemon/main.cpp index 846f431..f0c00c6 100644 --- a/zone-daemon/main.cpp +++ b/zone-daemon/main.cpp @@ -57,8 +57,6 @@ const std::string PROGRAM_NAME_AND_VERSION = int main(int argc, char* argv[]) { - std::string configPath ; - try { po::options_description desc("Allowed options");