From 4affad6ac36f36ad0600ca5f6fbb1f823eacf427 Mon Sep 17 00:00:00 2001 From: "ky85.kim" Date: Wed, 25 May 2016 20:20:39 +0900 Subject: [PATCH 01/16] Fix invalid free Change-Id: I34b5f9ff08c2021bf2bcf42ba9431c31b757d0af Signed-off-by: ky85.kim --- server/vcd_server.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/vcd_server.c b/server/vcd_server.c index 86be307..2643476 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -697,6 +697,10 @@ static void __vcd_cleanup_client(vcd_client_type_e type) mgr_pid = vcd_client_manager_get_pid(); client_list = &mgr_pid; client_count = 1; + if (-1 == mgr_pid) { + SLOG(LOG_WARN, TAG_VCD, "[WARNING] Invalid Manager pid"); + return; + } } if (0 == ret || mgr_pid > 0) { -- 2.7.4 From ca38d0540a472230b7a4b282f02b4d772629113b Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 27 May 2016 10:52:08 +0900 Subject: [PATCH 02/16] Remove unnecessary codes Change-Id: I810df16f815356bb5403d3a454d896ee97667d13 Signed-off-by: sooyeon.kim --- client/vc.c | 26 +++++++++++++------------- client/vc_mgr.c | 30 +++++++++++++++--------------- client/vc_widget.c | 22 +++++++++++----------- server/vcd_client_data.c | 2 +- server/vcd_server.c | 16 +++++++--------- 5 files changed, 47 insertions(+), 49 deletions(-) diff --git a/client/vc.c b/client/vc.c index 611352e..5ad3709 100644 --- a/client/vc.c +++ b/client/vc.c @@ -154,17 +154,17 @@ static int __vc_check_privilege() static const char* __vc_get_error_code(vc_error_e err) { switch (err) { - case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; - case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; - case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; - case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; break; - case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; - case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; break; - case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; - case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; break; - case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; - case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; - default: return "Invalid error code"; break; + case VC_ERROR_NONE: return "VC_ERROR_NONE"; + case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; + case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; + case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; + case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; + case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; + case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; + case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; + case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; + case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; + default: return "Invalid error code"; } return NULL; } @@ -749,7 +749,7 @@ int vc_get_state(vc_state_e* state) case VC_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCC, "Current state is 'None'"); break; case VC_STATE_INITIALIZED: SLOG(LOG_DEBUG, TAG_VCC, "Current state is 'Created'"); break; case VC_STATE_READY: SLOG(LOG_DEBUG, TAG_VCC, "Current state is 'Ready'"); break; - default: SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state"); break; + default: SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state"); } SLOG(LOG_DEBUG, TAG_VCC, "====="); @@ -803,7 +803,7 @@ int vc_get_service_state(vc_service_state_e* state) case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'Ready'"); break; case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'Recording'"); break; case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'Processing'"); break; - default: SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state"); break; + default: SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state"); } SLOG(LOG_DEBUG, TAG_VCC, "====="); diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 06da0dc..ab70bcb 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -51,17 +51,17 @@ static Eina_Bool __vc_mgr_notify_result(void *data); static const char* __vc_mgr_get_error_code(vc_error_e err) { switch (err) { - case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; - case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; - case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; - case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; break; - case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; - case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; break; - case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; - case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; break; - case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; - case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; - default: return "Invalid error code"; break; + case VC_ERROR_NONE: return "VC_ERROR_NONE"; + case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; + case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; + case VC_ERROR_INVALID_PARAMETER: return "VC_ERROR_INVALID_PARAMETER"; + case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; + case VC_ERROR_RECORDER_BUSY: return "VC_ERROR_RECORDER_BUSY"; + case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; + case VC_ERROR_INVALID_LANGUAGE: return "VC_ERROR_INVALID_LANGUAGE"; + case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; + case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; + default: return "Invalid error code"; } return NULL; } @@ -496,7 +496,7 @@ int vc_mgr_get_state(vc_state_e* state) case VC_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'None'"); break; case VC_STATE_INITIALIZED: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'Created'"); break; case VC_STATE_READY: SLOG(LOG_DEBUG, TAG_VCM, "Current state is 'Ready'"); break; - default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); break; + default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); } SLOG(LOG_DEBUG, TAG_VCM, "====="); @@ -540,7 +540,7 @@ int vc_mgr_get_service_state(vc_service_state_e* state) case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Ready'"); break; case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Recording'"); break; case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Processing'"); break; - default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); break; + default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); } SLOG(LOG_DEBUG, TAG_VCM, "====="); @@ -665,7 +665,7 @@ int vc_mgr_is_command_format_supported(vc_cmd_format_e format, bool* support) case VC_CMD_FORMAT_FIXED: *support = true; break; case VC_CMD_FORMAT_FIXED_AND_EXTRA: *support = non_fixed_support; break; case VC_CMD_FORMAT_EXTRA_AND_FIXED: *support = non_fixed_support; break; - default: *support = false; break; + default: *support = false; } SLOG(LOG_ERROR, TAG_VCM, "[DEBUG] Format(%d) support(%s)", format, *support ? "true" : "false"); @@ -2401,4 +2401,4 @@ int __vc_mgr_request_auth_cancel(int pid) ecore_timer_add(0, __request_auth_cancel, NULL); return 0; -} \ No newline at end of file +} diff --git a/client/vc_widget.c b/client/vc_widget.c index 7002bda..c342d67 100755 --- a/client/vc_widget.c +++ b/client/vc_widget.c @@ -46,15 +46,15 @@ const char* vc_tag() static const char* __vc_widget_get_error_code(vc_error_e err) { switch (err) { - case VC_ERROR_NONE: return "VC_ERROR_NONE"; break; - case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; break; - case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; break; - case VC_ERROR_INVALID_PARAMETER:return "VC_ERROR_INVALID_PARAMETER"; break; - case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; break; - case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; break; - case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; break; - case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; break; - default: return "Invalid error code"; break; + case VC_ERROR_NONE: return "VC_ERROR_NONE"; + case VC_ERROR_OUT_OF_MEMORY: return "VC_ERROR_OUT_OF_MEMORY"; + case VC_ERROR_IO_ERROR: return "VC_ERROR_IO_ERROR"; + case VC_ERROR_INVALID_PARAMETER:return "VC_ERROR_INVALID_PARAMETER"; + case VC_ERROR_TIMED_OUT: return "VC_ERROR_TIMED_OUT"; + case VC_ERROR_INVALID_STATE: return "VC_ERROR_INVALID_STATE"; + case VC_ERROR_ENGINE_NOT_FOUND: return "VC_ERROR_ENGINE_NOT_FOUND"; + case VC_ERROR_OPERATION_FAILED: return "VC_ERROR_OPERATION_FAILED"; + default: return "Invalid error code"; } return NULL; } @@ -399,7 +399,7 @@ int vc_widget_get_state(vc_state_e* state) case VC_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'None'"); break; case VC_STATE_INITIALIZED: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'Created'"); break; case VC_STATE_READY: SLOG(LOG_DEBUG, TAG_VCW, "Current state is 'Ready'"); break; - default: SLOG(LOG_ERROR, TAG_VCW, "Invalid state"); break; + default: SLOG(LOG_ERROR, TAG_VCW, "Invalid state"); } SLOG(LOG_DEBUG, TAG_VCW, "====="); @@ -446,7 +446,7 @@ int vc_widget_get_service_state(vc_service_state_e* state) case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Ready'"); break; case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Recording'"); break; case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCW, "Current service state is 'Processing'"); break; - default: SLOG(LOG_ERROR, TAG_VCW, "Invalid service state"); break; + default: SLOG(LOG_ERROR, TAG_VCW, "Invalid service state"); } SLOG(LOG_DEBUG, TAG_VCW, "====="); diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index 5d5ff34..c922c4d 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -1364,4 +1364,4 @@ int vcd_client_widget_unset_command(int pid) info->widget_cmd = false; return 0; -} \ No newline at end of file +} diff --git a/server/vcd_server.c b/server/vcd_server.c index 2643476..748e548 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -257,13 +257,13 @@ static Eina_Bool __vcd_send_selected_result(void *data) static int __convert_type_to_priority(vc_cmd_type_e type) { switch (type) { - case VC_COMMAND_TYPE_NONE: return 0; break; - case VC_COMMAND_TYPE_BACKGROUND: return 1; break; - case VC_COMMAND_TYPE_FOREGROUND: return 2; break; - case VC_COMMAND_TYPE_WIDGET: return 2; break; - case VC_COMMAND_TYPE_SYSTEM: return 3; break; - case VC_COMMAND_TYPE_EXCLUSIVE: return 3; break; - default: return 0; break; + case VC_COMMAND_TYPE_NONE: return 0; + case VC_COMMAND_TYPE_BACKGROUND: return 1; + case VC_COMMAND_TYPE_FOREGROUND: return 2; + case VC_COMMAND_TYPE_WIDGET: return 2; + case VC_COMMAND_TYPE_SYSTEM: return 3; + case VC_COMMAND_TYPE_EXCLUSIVE: return 3; + default: return 0; } } @@ -272,8 +272,6 @@ static void __vcd_server_pre_result_cb(vcp_pre_result_event_e event, const char* if (NULL != pre_result) { vcdc_send_pre_result_to_manager(vcd_client_manager_get_pid(), event, pre_result); } - - return; } static void __vcd_server_result_cb(vcp_result_event_e event, int* result_id, int count, const char* all_result, -- 2.7.4 From dfbeea6d68a1ef7d0291e4e6a39be4782d009e0c Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 27 May 2016 14:35:58 +0900 Subject: [PATCH 03/16] Remove unnecessary codes - default Change-Id: I2d1f6f8a59842a31d87a76eae29c0681dfe9ee56 Signed-off-by: sooyeon.kim --- client/vc.c | 2 -- client/vc_mgr.c | 2 -- client/vc_widget.c | 2 -- 3 files changed, 6 deletions(-) diff --git a/client/vc.c b/client/vc.c index 5ad3709..7410708 100644 --- a/client/vc.c +++ b/client/vc.c @@ -418,8 +418,6 @@ int vc_deinitialize(void) break; case VC_STATE_NONE: break; - default: - break; } SLOG(LOG_DEBUG, TAG_VCC, "Success: destroy"); diff --git a/client/vc_mgr.c b/client/vc_mgr.c index ab70bcb..b0ae203 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -207,8 +207,6 @@ int vc_mgr_deinitialize() break; case VC_STATE_NONE: break; - default: - break; } SLOG(LOG_DEBUG, TAG_VCM, "Success: destroy"); diff --git a/client/vc_widget.c b/client/vc_widget.c index c342d67..40210a6 100755 --- a/client/vc_widget.c +++ b/client/vc_widget.c @@ -189,8 +189,6 @@ int vc_widget_deinitialize() break; case VC_STATE_NONE: break; - default: - break; } SLOG(LOG_DEBUG, TAG_VCW, "Success: destroy"); -- 2.7.4 From aa8a2de43dfb393f022e576b54e37eadb5992307 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Thu, 9 Jun 2016 16:57:35 +0900 Subject: [PATCH 04/16] [Code Review] Fix codes Change-Id: I276d19b41172aa86c94b281c412a2b9dd499a334 Signed-off-by: sooyeon.kim --- client/vc_mgr.c | 61 ----------------------------------- include/voice_control_manager.h | 2 -- include/voice_control_plugin_engine.h | 3 -- server/vcd_engine_agent.c | 1 - 4 files changed, 67 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index b0ae203..0623886 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -296,62 +296,6 @@ static Eina_Bool __vc_mgr_prepare_daemon(void *data) g_m_connect_timer = ecore_idler_add(__vc_mgr_connect_daemon, data); -#if 0 - /* request initialization */ - int ret = -1; - int service_state = 0; - int foreground = VC_RUNTIME_INFO_NO_FOREGROUND; - ret = vc_mgr_dbus_request_initialize(g_vc_m->handle, &service_state, &foreground, &g_daemon_pid); - - if (VC_ERROR_ENGINE_NOT_FOUND == ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to initialize : %s", __vc_mgr_get_error_code(ret)); - - vc_mgr_client_set_error(g_vc_m, VC_ERROR_ENGINE_NOT_FOUND); - ecore_timer_add(0, __vc_mgr_notify_error, g_vc_m); - - SLOG(LOG_DEBUG, TAG_VCM, "====="); - SLOG(LOG_DEBUG, TAG_VCM, " "); - return EINA_FALSE; - - } else if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[WARNING] Fail to connection. Retry to connect : %s", __vc_mgr_get_error_code(ret)); - return EINA_TRUE; - } else { - /* Success to connect */ - } - - /* Set service state */ - vc_mgr_client_set_service_state(g_vc_m, (vc_service_state_e)service_state); - - /* Set foreground */ - vc_mgr_client_set_foreground(g_vc_m, foreground, true); - - SLOG(LOG_DEBUG, TAG_VCM, "[SUCCESS] Connected daemon"); - - vc_mgr_client_set_client_state(g_vc_m, VC_STATE_READY); - - vc_state_changed_cb changed_callback = NULL; - void* user_data = NULL; - - vc_mgr_client_get_state_changed_cb(g_vc_m, &changed_callback, &user_data); - - vc_state_e current_state; - vc_state_e before_state; - - vc_mgr_client_get_before_state(g_vc_m, ¤t_state, &before_state); - - if (NULL != changed_callback) { - vc_mgr_client_use_callback(g_vc_m); - changed_callback(before_state, current_state, user_data); - vc_mgr_client_not_use_callback(g_vc_m); - SLOG(LOG_DEBUG, TAG_VCM, "State changed callback is called"); - } else { - SLOG(LOG_WARN, TAG_VCM, "[WARNING] State changed callback is null"); - } - - SLOG(LOG_DEBUG, TAG_VCM, "====="); - SLOG(LOG_DEBUG, TAG_VCM, " "); -#endif return EINA_FALSE; } @@ -1516,11 +1460,6 @@ static Eina_Bool __vc_mgr_set_select_result(void *data) return EINA_FALSE; } -int vc_mgr_set_nlp_info(const char* info) -{ - return 0; -} - int vc_mgr_get_nlp_info(char** info) { SLOG(LOG_DEBUG, TAG_VCM, "===== [Manager] Get nlp info"); diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index 8909b57..47e2ff0 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -533,8 +533,6 @@ int vc_mgr_get_recording_volume(float* volume); int vc_mgr_set_selected_results(vc_cmd_list_h vc_cmd_list); -int vc_mgr_set_nlp_info(const char* info); - int vc_mgr_get_nlp_info(char** info); int vc_mgr_set_pre_result_cb(vc_mgr_pre_result_cb callback, void* user_data); diff --git a/include/voice_control_plugin_engine.h b/include/voice_control_plugin_engine.h index 3d257a2..5649ace 100644 --- a/include/voice_control_plugin_engine.h +++ b/include/voice_control_plugin_engine.h @@ -290,8 +290,6 @@ typedef int (*vcpe_set_commands)(vcp_cmd_h vcp_command); typedef int (*vcpe_unset_commands)(); // Add new -typedef int (*vcpe_set_nlp_info)(const char* info); - typedef int (*vcpe_get_nlp_info)(char** info); /** @@ -454,7 +452,6 @@ typedef struct { vcpe_set_language set_language; /**< Set language */ vcpe_set_commands set_commands; /**< Request to set current commands */ vcpe_unset_commands unset_commands; /**< Request to unset current commands */ - vcpe_set_nlp_info set_nlp_info; /**< Set nlp info */ vcpe_get_nlp_info get_nlp_info; /**< Get nlp info */ /* Control recognition */ diff --git a/server/vcd_engine_agent.c b/server/vcd_engine_agent.c index cfa89ad..0100ac1 100644 --- a/server/vcd_engine_agent.c +++ b/server/vcd_engine_agent.c @@ -472,7 +472,6 @@ void __pre_result_cb(vcp_pre_result_event_e event, const char* pre_result, void* SLOG(LOG_DEBUG, TAG_VCD, "[Engine Agent ERROR] Result callback function is NOT valid"); } - return; } void __result_cb(vcp_result_event_e event, int* result_id, int count, const char* all_result, const char* non_fixed, const char* msg, void *user_data) -- 2.7.4 From 5b8474f275669a5e637a7764634afdc0e01e5b9f Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 10 Jun 2016 13:35:26 +0900 Subject: [PATCH 05/16] [Code Review] Fix codes Change-Id: I6f39607772f0cda1b51ade7490d83b2203b1effe Signed-off-by: sooyeon.kim --- common/vc_defs.h | 12 ++++++------ include/voice_control_manager.h | 14 +++++++------- include/voice_control_plugin_engine.h | 4 ++-- include/voice_control_setting.h | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/common/vc_defs.h b/common/vc_defs.h index 1194fed..6b580da 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -26,7 +26,7 @@ extern "C" { /****************************************************************************************** -* Definition for Dbus +* Definitions for Dbus *******************************************************************************************/ #define VC_CLIENT_SERVICE_NAME "org.tizen.voice.vcclient" @@ -53,7 +53,7 @@ extern "C" { #define VC_METHOD_HELLO "vc_method_hello" /****************************************************************************************** -* Message Definition for Client +* Message Definitions for Client *******************************************************************************************/ #define VC_METHOD_INITIALIZE "vc_method_initialize" @@ -87,7 +87,7 @@ extern "C" { #define VC_METHOD_AUTH_CANCEL "vc_method_auth_cancel" /****************************************************************************************** -* Message Definition for widget +* Message Definitions for widget *******************************************************************************************/ #define VC_WIDGET_METHOD_INITIALIZE "vc_widget_method_initialize" @@ -107,7 +107,7 @@ extern "C" { /****************************************************************************************** -* Message Definition for manager +* Message Definitions for manager *******************************************************************************************/ #define VC_MANAGER_METHOD_INITIALIZE "vc_manager_method_initialize" @@ -139,7 +139,7 @@ extern "C" { /****************************************************************************************** -* Defines for configuration +* Definitions for configuration *******************************************************************************************/ #define VC_DAEMON_PATH tzplatform_mkpath(TZ_SYS_BIN, "vc-daemon") @@ -183,7 +183,7 @@ extern "C" { #define VC_PRIVILEGE "http://tizen.org/privilege/recorder" /****************************************************************************************** -* Defines for common enum +* Definitions for common enum *******************************************************************************************/ typedef enum { diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index 47e2ff0..6cb1829 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -34,41 +34,41 @@ extern "C" /** - * @brief Defines of audio-in type. + * @brief Definition of audio-in type. */ #define VC_AUDIO_TYPE_BLUETOOTH "VC_AUDIO_ID_BLUETOOTH" /**< Bluetooth audio type */ /** - * @brief Defines of audio-in type. + * @brief Definition of audio-in type. */ #define VC_AUDIO_TYPE_MSF "VC_AUDIO_ID_MSF" /**< MSF (wifi) audio type */ /** -* @brief Definitions for foreground command type. +* @brief Definition for foreground command type. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_FOREGROUND 1 /** -* @brief Definitions for background command type. +* @brief Definition for background command type. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_BACKGROUND 2 /** -* @brief Definitions for widget command type. +* @brief Definition for widget command type. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_WIDGET 3 /** -* @brief Definitions for system command type. +* @brief Definition for system command type. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_SYSTEM 4 /** -* @brief Definitions for exclusive command type. +* @brief Definition for exclusive command type. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif */ #define VC_COMMAND_TYPE_EXCLUSIVE 5 diff --git a/include/voice_control_plugin_engine.h b/include/voice_control_plugin_engine.h index 5649ace..c4322ea 100644 --- a/include/voice_control_plugin_engine.h +++ b/include/voice_control_plugin_engine.h @@ -85,12 +85,12 @@ typedef enum { typedef int vcp_cmd_h; /** - * @brief Defines of bluetooth audio id. + * @brief Definition of bluetooth audio id. */ #define VCP_AUDIO_ID_BLUETOOTH "VC_AUDIO_ID_BLUETOOTH" /**< Bluetooth audio id */ /** - * @brief Defines of MSF(wifi) audio id. + * @brief Definition of MSF(wifi) audio id. */ #define VCP_AUDIO_ID_MSF "VC_AUDIO_ID_MSF" /**< MSF (wifi) audio id */ diff --git a/include/voice_control_setting.h b/include/voice_control_setting.h index 29b95bd..bb35f8e 100755 --- a/include/voice_control_setting.h +++ b/include/voice_control_setting.h @@ -31,7 +31,7 @@ extern "C" { #endif /** -* @brief Defines of audio-in type. +* @brief Definition of audio-in type. */ #define VC_SETTING_LANGUAGE_AUTO "auto" -- 2.7.4 From 6b58a2bd456bccafa3ef2c924acfbc21db7b7ed0 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Mon, 13 Jun 2016 19:21:37 +0900 Subject: [PATCH 06/16] Fix deference without checking NULL Change-Id: I0a3adc803ebd533e1f2efa8868de0a656eebde34 Signed-off-by: Wonnam Jang --- common/vc_info_parser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/vc_info_parser.c b/common/vc_info_parser.c index b6e7142..cc1af86 100644 --- a/common/vc_info_parser.c +++ b/common/vc_info_parser.c @@ -1676,6 +1676,9 @@ int __vc_cmd_parser_print_commands(GSList* cmd_list) iter = g_slist_nth(cmd_list, 0); for (i = 0; i < count; i++) { + if (NULL == iter) + break; + temp_cmd = iter->data; if (NULL == temp_cmd) { @@ -1689,9 +1692,6 @@ int __vc_cmd_parser_print_commands(GSList* cmd_list) temp_cmd->command, temp_cmd->parameter); iter = g_slist_next(iter); - - if (NULL == iter) - break; } return 0; -- 2.7.4 From 4d7acece1fad6176efdc9ffb45842a8d70acf84d Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 15 Jun 2016 18:23:37 +0900 Subject: [PATCH 07/16] Fix deference without checking NULL Change-Id: Ibdc263e17e95855811e817a74d187136c58eddcf Signed-off-by: Wonnam Jang --- common/vc_info_parser.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/vc_info_parser.c b/common/vc_info_parser.c index cc1af86..de84287 100644 --- a/common/vc_info_parser.c +++ b/common/vc_info_parser.c @@ -150,6 +150,9 @@ int vc_cmd_parser_save_file(int pid, vc_cmd_type_e type, GSList* cmd_list) int selected_count = 0; for (i = 0; i < count; i++) { + if (NULL == iter) + break; + temp_cmd = iter->data; if (NULL == temp_cmd) { @@ -1482,6 +1485,9 @@ int vc_info_parser_set_client_info(GSList* client_info_list) char temp[16] = {0, }; for (i = 0; i < count; i++) { + if (NULL == iter) + break; + client = iter->data; if (NULL != client) { -- 2.7.4 From 0a9d2de404bb90f814a226142947f5a888fd7377 Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Wed, 22 Jun 2016 10:34:48 +0900 Subject: [PATCH 08/16] Remove cynara check for command apis Change-Id: Id7902e6d4e076e289a43373e5284ae824e341786 Signed-off-by: Kwangyoun Kim --- common/vc_command.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/vc_command.c b/common/vc_command.c index e93a1e8..9adfaf4 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -110,7 +110,8 @@ static void __check_privilege_deinitialize() static int __vc_cmd_check_privilege() { - char uid[16]; +#if 0 + char uid[16]; int ret = -1; if (0 == g_privilege_allowed) { @@ -132,6 +133,7 @@ static int __vc_cmd_check_privilege() } g_privilege_allowed = 1; +#endif return VC_ERROR_NONE; } -- 2.7.4 From 4f739c9af79d43ad962cec9f32641cd4f858acf8 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 22 Jun 2016 10:06:39 +0900 Subject: [PATCH 09/16] Fix deference before checking null Change-Id: I3cd94fc13dadcb932911f97060cd6b5049115c1c Signed-off-by: Wonnam Jang --- server/vcd_client_data.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index c922c4d..e6d66b6 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -815,6 +815,9 @@ int __show_client_list() } else { iter = g_slist_nth(g_client_list, 0); for (i = 0; i < count; i++) { + if (NULL == iter) + break; + data = iter->data; SLOG(LOG_DEBUG, TAG_VCD, "[%dth] pid(%d)", i, data->pid); @@ -835,6 +838,9 @@ int __show_client_list() } else { iter = g_slist_nth(g_widget_list, 0); for (i = 0; i < count; i++) { + if (NULL == iter) + break; + widget_data = iter->data; SLOG(LOG_DEBUG, TAG_VCD, "[%dth] pid(%d)", i, widget_data->pid); @@ -862,6 +868,9 @@ int __show_command_list(GSList* cmd_group) } else { iter = g_slist_nth(cmd_group, 0); for (i = 0; i < count; i++) { + if (NULL == iter) + break; + data = iter->data; if (NULL != data->parameter) { @@ -889,6 +898,9 @@ GSList* __client_get_item(const int pid) if (0 < count) { iter = g_slist_nth(g_client_list, 0); for (i = 0; i < count; i++) { + if (NULL == iter) + break; + data = iter->data; if (pid == data->pid) @@ -912,6 +924,9 @@ vc_client_info_s* __client_get_element(int pid) if (0 < count) { iter = g_slist_nth(g_client_list, 0); for (i = 0; i < count; i++) { + if (NULL == iter) + break; + data = iter->data; if (pid == data->pid) @@ -1163,6 +1178,9 @@ GSList* __widget_get_item(int pid) if (0 < count) { iter = g_slist_nth(g_widget_list, 0); for (i = 0; i < count; i++) { + if (NULL == iter) + break; + data = iter->data; if (pid == data->pid) @@ -1186,6 +1204,9 @@ widget_info_s* __widget_get_element(int pid) if (0 < count) { iter = g_slist_nth(g_widget_list, 0); for (i = 0; i < count; i++) { + if (NULL == iter) + break; + data = iter->data; if (NULL != data) { -- 2.7.4 From df9e73e4460fa1652b8f9e280bd95ed76d4651c3 Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Wed, 22 Jun 2016 19:04:10 +0900 Subject: [PATCH 10/16] Add memory check before referencing Change-Id: I8d60532a51208e9c260d634434f1aa34049dbbca --- common/vc_command.c | 9 +++++++++ common/vc_config_mgr.c | 5 +++++ server/vcd_client_data.c | 38 ++++++++++++++++++++++++-------------- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/common/vc_command.c b/common/vc_command.c index 9adfaf4..f6e31c5 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -386,6 +386,11 @@ int vc_cmd_list_foreach_commands(vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callb iter = g_slist_nth(list->list, 0); for (i = 0; i < count; i++) { + if (NULL == iter) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] No command in list"); + return VC_ERROR_OPERATION_FAILED; + } + temp_cmd = iter->data; if (NULL != temp_cmd) { @@ -441,6 +446,10 @@ int vc_cmd_list_filter_by_type(vc_cmd_list_h original, int type, vc_cmd_list_h* iter = g_slist_nth(list->list, 0); for (i = 0; i < count; i++) { + if (NULL == iter) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] No command in list"); + return VC_ERROR_OPERATION_FAILED; + } if (NULL != iter->data) { iter_cmd = iter->data; diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c index b97959a..f8caf11 100644 --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -118,6 +118,11 @@ int __vc_config_mgr_check_engine_is_valid(const char* engine_id) } iter = g_slist_nth(g_engine_list, 0); + if (NULL == iter) { + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] No engine in list"); + return -1; + } + engine_info = iter->data; if (NULL == engine_info) { diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index e6d66b6..69bac43 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -820,7 +820,9 @@ int __show_client_list() data = iter->data; - SLOG(LOG_DEBUG, TAG_VCD, "[%dth] pid(%d)", i, data->pid); + if (NULL != data) { + SLOG(LOG_DEBUG, TAG_VCD, "[%dth] pid(%d)", i, data->pid); + } iter = g_slist_next(iter); } } @@ -843,7 +845,9 @@ int __show_client_list() widget_data = iter->data; - SLOG(LOG_DEBUG, TAG_VCD, "[%dth] pid(%d)", i, widget_data->pid); + if (NULL != widget_data) { + SLOG(LOG_DEBUG, TAG_VCD, "[%dth] pid(%d)", i, widget_data->pid); + } iter = g_slist_next(iter); } } @@ -872,11 +876,12 @@ int __show_command_list(GSList* cmd_group) break; data = iter->data; - - if (NULL != data->parameter) { - SLOG(LOG_DEBUG, TAG_VCD, "[%dth] command(%s) parameter(%s) key(%d)", i, data->command, data->parameter, data->key); - } else { - SLOG(LOG_DEBUG, TAG_VCD, "[%dth] command(%s) key(%d)", i, data->command, data->key); + if (NULL != data) { + if (NULL != data->parameter) { + SLOG(LOG_DEBUG, TAG_VCD, "[%dth] command(%s) parameter(%s) key(%d)", i, data->command, data->parameter, data->key); + } else { + SLOG(LOG_DEBUG, TAG_VCD, "[%dth] command(%s) key(%d)", i, data->command, data->key); + } } iter = g_slist_next(iter); } @@ -902,9 +907,10 @@ GSList* __client_get_item(const int pid) break; data = iter->data; - - if (pid == data->pid) - return iter; + if (NULL != data) { + if (pid == data->pid) + return iter; + } iter = g_slist_next(iter); } @@ -929,8 +935,10 @@ vc_client_info_s* __client_get_element(int pid) data = iter->data; - if (pid == data->pid) - return data; + if (NULL != data) { + if (pid == data->pid) + return data; + } iter = g_slist_next(iter); } @@ -1183,8 +1191,10 @@ GSList* __widget_get_item(int pid) data = iter->data; - if (pid == data->pid) - return iter; + if (NULL != data) { + if (pid == data->pid) + return iter; + } iter = g_slist_next(iter); } -- 2.7.4 From 484b8cafff60a118648cf105e1c916e6d7e8237a Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Mon, 4 Jul 2016 09:55:33 +0900 Subject: [PATCH 11/16] Remove build warnings Change-Id: Ic419ae4a48b57da0f5fc88c73a69404a484f2f53 Signed-off-by: Wonnam Jang --- CMakeLists.txt | 1 + common/vc_command.c | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffe62f9..ae696f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ SET(EXEC_PREFIX "${PREFIX}") SET(VERSION 0.2.10) ADD_DEFINITIONS("-DVOICE_LIBDIR=\"${LIBDIR}\"") +ADD_DEFINITIONS("-Werror") # pkg config tool INCLUDE(FindPkgConfig) diff --git a/common/vc_command.c b/common/vc_command.c index f6e31c5..c42e84e 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -30,7 +30,7 @@ static int g_feature_enabled = -1; -static int g_privilege_allowed = -1; +static int g_privilege_allowed = 1; /* Always True */ static cynara *p_cynara = NULL; static int __vc_cmd_get_feature_enabled() @@ -110,9 +110,7 @@ static void __check_privilege_deinitialize() static int __vc_cmd_check_privilege() { -#if 0 char uid[16]; - int ret = -1; if (0 == g_privilege_allowed) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Permission is denied"); @@ -133,8 +131,8 @@ static int __vc_cmd_check_privilege() } g_privilege_allowed = 1; -#endif - return VC_ERROR_NONE; + + return VC_ERROR_NONE; } int vc_cmd_list_create(vc_cmd_list_h* vc_cmd_list) -- 2.7.4 From 292789741d711e6934ad7480a73f6fd9fbf289df Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 6 Jul 2016 17:40:11 +0900 Subject: [PATCH 12/16] Fix build warning Change-Id: I4000c59cc540bb5c09b9b533524fb5f7c3fbe338 Signed-off-by: Wonnam Jang --- common/vc_info_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/vc_info_parser.c b/common/vc_info_parser.c index de84287..3b6095b 100644 --- a/common/vc_info_parser.c +++ b/common/vc_info_parser.c @@ -1234,7 +1234,7 @@ int vc_info_parser_set_nlp_info(const char* nlp_info) } /* Write size */ - fprintf(fp, "size(%d)\n", strlen(nlp_info)); + fprintf(fp, "size(%d)\n", (int)strlen(nlp_info)); write_size = fwrite(nlp_info, 1, strlen(nlp_info), fp); fclose(fp); -- 2.7.4 From 5f577ce27531836497ce18f41cd409a011725562 Mon Sep 17 00:00:00 2001 From: "stom.hwang" Date: Thu, 14 Jul 2016 16:57:54 +0900 Subject: [PATCH 13/16] Fix - Coding rule Change-Id: I86fdafc6db812191d809a7903f7e1748f073f545 Signed-off-by: stom.hwang --- client/vc.c | 2 +- client/vc_mgr.c | 2 +- client/vc_mgr_dbus.c | 3 +-- common/vc_command.c | 6 +++--- common/vc_info_parser.c | 22 +++++++++++----------- include/voice_control_manager.h | 2 +- include/voice_control_plugin_engine.h | 2 +- server/vcd_recorder.c | 6 ++---- server/vcd_server.c | 14 +++++++------- 9 files changed, 28 insertions(+), 31 deletions(-) diff --git a/client/vc.c b/client/vc.c index 7410708..7ddecc3 100644 --- a/client/vc.c +++ b/client/vc.c @@ -133,7 +133,7 @@ static int __vc_check_privilege() SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Permission is denied"); return VC_ERROR_PERMISSION_DENIED; } else if (-1 == g_privilege_allowed) { - if (false == __check_privilege_initialize()){ + if (false == __check_privilege_initialize()) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] privilege initialize is failed"); return VC_ERROR_PERMISSION_DENIED; } diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 0623886..e3a2f21 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -1497,7 +1497,7 @@ int vc_mgr_get_nlp_info(char** info) int vc_mgr_set_pre_result_cb(vc_mgr_pre_result_cb callback, void* user_data) { - if (NULL == callback){ + if (NULL == callback) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Set error callback : callback is NULL"); return VC_ERROR_INVALID_PARAMETER; } diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index 40f345e..93f4efd 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -240,8 +240,7 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd if (dbus_error_is_set(&err)) { SLOG(LOG_ERROR, TAG_VCM, "<<<< vc mgr Get Error message : Get arguments error (%s)", err.message); dbus_error_free(&err); - } - else { + } else { SLOG(LOG_ERROR, TAG_VCM, "<<<< vc mgr Get Error message : reason(%d), daemon_pid(%d), msg(%s)", reason, daemon_pid, err_msg); __vc_mgr_cb_error(reason, daemon_pid, err_msg); } diff --git a/common/vc_command.c b/common/vc_command.c index c42e84e..ef433d4 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -110,13 +110,13 @@ static void __check_privilege_deinitialize() static int __vc_cmd_check_privilege() { - char uid[16]; + char uid[16]; if (0 == g_privilege_allowed) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Permission is denied"); return VC_ERROR_PERMISSION_DENIED; } else if (-1 == g_privilege_allowed) { - if (false == __check_privilege_initialize()){ + if (false == __check_privilege_initialize()) { SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] privilege initialize is failed"); return VC_ERROR_PERMISSION_DENIED; } @@ -454,7 +454,7 @@ int vc_cmd_list_filter_by_type(vc_cmd_list_h original, int type, vc_cmd_list_h* if (NULL != iter_cmd) { int iter_type; if (0 != vc_cmd_get_type((vc_cmd_h)iter_cmd, &iter_type)) { - SLOG(LOG_ERROR,TAG_VCCMD, "[ERROR] Fail to get command type"); + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to get command type"); continue; } diff --git a/common/vc_info_parser.c b/common/vc_info_parser.c index 3b6095b..1f098f1 100644 --- a/common/vc_info_parser.c +++ b/common/vc_info_parser.c @@ -1278,19 +1278,19 @@ int vc_info_parser_get_nlp_info(char** nlp_info) } SLOG(LOG_DEBUG, vc_info_tag(), "[DEBUG] buffer size (%d)", readn); - if (10000000 < readn || 0 > readn) { - SLOG(LOG_DEBUG, vc_info_tag(), "[ERROR] Invalid buffer size"); - fclose(fp); - return -1; - } - int tmp_readn = readn + 10; + if (10000000 < readn || 0 > readn) { + SLOG(LOG_DEBUG, vc_info_tag(), "[ERROR] Invalid buffer size"); + fclose(fp); + return -1; + } + int tmp_readn = readn + 10; *nlp_info = (char*)calloc(tmp_readn, sizeof(char)); - if (NULL == *nlp_info) { - SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] Out of memory"); - fclose(fp); - return -1; - } + if (NULL == *nlp_info) { + SLOG(LOG_ERROR, vc_info_tag(), "[ERROR] Out of memory"); + fclose(fp); + return -1; + } readn = fread(*nlp_info, 1, readn, fp); fclose(fp); diff --git a/include/voice_control_manager.h b/include/voice_control_manager.h index 6cb1829..e6d80a4 100644 --- a/include/voice_control_manager.h +++ b/include/voice_control_manager.h @@ -117,7 +117,7 @@ typedef enum { VC_PRE_RESULT_EVENT_FINAL_RESULT = 0, VC_PRE_RESULT_EVENT_PARTIAL_RESULT, VC_PRE_RESULT_EVENT_ERROR -}vc_pre_result_event_e; +} vc_pre_result_event_e; // support pre-result typedef bool(*vc_mgr_pre_result_cb)(vc_pre_result_event_e event, const char* result, void *user_data); diff --git a/include/voice_control_plugin_engine.h b/include/voice_control_plugin_engine.h index c4322ea..0524a8c 100644 --- a/include/voice_control_plugin_engine.h +++ b/include/voice_control_plugin_engine.h @@ -127,7 +127,7 @@ typedef enum { VCP_PRE_RESULT_EVENT_FINAL_RESULT = 0, VCP_PRE_RESULT_EVENT_PARTIAL_RESULT, VCP_PRE_RESULT_EVENT_ERROR -}vcp_pre_result_event_e; +} vcp_pre_result_event_e; // Add new typedef void (*vcpe_pre_result_cb)(vcp_pre_result_event_e event, const char* pre_result, void *user_data); diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index 5e7f0d0..4996cea 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -542,8 +542,7 @@ int vcd_recorder_start() g_bt_extend_count = 0; #endif - } - else if (0 == strncmp(VCP_AUDIO_ID_MSF, g_current_audio_type, strlen(VCP_AUDIO_ID_MSF))) { + } else if (0 == strncmp(VCP_AUDIO_ID_MSF, g_current_audio_type, strlen(VCP_AUDIO_ID_MSF))) { SLOG(LOG_ERROR, TAG_VCD, "[Recorder] call RegisterMSFAudioCallback() function"); #ifdef TV_MSF_WIFI_MODE @@ -633,8 +632,7 @@ int vcd_recorder_stop() return VCD_ERROR_OPERATION_FAILED; } #endif - } - else if (0 == strncmp(VCP_AUDIO_ID_MSF, g_current_audio_type, strlen(VCP_AUDIO_ID_MSF))) { + } else if (0 == strncmp(VCP_AUDIO_ID_MSF, g_current_audio_type, strlen(VCP_AUDIO_ID_MSF))) { #ifdef TV_MSF_WIFI_MODE UnRegisterMSFAudioCallback(); stoped = true; diff --git a/server/vcd_server.c b/server/vcd_server.c index 748e548..e8ea19e 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -257,13 +257,13 @@ static Eina_Bool __vcd_send_selected_result(void *data) static int __convert_type_to_priority(vc_cmd_type_e type) { switch (type) { - case VC_COMMAND_TYPE_NONE: return 0; - case VC_COMMAND_TYPE_BACKGROUND: return 1; - case VC_COMMAND_TYPE_FOREGROUND: return 2; - case VC_COMMAND_TYPE_WIDGET: return 2; - case VC_COMMAND_TYPE_SYSTEM: return 3; - case VC_COMMAND_TYPE_EXCLUSIVE: return 3; - default: return 0; + case VC_COMMAND_TYPE_NONE: return 0; + case VC_COMMAND_TYPE_BACKGROUND: return 1; + case VC_COMMAND_TYPE_FOREGROUND: return 2; + case VC_COMMAND_TYPE_WIDGET: return 2; + case VC_COMMAND_TYPE_SYSTEM: return 3; + case VC_COMMAND_TYPE_EXCLUSIVE: return 3; + default: return 0; } } -- 2.7.4 From b546aeb3fac61f5798ebec3258aac3b3eb3be21b Mon Sep 17 00:00:00 2001 From: Kwangyoun Kim Date: Wed, 3 Aug 2016 17:37:34 +0900 Subject: [PATCH 14/16] Fix bug about privilege check Add dbus error handling Support MSF/BT audio recording policy Change-Id: I0852ef36e220d79757545a91ed214fec007b03c8 --- client/vc.c | 215 ++++++++------------------------------------------ client/vc_dbus.c | 57 +++++++++++++ common/vc_command.c | 5 +- server/vcd_recorder.c | 16 +++- 4 files changed, 103 insertions(+), 190 deletions(-) diff --git a/client/vc.c b/client/vc.c index 7ddecc3..b2e86fc 100644 --- a/client/vc.c +++ b/client/vc.c @@ -42,11 +42,6 @@ static int g_feature_enabled = -1; static int g_privilege_allowed = -1; static cynara *p_cynara = NULL; -#if 0 -static Ecore_Event_Handler* g_focus_in_hander = NULL; -static Ecore_Event_Handler* g_focus_out_hander = NULL; -#endif - Eina_Bool __vc_notify_state_changed(void *data); Eina_Bool __vc_notify_error(void *data); @@ -92,13 +87,14 @@ static int __check_privilege_initialize() static int __check_privilege(const char* uid, const char * privilege) { FILE *fp = NULL; - char smack_label[1024] = "/proc/self/attr/current"; + char label_path[1024] = "/proc/self/attr/current"; + char smack_label[1024] = {'\0',}; if (!p_cynara) { return false; } - fp = fopen(smack_label, "r"); + fp = fopen(label_path, "r"); if (fp != NULL) { if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0) SLOG(LOG_ERROR, TAG_VCC, "[ERROR] fail to fread"); @@ -365,12 +361,6 @@ static void __vc_internal_unprepare(void) SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request finalize : %s", __vc_get_error_code(ret)); } - -#if 0 - ecore_event_handler_del(g_focus_in_hander); - ecore_event_handler_del(g_focus_out_hander); -#endif - vc_cmd_parser_delete_file(getpid(), VC_COMMAND_TYPE_FOREGROUND); vc_cmd_parser_delete_file(getpid(), VC_COMMAND_TYPE_BACKGROUND); @@ -432,78 +422,6 @@ int vc_deinitialize(void) return VC_ERROR_NONE; } -#if 0 -static Eina_Bool __vc_x_event_window_focus_in(void *data, int type, void *event) -{ - Ecore_X_Event_Window_Focus_In *e; - - e = event; - - int xid = -1; - if (0 != vc_client_get_xid(g_vc, &xid)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current xid"); - return ECORE_CALLBACK_PASS_ON; - } - - if (e->win == (Ecore_X_Window)xid) { - SLOG(LOG_DEBUG, TAG_VCC, "Focus in : pid(%d) xid(%d)", getpid(), xid); - int ret = vc_config_mgr_set_foreground(getpid(), true); - if (0 != ret) { - ret = vc_config_convert_error_code((vc_config_error_e)ret); - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set focus in : %s", __vc_get_error_code(ret)); - } - /* set authority valid */ - vc_auth_state_e state = VC_AUTH_STATE_NONE; - if (0 != vc_client_get_auth_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get auth state"); - } - if (VC_AUTH_STATE_INVALID == state) { - vc_client_set_auth_state(g_vc, VC_AUTH_STATE_VALID); - - /* notify auth changed cb */ - ecore_timer_add(0, __notify_auth_changed_cb, NULL); - } - } - - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool __vc_x_event_window_focus_out(void *data, int type, void *event) -{ - Ecore_X_Event_Window_Focus_In *e; - - e = event; - - int xid = -1; - if (0 != vc_client_get_xid(g_vc, &xid)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current xid"); - return ECORE_CALLBACK_PASS_ON; - } - - if (e->win == (Ecore_X_Window)xid) { - SLOG(LOG_DEBUG, TAG_VCC, "Focus out : pid(%d) xid(%d)", getpid(), xid); - int ret = vc_config_mgr_set_foreground(getpid(), false); - if (0 != ret) { - ret = vc_config_convert_error_code((vc_config_error_e)ret); - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set focus out : %s", __vc_get_error_code(ret)); - } - /* set authority valid */ - vc_auth_state_e state = VC_AUTH_STATE_NONE; - if (0 != vc_client_get_auth_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get auth state"); - } - if (VC_AUTH_STATE_VALID == state) { - vc_client_set_auth_state(g_vc, VC_AUTH_STATE_INVALID); - - /* notify authority changed cb */ - ecore_timer_add(0, __notify_auth_changed_cb, NULL); - } - } - - return ECORE_CALLBACK_PASS_ON; -} -#endif - static Eina_Bool __vc_connect_daemon(void *data) { /* Send hello */ @@ -545,15 +463,38 @@ static Eina_Bool __vc_connect_daemon(void *data) vc_client_set_service_state(g_vc, (vc_service_state_e)service_state); g_connect_timer = NULL; -#if 0 - g_focus_in_hander = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, __vc_x_event_window_focus_in, NULL); - g_focus_out_hander = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, __vc_x_event_window_focus_out, NULL); -#else + ret = aul_add_status_local_cb(__vc_app_state_changed_cb, NULL); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set app stae changed callback"); } -#endif + + int status = aul_app_get_status_bypid(getpid()); + if (STATUS_FOCUS == status || STATUS_VISIBLE == status) { + SLOG(LOG_DEBUG, TAG_VCC, "===== Set foreground"); + ret = vc_dbus_set_foreground(getpid(), true); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set foreground (true) : %d", ret); + } + + ret = vc_client_set_is_foreground(g_vc, true); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to save is_foreground (true) : %d", ret); + } + + /* set authority valid */ + vc_auth_state_e state = VC_AUTH_STATE_NONE; + if (0 != vc_client_get_auth_state(g_vc, &state)) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get auth state"); + } + if (VC_AUTH_STATE_INVALID == state) { + vc_client_set_auth_state(g_vc, VC_AUTH_STATE_VALID); + + /* notify auth changed cb */ + ecore_idler_add(__notify_auth_changed_cb, NULL); + } + } + vc_client_set_client_state(g_vc, VC_STATE_READY); ecore_timer_add(0, __vc_notify_state_changed, g_vc); @@ -810,99 +751,6 @@ int vc_get_service_state(vc_service_state_e* state) return VC_ERROR_NONE; } -#if 0 -int vc_set_window_id(int wid) -{ - SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Set Window id"); - - if (0 >= wid) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Input parameter is invalid"); - SLOG(LOG_DEBUG, TAG_VCC, "====="); - SLOG(LOG_DEBUG, TAG_VCC, " "); - return VC_ERROR_INVALID_PARAMETER; - } - - vc_state_e state; - if (0 != vc_client_get_client_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_VCC, "====="); - SLOG(LOG_DEBUG, TAG_VCC, " "); - return VC_ERROR_INVALID_STATE; - } - - /* check state */ - if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "====="); - SLOG(LOG_DEBUG, TAG_VCC, " "); - return VC_ERROR_INVALID_STATE; - } - - if (0 != vc_client_set_xid(g_vc, wid)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not valid"); - SLOG(LOG_DEBUG, TAG_VCC, "====="); - SLOG(LOG_DEBUG, TAG_VCC, " "); - return VC_ERROR_INVALID_STATE; - } - - /* Check if current xid is top window */ - int ret = -1; - if ((Ecore_X_Window)wid == ecore_x_window_focus_get()) { - /* Set current pid */ - ret = vc_config_mgr_set_foreground(getpid(), true); - if (0 != ret) { - ret = vc_config_convert_error_code((vc_config_error_e)ret); - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set focus in : %s", __vc_get_error_code(ret)); - } - } - - SLOG(LOG_DEBUG, TAG_VCC, "====="); - SLOG(LOG_DEBUG, TAG_VCC, " "); - - return ret; -} - -int vc_get_window_id(int* wid) -{ - SLOG(LOG_DEBUG, TAG_VCC, "===== [Client] Get Window id"); - - if (NULL == wid) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Input parameter is NULL"); - SLOG(LOG_DEBUG, TAG_VCC, "====="); - SLOG(LOG_DEBUG, TAG_VCC, " "); - return VC_ERROR_INVALID_PARAMETER; - } - - vc_state_e state; - if (0 != vc_client_get_client_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_VCC, "====="); - SLOG(LOG_DEBUG, TAG_VCC, " "); - return VC_ERROR_INVALID_STATE; - } - - /* check state */ - if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "====="); - SLOG(LOG_DEBUG, TAG_VCC, " "); - return VC_ERROR_INVALID_STATE; - } - - if (0 != vc_client_get_xid(g_vc, wid)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not valid"); - SLOG(LOG_DEBUG, TAG_VCC, "====="); - SLOG(LOG_DEBUG, TAG_VCC, " "); - return VC_ERROR_INVALID_STATE; - } - - SLOG(LOG_DEBUG, TAG_VCC, "====="); - SLOG(LOG_DEBUG, TAG_VCC, " "); - - return VC_ERROR_NONE; -} -#endif - /** * @brief Checks whether the command format is supported. * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif @@ -1156,7 +1004,6 @@ int vc_set_exclusive_command_option(bool value) return ret; } - /* Check if current xid is top window */ int count = 0; do { ret = vc_dbus_request_set_exclusive_command(g_vc->handle, value); diff --git a/client/vc_dbus.c b/client/vc_dbus.c index 2f8ca3d..22171c5 100644 --- a/client/vc_dbus.c +++ b/client/vc_dbus.c @@ -307,8 +307,21 @@ int vc_dbus_reconnect() return 0; } +static int __dbus_check() +{ + if (NULL == g_conn_sender) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] NULL connection"); + return vc_dbus_reconnect(); + } + return 0; +} + int vc_dbus_request_hello() { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -349,6 +362,10 @@ int vc_dbus_request_hello() int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state) { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -417,6 +434,10 @@ int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state) int vc_dbus_request_finalize(int pid) { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -477,6 +498,10 @@ int vc_dbus_request_finalize(int pid) int vc_dbus_request_set_exclusive_command(int pid, bool value) { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -541,6 +566,10 @@ int vc_dbus_request_set_exclusive_command(int pid, bool value) int vc_dbus_request_set_command(int pid, vc_cmd_type_e cmd_type) { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -603,6 +632,10 @@ int vc_dbus_request_set_command(int pid, vc_cmd_type_e cmd_type) int vc_dbus_request_unset_command(int pid, vc_cmd_type_e cmd_type) { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; msg = dbus_message_new_method_call( @@ -665,6 +698,10 @@ int vc_dbus_request_unset_command(int pid, vc_cmd_type_e cmd_type) int vc_dbus_set_foreground(int pid, bool value) { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg = NULL; int tmp_value = 0; @@ -921,6 +958,10 @@ int vc_dbus_request_cancel(int pid) /* Authority */ int vc_dbus_request_auth_enable(int pid, int mgr_pid) { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; char service_name[64] = {0,}; @@ -991,6 +1032,10 @@ int vc_dbus_request_auth_enable(int pid, int mgr_pid) int vc_dbus_request_auth_disable(int pid, int mgr_pid) { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; char service_name[64] = {0,}; @@ -1061,6 +1106,10 @@ int vc_dbus_request_auth_disable(int pid, int mgr_pid) int vc_dbus_request_auth_start(int pid, int mgr_pid) { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; char service_name[64] = {0,}; @@ -1133,6 +1182,10 @@ int vc_dbus_request_auth_start(int pid, int mgr_pid) int vc_dbus_request_auth_stop(int pid, int mgr_pid) { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; char service_name[64] = {0,}; @@ -1203,6 +1256,10 @@ int vc_dbus_request_auth_stop(int pid, int mgr_pid) int vc_dbus_request_auth_cancel(int pid, int mgr_pid) { + if (0 != __dbus_check()) { + return VC_ERROR_OPERATION_FAILED; + } + DBusMessage* msg; char service_name[64] = {0,}; diff --git a/common/vc_command.c b/common/vc_command.c index ef433d4..4d5fa9f 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -75,13 +75,14 @@ static int __check_privilege_initialize() static int __check_privilege(const char* uid, const char * privilege) { FILE *fp = NULL; - char smack_label[1024] = "/proc/self/attr/current"; + char label_path[1024] = "/proc/self/attr/current"; + char smack_label[1024] = {'\0',}; if (!p_cynara) { return false; } - fp = fopen(smack_label, "r"); + fp = fopen(label_path, "r"); if (fp != NULL) { if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0) SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] fail to fread"); diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index 4996cea..6c87c63 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -82,11 +82,15 @@ static float get_volume_decibel(char* data, int size); #ifdef TV_MSF_WIFI_MODE static void __msf_wifi_audio_data_receive_cb(msf_wifi_voice_data_s *voice_data, void* user_data) { - if (VCD_RECORDER_STATE_RECORDING != g_recorder_state) { - /*SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] Exit audio reading normal func");*/ + if (0 != strncmp(g_current_audio_type, VCP_AUDIO_ID_MSF, sizeof(VCP_AUDIO_ID_MSF))){ + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] current audio type is (%s)", g_current_audio_type); return; } + if (VCD_RECORDER_STATE_RECORDING != g_recorder_state) { + SLOG(LOG_WARN, TAG_VCD, "[Recorder] Not start yet, but send audio data vi MSF"); + } + if (NULL != g_audio_cb) { if (0 != g_audio_cb((void*)voice_data->audio_buf, (unsigned int)voice_data->length)) { SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to read audio"); @@ -135,11 +139,15 @@ static void _bt_cb_hid_state_changed(int result, bool connected, const char *rem static void _bt_hid_audio_data_receive_cb(bt_hid_voice_data_s *voice_data, void *user_data) { - if (VCD_RECORDER_STATE_RECORDING != g_recorder_state) { - /*SLOG(LOG_DEBUG, TAG_VCD, "[Recorder] Exit audio reading normal func");*/ + if (0 != strncmp(g_current_audio_type, VCP_AUDIO_ID_BLUETOOTH, sizeof(VCP_AUDIO_ID_BLUETOOTH))){ + SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] current audio type is (%s)", g_current_audio_type); return; } + if (VCD_RECORDER_STATE_RECORDING != g_recorder_state) { + SLOG(LOG_WARN, TAG_VCD, "[Recorder] Not start yet, but send audio data vi Bluetooth"); + } + if (NULL != g_audio_cb) { if (0 != g_audio_cb((void*)voice_data->audio_buf, (unsigned int)voice_data->length)) { SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to read audio"); -- 2.7.4 From 83e61177ed913327e0a22b55816d84ab4140e124 Mon Sep 17 00:00:00 2001 From: "stom.hwang" Date: Tue, 16 Aug 2016 21:24:21 +0900 Subject: [PATCH 15/16] Fix coding rule Change-Id: I8784d3b9aa834a7b319fcbe5aac7332a3e02cc73 Signed-off-by: stom.hwang --- server/vcd_recorder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index 6c87c63..52a9f3a 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -82,7 +82,7 @@ static float get_volume_decibel(char* data, int size); #ifdef TV_MSF_WIFI_MODE static void __msf_wifi_audio_data_receive_cb(msf_wifi_voice_data_s *voice_data, void* user_data) { - if (0 != strncmp(g_current_audio_type, VCP_AUDIO_ID_MSF, sizeof(VCP_AUDIO_ID_MSF))){ + if (0 != strncmp(g_current_audio_type, VCP_AUDIO_ID_MSF, sizeof(VCP_AUDIO_ID_MSF))) { SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] current audio type is (%s)", g_current_audio_type); return; } @@ -139,7 +139,7 @@ static void _bt_cb_hid_state_changed(int result, bool connected, const char *rem static void _bt_hid_audio_data_receive_cb(bt_hid_voice_data_s *voice_data, void *user_data) { - if (0 != strncmp(g_current_audio_type, VCP_AUDIO_ID_BLUETOOTH, sizeof(VCP_AUDIO_ID_BLUETOOTH))){ + if (0 != strncmp(g_current_audio_type, VCP_AUDIO_ID_BLUETOOTH, sizeof(VCP_AUDIO_ID_BLUETOOTH))) { SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] current audio type is (%s)", g_current_audio_type); return; } -- 2.7.4 From 1b5bf32264532fce4b2c0d71c93faa10ad4b2465 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Wed, 31 Aug 2016 09:25:14 +0900 Subject: [PATCH 16/16] remove unused macro Change-Id: Id6d3d3db6235ebfccf023da95e31ec71bf9da039 Signed-off-by: Wonnam Jang --- packaging/voice-control.spec | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 8b38128..7ed37d4 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -84,11 +84,6 @@ cp %{SOURCE1001} %{SOURCE1002} . %build -%if 0%{?tizen_build_binary_release_type_eng} -export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE" -export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE" -export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE" -%endif %if "%{PRODUCT_TYPE}" == "TV" export CFLAGS="$CFLAGS -DTV_PRODUCT" cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \ -- 2.7.4