Fix some compilation warnings

GScanner token field is declared as GTokenType instead a guint
See Glib bug: https://bugzilla.gnome.org/show_bug.cgi?id=627890

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=627962
This commit is contained in:
Javier Jardón 2010-08-25 17:55:48 +02:00
parent e3fafd7512
commit 7e520d908a
2 changed files with 31 additions and 17 deletions

View File

@ -1350,6 +1350,7 @@ gtk_binding_parse_signal (GScanner *scanner,
gboolean negate; gboolean negate;
gboolean need_arg; gboolean need_arg;
gboolean seen_comma; gboolean seen_comma;
guint token;
g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR); g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
@ -1377,8 +1378,9 @@ gtk_binding_parse_signal (GScanner *scanner,
expected_token = G_TOKEN_INT; expected_token = G_TOKEN_INT;
else else
expected_token = ')'; expected_token = ')';
g_scanner_get_next_token (scanner);
switch (scanner->token) token = g_scanner_get_next_token (scanner);
switch (token)
{ {
GtkBindingArg *arg; GtkBindingArg *arg;
@ -1501,14 +1503,15 @@ gtk_binding_parse_bind (GScanner *scanner,
guint keyval = 0; guint keyval = 0;
GdkModifierType modifiers = 0; GdkModifierType modifiers = 0;
gboolean unbind = FALSE; gboolean unbind = FALSE;
guint token;
g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR); g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
g_scanner_get_next_token (scanner); token = g_scanner_get_next_token (scanner);
if (scanner->token != GTK_RC_TOKEN_BIND && if (token != GTK_RC_TOKEN_BIND &&
scanner->token != GTK_RC_TOKEN_UNBIND) token != GTK_RC_TOKEN_UNBIND)
return GTK_RC_TOKEN_BIND; return GTK_RC_TOKEN_BIND;
unbind = scanner->token == GTK_RC_TOKEN_UNBIND; unbind = token == GTK_RC_TOKEN_UNBIND;
g_scanner_get_next_token (scanner); g_scanner_get_next_token (scanner);
if (scanner->token != G_TOKEN_STRING) if (scanner->token != G_TOKEN_STRING)
return G_TOKEN_STRING; return G_TOKEN_STRING;
@ -1559,13 +1562,14 @@ gtk_binding_parse_bind (GScanner *scanner,
guint guint
_gtk_binding_parse_binding (GScanner *scanner) _gtk_binding_parse_binding (GScanner *scanner)
{ {
gchar *name;
GtkBindingSet *binding_set; GtkBindingSet *binding_set;
gchar *name;
guint token;
g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR); g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
g_scanner_get_next_token (scanner); token = g_scanner_get_next_token (scanner);
if (scanner->token != GTK_RC_TOKEN_BINDING) if (token != GTK_RC_TOKEN_BINDING)
return GTK_RC_TOKEN_BINDING; return GTK_RC_TOKEN_BINDING;
g_scanner_get_next_token (scanner); g_scanner_get_next_token (scanner);
if (scanner->token != G_TOKEN_STRING) if (scanner->token != G_TOKEN_STRING)
@ -1590,7 +1594,8 @@ _gtk_binding_parse_binding (GScanner *scanner)
g_scanner_peek_next_token (scanner); g_scanner_peek_next_token (scanner);
while (scanner->next_token != '}') while (scanner->next_token != '}')
{ {
switch (scanner->next_token) guint next_token = scanner->next_token;
switch (next_token)
{ {
guint expected_token; guint expected_token;

View File

@ -2219,6 +2219,8 @@ gtk_rc_parse_any (GtkRcContext *context,
if (scanner->scope_id == 0) if (scanner->scope_id == 0)
{ {
guint token;
/* if we are in scope 0, we know the symbol names /* if we are in scope 0, we know the symbol names
* that are associated with certain token values. * that are associated with certain token values.
* so we look them up to make the error messages * so we look them up to make the error messages
@ -2237,8 +2239,9 @@ gtk_rc_parse_any (GtkRcContext *context,
msg = g_strconcat ("e.g. `", sym, "'", NULL); msg = g_strconcat ("e.g. `", sym, "'", NULL);
} }
if (scanner->token > GTK_RC_TOKEN_INVALID && token = scanner->token;
scanner->token < GTK_RC_TOKEN_LAST) if (token > GTK_RC_TOKEN_INVALID &&
token < GTK_RC_TOKEN_LAST)
{ {
symbol_name = "???"; symbol_name = "???";
for (i = 0; i < G_N_ELEMENTS (symbols); i++) for (i = 0; i < G_N_ELEMENTS (symbols); i++)
@ -3324,7 +3327,10 @@ static guint
gtk_rc_parse_xthickness (GScanner *scanner, gtk_rc_parse_xthickness (GScanner *scanner,
GtkRcStyle *style) GtkRcStyle *style)
{ {
if (g_scanner_get_next_token (scanner) != GTK_RC_TOKEN_XTHICKNESS) guint token;
token = g_scanner_get_next_token (scanner);
if (token != GTK_RC_TOKEN_XTHICKNESS)
return GTK_RC_TOKEN_XTHICKNESS; return GTK_RC_TOKEN_XTHICKNESS;
if (g_scanner_get_next_token (scanner) != G_TOKEN_EQUAL_SIGN) if (g_scanner_get_next_token (scanner) != G_TOKEN_EQUAL_SIGN)
@ -3342,7 +3348,10 @@ static guint
gtk_rc_parse_ythickness (GScanner *scanner, gtk_rc_parse_ythickness (GScanner *scanner,
GtkRcStyle *style) GtkRcStyle *style)
{ {
if (g_scanner_get_next_token (scanner) != GTK_RC_TOKEN_YTHICKNESS) guint token;
token = g_scanner_get_next_token (scanner);
if (token != GTK_RC_TOKEN_YTHICKNESS)
return GTK_RC_TOKEN_YTHICKNESS; return GTK_RC_TOKEN_YTHICKNESS;
if (g_scanner_get_next_token (scanner) != G_TOKEN_EQUAL_SIGN) if (g_scanner_get_next_token (scanner) != G_TOKEN_EQUAL_SIGN)