changeset 109141:fa173b9bd9ce

Fix some bad prototypes and formatting after conversion from K&R declaration. * lwlib/lwlib-Xaw.c: Include <ctype.h> for isdigit. (fill_xft_data, set_text): Remove unused variable screen. (draw_text): Cast bp to FcChar8*. (find_xft_data): Return 0 if inst or xft_data is not set. (wm_delete_window): Correct prototype. Initialize widget to 0 and return if widget is still 0 after loop. * lwlib/xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype. (display_menu_item): Remove unused variable gi. (make_windows_if_needed): Remove unused variable screen. (XlwMenuRedisplay): Remove unused variable i. * src/gtkutil.c (xg_get_pixbuf_from_pix_and_mask) (xg_get_image_for_pixmap, create_dialog) (xg_get_file_with_selection, xg_get_file_name, update_cl_data) (menuitem_highlight_callback, make_menu_item) (xg_create_one_menuitem, create_menus, xg_update_menu_item) (xg_create_scroll_bar, xg_update_scrollbar_pos) (xg_set_toolkit_scroll_bar_thumb, xg_tool_bar_button_cb) (xg_tool_bar_proxy_help_callback, xg_tool_bar_detach_callback) (xg_tool_bar_attach_callback, xg_tool_bar_help_callback) (xg_tool_bar_item_expose_callback): Reformat prototype. (xg_update_menubar): GList *group => GSList *group. (xg_modify_menubar_widgets): Initialize witem to 0, check witem != 0 before use. (update_frame_tool_bar): 4:th param to xg_get_image_for_pixmap changed to GTK_IMAGE (wimage). * src/xsettings.c (something_changedCB, parse_settings) (apply_xft_settings): Reformat prototype. (something_changedCB, init_gconf): Remove unused variable i. (read_settings): Remove unused variable long_len. * src/xsmfns.c (SSDATA): New macro. (smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings passed to strlen/strcpy/strcat. (create_client_leader_window): Surround with #ifndef USE_GTK. Cast 7:th arg to XChangeProperty to (unsigned char *)
author Jan D <jan.h.d@swipnet.se>
date Mon, 05 Jul 2010 11:17:12 +0200
parents 3e48102ba93a
children 30e7117b54cd
files lwlib/ChangeLog lwlib/lwlib-Xaw.c lwlib/xlwmenu.c src/ChangeLog src/gtkutil.c src/xsettings.c src/xsmfns.c
diffstat 7 files changed, 180 insertions(+), 77 deletions(-) [+]
line wrap: on
line diff
--- a/lwlib/ChangeLog	Sun Jul 04 21:57:13 2010 -0700
+++ b/lwlib/ChangeLog	Mon Jul 05 11:17:12 2010 +0200
@@ -1,3 +1,17 @@
+2010-07-05  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype.
+	(display_menu_item): Remove unused variable gi.
+	(make_windows_if_needed): Remove unused variable screen.
+	(XlwMenuRedisplay): Remove unused variable i.
+
+	* lwlib-Xaw.c: Include <ctype.h> for isdigit.
+	(fill_xft_data, set_text): Remove unused variable screen.
+	(draw_text): Cast bp to FcChar8*.
+	(find_xft_data): Return 0 if inst or xft_data is not set.
+	(wm_delete_window): Correct prototype.  Initialize widget to 0
+	and return if widget is still 0 after loop.
+
 2010-07-04  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* lwlib-Xaw.c: Convert function definitions to standard C.
--- a/lwlib/lwlib-Xaw.c	Sun Jul 04 21:57:13 2010 -0700
+++ b/lwlib/lwlib-Xaw.c	Mon Jul 05 11:17:12 2010 +0200
@@ -26,6 +26,7 @@
 
 #include <stdio.h>
 #include <setjmp.h>
+#include <ctype.h>
 
 #include "../src/lisp.h"
 
@@ -151,7 +152,6 @@
 {
   Pixel bg, fg;
   XColor colors[2];
-  int screen = XScreenNumberOfScreen (XtScreen (widget));
 
   data->widget = widget;
   data->xft_font = font;
@@ -252,7 +252,9 @@
       char *cp = strchr (bp, '\n');
       XftDrawStringUtf8 (data->xft_draw,
                          inverse ? &data->xft_bg : &data->xft_fg,
-                         data->xft_font, x, y, bp, cp ? cp - bp : strlen (bp));
+                         data->xft_font, x, y,
+                         (FcChar8 *) bp,
+                         cp ? cp - bp : strlen (bp));
       bp = cp ? cp + 1 : NULL;
       /* 1.2 gives reasonable line spacing.  */
       y += data->xft_font->height * 1.2;
@@ -264,7 +266,6 @@
 static void
 set_text (struct widget_xft_data *data, Widget toplevel, char *lbl, int margin)
 {
-  int screen = XScreenNumberOfScreen (XtScreen (data->widget));
   int width, height;
 
   width = get_text_width_and_height (data->widget, lbl, data->xft_font,
@@ -293,7 +294,7 @@
       inst = lw_get_widget_instance (parent);
       parent = XtParent (parent);
     }
-  if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return;
+  if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return 0;
 
   for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr) 
     {
@@ -550,7 +551,10 @@
 /* Dialogs pop down on any key press */
 static char dialogOverride[] =
        "<KeyPress>Escape:	lwlib_delete_dialog()";
-static void wm_delete_window(Widget w, XtPointer closure, XtPointer call_data);
+static void wm_delete_window (Widget w,
+                              XEvent *event,
+                              String *params,
+                              Cardinal *num_params);
 static XtActionsRec xaw_actions [] = {
   {"lwlib_delete_dialog", wm_delete_window}
 };
@@ -851,13 +855,16 @@
 }
 
 static void
-wm_delete_window (Widget w, XtPointer closure, XtPointer call_data)
+wm_delete_window (Widget w,
+                  XEvent *event,
+                  String *params,
+                  Cardinal *num_params)
 {
   LWLIB_ID id;
   Cardinal nkids;
   int i;
   Widget *kids = 0;
-  Widget widget, shell;
+  Widget widget = 0, shell;
 
   if (XtIsSubclass (w, dialogWidgetClass))
     shell = XtParent (w);
@@ -876,6 +883,8 @@
       if (XtIsSubclass (widget, dialogWidgetClass))
 	break;
     }
+  if (! widget) return;
+
   id = lw_get_widget_id (widget);
   if (! id) abort ();
 
--- a/lwlib/xlwmenu.c	Sun Jul 04 21:57:13 2010 -0700
+++ b/lwlib/xlwmenu.c	Mon Jul 05 11:17:12 2010 +0200
@@ -185,10 +185,11 @@
 };
 #undef offset
 
