Define constant for max length of app ID 80/263680/2
authorSuyeon Hwang <stom.hwang@samsung.com>
Wed, 8 Sep 2021 03:36:26 +0000 (12:36 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Wed, 22 Dec 2021 06:13:12 +0000 (15:13 +0900)
Change-Id: Id8d394884fb5136a9e577ff735e9e3197e91760e
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/tts_core.c
client/tts_tidl.c
common/tts_defs.h

index d529b86aa54b543b86483893dc442145e8b36e5f..d2cc830b7703ac0411a4fa1bd5855c809a08c668 100644 (file)
@@ -59,19 +59,19 @@ static char* __get_engine_appid(int mode) {
                return NULL;
        }
 
-       char* appid = (char*)calloc(256, sizeof(char));
+       char* appid = (char*)calloc(TTS_ENGINE_APPID_LEN, sizeof(char));
        if (NULL == appid) {
                return NULL;
        }
 
        if (TTS_MODE_DEFAULT <= mode && TTS_MODE_SCREEN_READER >= mode) {
-               snprintf(appid, 256, "%s", g_engine_name);
+               snprintf(appid, TTS_ENGINE_APPID_LEN, "%s", g_engine_name);
 //     } else if (TTS_MODE_NOTIFICATION == mode) {
-//             snprintf(appid, 256, "%s-noti", g_engine_name);
+//             snprintf(appid, TTS_ENGINE_APPID_LEN, "%s-noti", g_engine_name);
 //     } else if (TTS_MODE_SCREEN_READER == mode) {
-//             snprintf(appid, 256, "%s-sr", g_engine_name);
+//             snprintf(appid, TTS_ENGINE_APPID_LEN, "%s-sr", g_engine_name);
        } else if (TTS_MODE_INTERRUPT == mode) {
-               snprintf(appid, 256, "%s-interrupt", g_engine_name);
+               snprintf(appid, TTS_ENGINE_APPID_LEN, "%s-interrupt", g_engine_name);
        } else {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] mode is not valid. mode(%d)", mode);
                free(appid);
index ef2ad4cd4be3f703ee86ac2b77af7470ad83feb8..45523b227a260db1e4cfb248f0d16b15491e1710 100644 (file)
@@ -272,8 +272,8 @@ int tts_tidl_open_connection(int uid)
        }
 
        tts_mode_e mode = tts_client_get_mode(client);
-       char engine_app_id[256] = {0, };
-       __get_engine_app_id(mode, 256, engine_app_id);
+       char engine_app_id[TTS_ENGINE_APPID_LEN] = {0, };
+       __get_engine_app_id(mode, TTS_ENGINE_APPID_LEN, engine_app_id);
 
        info->rpc_h = __create_rpc_port(uid, engine_app_id);
        if (NULL == info->rpc_h) {
@@ -399,10 +399,10 @@ int tts_tidl_request_hello(int uid)
        }
 
        tts_mode_e mode = tts_client_get_mode(client);
-       char engine_app_id[256] = {0, };
-       __get_engine_app_id(mode, 256, engine_app_id);
+       char engine_app_id[TTS_ENGINE_APPID_LEN] = {0, };
+       __get_engine_app_id(mode, TTS_ENGINE_APPID_LEN, engine_app_id);
 
-       if (NULL == info->engine_app_id || 0 != strncmp(info->engine_app_id, engine_app_id, 256)) {
+       if (NULL == info->engine_app_id || 0 != strncmp(info->engine_app_id, engine_app_id, TTS_ENGINE_APPID_LEN)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[TIDL] tts engine is changed from (%s) to (%s)", info->engine_app_id, engine_app_id);
                if (0 != rpc_port_proxy_tts_destroy(info->rpc_h)) {
                        SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to destroy old rpc_port");
index 80c6a4076d32e7c2ae3cfb8aef99b7a135cfe3cd..07a45eb65961d6b99d1c67b3f8e7c59ce6ba0a1b 100644 (file)
@@ -123,6 +123,8 @@ extern "C" {
 #define TTS_ERROR_ALREADY_INITIALIZED  -999
 #define TTS_CREDENTIAL_NEEDED_ALREADY_INITIALIZED      -1
 
+#define TTS_ENGINE_APPID_LEN 256
+
 /******************************************************************************************
 * Defines for vconf key
 *******************************************************************************************/