[common] Coverity issues fix 11/176911/2
authorRafal Walczyna <r.walczyna@partner.samsung.com>
Mon, 23 Apr 2018 12:14:56 +0000 (14:14 +0200)
committerRafal Walczyna <r.walczyna@partner.samsung.com>
Tue, 24 Apr 2018 09:20:51 +0000 (11:20 +0200)
[Feature] Fixed coverity issues with below ids:
      112270, 112248, 112261, 112244, 110974, 106503, 110555,
      105980, 110371, 108240, 105141, 110066, 109641, 109341,
      109028, 108310, 106161, 105761, 105746, 108409, 108493,
      106299, 106009, 105130, 105410

[Verification] 100% passrate for modules:
      alarm, bluetooth, contact, content, email, filesystem,
      humanactivitymonitor, mms, sms, voice-control

Change-Id: Ic32295ee12e9a8830d2e071e003a0045d0c5355e
Signed-off-by: Rafal Walczyna <r.walczyna@partner.samsung.com>
27 files changed:
src/alarm/alarm_manager.cc
src/bluetooth/bluetooth_health_profile_handler.cc
src/bluetooth/bluetooth_le_adapter.cc
src/contact/contact_util.cc
src/content/content_manager.cc
src/filesystem/filesystem_manager.cc
src/filesystem/filesystem_manager.h
src/filesystem/filesystem_stat.cc
src/filesystem/filesystem_stat.h
src/humanactivitymonitor/humanactivitymonitor_manager.cc
src/messaging/MsgCommon/AbstractFilter.cpp
src/messaging/MsgCommon/AbstractFilter.h
src/messaging/MsgCommon/AttributeFilter.cpp
src/messaging/MsgCommon/AttributeFilter.h
src/messaging/MsgCommon/AttributeRangeFilter.cpp
src/messaging/MsgCommon/AttributeRangeFilter.h
src/messaging/MsgCommon/CompositeFilter.cpp
src/messaging/MsgCommon/CompositeFilter.h
src/messaging/email_manager.cc
src/messaging/message.cc
src/messaging/messaging_database_manager.h
src/messaging/messaging_util.cc
src/messaging/messaging_util.h
src/messaging/short_message_manager.cc
src/voicecontrol/voicecontrol_client.cc
src/voicecontrol/voicecontrol_client.h
src/widgetservice/widgetservice_instance.cc

index c7d67a112f91cce6ed8c2141940881f04a51ee06..1669bb6fd6d4bb4ad1d95aaea1070aa436c468ac 100644 (file)
@@ -143,14 +143,15 @@ void AlarmManager::Add(const picojson::value& args, picojson::object& out) {
     }
 
     std::string delay_str = std::to_string(delay);
-    int ret = app_control_add_extra_data(app_control, kAlarmRelativeDelayKey, delay_str.c_str());
-    if (APP_CONTROL_ERROR_NONE != ret) {
+    int ret_app = app_control_add_extra_data(app_control, kAlarmRelativeDelayKey, delay_str.c_str());
+    if (APP_CONTROL_ERROR_NONE != ret_app) {
       LogAndReportError(
           PlatformResult(ErrorCode::UNKNOWN_ERR, "Fail to add data from app_control."), &out,
-          ("Fail to add data from app_control: %d (%s)", ret, get_error_message(ret)));
+          ("Fail to add data from app_control: %d (%s)", ret_app, get_error_message(ret_app)));
       return;
     }
 
+    int ret = ALARM_ERROR_NONE;
     if (!isPeriodSet) {
       ret = alarm_schedule_once_after_delay(app_control, delay, &alarm_id);
     } else {
@@ -628,10 +629,10 @@ PlatformResult AlarmManager::GetAlarm(int id, picojson::object& obj) {
                                 ("Unknown error occurred: %d (%s)", ret, get_error_message(ret)));
     }
 
