diff src/xsmfns.c @ 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 c25c24812fb1
children 750db9f3e6d8
line wrap: on
line diff
--- 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.  */