Fix build warnings which casues build error by -Werror option 98/290098/1
authorSeunghun Lee <shiin.lee@samsung.com>
Mon, 20 Mar 2023 06:41:29 +0000 (15:41 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 20 Mar 2023 07:24:00 +0000 (16:24 +0900)
Change-Id: I05856cfbf303fb2a84266c4fae264914239acb41

12 files changed:
examples/protocol-trace.c
examples/tinyds-launch.c
examples/tinyds-tdm.c
meson.build
src/backend/tdm/tdm_output_hwc.c
src/eom/eom.c
src/indicator/indicator.c
src/input_devicemgr/input_devicemgr.c
src/launch/appinfo.c
src/policy/policy.c
src/remote_surface/remote_surface.c
tests/tc_scaler.cpp

index 7975b0d..45a3120 100644 (file)
@@ -194,7 +194,7 @@ static bool rule_set(const int argc, const char **argv, char *reply, int *len);
 char trace_env_path[PATH_MAX + 1];
 static FILE *log_fp_ptrace = NULL;
 static struct wl_protocol_logger *ds_wl_protocol_logger;
-static struct protocol_trace_rule_checker *rc = NULL;
+static struct protocol_trace_rule_checker *global_rc = NULL;
 static struct wl_display *display;
 
 static struct
@@ -583,12 +583,12 @@ logger_validate_rule(struct protocol_trace_protocol_log *log)
     const char *cmd = "";
     int ret;
 
-    if (!rc)
+    if (!global_rc)
         return false;
 
     cmd = logger_cmd_get(log->cmd);
 
-    ret = rulechecker_validate_rules(rc, log->type, log->target_id, log->name,
+    ret = rulechecker_validate_rules(global_rc, log->type, log->target_id, log->name,
             log->client_pid, cmd);
 
     return ret;
@@ -1359,7 +1359,7 @@ rule_set(const int argc, const char **argv, char *reply, int *len)
     ds_dbg("(parameter) argc = %d, argv[0] = %s", argc, argv[0]);
 
     if (argc == 0) {
-        rulechecker_print_rules(rc, reply, len);
+        rulechecker_print_rules(global_rc, reply, len);
         return true;
     }
 
@@ -1406,9 +1406,9 @@ rule_set(const int argc, const char **argv, char *reply, int *len)
                 if (apply == 0) {
                     const char * plus = "|| type=reply || type=error";
                     int size_plus = strlen(plus);
-                    int len = MIN(size_rule - index, size_plus);
+                    int l = MIN(size_rule - index, size_plus);
                     snprintf(rule, sizeof(rule), "%s", plus);
-                    index += len;
+                    index += l;
                     if (index >size_rule)
                         return false;
                     apply =1;
@@ -1421,7 +1421,7 @@ rule_set(const int argc, const char **argv, char *reply, int *len)
         }
         ds_dbg("ADD :: rule = %s", rule);
 
-        result = rulechecker_rule_add(rc, policy_type, rule);
+        result = rulechecker_rule_add(global_rc, policy_type, rule);
 
         if (result == PROTOCOL_TRACE_RULE_SET_ERR_TOO_MANY_RULES) {
             ds_err("Error: Too many rules were added.");
@@ -1447,9 +1447,9 @@ rule_set(const int argc, const char **argv, char *reply, int *len)
             remove_idx = argv[i + 1];
             if (!strcasecmp(remove_idx, "all")) {
                 ds_dbg("REMOVE :: all");
-                rulechecker_destroy(rc);
-                rc = rulechecker_init();
-                if (!rc) {
+                rulechecker_destroy(global_rc);
+                global_rc = rulechecker_init();
+                if (!global_rc) {
                     ds_err("Error: rules not removed");
                     return false;
                 }
@@ -1461,7 +1461,7 @@ rule_set(const int argc, const char **argv, char *reply, int *len)
                     ds_dbg("REMOVE :: remove idx = %d", index);
 
                     if (isdigit(*remove_idx) &&
-                        rulechecker_rule_remove(rc, index) == 0)
+                        rulechecker_rule_remove(global_rc, index) == 0)
                         ds_dbg("Rule remove success : rule [%d]", index);
                     else
                         ds_err("Rule remove fail : No rule [%s]", remove_idx);
@@ -1478,9 +1478,9 @@ rule_set(const int argc, const char **argv, char *reply, int *len)
         if (!rule_file_set(argv[1], reply, len))
             return false;
 
-        rulechecker_print_rules(rc, reply, len);
+        rulechecker_print_rules(global_rc, reply, len);
     } else if (!strcasecmp(command, "print")) {
-        rulechecker_print_rules(rc, reply, len);
+        rulechecker_print_rules(global_rc, reply, len);
     } else if (!strcasecmp(command, "help")) {
         ds_dbg( "%s", rulechecker_usage_print());
     } else {
@@ -1571,7 +1571,7 @@ protocol_trace_init(struct wl_display *d)
     char *env_path = NULL;
 
     display = d;
-    rc = rulechecker_init();
+    global_rc = rulechecker_init();
 
     env_path = getenv("DS_PROTOCOL_RULE_FILE");
     ret = rule_init(env_path);
@@ -1601,5 +1601,5 @@ protocol_trace_init(struct wl_display *d)
 void
 protocol_trace_fini()
 {
-    rulechecker_destroy(rc);
-}
\ No newline at end of file
+    rulechecker_destroy(global_rc);
+}
index a5a1124..976590f 100644 (file)
@@ -50,7 +50,7 @@ launch_effect_handle_type_set(struct wl_listener *listener, void *data)
     ds_inf("Launch effect. type_set: pid(%u) type:%s", event->pid, (event->effect_type == 1) ? "depth-in" : "launch");
 
     wl_list_for_each(view, &launch->server->views, link) {
-        if (view->pid == event->pid) {
+        if ((uint32_t)view->pid == event->pid) {
             view->effect_type = event->effect_type;
             existing = true;
             ds_inf("Launch effect. existing pid");
@@ -75,7 +75,7 @@ launch_effect_handle_type_unset(struct wl_listener *listener, void *data)
     ds_inf("Launch effect. type_unset: pid(%u)", event->pid);
 
     wl_list_for_each(view, &launch->server->views, link) {
-        if (view->pid == event->pid) {
+        if ((uint32_t)view->pid == event->pid) {
             view->effect_type = -1;
             ds_inf("Launch effect. pid found");
         }
@@ -95,7 +95,7 @@ launch_splash_handle_owner(struct wl_listener *listener, void *data)
     ds_inf("Splash owner. pid(%u)", event->pid);
 
     wl_list_for_each(view, &launch->server->views, link) {
-        if (view->pid == event->pid) {
+        if ((uint32_t)view->pid == event->pid) {
             if (event->pid == ds_tizen_launch_splash_get_pid(launch->splash))
                 ;//
             else {
index 8383e80..9c50c84 100644 (file)
@@ -623,7 +623,7 @@ output_commit(struct tinyds_output *output)
     struct ds_tdm_output_hwc_window **changed_hwc_windows = NULL;
     enum ds_tdm_output_hwc_window_composition composition;
     struct tinyds_view *view;
-    int i;
+    size_t i;
     bool need_target = false;
     bool fully_obscured = false;
     struct ds_buffer *ds_buffer;
@@ -764,7 +764,7 @@ output_commit(struct tinyds_output *output)
             return;
         }
 
-        for (i = 0; i < num_changed; i++) {
+        for (i = 0; i < (size_t)num_changed; i++) {
             composition = ds_tdm_output_hwc_window_get_composition(changed_hwc_windows[i]);
             if (composition == DS_TDM_OUTPUT_HWC_WINDOW_COMPOSITION_CLIENT) {
                 need_target = true;
@@ -805,8 +805,6 @@ output_commit(struct tinyds_output *output)
     output->target_updated = false;
 
     wl_list_for_each(view, &output->server->views, link) {
-        enum ds_tdm_output_hwc_window_composition composition;
-
         if (!view->mapped)
             continue;
 
index 5446b25..434f1b9 100644 (file)
@@ -9,6 +9,15 @@ project('libds_tizen',
   ]
 )
 
+cc = meson.get_compiler('c')
+
+add_project_arguments(cc.get_supported_arguments([
+  '-Wno-missing-field-initializers',
+  '-Wno-unused-parameter',
+  '-Wno-pedantic',
+  '-Wno-missing-braces',
+]), language: ['c', 'cpp'])
+
 libds_tizen_version = meson.project_version()
 version_arr = libds_tizen_version.split('.')
 libds_tizen_version_major = version_arr[0]
index 535fdef..3618aff 100644 (file)
@@ -487,7 +487,7 @@ ds_tdm_output_hwc_validate(struct ds_tdm_output_hwc *hwc,
     tdm_error terr;
     tdm_hwc_window **compositied_hwc_windows = NULL;
     struct ds_tdm_output_hwc_window *hwc_window;
-    int i;
+    size_t i;
 
     wl_list_for_each(hwc_window, &hwc->hwc_windows, link)
         hwc_window_update(hwc_window);
@@ -497,7 +497,7 @@ ds_tdm_output_hwc_validate(struct ds_tdm_output_hwc *hwc,
         if (!compositied_hwc_windows)
             return false;
 
-        for (i = 0; i < num_windows; i++)
+        for (i = 0; i < (size_t)num_windows; i++)
             compositied_hwc_windows[i] = composited_windows[i]->twindow;
     }
 
@@ -538,7 +538,7 @@ ds_tdm_output_hwc_get_changed_composition(struct ds_tdm_output_hwc *hwc, uint32_
     tdm_hwc_window_composition *compositions = NULL;
     struct ds_tdm_output_hwc_window *hwc_window;
     tdm_error terr;
-    int i;
+    size_t i;
 
     if (!hwc->validate_num_changed) {
         *num_changed = 0;
@@ -564,8 +564,8 @@ ds_tdm_output_hwc_get_changed_composition(struct ds_tdm_output_hwc *hwc, uint32_
         return false;
     }
 
-    for (i = 0; i < hwc->validate_num_changed; i++) {
-        if (i >= *num_changed)
+    for (i = 0; i < (size_t)hwc->validate_num_changed; i++) {
+        if (i >= (size_t)*num_changed)
             break;
 
         hwc_window = hwc_get_hwc_window_from_tdm_hwc_window(hwc, changed_thwc_windows[i]);
index 3c41c3e..4053b38 100644 (file)
@@ -564,7 +564,7 @@ _ds_tizen_eom_get_eom_output_by_id(struct ds_tizen_eom *eom, uint32_t id)
     struct ds_tizen_eom_output *output;
 
     wl_list_for_each(output, &eom->outputs, link) {
-        if (output->id == id)
+        if ((uint32_t)output->id == id)
             return output;
     }
 
index b08dae5..7b8cf67 100644 (file)
@@ -42,9 +42,9 @@ struct ds_tizen_indicator_info
 {
     struct ds_surface *surface;
 
-    int32_t state;
-    int32_t opacity_mode;
-    int32_t visible_type;
+    enum ds_tizen_indicator_state state;
+    enum ds_tizen_indicator_opacity_mode opacity_mode;
+    enum ds_tizen_indicator_visible_type visible_type;
 
     struct wl_list link; // ds_tizen_indicator_client::infos
 };
@@ -263,9 +263,9 @@ tizen_indicator_client_get_info(struct ds_tizen_indicator_client *client,
     // enum ds_tizen_indicator_opacity_mode and
     // enum ds_tizen_indicator_opacity_mode
     // because of the first signal emit for change_state signal.
-    info->state = -1;
-    info->opacity_mode = -1;
-    info->visible_type = -1;
+    info->state = DS_TIZEN_INDICATOR_STATE_UNKNOWN;
+    info->opacity_mode = DS_TIZEN_INDICATOR_OPACITY_MODE_UNKNOWN;
+    info->visible_type = DS_TIZEN_INDICATOR_VISIBLE_TYPE_HIDDEN;
 
     wl_list_insert(&client->infos, &info->link);
 
index 2d7e6fb..d76b1dc 100644 (file)
@@ -735,7 +735,7 @@ device_manager_handle_generate_touch(struct wl_client *client,
         goto finish;
     }
 
-    if (finger >= tz_devicemgr->touch_max_count)
+    if (finger >= (uint32_t)tz_devicemgr->touch_max_count)
     {
         ds_err("Invalid fingers: %d\n", finger);
         ret = TIZEN_INPUT_DEVICE_MANAGER_ERROR_INVALID_PARAMETER;
index b079836..944797b 100644 (file)
@@ -509,7 +509,7 @@ appinfo_handle_ready_metadata(struct wl_client *wl_client,
         return;
     }
 
-    if (info->pid != pid)
+    if ((uint32_t)info->pid != pid)
         appinfo_set_pid(info, pid);
 
     wl_signal_emit(&client->appinfo_mgr->events.metadata_ready, info);
index 632bb7d..ab7e9a6 100644 (file)
@@ -1825,7 +1825,7 @@ policy_handle_set_background_state(struct wl_client *wl_client,
     policy = client->policy;
 
     wl_list_for_each(client, &policy->clients, link) {
-        if (pid == client->pid) {
+        if (pid == (uint32_t)client->pid) {
             struct ds_tizen_policy_event_set_background_state event = {
                 .policy = client->policy,
                 .pid = pid,
@@ -1846,7 +1846,7 @@ policy_handle_unset_background_state(struct wl_client *wl_client,
     policy = client->policy;
 
     wl_list_for_each(client, &policy->clients, link) {
-        if (pid == client->pid) {
+        if (pid == (uint32_t)client->pid) {
             struct ds_tizen_policy_event_unset_background_state event = {
                 .policy = client->policy,
                 .pid = pid,
@@ -2216,50 +2216,50 @@ policy_handle_set_parent_with_below(struct wl_client *wl_client,
 
 static const struct tizen_policy_interface policy_impl =
 {
-   policy_handle_get_visibility,
-   policy_handle_get_position,
-   policy_handle_activate,
-   policy_handle_activate_below_by_res_id,
-   policy_handle_raise,
-   policy_handle_lower,
-   policy_handle_lower_by_res_id,
-   policy_handle_set_focus_skip,
-   policy_handle_unset_focus_skip,
-   policy_handle_set_role,
-   policy_handle_set_type,
-   policy_handle_set_conformant,
-   policy_handle_unset_conformant,
-   policy_handle_get_conformant,
-   policy_handle_set_notification_level,
-   policy_handle_set_transient_for,
-   policy_handle_unset_transient_for,
-   policy_handle_set_window_screen_mode,
-   policy_handle_place_subsurface_below_parent,
-   policy_handle_set_subsurface_stand_alone,
-   policy_handle_get_subsurface,
-   policy_handle_set_opaque_state,
-   policy_handle_iconify,
-   policy_handle_uniconify,
-   policy_handle_add_aux_hint,
-   policy_handle_change_aux_hint,
-   policy_handle_delete_aux_hint,
-   policy_handle_get_supported_aux_hints,
-   policy_handle_set_background_state,
-   policy_handle_unset_background_state,
-   policy_handle_set_floating_mode,
-   policy_handle_unset_floating_mode,
-   policy_handle_set_stack_mode,
-   policy_handle_activate_above_by_res_id,
-   policy_handle_get_subsurface_watcher,
-   policy_handle_set_parent,
-   policy_handle_ack_conformant_region,
-   policy_handle_destroy,
-   policy_handle_has_video,
-   policy_handle_set_appid,
-   policy_handle_show,
-   policy_handle_hide,
-   policy_handle_set_transient_for_below,
-   policy_handle_set_parent_with_below,
+   .get_visibility = policy_handle_get_visibility,
+   .get_position = policy_handle_get_position,
+   .activate = policy_handle_activate,
+   .activate_below_by_res_id = policy_handle_activate_below_by_res_id,
+   .raise = policy_handle_raise,
+   .lower = policy_handle_lower,
+   .lower_by_res_id = policy_handle_lower_by_res_id,
+   .set_focus_skip = policy_handle_set_focus_skip,
+   .unset_focus_skip = policy_handle_unset_focus_skip,
+   .set_role = policy_handle_set_role,
+   .set_type = policy_handle_set_type,
+   .set_conformant = policy_handle_set_conformant,
+   .unset_conformant = policy_handle_unset_conformant,
+   .get_conformant = policy_handle_get_conformant,
+   .set_notification_level = policy_handle_set_notification_level,
+   .set_transient_for = policy_handle_set_transient_for,
+   .unset_transient_for = policy_handle_unset_transient_for,
+   .set_window_screen_mode = policy_handle_set_window_screen_mode,
+   .place_subsurface_below_parent = policy_handle_place_subsurface_below_parent,
+   .set_subsurface_stand_alone = policy_handle_set_subsurface_stand_alone,
+   .get_subsurface = policy_handle_get_subsurface,
+   .set_opaque_state = policy_handle_set_opaque_state,
+   .iconify = policy_handle_iconify,
+   .uniconify = policy_handle_uniconify,
+   .add_aux_hint = policy_handle_add_aux_hint,
+   .change_aux_hint = policy_handle_change_aux_hint,
+   .del_aux_hint = policy_handle_delete_aux_hint,
+   .get_supported_aux_hints = policy_handle_get_supported_aux_hints,
+   .set_background_state = policy_handle_set_background_state,
+   .unset_background_state = policy_handle_unset_background_state,
+   .set_floating_mode = policy_handle_set_floating_mode,
+   .unset_floating_mode = policy_handle_unset_floating_mode,
+   .set_stack_mode = policy_handle_set_stack_mode,
+   .activate_above_by_res_id = policy_handle_activate_above_by_res_id,
+   .get_subsurface_watcher = policy_handle_get_subsurface_watcher,
+   .set_parent = policy_handle_set_parent,
+   .ack_conformant_region = policy_handle_ack_conformant_region,
+   .destroy = policy_handle_destroy,
+   .has_video = policy_handle_has_video,
+   .set_appid = policy_handle_set_appid,
+   .show = policy_handle_show,
+   .hide = policy_handle_hide,
+   .set_transient_for_below = policy_handle_set_transient_for_below,
+   .set_parent_with_below = policy_handle_set_parent_with_below,
 };
 
 static void
index a391d4a..b9aaa36 100644 (file)
@@ -13,7 +13,7 @@
 
 #define TIZEN_REMOTE_SURFACE_VERSION 6
 
-static uint32_t resource_id = 1;
+static uint32_t global_resource_id = 1;
 
 struct ds_tizen_remote_surface_manager
 {
@@ -305,7 +305,7 @@ remote_surface_manager_handle_create_provider(struct wl_client *wl_client,
 
     wl_signal_emit(&remote_client->remote_manager->events.new_provider, remote_provider);
 
-    remote_provider->resource_id = resource_id++;
+    remote_provider->resource_id = global_resource_id++;
 
     tizen_remote_surface_provider_send_resource_id(remote_provider->resource, remote_provider->resource_id);
 
index 6a74df5..fde5f9d 100644 (file)
@@ -198,7 +198,7 @@ class ScalerCompositorBadSourceTest :
 {
 };
 
-INSTANTIATE_TEST_SUITE_P(ScalerBadSourceParamTest,
+INSTANTIATE_TEST_CASE_P(ScalerBadSourceParamTest,
         ScalerCompositorBadSourceTest,
         testing::Values(
             Box{0, 0, 0, 0},
@@ -238,7 +238,7 @@ class ScalerCompositorBadDestinationTest :
 {
 };
 
-INSTANTIATE_TEST_SUITE_P(ScalerBadDestinationParamTest,
+INSTANTIATE_TEST_CASE_P(ScalerBadDestinationParamTest,
         ScalerCompositorBadDestinationTest,
         testing::Values(
             Size{0, 0},