A load of fixes of issues reported by sparse. Closes bug #152849

2004-09-17  Kjartan Maraas  <kmaraas@gnome.org>

	* src/bell.c: (meta_bell_flash_screen):
	* src/compositor.c:
	* src/effects.c: (meta_effects_draw_box_animation):
	* src/fixedtip.c: (meta_fixed_tip_show):
	* src/frame.c: (find_argb_visual):
	* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
	(meta_frames_apply_shapes):
	* src/iconcache.c: (find_largest_sizes), (find_best_size):
	* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
	* src/main.c: (main):
	* src/menu.c: (meta_window_menu_new):
	* src/prefs.c: (meta_prefs_get_visual_bell),
	(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
	(meta_prefs_get_action_double_click_titlebar),
	(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
	(meta_prefs_get_reduced_resources):
	* src/screen.c: (meta_create_offscreen_window):
	* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
	* src/theme-parser.c: (meta_theme_load):
	* src/theme.c: (meta_gtk_widget_get_font_desc):
	* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
	* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
	reported by sparse. Closes bug #152849
This commit is contained in:
Kjartan Maraas 2004-09-16 23:18:22 +00:00 committed by Kjartan Maraas
parent 9d9c744490
commit 43cc3b8606
18 changed files with 69 additions and 46 deletions

View File

@ -1,3 +1,29 @@
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-15 Elijah Newren <newren@math.utah.edu>
* src/display.c (event_callback): Remove some redundant code

View File

@ -34,7 +34,7 @@ meta_bell_flash_screen (MetaDisplay *display,
if (screen->flash_window == None)
{
Visual *visual = CopyFromParent;
Visual *visual = (Visual *)CopyFromParent;
XSetWindowAttributes xswa;
int depth = CopyFromParent;
xswa.save_under = True;

View File

@ -100,7 +100,7 @@ struct MetaCompositor
guint have_composite : 1;
guint have_damage : 1;
guint have_fixes : 1;
#if HAVE_NAME_WINDOW_PIXMAP
#ifdef HAVE_NAME_WINDOW_PIXMAP
guint have_name_window_pixmap : 1;
#endif
};

View File

@ -382,7 +382,7 @@ meta_effects_draw_box_animation (MetaScreen *screen,
0,
CopyFromParent,
CopyFromParent,
CopyFromParent,
(Visual *)CopyFromParent,
CWOverrideRedirect | CWBackPixel,
&attrs);

View File

@ -64,10 +64,8 @@ meta_fixed_tip_show (Display *xdisplay, int screen_number,
gtk_widget_set_name (tip, "gtk-tooltips");
gtk_container_set_border_width (GTK_CONTAINER (tip), 4);
gtk_signal_connect_object (GTK_OBJECT (tip),
"expose_event",
GTK_SIGNAL_FUNC (expose_handler),
NULL);
g_signal_connect_swapped (tip, "expose_event",
G_CALLBACK (expose_handler), NULL);
label = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
@ -76,10 +74,8 @@ meta_fixed_tip_show (Display *xdisplay, int screen_number,
gtk_container_add (GTK_CONTAINER (tip), label);
gtk_signal_connect (GTK_OBJECT (tip),
"destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&tip);
g_signal_connect (tip, "destroy",
G_CALLBACK (gtk_widget_destroyed), &tip);
}
gtk_label_set_markup (GTK_LABEL (label), markup_text);

View File

@ -63,7 +63,7 @@ find_argb_visual (MetaDisplay *display,
&template,
&nvi);
if (!xvi)
return 0;
return NULL;
visual = NULL;

View File

@ -159,7 +159,7 @@ unsigned_long_hash (gconstpointer v)
gulong val = * (const gulong *) v;
/* I'm not sure this works so well. */
#if G_SIZEOF_LONG > 4
#if GLIB_SIZEOF_LONG > 4
return (guint) (val ^ (val >> 32));
#else
return val;
@ -472,7 +472,6 @@ meta_frames_manage_window (MetaFrames *frames,
GdkWindow *window)
{
MetaUIFrame *frame;
GdkColor col;
g_assert (window);
@ -853,7 +852,7 @@ meta_frames_apply_shapes (MetaFrames *frames,
0,
CopyFromParent,
CopyFromParent,
CopyFromParent,
(Visual *)CopyFromParent,
CWOverrideRedirect,
&attrs);

View File

@ -66,7 +66,7 @@ find_largest_sizes (gulong *data,
w = data[0];
h = data[1];
if (nitems < ((w * h) + 2))
if (nitems < ((gulong)(w * h) + 2))
return FALSE; /* not enough data */
*width = MAX (w, *width);
@ -122,7 +122,7 @@ find_best_size (gulong *data,
w = data[0];
h = data[1];
if (nitems < ((w * h) + 2))
if (nitems < ((gulong)(w * h) + 2))
break; /* not enough data */
if (best_start == NULL)

View File

@ -2553,7 +2553,7 @@ meta_spawn_command_line_async_on_screen (const gchar *command_line,
GError **error)
{
gboolean retval;
gchar **argv = 0;
gchar **argv = NULL;
g_return_val_if_fail (command_line != NULL, FALSE);
@ -3379,6 +3379,7 @@ handle_workspace_switch (MetaDisplay *display,
}
}
#if 0
static void
handle_spew_mark (MetaDisplay *display,
MetaScreen *screen,
@ -3388,6 +3389,7 @@ handle_spew_mark (MetaDisplay *display,
{
meta_verbose ("-- MARK MARK MARK MARK --\n");
}
#endif
void
meta_set_keybindings_disabled (gboolean setting)

View File

@ -186,11 +186,11 @@ main (int argc, char **argv)
act.sa_handler = SIG_IGN;
act.sa_mask = empty_mask;
act.sa_flags = 0;
if (sigaction (SIGPIPE, &act, 0) < 0)
if (sigaction (SIGPIPE, &act, NULL) < 0)
g_printerr ("Failed to register SIGPIPE handler: %s\n",
g_strerror (errno));
#ifdef SIGXFSZ
if (sigaction (SIGXFSZ, &act, 0) < 0)
if (sigaction (SIGXFSZ, &act, NULL) < 0)
g_printerr ("Failed to register SIGXFSZ handler: %s\n",
g_strerror (errno));
#endif

View File

@ -421,10 +421,8 @@ meta_window_menu_new (MetaFrames *frames,
else
meta_verbose ("not creating workspace menu\n");
gtk_signal_connect (GTK_OBJECT (menu->menu),
"selection_done",
GTK_SIGNAL_FUNC (menu_closed),
menu);
g_signal_connect (menu->menu, "selection_done",
G_CALLBACK (menu_closed), menu);
return menu;
}

View File

@ -1975,19 +1975,19 @@ meta_prefs_get_button_layout (MetaButtonLayout *button_layout_p)
}
gboolean
meta_prefs_get_visual_bell ()
meta_prefs_get_visual_bell (void)
{
return provide_visual_bell;
}
gboolean
meta_prefs_bell_is_audible ()
meta_prefs_bell_is_audible (void)
{
return bell_is_audible;
}
MetaVisualBellType
meta_prefs_get_visual_bell_type ()
meta_prefs_get_visual_bell_type (void)
{
return visual_bell_type;
}
@ -2010,25 +2010,25 @@ meta_prefs_get_window_bindings (const MetaKeyPref **bindings,
}
MetaActionDoubleClickTitlebar
meta_prefs_get_action_double_click_titlebar ()
meta_prefs_get_action_double_click_titlebar (void)
{
return action_double_click_titlebar;
}
gboolean
meta_prefs_get_auto_raise ()
meta_prefs_get_auto_raise (void)
{
return auto_raise;
}
int
meta_prefs_get_auto_raise_delay ()
meta_prefs_get_auto_raise_delay (void)
{
return auto_raise_delay;
}
gboolean
meta_prefs_get_reduced_resources ()
meta_prefs_get_reduced_resources (void)
{
return reduced_resources;
}

View File

@ -1769,7 +1769,7 @@ meta_create_offscreen_window (Display *xdisplay,
0,
CopyFromParent,
CopyFromParent,
CopyFromParent,
(Visual *)CopyFromParent,
CWOverrideRedirect | CWEventMask,
&attrs);
}

View File

@ -473,7 +473,7 @@ meta_ui_tab_popup_get_selected (MetaTabPopup *popup)
return te->key;
}
else
return None;
return (MetaTabEntryKey)None;
}
void

View File

@ -4350,7 +4350,7 @@ meta_theme_load (const char *theme_name,
g_propagate_error (err, error);
g_free (theme_file);
g_free (theme_dir);
return FALSE; /* all fallbacks failed */
return NULL; /* all fallbacks failed */
}
}

View File

@ -1602,6 +1602,7 @@ pos_tokenize (const char *expr,
return FALSE;
}
#if 0
static void
debug_print_tokens (PosToken *tokens,
int n_tokens)
@ -1642,6 +1643,7 @@ debug_print_tokens (PosToken *tokens,
g_print ("\n");
}
#endif
typedef enum
{
@ -1661,6 +1663,7 @@ typedef struct
} d;
} PosExpr;
#if 0
static void
debug_print_exprs (PosExpr *exprs,
int n_exprs)
@ -1687,6 +1690,7 @@ debug_print_exprs (PosExpr *exprs,
}
g_print ("\n");
}
#endif
static gboolean
do_operation (PosExpr *a,
@ -5157,7 +5161,7 @@ meta_gtk_widget_get_font_desc (GtkWidget *widget,
{
PangoFontDescription *font_desc;
g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), 0);
g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL);
font_desc = pango_font_description_copy (widget->style->font_desc);

View File

@ -211,12 +211,10 @@ mouse_press (GtkWidget *invisible,
if (event->type == GDK_BUTTON_PRESS &&
event->button == 1)
{
gtk_signal_connect (GTK_OBJECT (invisible), "motion_notify_event",
GTK_SIGNAL_FUNC (mouse_motion),
NULL);
gtk_signal_connect (GTK_OBJECT (invisible), "button_release_event",
GTK_SIGNAL_FUNC (mouse_release),
NULL);
g_signal_connect (invisible, "motion_notify_event",
G_CALLBACK (mouse_motion), NULL);
g_signal_connect (invisible, "button_release_event",
G_CALLBACK (mouse_release), NULL);
gtk_signal_disconnect_by_func (GTK_OBJECT (invisible),
GTK_SIGNAL_FUNC (mouse_press),
NULL);
@ -264,10 +262,10 @@ begin_area_grab (void)
gtk_grab_add (grab_widget);
gtk_signal_connect (GTK_OBJECT (grab_widget), "button_press_event",
GTK_SIGNAL_FUNC (mouse_press), NULL);
gtk_signal_connect (GTK_OBJECT (grab_widget), "key_press_event",
GTK_SIGNAL_FUNC (key_press), NULL);
g_signal_connect (grab_widget, "button_press_event",
G_CALLBACK (mouse_press), NULL);
g_signal_connect (grab_widget, "key_press_event",
G_CALLBACK (key_press), NULL);
}
int

View File

@ -443,7 +443,7 @@ meta_unsigned_long_hash (gconstpointer v)
gulong val = * (const gulong *) v;
/* I'm not sure this works so well. */
#if G_SIZEOF_LONG > 4
#if GLIB_SIZEOF_LONG > 4
return (guint) (val ^ (val >> 32));
#else
return val;