[gimp] Fix -Wdiscarded-qualifiers in gimp_tool_button_update.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Fix -Wdiscarded-qualifiers in gimp_tool_button_update.
- Date: Fri, 1 Apr 2022 18:47:40 +0000 (UTC)
commit 3372dbaf38f2b8afaaca9049958c82dc137d6035
Author: Axel Viala <axel viala darnuria eu>
Date: Tue Mar 29 17:04:32 2022 +0200
Fix -Wdiscarded-qualifiers in gimp_tool_button_update.
[2207/2321] Compiling C object app/widgets/libappwidgets.a.p/gimptoolbutton.c.o
../app/widgets/gimptoolbutton.c: In function ‘gimp_tool_button_update’:
../app/widgets/gimptoolbutton.c:905:19: warning: initialization discards ‘const’ qualifier from pointer
target type [-Wdiscarded-qualifiers]
905 | gchar *id = gimp_object_get_name (tool_info);
| ^~~~~~~~~~~~~~~~~~~~
app/widgets/gimptoolbutton.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/app/widgets/gimptoolbutton.c b/app/widgets/gimptoolbutton.c
index c6e7b20d6e..a539c899f7 100644
--- a/app/widgets/gimptoolbutton.c
+++ b/app/widgets/gimptoolbutton.c
@@ -902,10 +902,11 @@ gimp_tool_button_update (GimpToolButton *tool_button)
if (tool_info)
{
- gchar *id = gimp_object_get_name (tool_info);
+ const gchar *tool_name = gimp_object_get_name (tool_info);
+ gchar *identifier;
- if (g_str_has_prefix (id, "gimp-") &&
- g_str_has_suffix (id, "-tool"))
+ if (g_str_has_prefix (tool_name, "gimp-") &&
+ g_str_has_suffix (tool_name, "-tool"))
{
/* The GimpToolInfo names are of the form "gimp-pencil-tool",
* and action names are of the form "tools-pencil".
@@ -914,16 +915,17 @@ gimp_tool_button_update (GimpToolButton *tool_button)
*/
gchar *suffix;
- id = g_strdup_printf ("tools-%s", id + 5);
- suffix = g_strrstr (id, "-tool");
+ identifier = g_strdup_printf ("tools-%s", tool_name + 5);
+ suffix = g_strrstr (identifier, "-tool");
suffix[0] = '\0';
}
else
{
- id = g_strdup (id);
+ identifier = g_strdup (tool_name);
}
- gimp_widget_set_identifier (tool_button, id);
+ gimp_widget_set_identifier (GTK_WIDGET (tool_button), identifier);
+ g_free (identifier);
}
gimp_tool_button_update_toggled (tool_button);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]