Remove build warnings
[platform/core/uifw/voice-control.git] / common / vc_command.c
index e93a1e8..c42e84e 100644 (file)
@@ -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,8 +110,7 @@ static void __check_privilege_deinitialize()
 
 static int __vc_cmd_check_privilege()
 {
-       char uid[16];
-       int ret = -1;
+        char uid[16];
 
        if (0 == g_privilege_allowed) {
                SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Permission is denied");
@@ -132,7 +131,8 @@ static int __vc_cmd_check_privilege()
        }
 
        g_privilege_allowed = 1;
-       return VC_ERROR_NONE;   
+
+       return VC_ERROR_NONE;
 }
 
 int vc_cmd_list_create(vc_cmd_list_h* vc_cmd_list)
@@ -384,6 +384,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) {
@@ -439,6 +444,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;