Change variable related with uid to unsigned integer 71/268571/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Mon, 27 Dec 2021 05:47:38 +0000 (14:47 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Mon, 27 Dec 2021 05:47:38 +0000 (14:47 +0900)
Change-Id: Id74b98a2adc21d5e71905203ec5752c11b826abf
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/vc_widget_client.c
common/vc_main.h
server/vcd_server.c

index 0907406c8eb6ec2c2bf9a129122c7e0b7c339686..c18036e5f26eef4dd22ac47af709d783e7c04e1a 100644 (file)
@@ -21,9 +21,9 @@
 #include "voice_control_common.h"
 
 /* Max number of handle */
-static const int g_max_handle = 999;
+static const unsigned int MAX_NUMBER_OF_HANDLE = 999;
 /* allocated handle */
-static int g_allocated_handle = 0;
+static unsigned int g_allocated_handle = 0;
 /* widget list */
 static GSList *g_widget_list = NULL;
 
@@ -61,16 +61,16 @@ vc_widget_s* widget_get(vc_h vc)
        return NULL;
 }
 
-static int __client_generate_uid(int pid)
+static unsigned int __client_generate_uid(unsigned int pid)
 {
        g_allocated_handle++;
 
-       if (g_allocated_handle > g_max_handle) {
+       if (g_allocated_handle > MAX_NUMBER_OF_HANDLE) {
                g_allocated_handle = 1;
        }
 
        /* generate uid, handle number should be smaller than 1000 */
-       return pid * 1000 + g_allocated_handle;
+       return pid * 1000u + g_allocated_handle;
 }
 
 int vc_widget_client_create(vc_h* vc)
@@ -90,7 +90,7 @@ int vc_widget_client_create(vc_h* vc)
                return VC_ERROR_OUT_OF_MEMORY;
        }
 
-       temp->handle = __client_generate_uid(getpid());
+       temp->handle = __client_generate_uid((unsigned int)getpid());
 
        /* initialize widget data */
        widget->vc = temp;
index 9ed41285e3e7770ec01950cac3067007a163c41d..15e94f92ec5f3861f78c3351f9bcd467099bb79e 100644 (file)
@@ -48,7 +48,7 @@ extern "C" {
 * @brief A structure of handle for identification
 */
 struct vc_s {
-       int handle;
+       unsigned int handle;
 };
 
 typedef struct vc_s *vc_h;
index aa2a3471fc7e9f80c8e6745394e5e70568c6eda8..f55f33af4a99d8fb4048c51d19772487a5eed963 100644 (file)
@@ -1153,7 +1153,7 @@ int vcd_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int le
 {
        if (VC_INVALID_TTS_UID == g_current_tts_uid && VCE_FEEDBACK_EVENT_START == event) {
                g_current_utt_id = (g_current_utt_id + 1) % 1000;
-               g_current_tts_uid = vcd_client_manager_get_pid() * 1000 + g_current_utt_id;
+               g_current_tts_uid = (unsigned int)vcd_client_manager_get_pid() * 1000u + 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());
        }
 
@@ -2687,9 +2687,9 @@ int vcd_server_request_tts(int pid, const char* text, const char* language, int
        g_current_utt_id = (g_current_utt_id + 1) % 1000;
        *utt_id = g_current_utt_id;
        if (0 == to_vcm) {
-               tts_uid = pid * 1000 + g_current_utt_id;
+               tts_uid = (unsigned int)pid * 1000u + (unsigned int)g_current_utt_id;
        } else {
-               tts_uid = vcd_client_manager_get_pid() * 1000 + g_current_utt_id;
+               tts_uid = (unsigned int)vcd_client_manager_get_pid() * 1000u + (unsigned int)g_current_utt_id;
        }
        SLOG(LOG_INFO, TAG_VCD, "[Server INFO] pid(%d), text(%s), language(%s), to_vcm(%d), ", pid, text, language, to_vcm);
        SLOG(LOG_INFO, TAG_VCD, "[Server INFO] current_uid(%u), current_utt_id(%d)", tts_uid, g_current_utt_id);
@@ -2736,7 +2736,7 @@ int vcd_server_cancel_tts(int pid, int utt_id)
 
        vc_tts_text_data_s* tts_text_data = NULL;
 
-       unsigned int tts_uid = pid * 1000 + utt_id;
+       unsigned int tts_uid = (unsigned int)pid * 1000u + (unsigned int)utt_id;
        int ret = vcd_data_get_tts_text_data(tts_uid, &tts_text_data);
        if (0 != ret) {
                SLOG(LOG_WARN, TAG_VCD, "[Server WARN] No data in vcd tts text queue");