Fix defects detected by static analysis tool 09/229909/2 accepted/tizen/unified/20200410.015514 submit/tizen/20200409.014926
authorJi-hoon Lee <dalton.lee@samsung.com>
Mon, 6 Apr 2020 10:16:18 +0000 (19:16 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Wed, 8 Apr 2020 10:45:37 +0000 (19:45 +0900)
Change-Id: I9af8980b3d3f15ded3fa261ec957debe7adc5365

inc/service_config.h
plugins/wakeup-manager/inc/wakeup_manager.h
plugins/wakeup-manager/src/wakeup_manager.cpp
src/service_main.cpp

index 5a87e0f..5604ed2 100644 (file)
@@ -28,9 +28,6 @@ extern "C"
 {
 #endif
 
-#define MAX_WAKEUP_LIST_NUM 32
-#define MAX_SUPPORTED_LANGUAGE_NUM 128
-
 /**************************************************************************************
  *** Definitions for xml file
  *************************************************************************************/
@@ -79,10 +76,10 @@ typedef struct ma_assistant_info_s {
        const char* app_id;
        const char* name;
        const char* icon_path;
-       const char* wakeup_list[MAX_WAKEUP_LIST_NUM];
-       const char* wakeup_language[MAX_WAKEUP_LIST_NUM];
+       const char* wakeup_list[MAX_WAKEUP_WORDS_NUM];
+       const char* wakeup_language[MAX_WAKEUP_WORDS_NUM];
        int cnt_wakeup;
-       const char* supported_lang[MAX_SUPPORTED_LANGUAGE_NUM];
+       const char* supported_lang[MAX_SUPPORTED_LANGUAGES_NUM];
        int cnt_lang;
        const char* wakeup_engine;
        bool custom_ui_option;
index 3b6a00b..8e98d93 100644 (file)
@@ -226,7 +226,8 @@ private:
        bool mVoiceKeyPressed{false};
        string mCurrentLanguage;
        string mCurrentDefaultAssistant;
-       VOICE_KEY_SUPPORT_MODE mCurrentVoiceKeySupportMode;
+       /* Assume Push-to-talk is the default mode */
+       VOICE_KEY_SUPPORT_MODE mCurrentVoiceKeySupportMode{VOICE_KEY_SUPPORT_MODE_PUSH_TO_TALK};
 
        STREAMING_MODE mStreamingMode{STREAMING_MODE::NONE};
        Ecore_Timer* mStreamingDurationTimer{nullptr};
@@ -239,4 +240,4 @@ private:
 } // wakeup
 } // multiassistant
 
-#endif /* _WAKEUP_MANAGER_H_ */
\ No newline at end of file
+#endif /* _WAKEUP_MANAGER_H_ */
index bce479c..e7cdbf0 100644 (file)
@@ -509,6 +509,7 @@ bool CWakeupManager::change_voice_key_status(ma_voice_key_status_e status) {
                MA_VOICE_KEY_STATUS_RELEASED_AFTER_TAP == status) {
                mVoiceKeyPressed = false;
        }
+       return true;
 }
 
 bool CWakeupManager::process_plugin_event(mas_plugin_event_e event, void* data, int len)
index b3d4dff..4628c15 100644 (file)
@@ -609,7 +609,7 @@ int CServiceMain::initialize_service_plugin(void)
                                                }
                                        }
                                }
-                               for (inner_loop = 0; inner_loop < MAX_SUPPORTED_LANGUAGE_NUM; inner_loop++) {
+                               for (inner_loop = 0; inner_loop < MAX_SUPPORTED_LANGUAGES_NUM; inner_loop++) {
                                        if (mClientInfo[loop].supported_language[inner_loop] &&
                                                0 < strlen(mClientInfo[loop].supported_language[inner_loop])) {
                                                MAS_LOGD("Adding language %s for app %s",