gtk: Cast static strings assigned to non-const variables

GtkTargetEntry.target is particularly egregious, and it should really be
constified.
This commit is contained in:
Emmanuele Bassi 2016-10-15 21:24:42 +01:00
parent 9bb816f8ee
commit 5880d1b990
13 changed files with 34 additions and 29 deletions

View File

@ -609,7 +609,7 @@ gtk_accel_map_load_scanner (GScanner *scanner)
skip_comment_single = scanner->config->skip_comment_single;
scanner->config->skip_comment_single = TRUE;
cpair_comment_single = scanner->config->cpair_comment_single;
scanner->config->cpair_comment_single = ";\n";
scanner->config->cpair_comment_single = (char *) ";\n";
symbol_2_token = scanner->config->symbol_2_token;
scanner->config->symbol_2_token = FALSE;
saved_symbol = g_scanner_lookup_symbol (scanner, "gtk_accel_path");

View File

@ -1345,7 +1345,7 @@ create_signal_scanner (void)
GScanner *scanner;
scanner = g_scanner_new (NULL);
scanner->config->cset_identifier_nth = G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS "-_";
scanner->config->cset_identifier_nth = (char *) G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS "-_";
g_scanner_scope_add_symbol (scanner, 0, "bind", GUINT_TO_POINTER (GTK_BINDING_TOKEN_BIND));
g_scanner_scope_add_symbol (scanner, 0, "unbind", GUINT_TO_POINTER (GTK_BINDING_TOKEN_UNBIND));

View File

