Commit e4c8d29a authored by Jan D's avatar Jan D

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 *)
parent 898b4c5c
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.
......
......@@ -26,6 +26,7 @@ Boston, MA 02110-1301, USA. */
#include <stdio.h>
#include <setjmp.h>
#include <ctype.h>
#include "../src/lisp.h"
......@@ -151,7 +152,6 @@ fill_xft_data (struct widget_xft_data *data, Widget widget, XftFont *font)
{
Pixel bg, fg;
XColor colors[2];
int screen = XScreenNumberOfScreen (XtScreen (widget));
data->widget = widget;
data->xft_font = font;
......@@ -252,7 +252,9 @@ draw_text (struct widget_xft_data *data, char *lbl, int inverse)
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 @@ draw_text (struct widget_xft_data *data, char *lbl, int inverse)
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 @@ find_xft_data (Widget widget)
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 @@ static char overrideTrans[] =
/* 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 @@ xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data)
}
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 @@ wm_delete_window (Widget w, XtPointer closure, XtPointer call_data)
if (XtIsSubclass (widget, dialogWidgetClass))
break;
}
if (! widget) return;
id = lw_get_widget_id (widget);
if (! id) abort ();
......
......@@ -185,10 +185,11 @@ xlwMenuResources[] =
};
#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 @@ display_menu_item (mw, val, ws, where, highlighted_p, horizontal_p,
#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 @@ make_windows_if_needed (XlwMenuWidget mw, int n)
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 @@ openXftFont (XlwMenuWidget mw)
#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 @@ static void
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 @@ facename_changed (XlwMenuWidget newmw,
#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;
......
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
......
This diff is collapsed.
......@@ -100,7 +100,10 @@ struct xsettings
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 @@ something_changedCB (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpoi
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 @@ get_prop_window (struct x_display_info *dpyinfo)
*/
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 @@ parse_settings (unsigned char *prop, long unsigned int bytes, struct xsettings *
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 @@ read_settings (struct x_display_info *dpyinfo, struct xsettings *settings)
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 @@ static void
init_gconf (void)
{
#if defined (HAVE_GCONF) && defined (HAVE_XFT)
int i;
char *s;
g_type_init ();
......
......@@ -42,6 +42,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#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 @@ smc_save_yourself_CB (SmcConn smcConn,
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 @@ smc_save_yourself_CB (SmcConn smcConn,
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 @@ ice_conn_watch_CB (IceConn iceConn, IcePointer clientData, int opening, IcePoint
/* 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 @@ create_client_leader_window (struct x_display_info *dpyinfo, char *client_id)
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 @@ x_session_initialize (struct x_display_info *dpyinfo)
/* 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 @@ x_session_initialize (struct x_display_info *dpyinfo)
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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment