Change type of uid from signed int to unsigned int 63/267763/4
authorwn.jang <wn.jang@samsung.com>
Thu, 9 Dec 2021 12:37:04 +0000 (21:37 +0900)
committerwn.jang <wn.jang@samsung.com>
Thu, 9 Dec 2021 13:13:14 +0000 (22:13 +0900)
Change-Id: I4c3754d4a468afa9fa1b7091eb65a8124869ba0e

17 files changed:
client/vc.c
client/vc_client.c
client/vc_client.h
client/vc_mgr.c
client/vc_mgr_client.c
client/vc_mgr_client.h
client/vc_setting.c
client/vc_widget.c
client/vc_widget_client.c
client/vc_widget_client.h
common/vc_command.c
common/vc_config_mgr.c
common/vc_config_mgr.h
server/vcd_server.c
server/vcd_server_data.cpp
server/vcd_server_data.h
server/vce.c

index 2f21d9c..60143a2 100644 (file)
@@ -164,8 +164,8 @@ static int __vc_check_privilege()
                        //LCOV_EXCL_STOP
                }
 
-               char uid[16];
-               snprintf(uid, 16, "%d", getuid());
+               char uid[32];
+               snprintf(uid, 32, "%d", getuid());
                ret = true;
                ret = __check_privilege(uid, VC_PRIVILEGE);
                __check_privilege_deinitialize();
index c7db4cc..60194c0 100644 (file)
@@ -21,7 +21,7 @@ typedef struct {
        /* base info */
        vc_h    vc;
        int     pid;
-       int     uid;            /*<< unique id = pid + handle */
+       unsigned int uid;               /*<< unique id = pid + handle */
        int     xid;            /*<< main X window id */
 
        vc_result_cb                    result_cb;
@@ -224,7 +224,7 @@ bool vc_client_is_valid(vc_h vc)
        return true;
 }
 
-bool vc_client_is_valid_by_uid(int uid)
+bool vc_client_is_valid_by_uid(unsigned int uid)
 {
        vc_client_s *data = NULL;
 
@@ -246,7 +246,7 @@ bool vc_client_is_valid_by_uid(int uid)
 }
 
 //LCOV_EXCL_START
-int vc_client_get_handle(int uid, vc_h* vc)
+int vc_client_get_handle(unsigned int uid, vc_h* vc)
 {
        vc_client_s *data = NULL;
 
@@ -473,7 +473,7 @@ int vc_client_get_client_state(vc_h vc, vc_state_e* state)
        return 0;
 }
 
-int vc_client_get_client_state_by_uid(int uid, vc_state_e* state)
+int vc_client_get_client_state_by_uid(unsigned int uid, vc_state_e* state)
 {
        vc_client_s *data = NULL;
 
index e084fe7..7c22e2c 100644 (file)
@@ -38,9 +38,9 @@ int vc_client_destroy(vc_h vc);
 
 bool vc_client_is_valid(vc_h vc);
 
-bool vc_client_is_valid_by_uid(int uid);
+bool vc_client_is_valid_by_uid(unsigned int uid);
 
-int vc_client_get_handle(int uid, vc_h* vc);
+int vc_client_get_handle(unsigned int uid, vc_h* vc);
 
 /*
 * set/get callback function
@@ -77,7 +77,7 @@ int vc_client_set_client_state(vc_h vc, vc_state_e state);
 
 int vc_client_get_client_state(vc_h vc, vc_state_e* state);
 
-int vc_client_get_client_state_by_uid(int uid, vc_state_e* state);
+int vc_client_get_client_state_by_uid(unsigned int uid, vc_state_e* state);
 
 int vc_client_get_before_state(vc_h vc, vc_state_e* state, vc_state_e* before_state);
 
index 5c0a44f..0c82dc8 100755 (executable)
@@ -42,7 +42,7 @@
 #include "voice_control_manager_internal.h"
 
 
-#define VC_MANAGER_CONFIG_HANDLE       100000
+#define VC_MANAGER_CONFIG_HANDLE       10000000
 
 static Ecore_Timer* g_send_hello_timer = NULL;
 static Ecore_Timer* g_request_init_timer = NULL;
@@ -226,8 +226,8 @@ static int __vc_mgr_check_privilege()
                        return VC_ERROR_PERMISSION_DENIED;
                }
 
-               char uid[16];
-               snprintf(uid, 16, "%d", getuid());
+               char uid[32];
+               snprintf(uid, 32, "%d", getuid());
                ret = true;
                ret = __check_privilege(uid, VC_PRIVILEGE);
                if (false == ret) {
index 4ccb0c3..f463c48 100644 (file)
@@ -22,7 +22,7 @@ typedef struct {
        /* base info */
        vc_h    vc;
        int     pid;
-       int     uid;            /*<< unique id = pid + handle */
+       unsigned int uid;               /*<< unique id = pid + handle */
 
        vc_mgr_all_result_cb            all_result_cb;
        void*                           all_result_user_data;
@@ -308,7 +308,7 @@ bool vc_mgr_client_is_valid(vc_h vc)
        return true;
 }
 
-bool vc_mgr_client_is_valid_by_uid(int uid)
+bool vc_mgr_client_is_valid_by_uid(unsigned int uid)
 {
        vc_mgr_client_s *data = NULL;
 
@@ -329,7 +329,7 @@ bool vc_mgr_client_is_valid_by_uid(int uid)
        return false;
 }
 
-int vc_mgr_client_get_handle(int uid, vc_h* vc)
+int vc_mgr_client_get_handle(unsigned int uid, vc_h* vc)
 {
        vc_mgr_client_s *data = NULL;
 
@@ -838,7 +838,7 @@ int vc_mgr_client_get_client_state(vc_h vc, vc_state_e* state)
        return 0;
 }
 
-int vc_mgr_client_get_client_state_by_uid(int uid, vc_state_e* state)
+int vc_mgr_client_get_client_state_by_uid(unsigned int uid, vc_state_e* state)
 {
        vc_mgr_client_s *data = NULL;
 
index 800ba0f..dfcfde1 100644 (file)
@@ -43,9 +43,9 @@ int vc_mgr_client_destroy(vc_h vc);
 
 bool vc_mgr_client_is_valid(vc_h vc);
 
-bool vc_mgr_client_is_valid_by_uid(int uid);
+bool vc_mgr_client_is_valid_by_uid(unsigned int uid);
 
-int vc_mgr_client_get_handle(int uid, vc_h* vc);
+int vc_mgr_client_get_handle(unsigned int uid, vc_h* vc);
 
 int vc_mgr_client_get_pid(vc_h vc, int* pid);
 
@@ -127,7 +127,7 @@ int vc_mgr_client_set_client_state(vc_h vc, vc_state_e state);
 
 int vc_mgr_client_get_client_state(vc_h vc, vc_state_e* state);
 
-int vc_mgr_client_get_client_state_by_uid(int uid, vc_state_e* state);
+int vc_mgr_client_get_client_state_by_uid(unsigned int uid, vc_state_e* state);
 
 int vc_mgr_client_get_before_state(vc_h vc, vc_state_e* state, vc_state_e* before_state);
 
index 4a8ca0e..238480f 100644 (file)
@@ -29,7 +29,7 @@ typedef enum {
        VC_SETTING_STATE_READY
 } vc_setting_state_e;
 
-#define VC_SETTING_CONFIG_HANDLE       300000
+#define VC_SETTING_CONFIG_HANDLE       30000000
 
 static vc_setting_state_e g_state = VC_SETTING_STATE_NONE;
 
index c6dcd8a..e5e7be4 100644 (file)
@@ -30,7 +30,7 @@
 #include "voice_control_widget.h"
 
 
-#define VC_WIDGET_CONFIG_HANDLE        200000
+#define VC_WIDGET_CONFIG_HANDLE        20000000
 
 static Ecore_Event_Handler* g_focus_in_handler = NULL;
 static Ecore_Event_Handler* g_focus_out_handler = NULL;
index 5c13f16..0907406 100644 (file)
@@ -190,7 +190,7 @@ bool vc_widget_client_is_valid(vc_h vc)
        return true;
 }
 
-bool vc_widget_client_is_valid_by_uid(int uid)
+bool vc_widget_client_is_valid_by_uid(unsigned int uid)
 {
        vc_widget_s *data = NULL;
 
@@ -215,7 +215,7 @@ bool vc_widget_client_is_valid_by_uid(int uid)
        return false;
 }
 
-int vc_widget_client_get_handle(int uid, vc_h* vc)
+int vc_widget_client_get_handle(unsigned int uid, vc_h* vc)
 {
        vc_widget_s *data = NULL;
 
@@ -546,7 +546,7 @@ int vc_widget_client_get_state(vc_h vc, vc_state_e* state)
        return 0;
 }
 
