[Common] Fixing Coverity issues: AUTO_CAUSES_COPY
[platform/core/api/webapi-plugins.git] / src / mediacontroller / mediacontroller_client.cc
index 82d927d..70371c5 100644 (file)
@@ -747,7 +747,7 @@ PlatformResult MediaControllerClient::SetAbilityChangeListener(const JsonCallbac
 
 void UnsubscribeAllTypes(mc_client_h handle_, const std::string& server_name) {
   int ret;
-  for (auto type : types::MediaControllerSubscriptionTypeEnum) {
+  for (auto& type : types::MediaControllerSubscriptionTypeEnum) {
     ret = mc_client_unsubscribe(handle_, type.second, server_name.c_str());
     if (MEDIA_CONTROLLER_ERROR_NONE != ret) {
       LoggerE("mc_client_unsubscribe() failed with type %s, error: %d, message: %s",
@@ -761,7 +761,7 @@ PlatformResult MediaControllerClient::UnsetAbilityChangeListener() {
 
   // we have to unsubscribe all servers before unsetting callback to avoid
   // calling callback twice if the callback will be set again
-  for (auto srv : subscribed_servers) {
+  for (auto& srv : subscribed_servers) {
     UnsubscribeAllTypes(handle_, srv);
   }
   subscribed_servers.clear();
@@ -812,7 +812,7 @@ PlatformResult MediaControllerClient::SubscribeServer(const std::string& server_
 
   SCOPE_EXIT {
     if (to_unsubscribe > 0) {
-      for (auto type : types::MediaControllerSubscriptionTypeEnum) {
+      for (auto& type : types::MediaControllerSubscriptionTypeEnum) {
         if (to_unsubscribe > 0) {
           ret = mc_client_unsubscribe(handle_, type.second, server_name.c_str());
           if (MEDIA_CONTROLLER_ERROR_NONE != ret) {
@@ -825,7 +825,7 @@ PlatformResult MediaControllerClient::SubscribeServer(const std::string& server_
     }
   };
 
-  for (auto type : types::MediaControllerSubscriptionTypeEnum) {
+  for (auto& type : types::MediaControllerSubscriptionTypeEnum) {
     ret = mc_client_subscribe(handle_, type.second, server_name.c_str());
     if (MEDIA_CONTROLLER_ERROR_NONE != ret) {
       return LogAndCreateResult(