-    ret = app_control_get_extra_data(app_control, kAlarmRelativeDelayKey, &delay_string);
+    int ret_app = app_control_get_extra_data(app_control, kAlarmRelativeDelayKey, &delay_string);
     if (APP_CONTROL_ERROR_NONE != ret) {
       return LogAndCreateResult(ErrorCode::NOT_FOUND_ERR, "Failed to get data.",
-                                ("Failed to get data: %d (%s)", ret, get_error_message(ret)));
+                                ("Failed to get data: %d (%s)", ret_app, get_error_message(ret_app)));
     }
 
     obj.insert(std::make_pair("type", picojson::value(kAlarmRelative)));
index 2aeacb582f3300ced2ea5f3c5c2b05e55127dda6..e5c483cd57d66c325b636803c29aa68f8ce16cb6 100644 (file)
@@ -112,12 +112,12 @@ void BluetoothHealthProfileHandler::OnConnected(int result, const char* remote_a
       response_obj.insert(std::make_pair(kId, picojson::value(app_id)));
       response_obj.insert(std::make_pair(kEvent, picojson::value(kOnConnect)));
 
-      picojson::value result = picojson::value(picojson::object());
+      picojson::value result_picojson = picojson::value(picojson::object());
 
       BluetoothHealthChannel::ToJson(channel, type, device_info, app_id,
-                                     &result.get<picojson::object>());
+                                     &result_picojson.get<picojson::object>());
 
-      ReportSuccess(result, response_obj);
+      ReportSuccess(result_picojson, response_obj);
       bt_adapter_free_device_info(device_info);
 
       object->instance_.FireEvent("BLUETOOTH_HEALTH_APPLICATION_CHANGED", response);
@@ -139,11 +139,11 @@ void BluetoothHealthProfileHandler::OnConnected(int result, const char* remote_a
         object->connected_channels_.insert(channel);
       }
 
-      picojson::value result = picojson::value(picojson::object());
+      picojson::value result_picojson = picojson::value(picojson::object());
 
-      BluetoothHealthChannel::ToJson(channel, type, &result.get<picojson::object>());
+      BluetoothHealthChannel::ToJson(channel, type, &result_picojson.get<picojson::object>());
 
-      ReportSuccess(result, response->get<picojson::object>());
+      ReportSuccess(result_picojson, response->get<picojson::object>());
     } else {
       LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR,
                                        "Failed to establish a connection with health profile"),
index 83dabfc419649700206d24405218a99e06f36116..b2f0be3283401f02bd2e42d8ea0ae8ab98b27125 100644 (file)
@@ -69,11 +69,11 @@ class HexData {
     common::tools::HexToBin(p_data, size, (unsigned char*)pointer(), length_);
   }
 