-static Boolean XlwMenuSetValues(Widget current, Widget request, Widget new);
+static Boolean XlwMenuSetValues(Widget current, Widget request, Widget new,
+                                ArgList args, Cardinal *num_args);
 static void XlwMenuRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes);
 static void XlwMenuResize(Widget w);
-static void XlwMenuInitialize(Widget request, XlwMenuWidget mw, ArgList args, Cardinal *num_args);
+static void XlwMenuInitialize(Widget request, Widget mw, ArgList args, Cardinal *num_args);
 static void XlwMenuRedisplay(Widget w, XEvent *ev, Region region);
 static void XlwMenuDestroy(Widget w);
 static void XlwMenuClassInitialize(void);
@@ -1086,7 +1087,6 @@
 #ifdef HAVE_XFT
                   if (ws->xft_draw)
                     {
-                      XGlyphInfo gi;
                       int draw_x = ws->width - ws->max_rest_width
                         + mw->menu.arrow_spacing;
                       int draw_y = y + v_spacing + shadow + font_ascent;
@@ -1277,9 +1277,6 @@
   int i;
   int start_at;
   window_state* windows;
-#ifdef HAVE_XFT
-  int screen = XScreenNumberOfScreen (mw->core.screen);
-#endif
 
   if (mw->menu.windows_length >= n)
     return;
@@ -1852,10 +1849,10 @@
 #endif
 
 static void
-XlwMenuInitialize (Widget request, XlwMenuWidget mw, ArgList args, Cardinal *num_args)
+XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
 {
   /* Get the GCs and the widget size */
-
+  XlwMenuWidget mw = (XlwMenuWidget) w;
   Window window = RootWindowOfScreen (DefaultScreenOfDisplay (XtDisplay (mw)));
   Display* display = XtDisplay (mw);
 
@@ -2003,7 +2000,6 @@
 XlwMenuRedisplay (Widget w, XEvent *ev, Region region)
 {
   XlwMenuWidget mw = (XlwMenuWidget)w;
-  int i;
 
   /* If we have a depth beyond 1, it's because a submenu was displayed.
      If the submenu has been destroyed, set the depth back to 1.  */
@@ -2106,7 +2102,8 @@
 #endif
 
 static Boolean
-XlwMenuSetValues (Widget current, Widget request, Widget new)
+XlwMenuSetValues (Widget current, Widget request, Widget new,
+                  ArgList args, Cardinal *num_args)
 {
   XlwMenuWidget oldmw = (XlwMenuWidget)current;
   XlwMenuWidget newmw = (XlwMenuWidget)new;
--- a/src/ChangeLog	Sun Jul 04 21:57:13 2010 -0700
+++ b/src/ChangeLog	Mon Jul 05 11:17:12 2010 +0200
@@ -1,3 +1,32 @@
+2010-07-05  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xsmfns.c (SSDATA): New macro.
+	(smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings
+	passed to strlen/strcpy/strcat.
+	(create_client_leader_window): Surround with #ifndef USE_GTK.  Cast
+	7:th arg to XChangeProperty to (unsigned char *)
+
+	* xsettings.c (something_changedCB, parse_settings)
+	(apply_xft_settings): Reformat prototype.
+	(something_changedCB, init_gconf): Remove unused variable i.
+	(read_settings): Remove unused variable long_len.
+
+	* gtkutil.c (xg_get_pixbuf_from_pix_and_mask)
+	(xg_get_image_for_pixmap, create_dialog)
+	(xg_get_file_with_selection, xg_get_file_name, update_cl_data)
+	(menuitem_highlight_callback, make_menu_item)
+	(xg_create_one_menuitem, create_menus, xg_update_menu_item)
+	(xg_create_scroll_bar, xg_update_scrollbar_pos)
+	(xg_set_toolkit_scroll_bar_thumb, xg_tool_bar_button_cb)
+	(xg_tool_bar_proxy_help_callback, xg_tool_bar_detach_callback)
+	(xg_tool_bar_attach_callback, xg_tool_bar_help_callback)
+	(xg_tool_bar_item_expose_callback): Reformat prototype.
+	(xg_update_menubar): GList *group => GSList *group.
+	(xg_modify_menubar_widgets): Initialize witem to 0, check witem != 0
+	before use.
+	(update_frame_tool_bar): 4:th param to xg_get_image_for_pixmap changed
+	to GTK_IMAGE (wimage).
+
 2010-07-05  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* atimer.c: Use "" instead of <> for local includes for
--- a/src/gtkutil.c	Sun Jul 04 21:57:13 2010 -0700
+++ b/src/gtkutil.c	Mon Jul 05 11:17:12 2010 +0200
@@ -231,7 +231,9 @@
 /* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel.  */
 
 static GdkPixbuf *
-xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix, GdkPixmap *gmask, GdkColormap *cmap)
+xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix,
+                                 GdkPixmap *gmask,
+                                 GdkColormap *cmap)
 {
   int width, height;
   GdkPixbuf *icon_buf, *tmp_buf;
@@ -309,7 +311,10 @@
    If OLD_WIDGET is not NULL, that widget is modified.  */
 
 static GtkWidget *
-xg_get_image_for_pixmap (FRAME_PTR f, struct image *img, GtkWidget *widget, GtkImage *old_widget)
+xg_get_image_for_pixmap (FRAME_PTR f,
+                         struct image *img,
+                         GtkWidget *widget,
+                         GtkImage *old_widget)
 {
   GdkPixmap *gpix;
   GdkPixmap *gmask;
@@ -1039,7 +1044,9 @@
    Returns the GTK dialog widget.  */
 
 static GtkWidget *
-create_dialog (widget_value *wv, GCallback select_cb, GCallback deactivate_cb)
+create_dialog (widget_value *wv,
+               GCallback select_cb,
+               GCallback deactivate_cb)
 {
   char *title = get_dialog_title (wv->name[0]);
   int total_buttons = wv->name[1] - '0';
@@ -1459,12 +1466,11 @@
    Returns the created widget.  */
 
 static GtkWidget *
-xg_get_file_with_selection (
-     FRAME_PTR f,
-     char *prompt,
-     char *default_filename,
-     int mustmatch_p, int only_dir_p,
-     xg_get_file_func *func)
+xg_get_file_with_selection (FRAME_PTR f,
+                            char *prompt,
+                            char *default_filename,
+                            int mustmatch_p, int only_dir_p,
+                            xg_get_file_func *func)
 {
   GtkWidget *filewin;
   GtkFileSelection *filesel;
@@ -1502,7 +1508,11 @@
    The returned string must be freed by the caller.  */
 
 char *
-xg_get_file_name (FRAME_PTR f, char *prompt, char *default_filename, int mustmatch_p, int only_dir_p)
+xg_get_file_name (FRAME_PTR f,
+                  char *prompt,
+                  char *default_filename,
+                  int mustmatch_p,
+                  int only_dir_p)
 {
   GtkWidget *w = 0;
   char *fn = 0;
@@ -1652,7 +1662,9 @@
    creating the menu bar.  */
 
 static void
-update_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb)
+update_cl_data (xg_menu_cb_data *cl_data,
+                FRAME_PTR f,
+                GCallback highlight_cb)
 {
   if (cl_data)
     {
@@ -1723,7 +1735,9 @@
    Returns FALSE to tell GTK to keep processing this event.  */
 
 static gboolean
-menuitem_highlight_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data)
+menuitem_highlight_callback (GtkWidget *w,
+                             GdkEventCrossing *event,
+                             gpointer client_data)
 {
   GdkEvent ev;
   GtkWidget *subwidget;
@@ -1800,7 +1814,10 @@
    but the MacOS X version doesn't either, so I guess that is OK.  */
 
 static GtkWidget *
-make_menu_item (char *utf8_label, char *utf8_key, widget_value *item, GSList **group)
+make_menu_item (char *utf8_label,
+                char *utf8_key,
+                widget_value *item,
+                GSList **group)
 {
   GtkWidget *w;
   GtkWidget *wtoadd = 0;
@@ -1945,7 +1962,12 @@
    Returns the created GtkWidget.  */
 
 static GtkWidget *
-xg_create_one_menuitem (widget_value *item, FRAME_PTR f, GCallback select_cb, GCallback highlight_cb, xg_menu_cb_data *cl_data, GSList **group)
+xg_create_one_menuitem (widget_value *item,
+                        FRAME_PTR f,
+                        GCallback select_cb,
+                        GCallback highlight_cb,
+                        xg_menu_cb_data *cl_data,
+                        GSList **group)
 {
   char *utf8_label;
   char *utf8_key;
@@ -1988,10 +2010,6 @@
   return w;
 }
 
-static GtkWidget *create_menus (widget_value *, FRAME_PTR, GCallback,
-                                GCallback, GCallback, int, int, int,
-                                GtkWidget *, xg_menu_cb_data *, char *);
-
 /* Create a full menu tree specified by DATA.
    F is the frame the created menu belongs to.
    SELECT_CB is the callback to use when a menu item is selected.
@@ -2015,19 +2033,17 @@
    This function calls itself to create submenus.  */
 
 static GtkWidget *
-create_menus (data, f, select_cb, deactivate_cb, highlight_cb,
-              pop_up_p, menu_bar_p, add_tearoff_p, topmenu, cl_data, name)
-     widget_value *data;
-     FRAME_PTR f;
-     GCallback select_cb;
-     GCallback deactivate_cb;
-     GCallback highlight_cb;
-     int pop_up_p;
-     int menu_bar_p;
-     int add_tearoff_p;
-     GtkWidget *topmenu;
-     xg_menu_cb_data *cl_data;
-     char *name;
+create_menus (widget_value *data,
+              FRAME_PTR f,
+              GCallback select_cb,
+              GCallback deactivate_cb,
+              GCallback highlight_cb,
+              int pop_up_p,
+              int menu_bar_p,
+              int add_tearoff_p,
+              GtkWidget *topmenu,
+              xg_menu_cb_data *cl_data,
+              char *name)
 {
   widget_value *item;
   GtkWidget *wmenu = topmenu;
@@ -2397,7 +2413,7 @@
               Insert X.  */
 
           int nr = pos;
-          GList *group = 0;
+          GSList *group = 0;
           GtkWidget *w = xg_create_one_menuitem (val,
                                                  f,
                                                  select_cb,
@@ -2456,7 +2472,11 @@
    CL_DATA is the data to set in the widget for menu invocation.  */
 
 static void
-xg_update_menu_item (widget_value *val, GtkWidget *w, GCallback select_cb, GCallback highlight_cb, xg_menu_cb_data *cl_data)
+xg_update_menu_item (widget_value *val,
+                     GtkWidget *w,
+                     GCallback select_cb,
+                     GCallback highlight_cb,
+                     xg_menu_cb_data *cl_data)
 {
   GtkWidget *wchild;
   GtkLabel *wlbl = 0;
@@ -2760,7 +2780,7 @@
           GList *iter;
           GtkWidget *sub = 0;
           GtkWidget *newsub;
-          GtkMenuItem *witem;
+          GtkMenuItem *witem = 0;
 
           /* Find sub menu that corresponds to val and update it.  */
           for (iter = list ; iter; iter = g_list_next (iter))
@@ -2783,7 +2803,7 @@
           /* sub may still be NULL.  If we just updated non deep and added
              a new menu bar item, it has no sub menu yet.  So we set the
              newly created sub menu under witem.  */
-          if (newsub != sub)
+          if (newsub != sub && witem != 0)
             {
               xg_set_screen (newsub, f);
               gtk_menu_item_set_submenu (witem, newsub);
@@ -2976,7 +2996,11 @@
    to set resources for the widget.  */
 
 void
-xg_create_scroll_bar (FRAME_PTR f, struct scroll_bar *bar, GCallback scroll_callback, GCallback end_callback, char *scroll_bar_name)
+xg_create_scroll_bar (FRAME_PTR f,
+                      struct scroll_bar *bar,
+                      GCallback scroll_callback,
+                      GCallback end_callback,
+                      char *scroll_bar_name)
 {
   GtkWidget *wscroll;
   GtkWidget *webox;
@@ -3047,7 +3071,12 @@
    WIDTH, HEIGHT is the size in pixels the bar shall have.  */
 
 void
-xg_update_scrollbar_pos (FRAME_PTR f, int scrollbar_id, int top, int left, int width, int height)
+xg_update_scrollbar_pos (FRAME_PTR f,
+                         int scrollbar_id,
+                         int top,
+                         int left,
+                         int width,
+                         int height)
 {
 
   GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id);
@@ -3108,7 +3137,10 @@
    displaying PORTION out of a whole WHOLE, and our position POSITION.  */
 
 void
-xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int position, int whole)
+xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
+                                 int portion,
+                                 int position,
+                                 int whole)
 {
   GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window);
 
@@ -3245,7 +3277,9 @@
    tool bar.  0 is the first button.  */
 
 static gboolean
-xg_tool_bar_button_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
+xg_tool_bar_button_cb (GtkWidget *widget,
+                       GdkEventButton *event,
+                       gpointer user_data)
 {
   /* Casts to avoid warnings when gpointer is 64 bits and int is 32 bits */
   gpointer ptr = (gpointer) (EMACS_INT) event->state;
@@ -3326,7 +3360,9 @@
    the detached tool bar when the detached tool bar it is not expanded.  */
 
 static gboolean
-xg_tool_bar_proxy_help_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data)
+xg_tool_bar_proxy_help_callback (GtkWidget *w,
+                                 GdkEventCrossing *event,
+                                 gpointer client_data)
 {
   GtkWidget *wbutton = GTK_WIDGET (g_object_get_data (G_OBJECT (w),
                                                       XG_TOOL_BAR_PROXY_BUTTON));
@@ -3462,7 +3498,9 @@
    CLIENT_DATA is a pointer to the frame the tool bar belongs to.  */
 
 static void
-xg_tool_bar_detach_callback (GtkHandleBox *wbox, GtkWidget *w, gpointer client_data)
+xg_tool_bar_detach_callback (GtkHandleBox *wbox,
+                             GtkWidget *w,
+                             gpointer client_data)
 {
   FRAME_PTR f = (FRAME_PTR) client_data;
   extern int x_gtk_whole_detached_tool_bar;
@@ -3490,7 +3528,9 @@
    CLIENT_DATA is a pointer to the frame the tool bar belongs to.  */
 
 static void
-xg_tool_bar_attach_callback (GtkHandleBox *wbox, GtkWidget *w, gpointer client_data)
+xg_tool_bar_attach_callback (GtkHandleBox *wbox,
+                             GtkWidget *w,
+                             gpointer client_data)
 {
   FRAME_PTR f = (FRAME_PTR) client_data;
   g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL);
@@ -3517,7 +3557,9 @@
    Returns FALSE to tell GTK to keep processing this event.  */
 
 static gboolean
-xg_tool_bar_help_callback (GtkWidget *w, GdkEventCrossing *event, gpointer client_data)
+xg_tool_bar_help_callback (GtkWidget *w,
+                           GdkEventCrossing *event,
+                           gpointer client_data)
 {
   /* The EMACS_INT cast avoids a warning. */
   int idx = (int) (EMACS_INT) client_data;
@@ -3556,7 +3598,9 @@
    Returns FALSE to tell GTK to keep processing this event.  */
 
 static gboolean
-xg_tool_bar_item_expose_callback (GtkWidget *w, GdkEventExpose *event, gpointer client_data)
+xg_tool_bar_item_expose_callback (GtkWidget *w,
+                                  GdkEventExpose *event,
+                                  gpointer client_data)
 {
   gint width, height;
 
@@ -3849,7 +3893,6 @@
       GtkWidget *wbutton = NULL;
       GtkWidget *weventbox;
       Lisp_Object specified_file;
-      Lisp_Object lbl = PROP (TOOL_BAR_ITEM_LABEL);
       char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL));
       
       ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i);
@@ -4020,7 +4063,8 @@
             }
           else if (img && old_img != img->pixmap)
             {
-              (void) xg_get_image_for_pixmap (f, img, x->widget, wimage);
+              (void) xg_get_image_for_pixmap (f, img, x->widget,
+                                              GTK_IMAGE (wimage));
               g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA,
                                  (gpointer)img->pixmap);
 
--- a/src/xsettings.c	Sun Jul 04 21:57:13 2010 -0700
+++ b/src/xsettings.c	Mon Jul 05 11:17:12 2010 +0200
@@ -100,7 +100,10 @@
    that is SYSTEM_MONO_FONT.  */
 
 static void
-something_changedCB (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
+something_changedCB (GConfClient *client,
+                     guint cnxn_id,
+                     GConfEntry *entry,
+                     gpointer user_data)
 {
   GConfValue *v = gconf_entry_get_value (entry);
   
@@ -108,7 +111,6 @@
   if (v->type == GCONF_VALUE_STRING)
     {
       const char *value = gconf_value_get_string (v);
-      int i;
       if (current_mono_font != NULL && strcmp (value, current_mono_font) == 0)
         return; /* No change. */
 
@@ -222,7 +224,9 @@
 */
 
 static int
-parse_settings (unsigned char *prop, long unsigned int bytes, struct xsettings *settings)
+parse_settings (unsigned char *prop,
+                long unsigned int bytes,
+                struct xsettings *settings)
 {
   Lisp_Object byteorder = Fbyteorder ();
   int my_bo = XFASTINT (byteorder) == 'B' ? MSBFirst : LSBFirst;
@@ -394,7 +398,6 @@
 static int
 read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
 {
-  long long_len;
   Atom act_type;
   int act_form;
   unsigned long nitems, bytes_after;
@@ -423,7 +426,9 @@
 
 
 static void
-apply_xft_settings (struct x_display_info *dpyinfo, int send_event_p, struct xsettings *settings)
+apply_xft_settings (struct x_display_info *dpyinfo,
+                    int send_event_p,
+                    struct xsettings *settings)
 {
 #ifdef HAVE_XFT
   FcPattern *pat;
@@ -620,7 +625,6 @@
 init_gconf (void)
 {
 #if defined (HAVE_GCONF) && defined (HAVE_XFT)
-  int i;
   char *s;
 
   g_type_init ();
--- a/src/xsmfns.c	Sun Jul 04 21:57:13 2010 -0700
+++ b/src/xsmfns.c	Mon Jul 05 11:17:12 2010 +0200
@@ -42,6 +42,9 @@
 #include "termopts.h"
 #include "xterm.h"
 
+/* Avoid "differ in sign" warnings */
+#define SSDATA(x)  ((char *) SDATA (x))
+
 /* The user login name.  */
 
 extern Lisp_Object Vuser_login_name;
@@ -219,7 +222,7 @@
   props[props_idx]->type = SmARRAY8;
   props[props_idx]->num_vals = 1;
   props[props_idx]->vals = &values[val_idx++];
-  props[props_idx]->vals[0].length = strlen (SDATA (Vinvocation_name));
+  props[props_idx]->vals[0].length = strlen (SSDATA (Vinvocation_name));
   props[props_idx]->vals[0].value = SDATA (Vinvocation_name);
   ++props_idx;
 
@@ -263,7 +266,7 @@
   props[props_idx]->type = SmARRAY8;
   props[props_idx]->num_vals = 1;
   props[props_idx]->vals = &values[val_idx++];
-  props[props_idx]->vals[0].length = strlen (SDATA (Vuser_login_name));
+  props[props_idx]->vals[0].length = strlen (SSDATA (Vuser_login_name));
   props[props_idx]->vals[0].value = SDATA (Vuser_login_name);
   ++props_idx;
 
@@ -388,6 +391,7 @@
 
 /* Create the client leader window.  */
 
+#ifndef USE_GTK
 static void
 create_client_leader_window (struct x_display_info *dpyinfo, char *client_id)
 {
@@ -407,10 +411,12 @@
 
   sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False);
   XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace,
-                   client_id, strlen (client_id));
+                   (unsigned char *)client_id, strlen (client_id));
 
   dpyinfo->client_leader_window = w;
 }
+#endif /* ! USE_GTK */
+
 
 /* Try to open a connection to the session manager.  */
 
@@ -429,12 +435,12 @@
   /* Check if we where started by the session manager.  If so, we will
      have a previous id.  */
   if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id))
-    previous_id = SDATA (Vx_session_previous_id);
+    previous_id = SSDATA (Vx_session_previous_id);
 
   /* Construct the path to the Emacs program.  */
   if (! EQ (Vinvocation_directory, Qnil))
-    name_len += strlen (SDATA (Vinvocation_directory));
-  name_len += strlen (SDATA (Vinvocation_name));
+    name_len += strlen (SSDATA (Vinvocation_directory));
+  name_len += strlen (SSDATA (Vinvocation_name));
 
   /* This malloc will not be freed, but it is only done once, and hopefully
      not very large   */
@@ -442,8 +448,8 @@
   emacs_program[0] = '\0';
 
   if (! EQ (Vinvocation_directory, Qnil))
-    strcpy (emacs_program, SDATA (Vinvocation_directory));
-  strcat (emacs_program, SDATA (Vinvocation_name));
+    strcpy (emacs_program, SSDATA (Vinvocation_directory));
+  strcat (emacs_program, SSDATA (Vinvocation_name));
 
   /* The SM protocol says all callbacks are mandatory, so set up all
      here and in the mask passed to SmcOpenConnection.  */