@ -2070,7 +2070,7 @@ gtk_clipboard_real_set_can_store (GtkClipboard *clipboard,
GtkWidget *clipboard_widget;
int i;
static const GtkTargetEntry save_targets[] = {
{ "SAVE_TARGETS", 0, TARGET_SAVE_TARGETS }
{ (char *) "SAVE_TARGETS", 0, TARGET_SAVE_TARGETS }
};
if (clipboard->selection != GDK_SELECTION_CLIPBOARD)

View File

@ -130,7 +130,7 @@ static void gtk_color_button_drag_data_received (GtkWidget *widget,
static guint color_button_signals[LAST_SIGNAL] = { 0 };
static const GtkTargetEntry drop_types[] = { { "application/x-color", 0, 0 } };
static const GtkTargetEntry drop_types[] = { { (char *) "application/x-color", 0, 0 } };
static void gtk_color_button_iface_init (GtkColorChooserInterface *iface);

View File

@ -778,7 +778,7 @@ gtk_color_swatch_new (void)
}
static const GtkTargetEntry dnd_targets[] = {
{ "application/x-color", 0 }
{ (char *) "application/x-color", 0 }
};
void

View File

@ -7125,7 +7125,7 @@ gtk_icon_view_get_reorderable (GtkIconView *icon_view)
}
static const GtkTargetEntry item_targets[] = {
{ "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 }
{ (char *) "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 }
};

View File

@ -128,8 +128,8 @@ static gboolean gtk_link_button_query_tooltip_cb (GtkWidget *widget,
static gboolean gtk_link_button_activate_link (GtkLinkButton *link_button);
static const GtkTargetEntry link_drop_types[] = {
{ "text/uri-list", 0, 0 },
{ "_NETSCAPE_URL", 0, 0 }
{ (char *) "text/uri-list", 0, 0 },
{ (char *) "_NETSCAPE_URL", 0, 0 }
};
static guint link_signals[LAST_SIGNAL] = { 0, };

View File

@ -313,12 +313,12 @@ struct _GtkNotebookPage
};
static const GtkTargetEntry src_notebook_targets [] = {
{ "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, 0 },
{ "application/x-rootwindow-drop", 0, 0 },
{ (char *) "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, 0 },
{ (char *) "application/x-rootwindow-drop", 0, 0 },
};
static const GtkTargetEntry dst_notebook_targets [] = {
{ "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, 0 },
{ (char *) "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, 0 },
};
/*** GtkNotebook Methods ***/

View File

@ -302,12 +302,12 @@ enum {
/* Target types for dragging from the shortcuts list */
static const GtkTargetEntry dnd_source_targets[] = {
{ "DND_GTK_SIDEBAR_ROW", GTK_TARGET_SAME_WIDGET, DND_GTK_SIDEBAR_ROW }
{ (char *) "DND_GTK_SIDEBAR_ROW", GTK_TARGET_SAME_WIDGET, DND_GTK_SIDEBAR_ROW }
};
/* Target types for dropping into the shortcuts list */
static const GtkTargetEntry dnd_drop_targets [] = {
{ "DND_GTK_SIDEBAR_ROW", GTK_TARGET_SAME_WIDGET, DND_GTK_SIDEBAR_ROW }
{ (char *) "DND_GTK_SIDEBAR_ROW", GTK_TARGET_SAME_WIDGET, DND_GTK_SIDEBAR_ROW }
};
G_DEFINE_TYPE (GtkPlacesSidebar, gtk_places_sidebar, GTK_TYPE_SCROLLED_WINDOW);
@ -909,7 +909,7 @@ update_places (GtkPlacesSidebar *sidebar)
GVolume *volume;
GSList *bookmarks, *sl;
gint index;
gchar *original_uri, *mount_uri, *name, *identifier;
gchar *original_uri, *name, *identifier;
GtkListBoxRow *selected;
gchar *home_uri;
GIcon *icon;
@ -943,11 +943,10 @@ update_places (GtkPlacesSidebar *sidebar)
/* add built-in places */
if (should_show_recent (sidebar))
{
mount_uri = "recent:///";
icon = g_themed_icon_new_with_default_fallbacks ("document-open-recent-symbolic");
add_place (sidebar, PLACES_BUILT_IN,
SECTION_COMPUTER,
_("Recent"), icon, mount_uri,
_("Recent"), icon, "recent:///",
NULL, NULL, NULL, 0,
_("Recent files"));
g_object_unref (icon);
@ -967,7 +966,7 @@ update_places (GtkPlacesSidebar *sidebar)
/* desktop */
if (sidebar->show_desktop)
{
mount_uri = get_desktop_directory_uri ();
char *mount_uri = get_desktop_directory_uri ();
if (mount_uri)
{
icon = g_themed_icon_new_with_default_fallbacks (ICON_NAME_DESKTOP);
@ -998,11 +997,10 @@ update_places (GtkPlacesSidebar *sidebar)
/* Trash */
if (!sidebar->local_only && sidebar->show_trash)
{
mount_uri = "trash:///"; /* No need to strdup */
icon = _gtk_trash_monitor_get_icon (sidebar->trash_monitor);
sidebar->trash_row = add_place (sidebar, PLACES_BUILT_IN,
SECTION_COMPUTER,
_("Trash"), icon, mount_uri,
_("Trash"), icon, "trash:///",
NULL, NULL, NULL, 0,
_("Open the trash"));
g_object_add_weak_pointer (G_OBJECT (sidebar->trash_row),
@ -1045,6 +1043,8 @@ update_places (GtkPlacesSidebar *sidebar)
mount = g_volume_get_mount (volume);
if (mount != NULL)
{
char *mount_uri;
/* Show mounted volume in the sidebar */
icon = g_mount_get_symbolic_icon (mount);
root = g_mount_get_default_location (mount);
@ -1149,6 +1149,8 @@ update_places (GtkPlacesSidebar *sidebar)
mount = g_volume_get_mount (volume);
if (mount != NULL)
{
char *mount_uri;
icon = g_mount_get_symbolic_icon (mount);
root = g_mount_get_default_location (mount);
mount_uri = g_file_get_uri (root);
@ -1184,11 +1186,10 @@ update_places (GtkPlacesSidebar *sidebar)
/* file system root */
if (!sidebar->show_other_locations)
{
mount_uri = "file:///"; /* No need to strdup */
icon = g_themed_icon_new_with_default_fallbacks (ICON_NAME_FILESYSTEM);
add_place (sidebar, PLACES_BUILT_IN,
SECTION_MOUNTS,
sidebar->hostname, icon, mount_uri,
sidebar->hostname, icon, "file:///",
NULL, NULL, NULL, 0,
_("Open the contents of the file system"));
g_object_unref (icon);
@ -1199,6 +1200,8 @@ update_places (GtkPlacesSidebar *sidebar)
for (l = mounts; l != NULL; l = l->next)
{
char *mount_uri;
mount = l->data;
if (g_mount_is_shadowed (mount))
{
@ -1325,6 +1328,8 @@ update_places (GtkPlacesSidebar *sidebar)
network_mounts = g_list_reverse (network_mounts);
for (l = network_mounts; l != NULL; l = l->next)
{
char *mount_uri;
mount = l->data;
root = g_mount_get_default_location (mount);
icon = g_mount_get_symbolic_icon (mount);

View File

@ -2513,21 +2513,21 @@ gtk_settings_set_double_property (GtkSettings *settings,
static const GScannerConfig gtk_rc_scanner_config =
{
(
(char *) (
" \t\r\n"
) /* cset_skip_characters */,
(
(char *) (
"_"
G_CSET_a_2_z
G_CSET_A_2_Z
) /* cset_identifier_first */,
(
(char *) (
G_CSET_DIGITS
"-_"
G_CSET_a_2_z
G_CSET_A_2_Z
) /* cset_identifier_nth */,
( "#\n" ) /* cpair_comment_single */,
(char *) ( "#\n" ) /* cpair_comment_single */,
TRUE /* case_sensitive */,

View File

@ -185,8 +185,8 @@ static GdkAtom dnd_target_atom_group = GDK_NONE;
static const GtkTargetEntry dnd_targets[] =
{
{ "application/x-gtk-tool-palette-item", GTK_TARGET_SAME_APP, 0 },
{ "application/x-gtk-tool-palette-group", GTK_TARGET_SAME_APP, 0 },
{ (char *) "application/x-gtk-tool-palette-item", GTK_TARGET_SAME_APP, 0 },
{ (char *) "application/x-gtk-tool-palette-group", GTK_TARGET_SAME_APP, 0 },
};
static void gtk_tool_palette_set_hadjustment (GtkToolPalette *palette,

View File

@ -13205,7 +13205,7 @@ gtk_tree_view_set_reorderable (GtkTreeView *tree_view,
if (reorderable)
{
const GtkTargetEntry row_targets[] = {
{ "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 }
{ (char *) "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, 0 }
};
gtk_tree_view_enable_model_drag_source (tree_view,

View File

@ -271,7 +271,7 @@ struct _GtkWindowPrivate
};
static const GtkTargetEntry dnd_dest_targets [] = {
{ "application/x-rootwindow-drop", 0, 0 },
{ (char *) "application/x-rootwindow-drop", 0, 0 },
};
enum {