[mutter] clutter: Fix const qualifier usage
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter: Fix const qualifier usage
- Date: Tue, 22 Jan 2019 17:38:55 +0000 (UTC)
commit 44477390a9a2e87a735e8b296470cc01d51055d1
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Sun Jan 20 09:09:50 2019 +0100
clutter: Fix const qualifier usage
The const qualifiers were implicitly discarded here and there. Avoid that
either by adding the constness, or casting it away when a const variable
is passed to a function that is defined as non-const but effectively
expect a const.
clutter/clutter/x11/xsettings/xsettings-client.c | 2 +-
clutter/tests/interactive/test-cogl-shader-glsl.c | 4 ++--
clutter/tests/interactive/test-events.c | 24 +++++++++++-----------
clutter/tests/interactive/test-grab.c | 20 +++++++++---------
clutter/tests/interactive/test-stage-read-pixels.c | 4 ++--
5 files changed, 27 insertions(+), 27 deletions(-)
---
diff --git a/clutter/clutter/x11/xsettings/xsettings-client.c
b/clutter/clutter/x11/xsettings/xsettings-client.c
index 494d57584..f23149901 100644
--- a/clutter/clutter/x11/xsettings/xsettings-client.c
+++ b/clutter/clutter/x11/xsettings/xsettings-client.c
@@ -480,7 +480,7 @@ xsettings_client_new_with_grab_funcs (Display *display,
{
XSettingsClient *client;
char buffer[256];
- char *atom_names[3];
+ const char *atom_names[3];
Atom atoms[3];
client = malloc (sizeof *client);
diff --git a/clutter/tests/interactive/test-cogl-shader-glsl.c
b/clutter/tests/interactive/test-cogl-shader-glsl.c
index ad32527fb..22c47d0ee 100644
--- a/clutter/tests/interactive/test-cogl-shader-glsl.c
+++ b/clutter/tests/interactive/test-cogl-shader-glsl.c
@@ -7,8 +7,8 @@
typedef struct
{
- char *name;
- char *source;
+ const char *name;
+ const char *source;
} ShaderSource;
int
diff --git a/clutter/tests/interactive/test-events.c b/clutter/tests/interactive/test-events.c
index 47a4e87f3..bfc5c22bc 100644
--- a/clutter/tests/interactive/test-events.c
+++ b/clutter/tests/interactive/test-events.c
@@ -59,7 +59,7 @@ get_event_type_name (const ClutterEvent *event)
static gchar *
get_event_state_string (const ClutterEvent *event)
{
- gchar *mods[18];
+ const char *mods[18];
int i = 0;
ClutterModifierType state = clutter_event_get_state (event);
@@ -102,7 +102,7 @@ get_event_state_string (const ClutterEvent *event)
mods[i++] = "-";
mods[i] = NULL;
- return g_strjoinv (",", mods);
+ return g_strjoinv (",", (char **) mods);
}
static void
@@ -428,15 +428,15 @@ test_events_main (int argc, char *argv[])
clutter_stage_set_title (CLUTTER_STAGE (stage), "Events");
clutter_actor_set_name (stage, "Stage");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
- g_signal_connect (stage, "event", G_CALLBACK (input_cb), "stage");
+ g_signal_connect (stage, "event", G_CALLBACK (input_cb), (char *) "stage");
g_signal_connect (stage, "fullscreen",
- G_CALLBACK (stage_state_cb), "fullscreen");
+ G_CALLBACK (stage_state_cb), (char *) "fullscreen");
g_signal_connect (stage, "unfullscreen",
- G_CALLBACK (stage_state_cb), "unfullscreen");
+ G_CALLBACK (stage_state_cb), (char *) "unfullscreen");
g_signal_connect (stage, "activate",
- G_CALLBACK (stage_state_cb), "activate");
+ G_CALLBACK (stage_state_cb), (char *) "activate");
g_signal_connect (stage, "deactivate",
- G_CALLBACK (stage_state_cb), "deactivate");
+ G_CALLBACK (stage_state_cb), (char *) "deactivate");
focus_box = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black);
clutter_actor_set_name (focus_box, "Focus Box");
@@ -448,7 +448,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_position (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
- g_signal_connect (actor, "event", G_CALLBACK (input_cb), "red box");
+ g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "red box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box);
/* Toggle motion - enter/leave capture */
@@ -463,7 +463,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_position (actor, 250, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
- g_signal_connect (actor, "event", G_CALLBACK (input_cb), "green box");
+ g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "green box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box);
g_signal_connect (actor, "captured-event", G_CALLBACK (capture_cb), NULL);
@@ -474,7 +474,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_position (actor, 400, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL);
- g_signal_connect (actor, "event", G_CALLBACK (input_cb), "blue box");
+ g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "blue box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box);
/* Fullscreen */
@@ -487,7 +487,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_size (actor, 400, 50);
clutter_actor_set_position (actor, 100, 250);
clutter_container_add (CLUTTER_CONTAINER(stage), actor, NULL);
- g_signal_connect (actor, "event", G_CALLBACK (input_cb), "blue box");
+ g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "blue box");
g_signal_connect (actor, "key-focus-in", G_CALLBACK (key_focus_in_cb),
focus_box);
g_signal_connect (stage, "key-focus-in", G_CALLBACK (key_focus_in_cb),
@@ -499,7 +499,7 @@ test_events_main (int argc, char *argv[])
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE);
- g_signal_connect (actor, "event", G_CALLBACK (input_cb), "yellow box");
+ g_signal_connect (actor, "event", G_CALLBACK (input_cb), (char *) "yellow box");
/* note group not reactive */
group = clutter_group_new ();
diff --git a/clutter/tests/interactive/test-grab.c b/clutter/tests/interactive/test-grab.c
index 959779653..3cef9d712 100644
--- a/clutter/tests/interactive/test-grab.c
+++ b/clutter/tests/interactive/test-grab.c
@@ -217,22 +217,22 @@ test_grab_main (int argc, char *argv[])
clutter_stage_set_title (CLUTTER_STAGE (stage), "Grabs");
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
g_signal_connect (stage, "event",
- G_CALLBACK (debug_event_cb), "stage");
+ G_CALLBACK (debug_event_cb), (char *) "stage");
g_signal_connect (stage, "fullscreen",
- G_CALLBACK (stage_state_cb), "fullscreen");
+ G_CALLBACK (stage_state_cb), (char *) "fullscreen");
g_signal_connect (stage, "unfullscreen",
- G_CALLBACK (stage_state_cb), "unfullscreen");
+ G_CALLBACK (stage_state_cb), (char *) "unfullscreen");
g_signal_connect (stage, "activate",
- G_CALLBACK (stage_state_cb), "activate");
+ G_CALLBACK (stage_state_cb), (char *) "activate");
g_signal_connect (stage, "deactivate",
- G_CALLBACK (stage_state_cb), "deactivate");
+ G_CALLBACK (stage_state_cb), (char *) "deactivate");
actor = clutter_rectangle_new_with_color (&rcol);
clutter_actor_set_size (actor, 100, 100);
clutter_actor_set_position (actor, 100, 100);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
- g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), "red box");
+ g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), (char *) "red box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (grab_pointer_cb), NULL);
g_signal_connect (actor, "button-release-event",
@@ -243,7 +243,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_position (actor, 100, 300);
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
- g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), "yellow box");
+ g_signal_connect (actor, "event", G_CALLBACK (debug_event_cb), (char *) "yellow box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (toggle_grab_pointer_cb), NULL);
@@ -253,7 +253,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event",
- G_CALLBACK (debug_event_cb), "blue box");
+ G_CALLBACK (debug_event_cb), (char *) "blue box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (grab_pointer_cb), NULL);
g_signal_connect (actor, "button-release-event",
@@ -265,7 +265,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event",
- G_CALLBACK (debug_event_cb), "green box");
+ G_CALLBACK (debug_event_cb), (char *) "green box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (green_press_cb), NULL);
@@ -276,7 +276,7 @@ test_grab_main (int argc, char *argv[])
clutter_actor_set_reactive (actor, TRUE);
clutter_container_add (CLUTTER_CONTAINER (stage), actor, NULL);
g_signal_connect (actor, "event",
- G_CALLBACK (debug_event_cb), "cyan box");
+ G_CALLBACK (debug_event_cb), (char *) "cyan box");
g_signal_connect (actor, "button-press-event",
G_CALLBACK (cyan_press_cb), NULL);
diff --git a/clutter/tests/interactive/test-stage-read-pixels.c
b/clutter/tests/interactive/test-stage-read-pixels.c
index 184e6359b..c1ace8498 100644
--- a/clutter/tests/interactive/test-stage-read-pixels.c
+++ b/clutter/tests/interactive/test-stage-read-pixels.c
@@ -27,12 +27,12 @@ make_label (void)
{
ClutterActor *label;
gchar *text;
- gchar *argv[] = { "ls", "--help", NULL };
+ const char *argv[] = { "ls", "--help", NULL };
label = clutter_text_new ();
clutter_text_set_font_name (CLUTTER_TEXT (label), "Sans 10");
- if (g_spawn_sync (NULL, argv, NULL,
+ if (g_spawn_sync (NULL, (char **) argv, NULL,
G_SPAWN_STDERR_TO_DEV_NULL | G_SPAWN_SEARCH_PATH,
NULL, NULL, &text, NULL, NULL, NULL))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]