From 5b0ca4c3f51d2481992863f491be8d8f3b4c622c Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Mon, 27 Dec 2021 14:47:38 +0900 Subject: [PATCH] Change variable related with uid to unsigned integer Change-Id: Id74b98a2adc21d5e71905203ec5752c11b826abf Signed-off-by: Suyeon Hwang --- client/vc_widget_client.c | 12 ++++++------ common/vc_main.h | 2 +- server/vcd_server.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/client/vc_widget_client.c b/client/vc_widget_client.c index 0907406..c18036e 100644 --- a/client/vc_widget_client.c +++ b/client/vc_widget_client.c @@ -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; diff --git a/common/vc_main.h b/common/vc_main.h index 9ed4128..15e94f9 100644 --- a/common/vc_main.h +++ b/common/vc_main.h @@ -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; diff --git a/server/vcd_server.c b/server/vcd_server.c index aa2a347..f55f33af4 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -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"); -- 2.7.4