-  const char* const pointer() const {
+  const char* pointer() const {
     return pointer_.get();
   }
 
-  const int length() const {
+  int length() const {
     return length_;
   }
 
index 52b6aa0804f57b197956e04e5873cf63a28f9630..eeefc421db8429754a9e5e19f6c5bfcf836d15bb 100644 (file)
@@ -1465,7 +1465,7 @@ PlatformResult ExportContactRelationshipToContactsRecord(contacts_record_h conta
   } else if (type == kContactRelationshipTypeCustom) {
     type_to_set = CONTACTS_RELATIONSHIP_TYPE_CUSTOM;
   } else {
-    type_to_set = CONTACTS_MESSENGER_TYPE_OTHER;
+    type_to_set = CONTACTS_RELATIONSHIP_TYPE_OTHER;
   }
 
   status = ContactUtil::SetIntInRecord(child_record, _contacts_relationship.type, type_to_set);
index 53c79bc8908a489bba239588028fe341d1b0cad9..9c069ed125c5c43c40ad3304c92e102881c66917 100644 (file)
@@ -958,7 +958,7 @@ void ContentManager::createPlaylist(std::string name,
   if (playlist != NULL) {
     int id, cnt;
     char* thumb_path = NULL;
-    char* name = NULL;
+    char* name_playlist = NULL;
     filter_h filter = NULL;
     if (media_playlist_get_playlist_id(playlist, &id) == MEDIA_CONTENT_ERROR_NONE) {
       o["id"] = picojson::value(std::to_string(id));
@@ -978,9 +978,9 @@ void ContentManager::createPlaylist(std::string name,
     } else {
       LoggerE("Invalid thumbnail path for playlist.");
     }
-    if (media_playlist_get_name(playlist, &name) == MEDIA_CONTENT_ERROR_NONE) {
-      o["name"] = picojson::value(std::string(name));
-      free(name);
+    if (media_playlist_get_name(playlist, &name_playlist) == MEDIA_CONTENT_ERROR_NONE) {
+      o["name"] = picojson::value(std::string(name_playlist));
+      free(name_playlist);
     } else {
       LoggerE("Invalid name for playlist.");
     }
index 44d343ca771fd5990b18deedd0c915e8fdcc3e6e..ad518b07e6764955e034bddf14c86058ed69326d 100644 (file)
@@ -289,7 +289,8 @@ void FilesystemManager::MakeDirectory(const std::string& path,
   result_cb(make_directory_worker(path));
 }
 
-void FilesystemManager::Rename(const std::string& oldPath, const std::string& newPath,
+// pass oldPath by copy to prevent possible TOCTOU bug
+void FilesystemManager::Rename(const std::string oldPath, const std::string& newPath,
                                const std::function<void(const FilesystemStat&)>& success_cb,
                                const std::function<void(FilesystemError)>& error_cb) {
   ScopeLogger();
index e0d2d12b8aa809e56db0dee5f7c4c67d87b70346..eaadf9ba0b1e359b399e923627bb01230c3cebfa 100644 (file)
@@ -69,7 +69,7 @@ class FilesystemManager {
                   const std::function<void(const FilesystemStat&)>& success_cb,
                   const std::function<void(FilesystemError)>& error_cb);
 
-  void Rename(const std::string& oldPath, const std::string& newPath,
+  void Rename(const std::string oldPath, const std::string& newPath,
               const std::function<void(const FilesystemStat&)>& success_cb,
               const std::function<void(FilesystemError)>& error_cb);
 
index feb7bed6f18cbd016a8b61f67579973c5a600681..bb5bc89be1c0a3e2d87dbf20c754ad800621892a 100644 (file)
@@ -59,7 +59,8 @@ picojson::value FilesystemStat::toJSON() const {
   return retval;
 }
 
-FilesystemStat FilesystemStat::getStat(const std::string& path) {
+// pass path by copy to prevent possible TOCTOU bug
+FilesystemStat FilesystemStat::getStat(const std::string path) {
   ScopeLogger();
   struct stat aStatObj;
   FilesystemStat _result;
index a984ab1dbaa49cedd0452c6bef5c2572d8f5e44a..31c58875ab1bbcf76648aaabde7e47c702f99ad3 100755 (executable)
@@ -49,7 +49,7 @@ class FilesystemStat {
 
   picojson::value toJSON() const;
 
-  static FilesystemStat getStat(const std::string& path);
+  static FilesystemStat getStat(const std::string path);
 };
 }  // namespace filesystem
 }  // namespace extension
index 457c39872341db21e93d91ca15fefb4766781b83..e174ccf8256a4303ae777c82caeb52ec040d97d6 100644 (file)
@@ -442,7 +442,7 @@ class HumanActivityMonitorManager::Monitor::GestureMonitor
     bool supported = false;
 
     int ret = gesture_is_supported(GESTURE_WRIST_UP, &supported);
-    if (ret != SENSOR_ERROR_NONE) {
+    if (GESTURE_ERROR_NONE != ret) {
       if (ret == GESTURE_ERROR_NOT_SUPPORTED) {
         return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR, "WRIST_UP gesture check failed",
                                   ("gesture_is_supported(GESTURE_WRIST_UP), error: %d (%s)", ret,
index b0365810aa2de5e090abf35a065dec74f114a134..ad1db04ac48b82ae296936ec191f70c8a8a30508 100644 (file)
@@ -45,34 +45,6 @@ bool AbstractFilter::isMatching(const FilterableObject* const tested_object) con
   return false;
 }
 
-AttributeFilterPtr castToAttributeFilter(AbstractFilterPtr from) {
-  if (ATTRIBUTE_FILTER != from->getFilterType()) {
-    LoggerE("Trying to get AttributeFilterPtr but filter's type is: %d", from->getFilterType());
-    return AttributeFilterPtr();
-  }
-
-  return std::dynamic_pointer_cast<AttributeFilter>(from);
-}
-
-AttributeRangeFilterPtr castToAttributeRangeFilter(AbstractFilterPtr from) {
-  if (ATTRIBUTE_RANGE_FILTER != from->getFilterType()) {
-    LoggerE("Trying to get AttributeRangeFilterPtr but filter's type is: %d",
-            from->getFilterType());
-    return AttributeRangeFilterPtr();
-  }
-
-  return std::dynamic_pointer_cast<AttributeRangeFilter>(from);
-}
-
-CompositeFilterPtr castToCompositeFilter(AbstractFilterPtr from) {
-  if (COMPOSITE_FILTER != from->getFilterType()) {
-    LoggerE("Trying to get CompositeFilterPtr but filter's type is: %d", from->getFilterType());
-    return CompositeFilterPtr();
-  }
-
-  return std::dynamic_pointer_cast<CompositeFilter>(from);
-}
-
 namespace {
 
 inline std::string convertToLowerCase(const std::string& input_string) {
index 3d91173021954d7ac2616acaab532661dfb2e1e7..db721e95f82e703aa85936b49b14aa391d01c7c0 100644 (file)
 namespace extension {
 namespace tizen {
 
-class AttributeFilter;
-typedef std::shared_ptr<AttributeFilter> AttributeFilterPtr;
-
-class AttributeRangeFilter;
-typedef std::shared_ptr<AttributeRangeFilter> AttributeRangeFilterPtr;
-
-class CompositeFilter;
-typedef std::shared_ptr<CompositeFilter> CompositeFilterPtr;
-
 class AbstractFilter;
 typedef std::shared_ptr<AbstractFilter> AbstractFilterPtr;
 typedef std::vector<AbstractFilterPtr> AbstractFilterPtrVector;
@@ -77,13 +68,6 @@ class AbstractFilter {
   FilterType m_filter_type;
 };
 
-/**
- * Returns NULL shared_ptr if cast is not possible (incorrect type)
- */
-AttributeFilterPtr castToAttributeFilter(AbstractFilterPtr from);
-AttributeRangeFilterPtr castToAttributeRangeFilter(AbstractFilterPtr from);
-CompositeFilterPtr castToCompositeFilter(AbstractFilterPtr from);
-
 // class JSFilterArray : public Common::JSArray<AbstractFilterPtr> {
 // public:
 //    JSFilterArray(JSContextRef ctx, JSObjectRef array):
@@ -127,8 +111,4 @@ class FilterUtils {
 }  // Tizen
 }  // DeviceAPI
 
-#include "AttributeFilter.h"
-#include "AttributeRangeFilter.h"
-#include "CompositeFilter.h"
-
 #endif  // __TIZEN_TIZEN_ABSTRACT_FILTER_H__
index 352c0a8455f02ebd635af74f7a0d66aa49bc709e..58014d4ecf497632c1be053f483b29d3608fc8c6 100644 (file)
@@ -64,5 +64,14 @@ bool AttributeFilter::isMatching(const FilterableObject *const filtered_object)
   return filtered_object->isMatchingAttribute(m_attribute_name, m_match_flag, m_match_value);
 }
 
+AttributeFilterPtr castToAttributeFilter(AbstractFilterPtr from) {
+  if (ATTRIBUTE_FILTER != from->getFilterType()) {
+    LoggerE("Trying to get AttributeFilterPtr but filter's type is: %d", from->getFilterType());
+    return AttributeFilterPtr();
+  }
+
+  return std::dynamic_pointer_cast<AttributeFilter>(from);
+}
+
 }  // Tizen
 }  // DeviceAPI
index 0f72188c9c6b50d29300a0153d944c00f792a07b..bd9ceabd286c9e83e28094ca1d52901b8a0cc3dc 100644 (file)
@@ -47,6 +47,11 @@ class AttributeFilter : public AbstractFilter {
   AnyPtr m_match_value;
 };
 
+/**
+ * Returns NULL shared_ptr if cast is not possible (incorrect type)
+ */
+AttributeFilterPtr castToAttributeFilter(AbstractFilterPtr from);
+
 }  // Tizen
 }  // DeviceAPI
 
index d34376714345b0290cfc04ac43504df760ab7367..4c063462a83980a9e165b751bb4a201b8c19d709 100644 (file)
@@ -64,5 +64,15 @@ bool AttributeRangeFilter::isMatching(const FilterableObject *const filtered_obj
   return filtered_object->isMatchingAttributeRange(m_attribute_name, m_initial_value, m_end_value);
 }
 
+AttributeRangeFilterPtr castToAttributeRangeFilter(AbstractFilterPtr from) {
+  if (ATTRIBUTE_RANGE_FILTER != from->getFilterType()) {
+    LoggerE("Trying to get AttributeRangeFilterPtr but filter's type is: %d",
+            from->getFilterType());
+    return AttributeRangeFilterPtr();
+  }
+
+  return std::dynamic_pointer_cast<AttributeRangeFilter>(from);
+}
+
 }  // Tizen
 }  // DeviceAPI
index d847c4cdec4379ecdc6e2a3cc6effde4822b1ba4..6d93cbfe1801f1fa34eb8e1aa6a872bc8146fbdf 100644 (file)
@@ -49,6 +49,12 @@ class AttributeRangeFilter : public AbstractFilter {
   AnyPtr m_end_value;
 };
 
+/**
+ * Returns NULL shared_ptr if cast is not possible (incorrect type)
+ */
+AttributeRangeFilterPtr castToAttributeRangeFilter(AbstractFilterPtr from);
+
+
 }  // Tizen
 }  // DeviceAPI
 
index d9b4ff77529d531c428200cd2fd1a1a1901db29f..275c61c5922f9f8b8fa6c0a1388bdb80a4adf13a 100644 (file)
@@ -87,5 +87,14 @@ bool CompositeFilter::isMatching(const FilterableObject* const filtered_object)
   return composite_result;
 }
 
+CompositeFilterPtr castToCompositeFilter(AbstractFilterPtr from) {
+  if (COMPOSITE_FILTER != from->getFilterType()) {
+    LoggerE("Trying to get CompositeFilterPtr but filter's type is: %d", from->getFilterType());
+    return CompositeFilterPtr();
+  }
+
+  return std::dynamic_pointer_cast<CompositeFilter>(from);
+}
+
 }  // Tizen
 }  // DeviceAPI
index 3b05b84b3101f107fed16d193cd0aa41e02ab990..696e75dffc21e3e87a246c280f747cb1c4df7c55 100644 (file)
@@ -44,6 +44,11 @@ class CompositeFilter : public AbstractFilter {
   AbstractFilterPtrVector m_filters;
 };
 
+/**
+ * Returns NULL shared_ptr if cast is not possible (incorrect type)
+ */
+CompositeFilterPtr castToCompositeFilter(AbstractFilterPtr from);
+
 }  // Tizen
 }  // DeviceAPI
 
index c207ca1c519aff1eaf7f1de1615904550dc04adb..65b117cfa6b1fa9dbeceb4ea63cf30a0399e557d 100644 (file)
@@ -315,10 +315,10 @@ void EmailManager::addDraftMessage(MessageCallbackUserData* callback) {
 }
 
 //**** sending email ****
-static gboolean sendEmailCompleteCB(void* data) {
+static gboolean sendEmailCompleteCB(void* user_data) {
   ScopeLogger();
 
-  MessageRecipientsCallbackData* callback = static_cast<MessageRecipientsCallbackData*>(data);
+  MessageRecipientsCallbackData* callback = static_cast<MessageRecipientsCallbackData*>(user_data);
   if (!callback) {
     LoggerE("Callback is null");
     return false;
index c983de727199597a7a0f16414d0329b121a60188..231e0957b1a6798447723770da6a7de3cb15a97a 100644 (file)
@@ -1449,25 +1449,26 @@ PlatformResult Message::convertPlatformShortMessageToObject(msg_struct_t msg,
             MessagingUtil::messageStatusToString(msg_status).c_str());
   } else {
     LoggerE("Couldn't get MSG_MESSAGE_FOLDER_ID_INT, error:%d", error);
-    error = msg_get_int_value(msg, MSG_SENT_STATUS_NETWORK_STATUS_INT, &infoInt);
+    int info_network = MSG_NETWORK_NOT_SEND;
+    error = msg_get_int_value(msg, MSG_SENT_STATUS_NETWORK_STATUS_INT, &info_network);
 
     if (MSG_SUCCESS == error) {
       MessageStatus msg_status;
-      if (infoInt == MSG_NETWORK_SEND_SUCCESS) {
+      if (MSG_NETWORK_SEND_SUCCESS == info_network) {
         msg_status = MessageStatus::STATUS_SENT;
-      } else if (infoInt == MSG_NETWORK_SENDING) {
+      } else if (MSG_NETWORK_SENDING == info_network) {
         msg_status = MessageStatus::STATUS_SENDING;
-      } else if (infoInt == MSG_NETWORK_SEND_FAIL) {
+      } else if (MSG_NETWORK_SEND_FAIL == info_network) {
         msg_status = MessageStatus::STATUS_FAILED;
-      } else if (infoInt == MSG_NETWORK_NOT_SEND) {
+      } else if (MSG_NETWORK_NOT_SEND == info_network) {
         msg_status = MessageStatus::STATUS_DRAFT;
       } else {
-        LoggerW("warning undefined messageStatus: %d!", infoInt);
+        LoggerW("warning undefined messageStatus: %d!", info_network);
         msg_status = MessageStatus::STATUS_UNDEFINED;
       }
       message->setMessageStatus(msg_status);
 
-      LoggerD("MSG_SENT_STATUS_NETWORK_STATUS:%d MessageStatus:%s", infoInt,
+      LoggerD("MSG_SENT_STATUS_NETWORK_STATUS:%d MessageStatus:%s", info_network,
               MessagingUtil::messageStatusToString(msg_status).c_str());
     } else {
       LoggerE("Couldn't get MSG_SENT_STATUS_NETWORK_STATUS_INT, error:%d", error);
index a24149258828b55fee1723a9950fe2773a125d8c..dd469915dca0dd46b01885c59cd3097096b85eb7 100644 (file)
@@ -22,7 +22,9 @@
 
 #include <db-util.h>
 #include <msg.h>
-#include "MsgCommon/AbstractFilter.h"
+#include "MsgCommon/AttributeFilter.h"
+#include "MsgCommon/AttributeRangeFilter.h"
+#include "MsgCommon/CompositeFilter.h"
 
 #include "common/platform_result.h"
 #include "find_msg_callback_user_data.h"
index d919911c5940211b391e47425a4141c25a84af82..e4b17e793898566022fd3fa399c52e310fd9077f 100644 (file)
@@ -1001,14 +1001,14 @@ PlatformResult MessagingUtil::jsonFilterToCompositeFilter(const picojson::object
   auto compositeFilter = new CompositeFilter(filterType);
 
   for (const auto& a : filter.at(JSON_TO_FILTER_ARRAY).get<picojson::array>()) {
-    AbstractFilterPtr filter;
-    PlatformResult ret = jsonFilterToAbstractFilter(a.get<picojson::object>(), &filter);
+    AbstractFilterPtr filter_ptr;
+    PlatformResult ret = jsonFilterToAbstractFilter(a.get<picojson::object>(), &filter_ptr);
     if (ret.IsError()) {
       delete compositeFilter;
       LoggerD("Convert JSON filter to Abstract filter failed (%s)", ret.message().c_str());
       return ret;
     }
-    compositeFilter->addFilter(filter);
+    compositeFilter->addFilter(filter_ptr);
   }
 
   (*result).reset(compositeFilter);
index 7ccd031a99f41c984c004a8ff86bc7d4af590911..996a5b8f39dbd0b1b84364f68d449bb2da805d87 100644 (file)
@@ -27,8 +27,9 @@
 #include "common/picojson.h"
 #include "common/platform_result.h"
 
-#include "MsgCommon/AbstractFilter.h"
 #include "MsgCommon/AttributeFilter.h"
+#include "MsgCommon/AttributeRangeFilter.h"
+#include "MsgCommon/CompositeFilter.h"
 #include "MsgCommon/SortMode.h"
 
 #include "common/platform_result.h"
index 050971f500f4ee1c22e8e8e948e3f9c08e4371d6..d1fc95cea7ee43886d19a6189fe7a8b44c12c938 100644 (file)
@@ -39,10 +39,10 @@ using common::PlatformResult;
 namespace extension {
 namespace messaging {
 
-static gboolean sendMessageCompleteCB(void* data) {
-  ScopeLogger("callback:%p", data);
+static gboolean sendMessageCompleteCB(void* user_data) {
+  ScopeLogger("callback: %p", user_data);
 
-  MessageRecipientsCallbackData* callback = static_cast<MessageRecipientsCallbackData*>(data);
+  MessageRecipientsCallbackData* callback = static_cast<MessageRecipientsCallbackData*>(user_data);
   if (!callback) {
     LoggerE("Callback is null");
     return false;
index e70976b664e4916e3ad73ebf74bc895513bf96a4..5659a1b75045cd6f0d8479b496b62f874b911edd 100644 (file)
@@ -142,13 +142,13 @@ common::PlatformResult VoiceControlClient::RemoveLanguageChangeListener() {
   return MakeErrorObject(VC_ERROR_NONE);
 }
 
-const bool VoiceControlClient::IsResultListenerSet() {
+bool VoiceControlClient::IsResultListenerSet() {
   ScopeLogger();
 
   return is_result_cb_set;
 }
 
-const bool VoiceControlClient::IsLanguageChangedListenerSet() {
+bool VoiceControlClient::IsLanguageChangedListenerSet() {
   ScopeLogger();
 
   return is_lang_cb_set;
index 117d99c881161681ef175400f7d1d95486e3bc22..952d3348ebf8c577a4f59673a95f2f41458460a5 100644 (file)
@@ -37,8 +37,8 @@ class VoiceControlClient {
   common::PlatformResult AddLanguageChangeListener();
   common::PlatformResult RemoveLanguageChangeListener();
 
-  const bool IsResultListenerSet();
-  const bool IsLanguageChangedListenerSet();
+  bool IsResultListenerSet();
+  bool IsLanguageChangedListenerSet();
 
  private:
   bool is_result_cb_set;
index 515455434f8d58b65f18587ad2dc764c699d61f9..fd8f0baae24b6a685fa37ecc8cf0055bed6fb4d8 100644 (file)
@@ -586,9 +586,9 @@ TizenResult WidgetServiceInstance::SendContent(picojson::object const& args) {
     LogAndReturnTizenError(common::AbortError(ret), ("bundle_add() failed"));
   }
 
-  ret = widget_service_trigger_update(widget_id.c_str(), instance_id.c_str(), data, force);
-  if (WIDGET_ERROR_NONE != ret) {
-    LogAndReturnTizenError(WidgetServiceUtils::ConvertErrorCode(ret),
+  int ret_widget = widget_service_trigger_update(widget_id.c_str(), instance_id.c_str(), data, force);
+  if (WIDGET_ERROR_NONE != ret_widget) {
+    LogAndReturnTizenError(WidgetServiceUtils::ConvertErrorCode(ret_widget),
                            ("widget_service_trigger_update() failed"));
   }
 
@@ -620,11 +620,11 @@ TizenResult WidgetServiceInstance::GetContent(picojson::object const& args,
       bundle_free(bundle_data);
     };
 
-    ret = widget_service_get_content_of_widget_instance(widget_id.c_str(), instance_id.c_str(),
+    int ret_widget = widget_service_get_content_of_widget_instance(widget_id.c_str(), instance_id.c_str(),
                                                         &bundle_data);
-    if (WIDGET_ERROR_NONE != ret) {
+    if (WIDGET_ERROR_NONE != ret_widget) {
       LoggerE("widget_service_get_content_of_widget_instance() failed");
-      this->Post(token, WidgetServiceUtils::ConvertErrorCode(ret));
+      this->Post(token, WidgetServiceUtils::ConvertErrorCode(ret_widget));
       return;
     }