-int vc_widget_client_get_state_by_uid(int uid, vc_state_e* state)
+int vc_widget_client_get_state_by_uid(unsigned int uid, vc_state_e* state)
 {
        vc_widget_s *data = NULL;
 
index 55a44e3..5ef3a55 100644 (file)
@@ -30,7 +30,7 @@ typedef struct {
        /* base info */
        vc_h    vc;
        int     pid;
-       int     uid;            /*<< unique id = pid + handle */
+       unsigned int uid;               /*<< unique id = pid + handle */
        int     xid;            /*<< main Wayland window id */
 
        vc_result_cb                    result_cb;
@@ -80,9 +80,9 @@ int vc_widget_client_destroy(vc_h vc);
 
 bool vc_widget_client_is_valid(vc_h vc);
 
-bool vc_widget_client_is_valid_by_uid(int uid);
+bool vc_widget_client_is_valid_by_uid(unsigned int uid);
 
-int vc_widget_client_get_handle(int uid, vc_h* vc);
+int vc_widget_client_get_handle(unsigned int uid, vc_h* vc);
 
 vc_widget_s* widget_get(vc_h vc);
 
@@ -136,7 +136,7 @@ int vc_widget_client_set_state(vc_h vc, vc_state_e state);
 
 int vc_widget_client_get_state(vc_h vc, vc_state_e* state);
 
-int vc_widget_client_get_state_by_uid(int uid, vc_state_e* state);
+int vc_widget_client_get_state_by_uid(unsigned int uid, vc_state_e* state);
 
 int vc_widget_client_get_before_state(vc_h vc, vc_state_e* state, vc_state_e* before_state);
 
index 25eabf9..9d7f9d6 100644 (file)
@@ -157,8 +157,8 @@ static int __vc_cmd_check_privilege()
                        return VC_ERROR_PERMISSION_DENIED;
                }
 
-               char uid[16];
-               snprintf(uid, 16, "%d", getuid());
+               char uid[32];
+               snprintf(uid, 32, "%d", getuid());
                ret = true;
                ret = __check_privilege(uid, VC_PRIVILEGE);
                __check_privilege_deinitialize();
index f1c351b..cf3bbda 100644 (file)
@@ -37,7 +37,7 @@
 #define BUF_LEN     (EVENT_SIZE + 16)
 
 typedef struct {
-       int     uid;
+       unsigned int uid;
        vc_config_engine_changed_cb     engine_cb;
        vc_config_lang_changed_cb       lang_cb;
        vc_config_enabled_cb            enabled_cb;
@@ -274,7 +274,7 @@ int __vc_config_mgr_select_lang(const char* engine_id, char** language)
        return VC_ERROR_OPERATION_FAILED;
 }
 
-int __vc_config_release_client(int uid)
+int __vc_config_release_client(unsigned int uid)
 {
        GSList *iter = NULL;
        vc_config_client_s* temp_client = NULL;
@@ -828,7 +828,7 @@ void __vc_config_language_changed_cb(keynode_t *key, void *data)
        return;
 }
 
-int vc_config_mgr_initialize(int uid)
+int vc_config_mgr_initialize(unsigned int uid)
 {
        GSList *iter = NULL;
        int* get_uid;
@@ -1044,7 +1044,7 @@ int vc_config_mgr_initialize(int uid)
        return 0;
 }
 
-int vc_config_mgr_finalize(int uid)
+int vc_config_mgr_finalize(unsigned int uid)
 {
        SLOG(LOG_INFO, vc_config_tag(), "[WARNING] Enter critical section");
 
@@ -1133,7 +1133,7 @@ int __vc_config_mgr_unregister_config_event()
        return 0;
 }
 
-int vc_config_mgr_set_engine_cb(int uid, vc_config_engine_changed_cb engine_cb)
+int vc_config_mgr_set_engine_cb(unsigned int uid, vc_config_engine_changed_cb engine_cb)
 {
        GSList *iter = NULL;
        vc_config_client_s* temp_client = NULL;
@@ -1165,7 +1165,7 @@ int vc_config_mgr_set_engine_cb(int uid, vc_config_engine_changed_cb engine_cb)
        return 0;
 }
 
-int vc_config_mgr_unset_engine_cb(int uid)
+int vc_config_mgr_unset_engine_cb(unsigned int uid)
 {
        GSList *iter = NULL;
        vc_config_client_s* temp_client = NULL;
@@ -1194,7 +1194,7 @@ int vc_config_mgr_unset_engine_cb(int uid)
 }
 
 
-int vc_config_mgr_set_lang_cb(int uid, vc_config_lang_changed_cb lang_cb)
+int vc_config_mgr_set_lang_cb(unsigned int uid, vc_config_lang_changed_cb lang_cb)
 {
        GSList *iter = NULL;
        vc_config_client_s* temp_client = NULL;
@@ -1226,7 +1226,7 @@ int vc_config_mgr_set_lang_cb(int uid, vc_config_lang_changed_cb lang_cb)
        return 0;
 }
 
-int vc_config_mgr_unset_lang_cb(int uid)
+int vc_config_mgr_unset_lang_cb(unsigned int uid)
 {
        GSList *iter = NULL;
        vc_config_client_s* temp_client = NULL;
@@ -1254,7 +1254,7 @@ int vc_config_mgr_unset_lang_cb(int uid)
        return 0;
 }
 
-int vc_config_mgr_set_enabled_cb(int uid, vc_config_enabled_cb enabled_cb)
+int vc_config_mgr_set_enabled_cb(unsigned int uid, vc_config_enabled_cb enabled_cb)
 {
        if (NULL == enabled_cb) {
                SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] enabled cb is NULL : uid(%d) ", uid);
@@ -1286,7 +1286,7 @@ int vc_config_mgr_set_enabled_cb(int uid, vc_config_enabled_cb enabled_cb)
        return VC_CONFIG_ERROR_INVALID_PARAMETER;
 }
 
-int vc_config_mgr_unset_enabled_cb(int uid)
+int vc_config_mgr_unset_enabled_cb(unsigned int uid)
 {
        GSList *iter = NULL;
        vc_config_client_s* temp_client = NULL;
index 647da0f..ce623d1 100644 (file)
@@ -45,25 +45,25 @@ typedef void (*vc_config_enabled_cb)(bool enable);
 
 typedef bool (*vc_config_supported_engine_cb)(const char *engine_name, const char *engine_appid, const char *setting, const char *default_lang, bool non_fixed_support, void *user_data);
 
-int vc_config_mgr_initialize(int uid);
+int vc_config_mgr_initialize(unsigned int uid);
 
-int vc_config_mgr_finalize(int uid);
+int vc_config_mgr_finalize(unsigned int uid);
 
 
 /* Set / Unset callback */
-int vc_config_mgr_set_engine_cb(int uid, vc_config_engine_changed_cb engine_cb);
+int vc_config_mgr_set_engine_cb(unsigned int uid, vc_config_engine_changed_cb engine_cb);
 
-int vc_config_mgr_unset_engine_cb(int uid);
+int vc_config_mgr_unset_engine_cb(unsigned int uid);
 
 
-int vc_config_mgr_set_lang_cb(int uid, vc_config_lang_changed_cb lang_cb);
+int vc_config_mgr_set_lang_cb(unsigned int uid, vc_config_lang_changed_cb lang_cb);
 
-int vc_config_mgr_unset_lang_cb(int uid);
+int vc_config_mgr_unset_lang_cb(unsigned int uid);
 
 
-int vc_config_mgr_set_enabled_cb(int uid, vc_config_enabled_cb enabled_cb);
+int vc_config_mgr_set_enabled_cb(unsigned int uid, vc_config_enabled_cb enabled_cb);
 
-int vc_config_mgr_unset_enabled_cb(int uid);
+int vc_config_mgr_unset_enabled_cb(unsigned int uid);
 
 
 int vc_config_mgr_get_auto_language(bool* value);
index 486b6cb..853597c 100644 (file)
@@ -45,7 +45,7 @@ static Ecore_Timer *g_check_widget_client_timer = NULL;
 static Ecore_Timer *g_check_client_timer = NULL;
 
 static Ecore_Thread* g_tts_thread = NULL;
-static int g_current_uid = -1;
+static unsigned int g_current_uid = 0;
 static int g_current_utt_id = -1;
 
 /**
@@ -1137,7 +1137,7 @@ int vcd_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au
        /* send TTS feedback audio format to VC manager */
        int ret = VCD_ERROR_NONE;
        int pid = g_current_uid / 1000;
-       if (-1 == g_current_uid || vcd_client_manager_get_pid() == pid) {
+       if (0 == g_current_uid || vcd_client_manager_get_pid() == pid) {
                ret = vcdc_send_feedback_audio_format_to_manager(vcd_client_manager_get_pid(), rate, channel, audio_type);
                if (VCD_ERROR_NONE != ret) {
                        SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to send TTS feedback audio format to VC manager");
@@ -1151,7 +1151,7 @@ int vcd_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au
 
 int vcd_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int len)
 {
-       if (-1 == g_current_uid && VCE_FEEDBACK_EVENT_START == event) {
+       if (0 == g_current_uid && VCE_FEEDBACK_EVENT_START == event) {
                g_current_utt_id = (g_current_utt_id + 1) % 1000;
                g_current_uid = vcd_client_manager_get_pid() * 1000 + g_current_utt_id;
                SLOG(LOG_INFO, TAG_VCD, "[Server info] set current uid and utt_id as manager pid(%d)", vcd_client_manager_get_pid());
@@ -1179,7 +1179,7 @@ int vcd_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int le
 
        if (VCE_FEEDBACK_EVENT_FINISH == event) {
                /* reset current uid */
-               g_current_uid = -1;
+               g_current_uid = 0;
 
                /* Set service state to ready if state is synthesizing */
                vcd_state_e state = vcd_config_get_service_state();
@@ -1348,7 +1348,7 @@ int vcd_initialize(vce_request_callback_s *callback)
                SLOG(LOG_WARN, TAG_VCD, "[Server Warning] Fail to create timer of client check");
        }
 
-       g_current_uid = -1;
+       g_current_uid = 0;
        g_current_utt_id = -1;
 
        SLOG(LOG_ERROR, TAG_VCD, "[Server SUCCESS] initialize");
@@ -2684,7 +2684,7 @@ int vcd_server_request_tts(int pid, const char* text, const char* language, int
                return VCD_ERROR_INVALID_STATE;
        }
 
-       int uid = -1;
+       unsigned int uid = 0;
        g_current_utt_id = (g_current_utt_id + 1) % 1000;
        *utt_id = g_current_utt_id;
        if (0 == to_vcm) {
@@ -2737,7 +2737,7 @@ int vcd_server_cancel_tts(int pid, int utt_id)
 
        vc_tts_text_data_s* tts_text_data = NULL;
 
-       int uid = pid * 1000 + utt_id;
+       unsigned int uid = pid * 1000 + utt_id;
        int ret = vcd_data_get_tts_text_data(uid, &tts_text_data);
        if (0 != ret) {
                SLOG(LOG_WARN, TAG_VCD, "[Server WARN] No data in vcd tts text queue");
index 6f5906e..9cf6da5 100644 (file)
@@ -51,7 +51,7 @@ static int __data_show_text_list(void)
        return VCD_ERROR_NONE;
 }
 
-int vcd_data_add_tts_text_data(int uid, vc_tts_text_data_s* data)
+int vcd_data_add_tts_text_data(unsigned int uid, vc_tts_text_data_s* data)
 {
        if (NULL == data) {
                SLOG(LOG_ERROR, TAG_VCD, "[DATA ERROR] feedback data is NULL");
@@ -110,7 +110,7 @@ int vcd_data_clear_tts_text_data(vc_tts_text_data_s** tts_text_data)
        return VCD_ERROR_NONE;
 }
 
-int vcd_data_get_tts_text_data(int uid, vc_tts_text_data_s** data)
+int vcd_data_get_tts_text_data(unsigned int uid, vc_tts_text_data_s** data)
 {
        SLOG(LOG_INFO, TAG_VCD, "[DATA] Get tts text data : uid(%d)", uid);
 
index af2f055..86e4ece 100644 (file)
@@ -30,7 +30,7 @@ extern "C" {
 
 
 typedef struct {
-       int uid;
+       unsigned int uid;
        int pid;
        int     utt_id;
        char* text;
@@ -38,11 +38,11 @@ typedef struct {
 } vc_tts_text_data_s;
 
 
-int vcd_data_add_tts_text_data(int uid, vc_tts_text_data_s* data);
+int vcd_data_add_tts_text_data(unsigned int uid, vc_tts_text_data_s* data);
 
 int vcd_data_clear_tts_text_data(vc_tts_text_data_s** tts_text_data);
 
-int vcd_data_get_tts_text_data(int uid, vc_tts_text_data_s** data);
+int vcd_data_get_tts_text_data(unsigned int uid, vc_tts_text_data_s** data);
 
 int vcd_data_get_first_tts_text_data(vc_tts_text_data_s** data);
 
index 970f521..5d71383 100644 (file)
@@ -127,8 +127,8 @@ static int __vce_check_privilege()
                        return VCE_ERROR_PERMISSION_DENIED;
                }
 
-               char uid[16];
-               snprintf(uid, 16, "%d", getuid());
+               char uid[32];
+               snprintf(uid, 32, "%d", getuid());
                ret = true;
                ret = __check_privilege(uid, VC_PRIVILEGE);
                __check_privilege_deinitialize();