Lots of tiny fixes to make sure we compile with "gcc -ansi -Werror".

2008-02-27  Thomas Thurman  <tthurman@gnome.org>

	Lots of tiny fixes to make sure we compile with
	"gcc -ansi -Werror".


svn path=/trunk/; revision=3606
This commit is contained in:
Thomas Thurman 2008-02-27 04:39:10 +00:00 committed by Thomas James Alexander Thurman
parent 401b716cf5
commit 85631aec0f
14 changed files with 65 additions and 29 deletions

View File

@ -1,3 +1,8 @@
2008-02-27 Thomas Thurman <tthurman@gnome.org>
Lots of tiny fixes to make sure we compile with
"gcc -ansi -Werror".
2008-02-26 Jens Granseuer <jensgr@gmx.net> 2008-02-26 Jens Granseuer <jensgr@gmx.net>
* src/core/constraints.c (constrain_aspect_ratio, * src/core/constraints.c (constrain_aspect_ratio,

View File

@ -29,7 +29,6 @@
#include "boxes.h" #include "boxes.h"
#include "util.h" #include "util.h"
#include <X11/Xutil.h> /* Just for the definition of the various gravities */ #include <X11/Xutil.h> /* Just for the definition of the various gravities */
#include <stdio.h> /* For snprintf */
char* char*
meta_rectangle_to_string (const MetaRectangle *rect, meta_rectangle_to_string (const MetaRectangle *rect,
@ -61,7 +60,7 @@ meta_rectangle_region_to_string (GList *region,
char *cur = output; char *cur = output;
if (region == NULL) if (region == NULL)
snprintf (output, 10, "(EMPTY)"); g_snprintf (output, 10, "(EMPTY)");
while (tmp) while (tmp)
{ {
@ -114,7 +113,7 @@ meta_rectangle_edge_list_to_string (GList *edge_list,
GList *tmp = edge_list; GList *tmp = edge_list;
if (edge_list == NULL) if (edge_list == NULL)
snprintf (output, 10, "(EMPTY)"); g_snprintf (output, 10, "(EMPTY)");
while (tmp) while (tmp)
{ {

View File

@ -21,6 +21,9 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#define _GNU_SOURCE
#define _XOPEN_SOURCE 500 /* for usleep() */
#include <config.h> #include <config.h>
#include <stdlib.h> #include <stdlib.h>
@ -1310,7 +1313,7 @@ add_damage (MetaScreen *screen,
MetaDisplay *display = screen->display; MetaDisplay *display = screen->display;
MetaCompScreen *info = screen->compositor_data; MetaCompScreen *info = screen->compositor_data;
// dump_xserver_region ("add_damage", display, damage); /* dump_xserver_region ("add_damage", display, damage); */
if (info->all_damage) if (info->all_damage)
{ {

View File

@ -91,7 +91,7 @@
typedef enum typedef enum
{ {
PRIORITY_MINIMUM = 0, // Dummy value used for loop start = min(all priorities) PRIORITY_MINIMUM = 0, /* Dummy value used for loop start = min(all priorities) */
PRIORITY_ASPECT_RATIO = 0, PRIORITY_ASPECT_RATIO = 0,
PRIORITY_ENTIRELY_VISIBLE_ON_SINGLE_XINERAMA = 0, PRIORITY_ENTIRELY_VISIBLE_ON_SINGLE_XINERAMA = 0,
PRIORITY_ENTIRELY_VISIBLE_ON_WORKAREA = 1, PRIORITY_ENTIRELY_VISIBLE_ON_WORKAREA = 1,
@ -101,7 +101,7 @@ typedef enum
PRIORITY_SIZE_HINTS_LIMITS = 3, PRIORITY_SIZE_HINTS_LIMITS = 3,
PRIORITY_TITLEBAR_VISIBLE = 4, PRIORITY_TITLEBAR_VISIBLE = 4,
PRIORITY_PARTIALLY_VISIBLE_ON_WORKAREA = 4, PRIORITY_PARTIALLY_VISIBLE_ON_WORKAREA = 4,
PRIORITY_MAXIMUM = 4 // Dummy value used for loop end = max(all priorities) PRIORITY_MAXIMUM = 4 /* Dummy value used for loop end = max(all priorities) */
} ConstraintPriority; } ConstraintPriority;
typedef enum typedef enum

View File

@ -22,6 +22,9 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#define _GNU_SOURCE
#define _SVID_SOURCE /* for gethostname() */
#include <config.h> #include <config.h>
#include "util.h" #include "util.h"
#include "window.h" #include "window.h"

View File

@ -23,6 +23,9 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#define _GNU_SOURCE
#define _SVID_SOURCE /* for putenv() */
#include <config.h> #include <config.h>
#include "keybindings.h" #include "keybindings.h"
#include "workspace.h" #include "workspace.h"

View File

@ -40,6 +40,9 @@
* to investigate, read main(), meta_display_open(), and event_callback(). * to investigate, read main(), meta_display_open(), and event_callback().
*/ */
#define _GNU_SOURCE
#define _SVID_SOURCE /* for putenv() and some signal-related functions */
#include <config.h> #include <config.h>
#include "main.h" #include "main.h"
#include "util.h" #include "util.h"
@ -331,7 +334,7 @@ main (int argc, char **argv)
NULL, G_LOG_DOMAIN, "Gtk", "Gdk", "GLib", NULL, G_LOG_DOMAIN, "Gtk", "Gdk", "GLib",
"Pango", "GLib-GObject", "GThread" "Pango", "GLib-GObject", "GThread"
}; };
gint i; guint i;
if (setlocale (LC_ALL, "") == NULL) if (setlocale (LC_ALL, "") == NULL)
meta_warning ("Locale not understood by C library, internationalization will not work\n"); meta_warning ("Locale not understood by C library, internationalization will not work\n");

View File

@ -41,6 +41,7 @@ typedef enum
META_BOTTOM META_BOTTOM
} MetaWindowDirection; } MetaWindowDirection;
#if 0 /* never used -- remove if nobody wants it */
static gint static gint
northwestcmp (gconstpointer a, gconstpointer b) northwestcmp (gconstpointer a, gconstpointer b)
{ {
@ -86,7 +87,9 @@ northwestcmp (gconstpointer a, gconstpointer b)
else else
return 0; return 0;
} }
#endif /* 0 -- never used */
#if 0 /* never used -- remove if nobody wants it */
static void static void
find_next_cascade (MetaWindow *window, find_next_cascade (MetaWindow *window,
MetaFrameGeometry *fgeom, MetaFrameGeometry *fgeom,
@ -234,6 +237,7 @@ find_next_cascade (MetaWindow *window,
*new_y = cascade_y + fgeom->top_height; *new_y = cascade_y + fgeom->top_height;
} }
} }
#endif /* 0 -- never used */
static void static void
find_most_freespace (MetaWindow *window, find_most_freespace (MetaWindow *window,

View File

@ -625,15 +625,15 @@ test_regions_okay ()
/*************************************************************/ /*************************************************************/
region = get_screen_region (3); region = get_screen_region (3);
tmp = NULL; tmp = NULL;
tmp = g_list_prepend (tmp, new_meta_rect ( 380, 675, 420, 525)); // 220500 tmp = g_list_prepend (tmp, new_meta_rect ( 380, 675, 420, 525)); /* 220500 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 300, 1180)); // 354000 tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 300, 1180)); /* 354000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 380, 20, 320, 1180)); // 377600 tmp = g_list_prepend (tmp, new_meta_rect ( 380, 20, 320, 1180)); /* 377600 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 800, 475)); // 380000 tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 800, 475)); /* 380000 */
tmp = g_list_prepend (tmp, new_meta_rect (1200, 20, 400, 1180)); // 472000 tmp = g_list_prepend (tmp, new_meta_rect (1200, 20, 400, 1180)); /* 472000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 1600, 425)); // 680000 tmp = g_list_prepend (tmp, new_meta_rect ( 0, 675, 1600, 425)); /* 680000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 900, 20, 700, 1080)); // 756000 tmp = g_list_prepend (tmp, new_meta_rect ( 900, 20, 700, 1080)); /* 756000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 700, 1130)); // 791000 tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 700, 1130)); /* 791000 */
tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 1600, 505)); // 808000 tmp = g_list_prepend (tmp, new_meta_rect ( 0, 20, 1600, 505)); /* 808000 */
#if 0 #if 0
printf ("Got to here...\n"); printf ("Got to here...\n");
char region_list[(RECT_LENGTH+2) * g_list_length (region)]; char region_list[(RECT_LENGTH+2) * g_list_length (region)];

View File

@ -22,6 +22,9 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#define _GNU_SOURCE
#define _POSIX_C_SOURCE /* for fdopen() */
#include <config.h> #include <config.h>
#include "util.h" #include "util.h"
#include "main.h" #include "main.h"

View File

@ -22,6 +22,9 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#define _GNU_SOURCE
#define _SVID_SOURCE /* for gethostname() */
#include <config.h> #include <config.h>
#include "window-props.h" #include "window-props.h"
#include "errors.h" #include "errors.h"

View File

@ -627,17 +627,20 @@ meta_window_new_with_attrs (MetaDisplay *display,
parent = meta_display_lookup_x_window (window->display, parent = meta_display_lookup_x_window (window->display,
window->xtransient_for); window->xtransient_for);
// First, maybe the app was launched with startup notification using an /* First, maybe the app was launched with startup notification using an
// obsolete version of the spec; use that timestamp if it exists. * obsolete version of the spec; use that timestamp if it exists.
*/
if (window->initial_timestamp_set) if (window->initial_timestamp_set)
// NOTE: Do NOT toggle net_wm_user_time_set to true; this is just /* NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
// being recorded as a fallback for potential transients * being recorded as a fallback for potential transients
*/
window->net_wm_user_time = window->initial_timestamp; window->net_wm_user_time = window->initial_timestamp;
else if (parent != NULL) else if (parent != NULL)
meta_window_set_user_time(window, parent->net_wm_user_time); meta_window_set_user_time(window, parent->net_wm_user_time);
else else
// NOTE: Do NOT toggle net_wm_user_time_set to true; this is just /* NOTE: Do NOT toggle net_wm_user_time_set to true; this is just
// being recorded as a fallback for potential transients * being recorded as a fallback for potential transients
*/
window->net_wm_user_time = window->net_wm_user_time =
meta_display_get_current_time_roundtrip (window->display); meta_display_get_current_time_roundtrip (window->display);
} }
@ -5085,10 +5088,10 @@ meta_window_client_message (MetaWindow *window,
meta_window_move_resize_request(window, meta_window_move_resize_request(window,
value_mask, value_mask,
gravity, gravity,
event->xclient.data.l[1], // x event->xclient.data.l[1], /* x */
event->xclient.data.l[2], // y event->xclient.data.l[2], /* y */
event->xclient.data.l[3], // width event->xclient.data.l[3], /* width */
event->xclient.data.l[4]); // height event->xclient.data.l[4]); /* height */
} }
else if (event->xclient.message_type == else if (event->xclient.message_type ==
display->atom_net_active_window) display->atom_net_active_window)
@ -5892,7 +5895,7 @@ meta_window_update_struts (MetaWindow *window)
strut_end = struts[4+(i*2)+1]; strut_end = struts[4+(i*2)+1];
temp = g_new (MetaStrut, 1); temp = g_new (MetaStrut, 1);
temp->side = 1 << i; // See MetaDirection def. Matches nicely, eh? temp->side = 1 << i; /* See MetaDirection def. Matches nicely, eh? */
temp->rect = window->screen->rect; temp->rect = window->screen->rect;
switch (temp->side) switch (temp->side)
{ {

View File

@ -19,6 +19,9 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#define _GNU_SOURCE
#define _XOPEN_SOURCE 600 /* C99 -- for rint() */
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>

View File

@ -21,6 +21,10 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
#define _GNU_SOURCE
#define _XOPEN_SOURCE 600 /* for the maths routines over floats */
#include <math.h>
#include "preview-widget.h" #include "preview-widget.h"
static void meta_preview_class_init (MetaPreviewClass *klass); static void meta_preview_class_init (MetaPreviewClass *klass);
@ -470,7 +474,7 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
MetaFrameLayout *fgeom; MetaFrameLayout *fgeom;
MetaFrameStyle *frame_style; MetaFrameStyle *frame_style;
g_return_if_fail (META_IS_PREVIEW (preview)); g_return_val_if_fail (META_IS_PREVIEW (preview), NULL);
flags = (META_PREVIEW (preview)->flags); flags = (META_PREVIEW (preview)->flags);