Removing the parameter 'void* user_data' in ttse_send_personal_voice 36/317936/2
authordyamy-lee <dyamy.lee@samsung.com>
Fri, 20 Sep 2024 03:38:25 +0000 (12:38 +0900)
committerdyamy-lee <dyamy.lee@samsung.com>
Mon, 23 Sep 2024 02:01:51 +0000 (11:01 +0900)
In that code, the parameter 'user_data' is used as 'engine_id'.
However if it changed to 'engine_id' or stayed 'user_data', it can be entered wrong engine name from the engine's set.
So, it removed parameter sent from engine, and it finds itself what is current engine.

Change-Id: Ic4e0b05c5d46d1c85718246af3d5a1f2770a88f8

include/ttse.h
server/ttsd_config.c
server/ttsd_config.h
server/ttsd_server.c
server/ttsd_server.h
server/ttse.c

index cffe679..2ecf634 100755 (executable)
@@ -730,14 +730,13 @@ int ttse_set_personal_tts_id_set_cb(ttse_set_personal_tts_id_cb callback);
 * @brief Sends the personal voice's information to the engine service user.
 * @since_tizen 9.0
 * @remarks This API is called when TTS engine sends the personal voice's information to the engine service user.
-*          The personal voice's information and @a user_data must be transferred to the engine service user through this function.
+*          The personal voice's information must be transferred to the engine service user through this function.
 * @param[in] language The language is specified as an ISO 3166 alpha-2 two-letter country code
 *                     followed by ISO 639-1 for the two-letter language code.
 *                     For example, "ko_KR" for Korean, "en_US" for American English
 * @param[in] unique_id The unique_id is used as ptts_id.
 * @param[in] display_name The display_name is saved from user. It can be used client's side.
 * @param[in] device_name The device_name is the name of the device where personal voice is stored.
-* @param[in] user_data The user data which contains TTS engine name or NULL
 * @return @c 0 on success,
 *         otherwise a negative error value
 * @retval #TTSE_ERROR_NONE Successful
@@ -746,7 +745,7 @@ int ttse_set_personal_tts_id_set_cb(ttse_set_personal_tts_id_cb callback);
 * @retval #TTSE_ERROR_OPERATION_FAILED Operation failure
 * @pre The ttse_main() function doesn't have to be invoked before this function is called.
 */
-int ttse_send_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name, void* user_data);
+int ttse_send_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name);
 
 
 #ifdef __cplusplus
index aa03f8c..f3ce060 100644 (file)
@@ -264,16 +264,12 @@ int ttsd_config_set_instant_reprepare_client(const unsigned int uid)
        return TTSD_ERROR_NONE;
 }
 
-int ttsd_config_update_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name, void* user_data)
+int ttsd_config_update_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name)
 {
        int ret = 0;
        char current_engine[1024] = {'\0', };
-       if (user_data) {
-               strncpy(current_engine, (char*)user_data, sizeof(current_engine) - 1);
-       } else {
-               if (0 != aul_app_get_appid_bypid(getpid(), current_engine, sizeof(current_engine) - 1)) {
-                       SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get callee appid by pid");
-               }
+       if (0 != aul_app_get_appid_bypid(getpid(), current_engine, sizeof(current_engine) - 1)) {
+               SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get callee appid by pid");
        }
 
        SLOG(LOG_DEBUG, tts_tag(), "[Server] TTS Current Engine(%s)", current_engine);
@@ -285,6 +281,8 @@ int ttsd_config_update_personal_voice(const char* language, const char* unique_i
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
+       SLOG(LOG_DEBUG, tts_tag(), "[Server] TTS Current Engine(%s), matched(%d)", current_engine, matched);
+
        if (!matched) {
                ret = tts_config_mgr_update_personal_voice(current_engine, language, unique_id, display_name, device_name);
                if (0 != ret) {
index e1f1a7c..25f7b10 100644 (file)
@@ -60,7 +60,7 @@ int ttsd_config_get_instant_reprepare_client(unsigned int *uid);
 
 int ttsd_config_set_instant_reprepare_client(const unsigned int uid);
 
-int ttsd_config_update_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name, void* user_data);
+int ttsd_config_update_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name);
 
 int ttsd_config_get_personal_voices_list(ttsd_config_supported_personal_voice_cb personal_voice_cb, void* user_data);
 
index 122fe9a..a550e54 100644 (file)
@@ -1673,11 +1673,11 @@ int ttsd_set_personal_tts_id_set_cb(ttse_set_personal_tts_id_cb callback)
        return ret;
 }
 
-int ttsd_send_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name, void* user_data)
+int ttsd_send_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name)
 {
        SLOG(LOG_DEBUG, tts_tag(), "[Server] Set private data requested cb");
 
-       int ret = ttsd_config_update_personal_voice(language, unique_id, display_name, device_name, user_data);
+       int ret = ttsd_config_update_personal_voice(language, unique_id, display_name, device_name);
        if (0 != ret) {
                SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to update personal voice");
        }
index d7d9afe..4853328 100644 (file)
@@ -45,7 +45,7 @@ int ttsd_set_activated_mode_changed_cb(ttse_activated_mode_changed_cb callback);
 
 int ttsd_set_personal_tts_id_set_cb(ttse_set_personal_tts_id_cb callback);
 
-int ttsd_send_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name, void* user_data);
+int ttsd_send_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name);
 
 
 /*
index a6bc4a2..dcdd62f 100755 (executable)
@@ -121,11 +121,11 @@ static bool __is_test_app()
        return is_test_app;
 }
 
-int ttse_send_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name, void* user_data)
+int ttse_send_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name)
 {
        SLOG(LOG_INFO, tts_tag(), "[INFO] TTS Engine send personal voices list : language(%s), unique_id(%s), display_name(%s), device_name(%s)", language, unique_id, display_name, device_name);
 
-       int ret = ttsd_send_personal_voice(language, unique_id, display_name, device_name, user_data);
+       int ret = ttsd_send_personal_voice(language, unique_id, display_name, device_name);
        if (0 != ret) {
                SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to send personal voice");
        }