[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r103934: Static checks with GCC 4.6.0
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r103934: Static checks with GCC 4.6.0 and non-default toolkits. |
Date: |
Sat, 16 Apr 2011 16:11:35 -0700 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 103934 [merge]
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2011-04-16 16:11:35 -0700
message:
Static checks with GCC 4.6.0 and non-default toolkits.
modified:
lib-src/ChangeLog
lib-src/emacsclient.c
lib-src/fakemail.c
lib-src/movemail.c
lwlib/ChangeLog
lwlib/lwlib-Xm.c
lwlib/lwlib-utils.c
lwlib/lwlib-utils.h
lwlib/lwlib.c
lwlib/xlwmenu.c
oldXMenu/Activate.c
oldXMenu/AddPane.c
oldXMenu/AddSel.c
oldXMenu/ChangeLog
oldXMenu/Create.c
oldXMenu/Destroy.c
oldXMenu/Error.c
oldXMenu/EvHand.c
oldXMenu/FindPane.c
oldXMenu/FindSel.c
oldXMenu/InsPane.c
oldXMenu/InsSel.c
oldXMenu/Internal.c
oldXMenu/SetAEQ.c
oldXMenu/SetFrz.c
oldXMenu/X10.h
oldXMenu/XDelAssoc.c
oldXMenu/XDestAssoc.c
oldXMenu/XMakeAssoc.c
oldXMenu/XMenu.h
oldXMenu/XMenuInt.h
oldXMenu/insque.c
src/ChangeLog
src/alloc.c
src/bitmaps/cntrpmsk.xbm
src/bitmaps/cntrptr.xbm
src/bitmaps/crosswv.xbm
src/bitmaps/dimple1.xbm
src/bitmaps/dimple3.xbm
src/bitmaps/gray.xbm
src/bitmaps/gray1.xbm
src/bitmaps/gray3.xbm
src/bitmaps/leftpmsk.xbm
src/bitmaps/leftptr.xbm
src/bitmaps/rtpmsk.xbm
src/bitmaps/rtptr.xbm
src/bitmaps/stipple.xbm
src/data.c
src/dispextern.h
src/emacs.c
src/eval.c
src/fns.c
src/frame.c
src/frame.h
src/insdel.c
src/keyboard.c
src/menu.c
src/process.c
src/s/sol2-6.h
src/s/unixware.h
src/s/usg5-4-common.h
src/sysdep.c
src/termhooks.h
src/xdisp.c
src/xfaces.c
src/xfns.c
src/xgselect.c
src/xmenu.c
src/xrdb.c
src/xsmfns.c
src/xterm.c
src/xterm.h
=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2011-04-06 12:18:10 +0000
+++ b/lib-src/ChangeLog 2011-04-16 23:11:35 +0000
@@ -1,3 +1,18 @@
+2011-04-16 Paul Eggert <address@hidden>
+
+ Static checks with GCC 4.6.0 and non-default toolkits.
+
+ * movemail.c (mail_spool_name): Protoize.
+ (main): Remove unused var. Mark var as initialized.
+ Move locals to avoid shadowing, and use time_t for times.
+
+ * fakemail.c (xmalloc, xreallc): Use standard C prototypes
+ with void *. This avoids warnings about pointer casts.
+
+ * emacsclient.c (main): Don't use uninitialized var.
+ (IS_ANY_SEP): Remove; unused.
+ (get_current_dir_name): Add an extern decl.
+
2011-04-06 Paul Eggert <address@hidden>
Fix more problems found by GCC 4.6.0's static checks.
=== modified file 'lib-src/emacsclient.c'
--- a/lib-src/emacsclient.c 2011-04-05 19:59:58 +0000
+++ b/lib-src/emacsclient.c 2011-04-16 21:11:28 +0000
@@ -218,10 +218,8 @@
#define IS_DEVICE_SEP(_c_) ((_c_) == DEVICE_SEP)
#endif
#endif
-#ifndef IS_ANY_SEP
-#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_))
-#endif
+char *get_current_dir_name (void);
/* Return the current working directory. Returns NULL on errors.
Any other returned value must be freed with free. This is used
@@ -1524,7 +1522,7 @@
int
main (int argc, char **argv)
{
- int rl, needlf = 0;
+ int rl = 0, needlf = 0;
char *cwd, *str;
char string[BUFSIZ+1];
int null_socket_name IF_LINT ( = 0);
=== modified file 'lib-src/fakemail.c'
--- a/lib-src/fakemail.c 2011-03-21 05:04:41 +0000
+++ b/lib-src/fakemail.c 2011-04-16 21:13:07 +0000
@@ -178,20 +178,20 @@
/* Like malloc but get fatal error if memory is exhausted. */
-static long *
-xmalloc (int size)
+static void *
+xmalloc (size_t size)
{
- long *result = (long *) malloc (((unsigned) size));
- if (result == ((long *) NULL))
+ void *result = malloc (size);
+ if (! result)
fatal ("virtual memory exhausted");
return result;
}
-static long *
-xrealloc (long int *ptr, int size)
+static void *
+xrealloc (void *ptr, size_t size)
{
- long *result = (long *) realloc (ptr, ((unsigned) size));
- if (result == ((long *) NULL))
+ void *result = realloc (ptr, size);
+ if (! result)
fatal ("virtual memory exhausted");
return result;
}
@@ -221,7 +221,7 @@
if (p == end)
{
linebuffer->size *= 2;
- buffer = ((char *) xrealloc ((long *)buffer, linebuffer->size));
+ buffer = (char *) xrealloc (buffer, linebuffer->size);
p = buffer + (p - linebuffer->buffer);
end = buffer + linebuffer->size;
linebuffer->buffer = buffer;
=== modified file 'lib-src/movemail.c'
--- a/lib-src/movemail.c 2011-02-22 00:11:56 +0000
+++ b/lib-src/movemail.c 2011-04-16 21:20:25 +0000
@@ -131,7 +131,7 @@
files appear in. */
#ifdef MAILDIR
#define MAIL_USE_MAILLOCK
-static char *mail_spool_name ();
+static char *mail_spool_name (char *);
#endif
#endif
@@ -167,7 +167,6 @@
#ifndef MAIL_USE_SYSTEM_LOCK
struct stat st;
- long now;
int tem;
char *lockname, *p;
char *tempname;
@@ -259,7 +258,13 @@
#ifndef MAIL_USE_SYSTEM_LOCK
#ifdef MAIL_USE_MAILLOCK
spool_name = mail_spool_name (inname);
- if (! spool_name)
+ if (spool_name)
+ {
+#ifdef lint
+ lockname = 0;
+#endif
+ }
+ else
#endif
{
#ifndef DIRECTORY_SEP
@@ -336,7 +341,7 @@
by time differences between machines. */
if (stat (lockname, &st) >= 0)
{
- now = time (0);
+ time_t now = time (0);
if (st.st_ctime < now - 300)
unlink (lockname);
}
@@ -352,7 +357,10 @@
int lockcount = 0;
int status = 0;
#if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK)
- time_t touched_lock, now;
+ time_t touched_lock;
+# ifdef lint
+ touched_lock = 0;
+# endif
#endif
if (setuid (getuid ()) < 0 || setregid (-1, real_gid) < 0)
@@ -462,7 +470,7 @@
#if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK)
if (spool_name)
{
- now = time (0);
+ time_t now = time (0);
if (now - touched_lock > 60)
{
touchlock ();
=== modified file 'lwlib/ChangeLog'
--- a/lwlib/ChangeLog 2011-04-06 12:18:10 +0000
+++ b/lwlib/ChangeLog 2011-04-16 23:11:35 +0000
@@ -1,3 +1,19 @@
+2011-04-16 Paul Eggert <address@hidden>
+
+ Static checks with GCC 4.6.0 and non-default toolkits.
+
+ * lwlib-Xm.c (make_dialog): Rename local to avoid shadowing.
+ (make_menu_in_widget): Add cast to avoid warning.
+ * lwlib-utils.c (XtCompositeChildren): Likewise.
+
+ * lwlib.c (EXPLAIN, destroy_one_instance): Avoid "else;".
+ (first_child) [USE_MOTIF]: Protoize.
+
+ * lwlib-utils.h, lwlib-utils.c (XtSafelyDestroyWidget): Remove; unused.
+
+ * xlwmenu.c (XlwMenuSetValues): Rename/ move locals to avoid shadowing.
+ (MINL): Define only if not emacs.
+
2011-03-07 Chong Yidong <address@hidden>
* Version 23.3 released.
=== modified file 'lwlib/lwlib-Xm.c'
--- a/lwlib/lwlib-Xm.c 2011-02-10 05:03:29 +0000
+++ b/lwlib/lwlib-Xm.c 2011-04-16 21:22:40 +0000
@@ -511,7 +511,7 @@
/* Allocate the children array */
for (num_children = 0, cur = val; cur; num_children++, cur = cur->next)
;
- children = (Widget*)XtMalloc (num_children * sizeof (Widget));
+ children = (Widget*)(void*)XtMalloc (num_children * sizeof (Widget));
/* WIDGET should be a RowColumn. */
if (!XmIsRowColumn (widget))
@@ -1020,10 +1020,10 @@
{
KeySym sym = 0;
Modifiers modif_ret;
-
+
XtTranslateKeycode (event->xkey.display, event->xkey.keycode, 0,
&modif_ret, &sym);
-
+
if (sym == osfXK_Cancel)
{
Widget w = *((Widget *) closure);
@@ -1055,7 +1055,7 @@
Widget row;
Widget icon;
Widget icon_separator;
- Widget message;
+ Widget message_label;
Widget value = 0;
Widget separator;
Widget button = 0;
@@ -1269,7 +1269,7 @@
XtSetArg(al[ac], XmNleftWidget, icon); ac++;
XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
XtSetArg(al[ac], XmNrightOffset, 13); ac++;
- message = XmCreateLabel (form, "message", al, ac);
+ message_label = XmCreateLabel (form, "message", al, ac);
if (list)
XtManageChild (value);
@@ -1281,7 +1281,7 @@
{
children [i] = value; i++;
}
- children [i] = message; i++;
+ children [i] = message_label; i++;
children [i] = icon; i++;
children [i] = icon_separator; i++;
XtManageChildren (children, i);
=== modified file 'lwlib/lwlib-utils.c'
--- a/lwlib/lwlib-utils.c 2011-02-13 02:07:25 +0000
+++ b/lwlib/lwlib-utils.c 2011-04-16 21:23:30 +0000
@@ -129,7 +129,7 @@
return NULL;
}
n = cw->composite.num_children;
- result = (Widget*)XtMalloc (n * sizeof (Widget));
+ result = (Widget*)(void*)XtMalloc (n * sizeof (Widget));
*number = n;
for (i = 0; i < n; i++)
result [i] = cw->composite.children [i];
@@ -141,29 +141,3 @@
{
return widget->core.being_destroyed;
}
-
-void
-XtSafelyDestroyWidget (Widget widget)
-{
-#if 0
-
- /* this requires IntrinsicI.h (actually, InitialI.h) */
-
- XtAppContext app = XtWidgetToApplicationContext(widget);
-
- if (app->dispatch_level == 0)
- {
- app->dispatch_level = 1;
- XtDestroyWidget (widget);
- /* generates an event so that the event loop will be called */
- XChangeProperty (XtDisplay (widget), XtWindow (widget),
- XA_STRING, XA_STRING, 32, PropModeAppend, NULL, 0);
- app->dispatch_level = 0;
- }
- else
- XtDestroyWidget (widget);
-
-#else
- abort ();
-#endif
-}
=== modified file 'lwlib/lwlib-utils.h'
--- a/lwlib/lwlib-utils.h 2011-01-15 23:16:57 +0000
+++ b/lwlib/lwlib-utils.h 2011-04-16 01:41:12 +0000
@@ -15,7 +15,4 @@
Boolean
XtWidgetBeingDestroyedP (Widget widget);
-void XtSafelyDestroyWidget (Widget);
-
#endif /* _LWLIB_UTILS_H_ */
-
=== modified file 'lwlib/lwlib.c'
--- a/lwlib/lwlib.c 2011-02-10 05:03:29 +0000
+++ b/lwlib/lwlib.c 2011-04-16 16:42:58 +0000
@@ -422,7 +422,7 @@
(nc == STRUCTURAL_CHANGE ? "structural" : "???")))), \
nc, desc, a1, a2)
#else
-# define EXPLAIN(name, oc, nc, desc, a1, a2)
+# define EXPLAIN(name, oc, nc, desc, a1, a2) ((void) 0)
#endif
@@ -912,8 +912,9 @@
xaw_destroy_instance (instance);
else
#endif
- /* do not remove the empty statement */
- ;
+ {
+ /* Empty compound statement to terminate if-then-else chain. */
+ }
}
free_widget_instance (instance);
@@ -978,7 +979,7 @@
}
#ifdef USE_MOTIF
-extern Widget first_child (/* Widget */); /* garbage */
+extern Widget first_child (Widget); /* garbage */
#endif
Widget
=== modified file 'lwlib/xlwmenu.c'
--- a/lwlib/xlwmenu.c 2011-02-14 17:21:10 +0000
+++ b/lwlib/xlwmenu.c 2011-04-16 01:38:14 +0000
@@ -1220,9 +1220,9 @@
{
if (val->enabled)
*hit_return = val;
- else
+ else
no_return = 1;
- if (mw->menu.inside_entry != val)
+ if (mw->menu.inside_entry != val)
{
if (mw->menu.inside_entry)
XtCallCallbackList ((Widget)mw, mw->menu.leave,
@@ -1426,7 +1426,7 @@
static void
create_pixmap_for_menu (window_state* ws, XlwMenuWidget mw)
{
- if (ws->pixmap != None)
+ if (ws->pixmap != None)
{
XFreePixmap (XtDisplay (ws->w), ws->pixmap);
ws->pixmap = None;
@@ -1592,9 +1592,9 @@
}
}
- if (!inside)
+ if (!inside)
{
- if (mw->menu.inside_entry != NULL)
+ if (mw->menu.inside_entry != NULL)
XtCallCallbackList ((Widget)mw, mw->menu.leave,
(XtPointer) mw->menu.inside_entry);
mw->menu.inside_entry = NULL;
@@ -1693,8 +1693,10 @@
mw->menu.background_gc = (GC) -1;
}
+#ifndef emacs
#define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \
? ((unsigned long) (x)) : ((unsigned long) (y)))
+#endif
static void
make_shadow_gcs (XlwMenuWidget mw)
@@ -1881,7 +1883,7 @@
if (!mw->menu.font)
{
mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname);
- if (!mw->menu.xft_font)
+ if (!mw->menu.xft_font)
{
fprintf (stderr, "Can't find font '%s'\n", fname);
mw->menu.xft_font = getDefaultXftFont (mw);
@@ -1930,19 +1932,19 @@
if (!mw->menu.font)
{
mw->menu.font = XLoadQueryFont (display, "fixed");
- if (!mw->menu.font)
+ if (!mw->menu.font)
{
fprintf (stderr, "Menu font fixed not found, can't continue.\n");
abort ();
}
}
}
-
+
#ifdef HAVE_X_I18N
if (mw->menu.fontSet)
mw->menu.font_extents = XExtentsOfFontSet (mw->menu.fontSet);
#endif
-
+
make_drawing_gcs (mw);
make_shadow_gcs (mw);
@@ -2118,12 +2120,12 @@
XftFontClose (XtDisplay (mw), mw->menu.xft_font);
#endif
- if (mw->menu.windows [0].pixmap != None)
+ if (mw->menu.windows [0].pixmap != None)
XFreePixmap (XtDisplay (mw), mw->menu.windows [0].pixmap);
/* start from 1 because the one in slot 0 is w->core.window */
for (i = 1; i < mw->menu.windows_length; i++)
{
- if (mw->menu.windows [i].pixmap != None)
+ if (mw->menu.windows [i].pixmap != None)
XFreePixmap (XtDisplay (mw), mw->menu.windows [i].pixmap);
#ifdef HAVE_XFT
if (mw->menu.windows [i].xft_draw)
@@ -2153,18 +2155,17 @@
{
XlwMenuWidget oldmw = (XlwMenuWidget)current;
XlwMenuWidget newmw = (XlwMenuWidget)new;
- Boolean redisplay = False;
- int i;
+ Boolean do_redisplay = False;
if (newmw->menu.contents
&& newmw->menu.contents->contents
&& newmw->menu.contents->contents->change >= VISIBLE_CHANGE)
- redisplay = True;
+ do_redisplay = True;
/* Do redisplay if the contents are entirely eliminated. */
if (newmw->menu.contents
&& newmw->menu.contents->contents == 0
&& newmw->menu.contents->change >= VISIBLE_CHANGE)
- redisplay = True;
+ do_redisplay = True;
if (newmw->core.background_pixel != oldmw->core.background_pixel
|| newmw->menu.foreground != oldmw->menu.foreground
@@ -2179,6 +2180,7 @@
#endif
)
{
+ int i;
release_drawing_gcs (newmw);
make_drawing_gcs (newmw);
@@ -2188,7 +2190,7 @@
newmw->menu.bottom_shadow_color = -1;
make_shadow_gcs (newmw);
- redisplay = True;
+ do_redisplay = True;
if (XtIsRealized (current))
/* If the menu is currently displayed, change the display. */
@@ -2229,12 +2231,12 @@
#ifdef HAVE_X_I18N
if (newmw->menu.fontSet != oldmw->menu.fontSet && newmw->menu.fontSet !=
NULL)
{
- redisplay = True;
+ do_redisplay = True;
newmw->menu.font_extents = XExtentsOfFontSet (newmw->menu.fontSet);
}
#endif
- return redisplay;
+ return do_redisplay;
}
static void
=== modified file 'oldXMenu/Activate.c'
--- a/oldXMenu/Activate.c 2011-01-25 04:08:28 +0000
+++ b/oldXMenu/Activate.c 2011-04-16 08:25:42 +0000
@@ -122,7 +122,7 @@
int y_pos, /* Y coordinate of menu position. */
unsigned int event_mask, /* Mouse button event mask. */
char **data, /* Pointer to return data value. */
- void (* help_callback) (char *, int, int)) /* Help callback. */
+ void (*help_callback) (char const *, int, int)) /* Help callback. */
{
int status; /* X routine call status. */
int orig_x; /* Upper left menu origin X
coord. */
=== modified file 'oldXMenu/AddPane.c'
--- a/oldXMenu/AddPane.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/AddPane.c 2011-04-16 08:25:42 +0000
@@ -16,14 +16,14 @@
#include "XMenuInt.h"
int
-XMenuAddPane(Display *display, register XMenu *menu, register char *label, int
active)
-
+XMenuAddPane(Display *display, register XMenu *menu, register char const
*label, int active)
+
/* Menu object to be modified. */
/* Selection label. */
/* Make selection active? */
{
register XMPane *pane; /* Newly created pane. */
- register XMSelect *select; /* Initial selection for the new pane. */
+ register XMSelect *sel; /* Initial selection for the new pane. */
int label_length; /* Label length in characters. */
int label_width; /* Label width in pixels. */
@@ -44,8 +44,8 @@
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
- select = (XMSelect *)calloc(1, sizeof(XMSelect));
- if (select == NULL) {
+ sel = (XMSelect *)calloc(1, sizeof(XMSelect));
+ if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
@@ -62,11 +62,11 @@
* Set up the initial selection.
* Values not explicitly set are zeroed by calloc.
*/
- select->next = select;
- select->prev = select;
- select->type = SL_HEADER;
- select->serial = -1;
- select->parent_p = pane;
+ sel->next = sel;
+ sel->prev = sel;
+ sel->type = SL_HEADER;
+ sel->serial = -1;
+ sel->parent_p = pane;
/*
* Fill the XMPane structure.
@@ -78,7 +78,7 @@
pane->label = label;
pane->label_width = label_width;
pane->label_length = label_length;
- pane->s_list = select;
+ pane->s_list = sel;
/*
* Insert the pane at the end of the pane list.
@@ -101,4 +101,3 @@
_XMErrorCode = XME_NO_ERROR;
return((menu->p_count - 1));
}
-
=== modified file 'oldXMenu/AddSel.c'
--- a/oldXMenu/AddSel.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/AddSel.c 2011-04-16 08:25:42 +0000
@@ -17,8 +17,8 @@
#include "XMenuInt.h"
int
-XMenuAddSelection(Display *display, register XMenu *menu, register int p_num,
char *data, char *label, int active, char *help)
-
+XMenuAddSelection(Display *display, register XMenu *menu, register int p_num,
char *data, char *label, int active, char const *help)
+
/* Menu object to be modified. */
/* Pane number to be modified. */
/* Data value. */
@@ -27,7 +27,7 @@
/* Help string */
{
register XMPane *pane; /* Pane containing the new selection. */
- register XMSelect *select; /* Newly created selection. */
+ register XMSelect *sel; /* Newly created selection. */
int label_length; /* Label lenght in characters. */
@@ -49,8 +49,8 @@
/*
* Calloc the XMSelect structure.
*/
- select = (XMSelect *)calloc(1, sizeof(XMSelect));
- if (select == NULL) {
+ sel = (XMSelect *)calloc(1, sizeof(XMSelect));
+ if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
@@ -65,27 +65,27 @@
*/
if (!strcmp (label, "--") || !strcmp (label, "---"))
{
- select->type = SEPARATOR;
- select->active = 0;
+ sel->type = SEPARATOR;
+ sel->active = 0;
}
else
{
- select->type = SELECTION;
- select->active = active;
+ sel->type = SELECTION;
+ sel->active = active;
}
- select->serial = -1;
- select->label = label;
- select->label_width = label_width;
- select->label_length = label_length;
- select->data = data;
- select->parent_p = pane;
- select->help_string = help;
+ sel->serial = -1;
+ sel->label = label;
+ sel->label_width = label_width;
+ sel->label_length = label_length;
+ sel->data = data;
+ sel->parent_p = pane;
+ sel->help_string = help;
/*
* Insert the selection at the end of the selection list.
*/
- emacs_insque(select, pane->s_list->prev);
+ emacs_insque(sel, pane->s_list->prev);
/*
* Update the selection count.
@@ -103,4 +103,3 @@
_XMErrorCode = XME_NO_ERROR;
return((pane->s_count - 1));
}
-
=== modified file 'oldXMenu/ChangeLog'
--- a/oldXMenu/ChangeLog 2011-04-06 12:18:10 +0000
+++ b/oldXMenu/ChangeLog 2011-04-16 23:11:35 +0000
@@ -1,3 +1,43 @@
+2011-04-16 Paul Eggert <address@hidden>
+
+ Static checks with GCC 4.6.0 and non-default toolkits.
+
+ Modernize to C89, for better static checking.
+ * Activate.c (XMenuActivate): Callback's first arg is readonly.
+ * AddPane.c (XMenuAddPane): Label is readonly. Rename local
+ to avoid shadowing.
+ * AddSel.c (XMenuAddSelection): Help arg is readonly. Rename local.
+ * Create.c (atoi, atof): Remove decls; include <stdlib.h>.
+ (MAX_INACT_PNUM, TILE_BUF_SIZE): Remove; unused.
+ (x_get_resource_string): Args are readonly.
+ (XAllocDisplayColor): colorName is readonly.
+ (XMenuCreate): def_env is readonly. Remove unused locals. Avoid
+ "else;".
+ * Destroy.c (XMenuDestroy): Return void.
+ * Error.c (XMenuError): Remove const pointer.
+ * EvHand.c (XMenuEventHandler): Return void.
+ * FindPane.c, FindSel.c: Include <string.h>.
+ * InsPane.c (XMenuInsertPane): Rename local to avoid shadowing.
+ * InsSel.c (XMenuInsertSelection): Likewise.
+ * Internal.c (toggle_color, BUFFER_SIZE): Remove; unused.
+ (_XMErrorList): Now const.
+ (_XMWinQueInit, _XMRecomputeGlobals, _XMTransToOrigin, _XMRefreshPane):
+ (_XMRefreshSelection): Return void.
+ (_XMWinQueFlush, _XMRefreshSelection): Rename locals to avoid
+ shadowing.
+ (_XMWinQueFlush): Use stack, not heap. Don't use uninitialized var.
+ * SetAEQ.c (XMenuSetAEQ): Now returns void.
+ * SetFrz.c (XMenuSetFreeze): Likewise.
+ * X10.h (XAssoc): Use void * for generic pointer.
+ * XDelAssoc.c: Include XMenuInt.h rather than duplicating part of it.
+ * XDestAssoc.c, XMakeAssoc.c: Likewise.
+ * XDestAssoc.c (XDestroyAssocTable): Return void.
+ * XMakeAssoc.c (XMakeAssoc): Use void * for generic pointer.
+ * XMenu.h, XMenuInt.h: Adjust to signature changes. Use const
+ for pointers to readonly storage.
+ * insque.c: Include XMenuInt.h, to check our own signature.
+ (emacs_insque, emacs_remque): Use void * for generic pointers.
+
2011-03-07 Chong Yidong <address@hidden>
* Version 23.3 released.
=== modified file 'oldXMenu/Create.c'
--- a/oldXMenu/Create.c 2011-01-25 04:08:28 +0000
+++ b/oldXMenu/Create.c 2011-04-16 08:25:42 +0000
@@ -31,7 +31,7 @@
#include <config.h>
#include "XMenuInt.h"
-
+#include <stdlib.h>
#ifdef EMACS_BITMAP_FILES
#include "../src/bitmaps/dimple1.xbm"
@@ -71,7 +71,6 @@
#define DEF_MENU_STYLE LEFT
#define DEF_MENU_MODE BOX
#define DEF_INACT_PNUM 3
-#define MAX_INACT_PNUM 4
#define DEF_P_STYLE CENTER
@@ -88,16 +87,13 @@
#define XASSOC_TABLE_SIZE 64
-#define TILE_BUF_SIZE 5
-
-int atoi(const char *);
-double atof(const char *);
-char *x_get_resource_string (char *attribute, char *class);
+char *x_get_resource_string (char const *, char const *);
static Status
-XAllocDisplayColor(Display *display, Colormap map, char *colorName, XColor
*color, XColor *junk)
+XAllocDisplayColor(Display *display, Colormap map, char const *colorName,
+ XColor *color, XColor *junk)
{
return (colorName!=0 &&
XParseColor(display, map, colorName, color) &&
@@ -106,13 +102,11 @@
XMenu *
-XMenuCreate(Display *display, Window parent, register char *def_env)
+XMenuCreate(Display *display, Window parent, register char const *def_env)
/* ID of previously opened display */
/* Window ID of the menu's parent window. */
/* X Defaults program environment name. */
{
- register int i; /* Loop counter. */
- register int j; /* Loop counter. */
register char *def_val; /* X Default value temp variable. */
register XMenu *menu; /* Pointer to the new menu. */
@@ -125,7 +119,7 @@
int reverse; /* Reverse video mode. */
XMStyle p_style; /* Pane display style. */
- char *p_fnt_name; /* Flag font name. */
+ char const *p_fnt_name; /* Flag font name. */
XFontStruct *p_fnt_info; /* Flag font structure */
int p_fnt_pad; /* Flag font padding in pixels. */
double p_spread; /* Pane spread in flag height fractions. */
@@ -138,7 +132,7 @@
GC pane_GC; /* Pane graphics context. */
XMStyle s_style; /* Selection display style. */
- char *s_fnt_name; /* Selection font name. */
+ char const *s_fnt_name; /* Selection font name. */
XFontStruct *s_fnt_info; /* Selection font structure. */
int s_fnt_pad; /* Selection font padding in pixels. */
int s_fnt_height; /* Selection font character height */
@@ -151,10 +145,8 @@
GC inverse_select_GC; /* GC used for inverse video selection.
*/
GC inact_GC; /* GC for inactive pane header and */
/* selections. */
- GC inact_GC_noexpose;
XColor color_def; /* Temp color definition holder. */
- XColor screen_def; /* Temp screen color definition holder */
XColor p_bdr_color; /* Color of border. */
XColor s_bdr_color; /* Color of highlight. */
XColor p_frg_color; /* Color of pane foreground color. */
@@ -166,17 +158,6 @@
int inact_pnum; /* Inactive background pattern number. */
- Pixel p_bdr_pixel; /* Pane border pixel. */
- Pixel s_bdr_pixel; /* Selection border pixel. */
- Pixel p_frg_pixel; /* Pane foreground pixel. */
- Pixel s_frg_pixel; /* Selection foreground pixel. */
- Pixel bkgnd_pixel; /* Menu background pixel. */
-
- int *width, *height;
- Pixmap *bitmap;
- int *x_hot, *y_hot;
- int status; /* Return code from XReadBitmapFile. */
-
Pixmap cursor; /* Cursor pixmap holder. */
Pixmap cursor_mask; /* Cursor mask pixmap holder. */
Pixmap stipple_pixmap; /* Stipple mask for half-tone text. */
@@ -282,7 +263,7 @@
&mouse_color, &color_def)
);
- else ;
+ else {}
def_val = x_get_resource_string ("menuBackground", "MenuBackground");
if (
@@ -304,7 +285,7 @@
"white",
&bkgnd_color, &color_def)
);
- else;
+ else {}
def_val = x_get_resource_string ("menuInactivePattern",
"MenuInactivePattern");
if (def_val != NULL) {
@@ -401,7 +382,7 @@
"black",
&s_frg_color, &color_def)
) ;
- else ;
+ else {}
def_val = x_get_resource_string ("selectionBorder", "SelectionBorder");
@@ -424,7 +405,7 @@
"black",
&s_bdr_color, &color_def)
) ;
- else ;
+ else {}
def_val = x_get_resource_string ("selectionBorderWidth",
"SelectionBorderWidth");
if (def_val != NULL) s_bdr_width = atoi(def_val);
@@ -681,9 +662,6 @@
valuemask |= (GCGraphicsExposures);
values->graphics_exposures = False;
- inact_GC_noexpose = XCreateGC (display,
- root,
- valuemask, values);
/*
@@ -752,4 +730,3 @@
_XMErrorCode = XME_NO_ERROR;
return(menu);
}
-
=== modified file 'oldXMenu/Destroy.c'
--- a/oldXMenu/Destroy.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/Destroy.c 2011-04-16 08:25:42 +0000
@@ -15,8 +15,9 @@
#include "XMenuInt.h"
+void
XMenuDestroy(Display *display, register XMenu *menu)
-
+
/* Menu object to destroy. */
{
register XMPane *p_ptr; /* Pointer to the current pane. */
@@ -114,4 +115,3 @@
*/
free(menu);
}
-
=== modified file 'oldXMenu/Error.c'
--- a/oldXMenu/Error.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/Error.c 2011-04-16 08:25:42 +0000
@@ -16,7 +16,7 @@
#include "XMenuInt.h"
-char *
+char const *
XMenuError(void)
{
static char message[128]; /* Error message buffer. */
@@ -27,4 +27,3 @@
sprintf(message, "Unknown _XMErrorCode: %d", _XMErrorCode);
return(message);
}
-
=== modified file 'oldXMenu/EvHand.c'
--- a/oldXMenu/EvHand.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/EvHand.c 2011-04-16 08:25:42 +0000
@@ -15,6 +15,7 @@
#include "XMenuInt.h"
+void
XMenuEventHandler(int (*handler) (XEvent*))
{
/*
@@ -22,4 +23,3 @@
*/
_XMEventHandler = handler;
}
-
=== modified file 'oldXMenu/FindPane.c'
--- a/oldXMenu/FindPane.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/FindPane.c 2011-04-16 08:25:42 +0000
@@ -15,6 +15,7 @@
*/
#include "XMenuInt.h"
+#include <string.h>
int
XMenuFindPane(register XMenu *menu, register char *label)
@@ -60,4 +61,3 @@
_XMErrorCode = XME_P_NOT_FOUND;
return (XM_FAILURE);
}
-
=== modified file 'oldXMenu/FindSel.c'
--- a/oldXMenu/FindSel.c 2011-01-25 04:08:28 +0000
+++ b/oldXMenu/FindSel.c 2011-04-16 08:25:42 +0000
@@ -31,6 +31,7 @@
*/
#include "XMenuInt.h"
+#include <string.h>
int
XMenuFindSelection(register XMenu *menu, int p_num, register char *label)
@@ -83,4 +84,3 @@
_XMErrorCode = XME_S_NOT_FOUND;
return (XM_FAILURE);
}
-
=== modified file 'oldXMenu/InsPane.c'
--- a/oldXMenu/InsPane.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/InsPane.c 2011-04-16 08:25:42 +0000
@@ -26,7 +26,7 @@
{
register XMPane *p_ptr; /* XMPane pointer. */
register XMPane *pane; /* Newly created pane. */
- register XMSelect *select; /* Initial selection for the new pane. */
+ register XMSelect *sel; /* Initial selection for the new pane. */
int label_length; /* Label length in characters. */
int label_width; /* Label width in pixels. */
@@ -54,8 +54,8 @@
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
- select = (XMSelect *)calloc(1, sizeof(XMSelect));
- if (select == NULL) {
+ sel = (XMSelect *)calloc(1, sizeof(XMSelect));
+ if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
@@ -70,11 +70,11 @@
* Set up the initial selection.
* Values not explicitly set are zeroed by calloc.
*/
- select->next = select;
- select->prev = select;
- select->type = SL_HEADER;
- select->serial = -1;
- select->parent_p = pane;
+ sel->next = sel;
+ sel->prev = sel;
+ sel->type = SL_HEADER;
+ sel->serial = -1;
+ sel->parent_p = pane;
/*
* Fill the XMPane structure.
@@ -85,7 +85,7 @@
pane->label = label;
pane->label_width = label_width;
pane->label_length = label_length;
- pane->s_list = select;
+ pane->s_list = sel;
/*
* Insert the pane after the pane with the pane
@@ -110,4 +110,3 @@
_XMErrorCode = XME_NO_ERROR;
return(p_num);
}
-
=== modified file 'oldXMenu/InsSel.c'
--- a/oldXMenu/InsSel.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/InsSel.c 2011-04-16 08:25:42 +0000
@@ -28,7 +28,7 @@
register XMPane *p_ptr; /* XMPane pointer. */
register XMSelect *s_ptr; /* XMSelect pointer. */
- XMSelect *select; /* Newly created selection. */
+ XMSelect *sel; /* Newly created selection. */
int label_length; /* Label length in characters. */
int label_width; /* Label width in pixels. */
@@ -57,8 +57,8 @@
/*
* Calloc the XMSelect structure.
*/
- select = (XMSelect *)calloc(1, sizeof(XMSelect));
- if (select == NULL) {
+ sel = (XMSelect *)calloc(1, sizeof(XMSelect));
+ if (sel == NULL) {
_XMErrorCode = XME_CALLOC;
return(XM_FAILURE);
}
@@ -75,28 +75,28 @@
*/
if (!strcmp (label, "--") || !strcmp (label, "---"))
{
- select->type = SEPARATOR;
- select->active = 0;
+ sel->type = SEPARATOR;
+ sel->active = 0;
}
else
{
- select->type = SELECTION;
- select->active = active;
+ sel->type = SELECTION;
+ sel->active = active;
}
- select->active = active;
- select->serial = -1;
- select->label = label;
- select->label_width = label_width;
- select->label_length = label_length;
- select->data = data;
- select->parent_p = p_ptr;
+ sel->active = active;
+ sel->serial = -1;
+ sel->label = label;
+ sel->label_width = label_width;
+ sel->label_length = label_length;
+ sel->data = data;
+ sel->parent_p = p_ptr;
/*
* Insert the selection after the selection with the selection
* number one less than the desired number for the new selection.
*/
- emacs_insque(select, s_ptr);
+ emacs_insque(sel, s_ptr);
/*
* Update the selection count.
@@ -114,4 +114,3 @@
_XMErrorCode = XME_NO_ERROR;
return(s_num);
}
-
=== modified file 'oldXMenu/Internal.c'
--- a/oldXMenu/Internal.c 2011-01-25 04:08:28 +0000
+++ b/oldXMenu/Internal.c 2011-04-16 08:25:42 +0000
@@ -33,17 +33,10 @@
#include "XMenuInt.h"
/*
- * Toggle color macro.
- */
-#define toggle_color(x) \
- ((x) == menu->bkgnd_color ? menu->s_frg_color : menu->bkgnd_color)
-
-/*
* Internal Window creation queue sizes.
*/
#define S_QUE_SIZE 300
#define P_QUE_SIZE 20
-#define BUFFER_SIZE (S_QUE_SIZE >= P_QUE_SIZE ? S_QUE_SIZE : P_QUE_SIZE)
/*
@@ -71,7 +64,7 @@
/*
* _XMErrorList - Global XMenu error code description strings.
*/
-char *
+char const *const
_XMErrorList[XME_CODE_COUNT] = {
"No error", /* XME_NO_ERROR */
"Menu not initialized", /* XME_NOT_INIT */
@@ -103,6 +96,7 @@
* _XMWinQueInit - Internal routine to initialize the window
* queue.
*/
+void
_XMWinQueInit(void)
{
/*
@@ -138,7 +132,7 @@
*/
int
_XMWinQueAddPane(register Display *display, register XMenu *menu, register
XMPane *p_ptr)
-
+
/* Menu being manipulated. */
/* XMPane being queued. */
{
@@ -172,7 +166,7 @@
*/
int
_XMWinQueAddSelection(register Display *display, register XMenu *menu,
register XMSelect *s_ptr)
-
+
/* Menu being manipulated. */
/* XMSelection being queued. */
{
@@ -205,8 +199,8 @@
* selection window queues.
*/
int
-_XMWinQueFlush(register Display *display, register XMenu *menu, register
XMPane *pane, XMSelect *select)
-
+_XMWinQueFlush(register Display *display, register XMenu *menu, register
XMPane *pane, XMSelect *sel)
+
/* Menu being manipulated. */
/* Current pane. */
{
@@ -215,7 +209,8 @@
register XMPane *p_ptr; /* XMPane pointer. */
register XMSelect *s_ptr; /* XMSelect pointer. */
unsigned long valuemask; /* Which attributes to set. */
- XSetWindowAttributes *attributes; /* Attributes to be set. */
+ XSetWindowAttributes attributes_buf; /* Attributes to be set. */
+ XSetWindowAttributes *attributes = &attributes_buf;
/*
* If the pane window queue is not empty...
@@ -226,7 +221,6 @@
* set up attributes for pane window to be created.
*/
valuemask = (CWBackPixmap | CWBorderPixel | CWOverrideRedirect);
- attributes = (XSetWindowAttributes
*)malloc(sizeof(XSetWindowAttributes));
attributes->border_pixel = menu->p_bdr_color;
attributes->background_pixmap = menu->inact_pixmap;
attributes->override_redirect = True;
@@ -415,6 +409,7 @@
* _XMRecomputeGlobals - Internal subroutine to recompute menu wide
* global values.
*/
+void
_XMRecomputeGlobals(register Display *display, register XMenu *menu)
/*X11 display variable. */
/* Menu object to compute from. */
@@ -681,7 +676,7 @@
*/
int
_XMRecomputeSelection(register Display *display, register XMenu *menu,
register XMSelect *s_ptr, register int s_num)
-
+
/* Menu object being recomputed. */
/* Selection pointer. */
/* Selection sequence number. */
@@ -810,6 +805,7 @@
* recomputed before calling this routine or
* unpredictable results will follow.
*/
+void
_XMTransToOrigin(Display *display, register XMenu *menu, register XMPane
*p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int
*orig_y)
/* Not used. Included for consistency. */
/* Menu being computed against. */
@@ -870,6 +866,7 @@
* _XMRefreshPane - Internal subroutine to completely refresh
* the contents of a pane.
*/
+void
_XMRefreshPane(register Display *display, register XMenu *menu, register
XMPane *pane)
{
register XMSelect *s_list = pane->s_list;
@@ -937,34 +934,35 @@
* _XMRefreshSelection - Internal subroutine that refreshes
* a single selection window.
*/
-_XMRefreshSelection(register Display *display, register XMenu *menu, register
XMSelect *select)
+void
+_XMRefreshSelection(register Display *display, register XMenu *menu, register
XMSelect *sel)
{
- register int width = select->window_w;
- register int height = select->window_h;
+ register int width = sel->window_w;
+ register int height = sel->window_h;
register int bdr_width = menu->s_bdr_width;
- if (select->type == SEPARATOR) {
+ if (sel->type == SEPARATOR) {
XDrawLine(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->normal_select_GC,
- select->window_x,
- select->window_y + height / 2,
- select->window_x + width,
- select->window_y + height / 2);
+ sel->window_x,
+ sel->window_y + height / 2,
+ sel->window_x + width,
+ sel->window_y + height / 2);
}
- else if (select->activated) {
+ else if (sel->activated) {
if (menu->menu_mode == INVERT) {
XFillRectangle(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->normal_select_GC,
- select->window_x, select->window_y,
+ sel->window_x, sel->window_y,
width, height);
XDrawString(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->inverse_select_GC,
- select->label_x,
- select->label_y,
- select->label, select->label_length);
+ sel->label_x,
+ sel->label_y,
+ sel->label, sel->label_length);
}
else {
/*
@@ -975,42 +973,41 @@
*/
XDrawRectangle(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->normal_select_GC,
- select->window_x + (bdr_width >> 1),
- select->window_y + (bdr_width >> 1 ),
+ sel->window_x + (bdr_width >> 1),
+ sel->window_y + (bdr_width >> 1 ),
width - bdr_width,
height - bdr_width);
XDrawString(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->normal_select_GC,
- select->label_x,
- select->label_y,
- select->label, select->label_length);
+ sel->label_x,
+ sel->label_y,
+ sel->label, sel->label_length);
}
}
else {
XClearArea(display,
- select->parent_p->window,
- select->window_x, select->window_y,
+ sel->parent_p->window,
+ sel->window_x, sel->window_y,
width, height,
False);
- if (select->active) {
+ if (sel->active) {
XDrawString(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->normal_select_GC,
- select->label_x,
- select->label_y,
- select->label, select->label_length);
+ sel->label_x,
+ sel->label_y,
+ sel->label, sel->label_length);
}
else {
XDrawString(display,
- select->parent_p->window,
+ sel->parent_p->window,
menu->inact_GC,
- select->label_x,
- select->label_y,
- select->label, select->label_length);
+ sel->label_x,
+ sel->label_y,
+ sel->label, sel->label_length);
}
}
}
-
=== modified file 'oldXMenu/SetAEQ.c'
--- a/oldXMenu/SetAEQ.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/SetAEQ.c 2011-04-16 08:25:42 +0000
@@ -18,6 +18,7 @@
#include "XMenuInt.h"
+void
XMenuSetAEQ(register XMenu *menu, register int aeq)
/* Menu object to be modified. */
/* AEQ mode? */
@@ -27,4 +28,3 @@
*/
menu->aeq = aeq;
}
-
=== modified file 'oldXMenu/SetFrz.c'
--- a/oldXMenu/SetFrz.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/SetFrz.c 2011-04-16 08:25:42 +0000
@@ -17,6 +17,7 @@
#include "XMenuInt.h"
+void
XMenuSetFreeze(register XMenu *menu, register int freeze)
/* Menu object to be modified. */
/* Freeze mode? */
@@ -26,4 +27,3 @@
*/
menu->freeze = freeze;
}
-
=== modified file 'oldXMenu/X10.h'
--- a/oldXMenu/X10.h 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/X10.h 2011-04-16 08:25:42 +0000
@@ -54,7 +54,7 @@
struct _XAssoc *prev; /* Previous obejct in this bucket. */
Display *display; /* Display which owns the id. */
XID x_id; /* X Window System id. */
- char *data; /* Pointer to untyped memory. */
+ void *data; /* Pointer to untyped memory. */
} XAssoc;
/*
@@ -75,4 +75,3 @@
char *XLookUpAssoc(Display *dpy, XAssocTable *table, XID x_id);
#endif /* _X10_H_ */
-
=== modified file 'oldXMenu/XDelAssoc.c'
--- a/oldXMenu/XDelAssoc.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/XDelAssoc.c 2011-04-16 08:25:42 +0000
@@ -2,15 +2,7 @@
#include "copyright.h"
-
-#include <X11/Xlib.h>
-#include "X10.h"
-struct qelem {
- struct qelem *q_forw;
- struct qelem *q_back;
- char q_data[1];
-};
-void emacs_remque(struct qelem*);
+#include "XMenuInt.h"
/*
* XDeleteAssoc - Delete an association in an XAssocTable keyed on
@@ -56,4 +48,3 @@
/* It is apparently not in the table. */
return;
}
-
=== modified file 'oldXMenu/XDestAssoc.c'
--- a/oldXMenu/XDestAssoc.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/XDestAssoc.c 2011-04-16 08:25:42 +0000
@@ -2,14 +2,13 @@
#include "copyright.h"
-
-#include <X11/Xlib.h>
-#include "X10.h"
+#include "XMenuInt.h"
/*
* XDestroyAssocTable - Destroy (free the memory associated with)
* an XAssocTable.
*/
+void
XDestroyAssocTable(register XAssocTable *table)
{
register int i;
@@ -35,4 +34,3 @@
/* Free the table. */
free((char *)table);
}
-
=== modified file 'oldXMenu/XMakeAssoc.c'
--- a/oldXMenu/XMakeAssoc.c 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/XMakeAssoc.c 2011-04-16 08:25:42 +0000
@@ -4,22 +4,14 @@
#include <config.h>
-#include <X11/Xlib.h>
+#include "XMenuInt.h"
#include <X11/Xresource.h>
-#include "X10.h"
#include <errno.h>
#ifndef NULL
#define NULL 0
#endif
-struct qelem {
- struct qelem *q_forw;
- struct qelem *q_back;
- char q_data[1];
-};
-void emacs_insque (struct qelem *elem, struct qelem *prev);
-
/*
* XMakeAssoc - Insert data into an XAssocTable keyed on an XId.
* Data is inserted into the table only once. Redundant inserts are
@@ -27,7 +19,7 @@
* bucket is sorted (lowest XId to highest XId).
*/
void
-XMakeAssoc(register Display *dpy, register XAssocTable *table, register XID
x_id, register caddr_t data)
+XMakeAssoc(register Display *dpy, register XAssocTable *table, register XID
x_id, register void *data)
{
int hash;
register XAssoc *bucket;
@@ -85,4 +77,3 @@
/* Insert the new entry. */
emacs_insque((struct qelem *)new_entry, (struct qelem *)Entry->prev);
}
-
=== modified file 'oldXMenu/XMenu.h'
--- a/oldXMenu/XMenu.h 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/XMenu.h 2011-04-16 08:25:42 +0000
@@ -54,7 +54,7 @@
* XMenu error code and error list definitions.
*/
extern int _XMErrorCode;
-extern char *_XMErrorList[];
+extern char const *const _XMErrorList[];
/*
* Define the XMWindow datatypes.
@@ -106,7 +106,7 @@
int active; /* Window active? */
int activated; /* Window activated? */
int serial; /* -- Pane serial number. */
- char *label; /* -- Pane label. */
+ char const *label; /* -- Pane label. */
int label_width; /* -- Pane label width in pixels. */
int label_length; /* -- Pane label length in chars. */
int label_x; /* -- Pane label X offset. */
@@ -141,7 +141,7 @@
struct _xmwindow *pad_l9; /* ---- */
char *data; /* -- Selection data pointer. */
struct _xmpane *parent_p; /* -- Selection parent pane structure. */
- char *help_string; /* Help string or null. */
+ char const *help_string; /* Help string or null. */
} XMSelect;
@@ -240,29 +240,29 @@
/*
* XMenu library routine declarations.
*/
-XMenu *XMenuCreate(Display *display, Window parent, register char *def_env);
-int XMenuAddPane(Display *display, register XMenu *menu, register char *label,
int active);
-int XMenuAddSelection(Display *display, register XMenu *menu, register int
p_num, char *data, char *label, int active, char *help);
-int XMenuInsertPane(register XMenu *menu, register int p_num, char *label, int
active);
-int XMenuInsertSelection(register XMenu *menu, register int p_num, register
int s_num, char *data, char *label, int active);
-int XMenuFindPane(register XMenu *menu, register char *label);
-int XMenuFindSelection(register XMenu *menu, int p_num, register char *label);
-int XMenuChangePane(register XMenu *menu, register int p_num, char *label);
-int XMenuChangeSelection(Display *display, register XMenu *menu, register int
p_num, register int s_num, char *data, int data_sw, char *label, int label_sw);
-int XMenuSetPane(register XMenu *menu, register int p_num, register int
active);
-int XMenuSetSelection(register XMenu *menu, register int p_num, register int
s_num, int active);
-int XMenuRecompute(Display *display, register XMenu *menu);
-int XMenuEventHandler(int (*handler) (XEvent *)); /* No value actually
returned. */
-int XMenuLocate(register Display *display, register XMenu *menu, int p_num,
int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height);
-int XMenuSetFreeze(register XMenu *menu, register int freeze); /* No
value actually returned. */
+XMenu *XMenuCreate(Display *display, Window parent, char const *def_env);
+int XMenuAddPane(Display *display, XMenu *menu, char const *label, int active);
+int XMenuAddSelection(Display *display, XMenu *menu, int p_num, char *data,
char *label, int active, char const *help);
+int XMenuInsertPane(XMenu *menu, int p_num, char *label, int active);
+int XMenuInsertSelection(XMenu *menu, int p_num, int s_num, char *data, char
*label, int active);
+int XMenuFindPane(XMenu *menu, char *label);
+int XMenuFindSelection(XMenu *menu, int p_num, char *label);
+int XMenuChangePane(XMenu *menu, int p_num, char *label);
+int XMenuChangeSelection(Display *display, XMenu *menu, int p_num, int s_num,
char *data, int data_sw, char *label, int label_sw);
+int XMenuSetPane(XMenu *menu, int p_num, int active);
+int XMenuSetSelection(XMenu *menu, int p_num, int s_num, int active);
+int XMenuRecompute(Display *display, XMenu *menu);
+void XMenuEventHandler(int (*handler) (XEvent *));
+int XMenuLocate(Display *display, XMenu *menu, int p_num, int s_num, int
x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height);
+void XMenuSetFreeze(XMenu *menu, int freeze);
void XMenuActivateSetWaitFunction(Wait_func func, void *data);
-int XMenuActivate(Display *display, XMenu *menu, int *p_num, int *s_num, int
x_pos, int y_pos, unsigned int event_mask, char **data, void (*help_callback)
(char *, int, int));
-char *XMenuPost(register Display *display, register XMenu *menu, register int
*p_num, register int *s_num, register int x_pos, register int y_pos, int
event_mask);
-int XMenuDeletePane(register Display *display, register XMenu *menu, register
int p_num);
-int XMenuDeleteSelection(register Display *display, register XMenu *menu,
register int p_num, register int s_num);
-int XMenuDestroy(Display *display, register XMenu *menu); /* No
value actually returned. */
-char *XMenuError(void);
+int XMenuActivate(Display *display, XMenu *menu, int *p_num, int *s_num, int
x_pos, int y_pos, unsigned int event_mask, char **data, void (*help_callback)
(char const *, int, int));
+char *XMenuPost(Display *display, XMenu *menu, int *p_num, int *s_num, int
x_pos, int y_pos, int event_mask);
+int XMenuDeletePane(Display *display, XMenu *menu, int p_num);
+int XMenuDeleteSelection(Display *display, XMenu *menu, int p_num, int s_num);
+void XMenuDestroy(Display *display, XMenu *menu);
+char const *XMenuError(void);
+void XMenuSetAEQ(XMenu *menu, int aeq);
#endif
/* Don't add after this point. */
-
=== modified file 'oldXMenu/XMenuInt.h'
--- a/oldXMenu/XMenuInt.h 2011-01-15 23:16:57 +0000
+++ b/oldXMenu/XMenuInt.h 2011-04-16 08:25:42 +0000
@@ -46,18 +46,24 @@
/*
* Internal routine declarations.
*/
-int _XMWinQueInit(void); /* No value actually returned. */
-int _XMWinQueAddPane(register Display *display, register XMenu *menu, register
XMPane *p_ptr);
-int _XMWinQueAddSelection(register Display *display, register XMenu *menu,
register XMSelect *s_ptr);
-int _XMWinQueFlush(register Display *display, register XMenu *menu, register
XMPane *pane, XMSelect *select);
-XMPane *_XMGetPanePtr(register XMenu *menu, register int p_num);
-XMSelect *_XMGetSelectionPtr(register XMPane *p_ptr, register int s_num);
-int _XMRecomputeGlobals(register Display *display, register XMenu *menu);
/* No value actually returned. */
-int _XMRecomputePane(register Display *display, register XMenu *menu, register
XMPane *p_ptr, register int p_num);
-int _XMRecomputeSelection(register Display *display, register XMenu *menu,
register XMSelect *s_ptr, register int s_num);
-int _XMTransToOrigin(Display *display, register XMenu *menu, register XMPane
*p_ptr, register XMSelect *s_ptr, int x_pos, int y_pos, int *orig_x, int
*orig_y); /* No value actually returned. */
-int _XMRefreshPane(register Display *display, register XMenu *menu, register
XMPane *pane); /* No value actually returned. */
+void _XMWinQueInit(void);
+int _XMWinQueAddPane(Display *display, XMenu *menu, XMPane *p_ptr);
+int _XMWinQueAddSelection(Display *display, XMenu *menu, XMSelect *s_ptr);
+int _XMWinQueFlush(Display *display, XMenu *menu, XMPane *pane, XMSelect
*select);
+XMPane *_XMGetPanePtr(XMenu *menu, int p_num);
+XMSelect *_XMGetSelectionPtr(XMPane *p_ptr, int s_num);
+void _XMRecomputeGlobals(Display *display, XMenu *menu);
+int _XMRecomputePane(Display *display, XMenu *menu, XMPane *p_ptr, int p_num);
+int _XMRecomputeSelection(Display *display, XMenu *menu, XMSelect *s_ptr, int
s_num);
+void _XMTransToOrigin(Display *display, XMenu *menu, XMPane *p_ptr, XMSelect
*s_ptr, int x_pos, int y_pos, int *orig_x, int *orig_y);
+void _XMRefreshPane(Display *display, XMenu *menu, XMPane *pane);
+void _XMRefreshSelection(Display *display, XMenu *menu, XMSelect *select);
+void emacs_insque (void *elem, void *prev);
+void emacs_remque (void *elem);
+void XDeleteAssoc(Display *dpy, XAssocTable *table, XID x_id);
+void XDestroyAssocTable(XAssocTable *table);
+void XMakeAssoc(Display *dpy, XAssocTable *table, XID x_id, void *data);
+void XDeleteAssoc(Display *dpy, XAssocTable *table, XID x_id);
#endif
/* Don't add stuff after this #endif */
-
=== modified file 'oldXMenu/insque.c'
--- a/oldXMenu/insque.c 2011-01-25 04:08:28 +0000
+++ b/oldXMenu/insque.c 2011-04-16 08:25:42 +0000
@@ -19,6 +19,7 @@
their callers have been renamed to emacs_mumble to allow us to
include this file in the menu library on all systems. */
+#include "XMenuInt.h"
struct qelem {
struct qelem *q_forw;
@@ -29,8 +30,10 @@
/* Insert ELEM into a doubly-linked list, after PREV. */
void
-emacs_insque (struct qelem *elem, struct qelem *prev)
+emacs_insque (void *velem, void *vprev)
{
+ struct qelem *elem = velem;
+ struct qelem *prev = vprev;
struct qelem *next = prev->q_forw;
prev->q_forw = elem;
if (next)
@@ -41,8 +44,10 @@
/* Unlink ELEM from the doubly-linked list that it is in. */
-emacs_remque (struct qelem *elem)
+void
+emacs_remque (void *velem)
{
+ struct qelem *elem = velem;
struct qelem *next = elem->q_forw;
struct qelem *prev = elem->q_back;
if (next)
@@ -50,4 +55,3 @@
if (prev)
prev->q_forw = next;
}
-
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2011-04-16 19:16:40 +0000
+++ b/src/ChangeLog 2011-04-16 23:11:35 +0000
@@ -1,3 +1,107 @@
+2011-04-16 Paul Eggert <address@hidden>
+
+ Static checks with GCC 4.6.0 and non-default toolkits.
+
+ * s/sol2-6.h, s/unixware.h (PTY_TTY_NAME_SPRINTF): Protoize decl.
+
+ * process.c (keyboard_bit_set): Define only if SIGIO.
+ (send_process_trap): Mark it with NO_RETURN if it doesn't return.
+ (send_process): Repair possible setjmp clobbering.
+
+ * s/usg5-4-common.h (SETUP_SLAVE_PTY): Don't pass extra arg to 'fatal'.
+
+ * eval.c: Include <stdio.h>, for vsnprintf on non-GNU/Linux hosts.
+
+ * data.c (arith_error): Mark with NO_RETURN if it doesn't return.
+
+ * alloc.c (bytes_used_when_full, SPARE_MEMORY, BYTES_USED):
+ Define only if needed.
+
+ * sysdep.c (_FILE_OFFSET_BITS): Make this hack even uglier
+ by pacifying GCC about it. Maybe it's time to retire it?
+ * xfaces.c (USG, __TIMEVAL__): Likewise.
+
+ * dispextern.h (struct redisplay_interface): Rename param
+ to avoid shadowing.
+ * termhooks.h (struct terminal): Likewise.
+ * xterm.c (xembed_send_message): Likewise.
+
+ * insdel.c (make_gap_smaller): Define only if
+ USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC.
+
+ * keyboard.c (read_char): Make a var volatile so longjmp won't clobber
+ it.
+
+ * emacs.c (MAX_HEAP_BSS_DIFF, my_edata): Move to where they're used,
+ so that we aren't warned about unused symbols.
+
+ * xfns.c (Fx_file_dialog): Rename local to avoid shadowing.
+
+ * xdisp.c (x_produce_glyphs): Mark var as initialized (Bug#8512).
+
+ * xfns.c (x_real_positions): Mark locals as initialized.
+
+ * xmenu.c (xmenu_show): Don't use uninitialized vars.
+
+ * xterm.c: Fix problems found by static analysis with other toolkits.
+ (toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT.
+ (x_dispatch_event): Declare static if USE_GTK, and
+ define if USE_GTK || USE_X_TOOLKIT.
+ (SET_SAVED_BUTTON_EVENT): Define only if USE_X_TOOLKIT || USE_GTK.
+ * xterm.h (x_dispatch_event): Extern only if USE_X_TOOLKIT.
+ * xterm.c, xterm.h (x_mouse_leave): Bring this function back, but only
if
+ defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK.
+
+ * xmenu.c (menu_help_callback): Pointer type fixes.
+ Use const pointers when pointing at readonly data. Avoid pointer
+ signedness clashes.
+ (FALSE): Remove unused macro.
+ (update_frame_menubar): Remove unused decl.
+
+ * xfns.c (Fx_hide_tip): Move locals to avoid shadowing.
+
+ * menu.c (push_submenu_start, push_submenu_end): Do not define unless
+ USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI.
+ (single_menu_item): Rename local to avoid shadowing.
+
+ * keyboard.c (make_lispy_event): Remove unused local var.
+
+ * frame.c, frame.h (x_get_resource_string): Bring this back, but
+ only if HAVE_X_WINDOWS && !USE_X_TOOLKIT.
+
+ * bitmaps: Change bitmaps from unsigned char back to the X11
+ compatible char. Avoid the old compiler warnings about
+ out-of-range initializers by using, for example, '\xab' rather
+ than 0xab.
+
+ * xgselect.c (xgselect_initialize): Check vs interface
+ even if ! (defined (USE_GTK) || defined (HAVE_GCONF)).
+
+ * xmenu.c (xmenu_show): Rename parm to avoid shadowing.
+
+ * xterm.c (x_create_toolkit_scroll_bar): Use const * for pointers
+ to read-only memory.
+
+ * fns.c (vector): Remove; this old hack is no longer needed.
+
+ * xsmfns.c (create_client_leader_window): Rename shadowing arg.
+ Remove unused var.
+ (gdk_x11_set_sm_client_id) [!USE_GTK]: Don't define.
+
+ * xrdb.c (x_load_resources): Omit unused local.
+
+ * xfns.c (free_frame_menubar, atof): Remove duplicate decls.
+ (x_window): Rename locals to avoid shadowing.
+ (USG): Use the kludged USG macro, to pacify gcc.
+
+ * xterm.c (x_alloc_nearest_color_for_widget): Remove; unused.
+ (x_term_init): Remove local to avoid shadowing.
+
+ * xfns.c, xterm.c (_XEditResCheckMessages): Protoize decl.
+
+ * xdisp.c, dispextern.h (set_vertical_scroll_bar): Now extern if
+ USE_TOOLKIT_SCROLL_BARS && !USE_GTK, as xterm.c needs it then.
+
2011-04-16 Eli Zaretskii <address@hidden>
* gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'.
=== modified file 'src/alloc.c'
--- a/src/alloc.c 2011-04-14 20:16:48 +0000
+++ b/src/alloc.c 2011-04-16 21:47:57 +0000
@@ -139,10 +139,6 @@
#endif /* ! defined HAVE_GTK_AND_PTHREAD */
#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */
-/* Value of _bytes_used, when spare_memory was freed. */
-
-static __malloc_size_t bytes_used_when_full;
-
/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer
to a struct Lisp_String. */
@@ -198,9 +194,11 @@
static char *spare_memory[7];
+#ifndef SYSTEM_MALLOC
/* Amount of spare memory to keep in large reserve block. */
#define SPARE_MEMORY (1 << 14)
+#endif
/* Number of extra blocks malloc should get when it needs more core. */
@@ -469,13 +467,6 @@
intern ("emergency"));
pending_malloc_warning = 0;
}
-
-
-#ifdef DOUG_LEA_MALLOC
-# define BYTES_USED (mallinfo ().uordblks)
-#else
-# define BYTES_USED _bytes_used
-#endif
/* Called if we can't allocate relocatable space for a buffer. */
@@ -1096,8 +1087,18 @@
static void * (*old_realloc_hook) (void *, size_t, const void*);
static void (*old_free_hook) (void*, const void*);
+#ifdef DOUG_LEA_MALLOC
+# define BYTES_USED (mallinfo ().uordblks)
+#else
+# define BYTES_USED _bytes_used
+#endif
+
static __malloc_size_t bytes_used_when_reconsidered;
+/* Value of _bytes_used, when spare_memory was freed. */
+
+static __malloc_size_t bytes_used_when_full;
+
/* This function is used as the hook for free to call. */
static void
@@ -3296,7 +3297,7 @@
/* Record the space now used. When it decreases substantially,
we can refill the memory reserve. */
-#ifndef SYSTEM_MALLOC
+#if !defined SYSTEM_MALLOC && !defined SYNC_INPUT
bytes_used_when_full = BYTES_USED;
#endif
=== modified file 'src/bitmaps/cntrpmsk.xbm'
--- a/src/bitmaps/cntrpmsk.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/cntrpmsk.xbm 2011-04-16 08:30:05 +0000
@@ -1,6 +1,6 @@
#define cntr_ptrmsk_width 16
#define cntr_ptrmsk_height 16
-static unsigned char cntr_ptrmsk_bits[] = {
- 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f,
- 0xf8, 0x1f, 0xf8, 0x1f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xdc, 0x3b,
- 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03};
+static char cntr_ptrmsk_bits[] = {
+
'\xc0','\x03','\xc0','\x03','\xe0','\x07','\xe0','\x07','\xf0','\x0f','\xf0','\x0f',
+
'\xf8','\x1f','\xf8','\x1f','\xfc','\x3f','\xfc','\x3f','\xfc','\x3f','\xdc','\x3b',
+ '\xc0','\x03','\xc0','\x03','\xc0','\x03','\xc0','\x03'};
=== modified file 'src/bitmaps/cntrptr.xbm'
--- a/src/bitmaps/cntrptr.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/cntrptr.xbm 2011-04-16 08:30:05 +0000
@@ -2,7 +2,7 @@
#define cntr_ptr_height 16
#define cntr_ptr_x_hot 7
#define cntr_ptr_y_hot 1
-static unsigned char cntr_ptr_bits[] = {
- 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07,
- 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0x98, 0x19, 0x88, 0x11, 0x80, 0x01,
- 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00};
+static char cntr_ptr_bits[] = {
+
'\x00','\x00','\x80','\x01','\x80','\x01','\xc0','\x03','\xc0','\x03','\xe0','\x07',
+
'\xe0','\x07','\xf0','\x0f','\xf0','\x0f','\x98','\x19','\x88','\x11','\x80','\x01',
+ '\x80','\x01','\x80','\x01','\x80','\x01','\x00','\x00'};
=== modified file 'src/bitmaps/crosswv.xbm'
--- a/src/bitmaps/crosswv.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/crosswv.xbm 2011-04-16 08:30:05 +0000
@@ -1,6 +1,6 @@
#define cross_weave_width 16
#define cross_weave_height 16
-static unsigned char cross_weave_bits[] = {
- 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88,
- 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22,
- 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22};
+static char cross_weave_bits[] = {
+
'\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22','\x55','\x55','\x88','\x88',
+
'\x55','\x55','\x22','\x22','\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22',
+ '\x55','\x55','\x88','\x88','\x55','\x55','\x22','\x22'};
=== modified file 'src/bitmaps/dimple1.xbm'
--- a/src/bitmaps/dimple1.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/dimple1.xbm 2011-04-16 08:30:05 +0000
@@ -1,6 +1,6 @@
#define dimple1_width 16
#define dimple1_height 16
-static unsigned char dimple1_bits[] = {
- 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00,
- 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00,
- 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00};
+static char dimple1_bits[] = {
+
'\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00',
+
'\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00',
+ '\x55','\x55','\x00','\x00','\x55','\x55','\x00','\x00'};
=== modified file 'src/bitmaps/dimple3.xbm'
--- a/src/bitmaps/dimple3.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/dimple3.xbm 2011-04-16 08:30:05 +0000
@@ -1,6 +1,6 @@
#define dimple3_width 16
#define dimple3_height 16
-static unsigned char dimple3_bits[] = {
- 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+static char dimple3_bits[] = {
+
'\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00','\x11','\x11','\x00','\x00',
+
'\x00','\x00','\x00','\x00','\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00',
+ '\x11','\x11','\x00','\x00','\x00','\x00','\x00','\x00'};
=== modified file 'src/bitmaps/gray.xbm'
--- a/src/bitmaps/gray.xbm 2011-02-06 03:48:28 +0000
+++ b/src/bitmaps/gray.xbm 2011-04-16 08:30:05 +0000
@@ -1,4 +1,4 @@
#define gray_width 2
#define gray_height 2
static char gray_bits[] = {
- 0x01, 0x02};
+ '\x01','\x02'};
=== modified file 'src/bitmaps/gray1.xbm'
--- a/src/bitmaps/gray1.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/gray1.xbm 2011-04-16 08:30:05 +0000
@@ -1,4 +1,4 @@
#define gray1_width 2
#define gray1_height 2
-static unsigned char gray1_bits[] = {
- 0x01, 0x02};
+static char gray1_bits[] = {
+ '\x01','\x02'};
=== modified file 'src/bitmaps/gray3.xbm'
--- a/src/bitmaps/gray3.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/gray3.xbm 2011-04-16 08:30:05 +0000
@@ -1,4 +1,4 @@
#define gray3_width 4
#define gray3_height 4
-static unsigned char gray3_bits[] = {
- 0x01, 0x00, 0x04, 0x00};
+static char gray3_bits[] = {
+ '\x01','\x00','\x04','\x00'};
=== modified file 'src/bitmaps/leftpmsk.xbm'
--- a/src/bitmaps/leftpmsk.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/leftpmsk.xbm 2011-04-16 08:30:05 +0000
@@ -1,6 +1,6 @@
#define left_ptrmsk_width 16
#define left_ptrmsk_height 16
-static unsigned char left_ptrmsk_bits[] = {
- 0x0c, 0x00, 0x1c, 0x00, 0x3c, 0x00, 0x7c, 0x00, 0xfc, 0x00, 0xfc, 0x01,
- 0xfc, 0x03, 0xfc, 0x07, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x01, 0xdc, 0x03,
- 0xcc, 0x03, 0x80, 0x07, 0x80, 0x07, 0x00, 0x03};
+static char left_ptrmsk_bits[] = {
+
'\x0c','\x00','\x1c','\x00','\x3c','\x00','\x7c','\x00','\xfc','\x00','\xfc','\x01',
+
'\xfc','\x03','\xfc','\x07','\xfc','\x0f','\xfc','\x0f','\xfc','\x01','\xdc','\x03',
+ '\xcc','\x03','\x80','\x07','\x80','\x07','\x00','\x03'};
=== modified file 'src/bitmaps/leftptr.xbm'
--- a/src/bitmaps/leftptr.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/leftptr.xbm 2011-04-16 08:30:05 +0000
@@ -2,7 +2,7 @@
#define left_ptr_height 16
#define left_ptr_x_hot 3
#define left_ptr_y_hot 1
-static unsigned char left_ptr_bits[] = {
- 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00,
- 0xf8, 0x01, 0xf8, 0x03, 0xf8, 0x07, 0xf8, 0x00, 0xd8, 0x00, 0x88, 0x01,
- 0x80, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00};
+static char left_ptr_bits[] = {
+
'\x00','\x00','\x08','\x00','\x18','\x00','\x38','\x00','\x78','\x00','\xf8','\x00',
+
'\xf8','\x01','\xf8','\x03','\xf8','\x07','\xf8','\x00','\xd8','\x00','\x88','\x01',
+ '\x80','\x01','\x00','\x03','\x00','\x03','\x00','\x00'};
=== modified file 'src/bitmaps/rtpmsk.xbm'
--- a/src/bitmaps/rtpmsk.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/rtpmsk.xbm 2011-04-16 08:30:05 +0000
@@ -1,6 +1,6 @@
#define right_ptrmsk_width 16
#define right_ptrmsk_height 16
-static unsigned char right_ptrmsk_bits[] = {
- 0x00, 0x30, 0x00, 0x38, 0x00, 0x3c, 0x00, 0x3e, 0x00, 0x3f, 0x80, 0x3f,
- 0xc0, 0x3f, 0xe0, 0x3f, 0xf0, 0x3f, 0xf0, 0x3f, 0x80, 0x3f, 0xc0, 0x3b,
- 0xc0, 0x33, 0xe0, 0x01, 0xe0, 0x01, 0xc0, 0x00};
+static char right_ptrmsk_bits[] = {
+
'\x00','\x30','\x00','\x38','\x00','\x3c','\x00','\x3e','\x00','\x3f','\x80','\x3f',
+
'\xc0','\x3f','\xe0','\x3f','\xf0','\x3f','\xf0','\x3f','\x80','\x3f','\xc0','\x3b',
+ '\xc0','\x33','\xe0','\x01','\xe0','\x01','\xc0','\x00'};
=== modified file 'src/bitmaps/rtptr.xbm'
--- a/src/bitmaps/rtptr.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/rtptr.xbm 2011-04-16 08:30:05 +0000
@@ -2,7 +2,7 @@
#define right_ptr_height 16
#define right_ptr_x_hot 12
#define right_ptr_y_hot 1
-static unsigned char right_ptr_bits[] = {
- 0x00, 0x00, 0x00, 0x10, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x1e, 0x00, 0x1f,
- 0x80, 0x1f, 0xc0, 0x1f, 0xe0, 0x1f, 0x00, 0x1f, 0x00, 0x1b, 0x80, 0x11,
- 0x80, 0x01, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00};
+static char right_ptr_bits[] = {
+
'\x00','\x00','\x00','\x10','\x00','\x18','\x00','\x1c','\x00','\x1e','\x00','\x1f',
+
'\x80','\x1f','\xc0','\x1f','\xe0','\x1f','\x00','\x1f','\x00','\x1b','\x80','\x11',
+ '\x80','\x01','\xc0','\x00','\xc0','\x00','\x00','\x00'};
=== modified file 'src/bitmaps/stipple.xbm'
--- a/src/bitmaps/stipple.xbm 1999-09-29 16:37:29 +0000
+++ b/src/bitmaps/stipple.xbm 2011-04-16 08:30:05 +0000
@@ -1,4 +1,4 @@
#define stipple_width 16
#define stipple_height 4
-static unsigned char stipple_bits[] = {
- 0x55, 0x55, 0xee, 0xee, 0x55, 0x55, 0xba, 0xbb};
+static char stipple_bits[] = {
+ '\x55','\x55','\xee','\xee','\x55','\x55','\xba','\xbb'};
=== modified file 'src/data.c'
--- a/src/data.c 2011-04-14 05:04:02 +0000
+++ b/src/data.c 2011-04-16 21:48:36 +0000
@@ -3305,6 +3305,10 @@
XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1;
}
+#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD
+static void arith_error (int) NO_RETURN;
+#endif
+
static void
arith_error (int signo)
{
=== modified file 'src/dispextern.h'
--- a/src/dispextern.h 2011-04-14 03:01:10 +0000
+++ b/src/dispextern.h 2011-04-16 21:24:54 +0000
@@ -2650,9 +2650,9 @@
int cursor_type, int cursor_width,
int on_p, int active_p);
-/* Draw vertical border for window W from (X,Y0) to (X,Y1). */
+/* Draw vertical border for window W from (X,Y_0) to (X,Y_1). */
void (*draw_vertical_window_border) (struct window *w,
- int x, int y0, int y1);
+ int x, int y_0, int y_1);
/* Shift display of frame F to make room for inserted glyphs.
The area at pixel (X,Y) of width WIDTH and height HEIGHT is
@@ -2953,6 +2953,9 @@
int display_prop_intangible_p (Lisp_Object);
void resize_echo_area_exactly (void);
int resize_mini_window (struct window *, int);
+#if defined USE_TOOLKIT_SCROLL_BARS && !defined USE_GTK
+void set_vertical_scroll_bar (struct window *);
+#endif
int try_window (Lisp_Object, struct text_pos, int);
void window_box (struct window *, int, int *, int *, int *, int *);
int window_box_height (struct window *);
=== modified file 'src/emacs.c'
--- a/src/emacs.c 2011-04-14 05:04:02 +0000
+++ b/src/emacs.c 2011-04-16 20:21:26 +0000
@@ -164,10 +164,6 @@
/* The gap between BSS end and heap start as far as we can tell. */
static unsigned long heap_bss_diff;
-/* If the gap between BSS end and heap start is larger than this
- output a warning in dump-emacs. */
-#define MAX_HEAP_BSS_DIFF (1024*1024)
-
/* Nonzero means running Emacs without interactive terminal. */
int noninteractive;
@@ -2100,7 +2096,6 @@
You must run Emacs in batch mode in order to dump it. */)
(Lisp_Object filename, Lisp_Object symfile)
{
- extern char my_edata[];
Lisp_Object tem;
Lisp_Object symbol;
int count = SPECPDL_INDEX ();
@@ -2111,6 +2106,10 @@
error ("Dumping Emacs works only in batch mode");
#ifdef GNU_LINUX
+
+ /* Warn if the gap between BSS end and heap start is larger than this. */
+# define MAX_HEAP_BSS_DIFF (1024*1024)
+
if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
{
fprintf (stderr, "**************************************************\n");
@@ -2157,7 +2156,10 @@
#ifndef WINDOWSNT
/* On Windows, this was done before dumping, and that once suffices.
Meanwhile, my_edata is not valid on Windows. */
- memory_warnings (my_edata, malloc_warning);
+ {
+ extern char my_edata[];
+ memory_warnings (my_edata, malloc_warning);
+ }
#endif /* not WINDOWSNT */
#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT
/* Pthread may call malloc before main, and then we will get an endless
=== modified file 'src/eval.c'
--- a/src/eval.c 2011-04-14 19:34:42 +0000
+++ b/src/eval.c 2011-04-16 21:50:01 +0000
@@ -20,6 +20,7 @@
#include <config.h>
#include <limits.h>
#include <setjmp.h>
+#include <stdio.h>
#include "lisp.h"
#include "blockinput.h"
#include "commands.h"
=== modified file 'src/fns.c'
--- a/src/fns.c 2011-04-14 05:04:02 +0000
+++ b/src/fns.c 2011-04-16 03:13:28 +0000
@@ -23,11 +23,6 @@
#include <time.h>
#include <setjmp.h>
-/* Note on some machines this defines `vector' as a typedef,
- so make sure we don't use that name in this file. */
-#undef vector
-#define vector *****
-
#include "lisp.h"
#include "commands.h"
#include "character.h"
=== modified file 'src/frame.c'
--- a/src/frame.c 2011-04-14 05:04:02 +0000
+++ b/src/frame.c 2011-04-16 08:36:41 +0000
@@ -3845,6 +3845,31 @@
attribute, class, component, subclass);
}
+#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT
+/* Used when C code wants a resource value. */
+/* Called from oldXMenu/Create.c. */
+char *
+x_get_resource_string (const char *attribute, const char *class)
+{
+ char *name_key;
+ char *class_key;
+ struct frame *sf = SELECTED_FRAME ();
+
+ /* Allocate space for the components, the dots which separate them,
+ and the final '\0'. */
+ name_key = (char *) alloca (SBYTES (Vinvocation_name)
+ + strlen (attribute) + 2);
+ class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
+ + strlen (class) + 2);
+
+ sprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute);
+ sprintf (class_key, "%s.%s", EMACS_CLASS, class);
+
+ return x_get_string_resource (FRAME_X_DISPLAY_INFO (sf)->xrdb,
+ name_key, class_key);
+}
+#endif
+
/* Return the value of parameter PARAM.
First search ALIST, then Vdefault_frame_alist, then the X defaults
=== modified file 'src/frame.h'
--- a/src/frame.h 2011-04-13 23:35:33 +0000
+++ b/src/frame.h 2011-04-16 08:36:41 +0000
@@ -1133,6 +1133,10 @@
Lisp_Object component,
Lisp_Object subclass);
+#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT
+extern char *x_get_resource_string (const char *, const char *);
+#endif
+
/* In xmenu.c */
extern void set_frame_menubar (FRAME_PTR, int, int);
=== modified file 'src/insdel.c'
--- a/src/insdel.c 2011-04-14 19:34:42 +0000
+++ b/src/insdel.c 2011-04-16 20:32:18 +0000
@@ -442,6 +442,7 @@
Vinhibit_quit = tem;
}
+#if defined USE_MMAP_FOR_BUFFERS || defined REL_ALLOC || defined
DOUG_LEA_MALLOC
/* Make the gap NBYTES_REMOVED bytes shorter. */
@@ -501,6 +502,8 @@
Vinhibit_quit = tem;
}
+#endif /* USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC */
+
void
make_gap (EMACS_INT nbytes_added)
{
=== modified file 'src/keyboard.c'
--- a/src/keyboard.c 2011-04-15 02:03:43 +0000
+++ b/src/keyboard.c 2011-04-16 20:27:04 +0000
@@ -2259,7 +2259,7 @@
volatile Lisp_Object also_record;
volatile int reread;
struct gcpro gcpro1, gcpro2;
- int polling_stopped_here = 0;
+ int volatile polling_stopped_here = 0;
struct kboard *orig_kboard = current_kboard;
also_record = Qnil;
@@ -5455,7 +5455,6 @@
&& (event->modifiers & down_modifier))
{
Lisp_Object items, item;
- int i;
/* Find the menu bar item under `column'. */
item = Qnil;
=== modified file 'src/menu.c'
--- a/src/menu.c 2011-04-14 05:04:02 +0000
+++ b/src/menu.c 2011-04-16 15:11:41 +0000
@@ -180,6 +180,9 @@
menu_items = larger_vector (menu_items, menu_items_allocated, Qnil);
}
+#if (defined USE_X_TOOLKIT || defined USE_GTK || defined HAVE_NS \
+ || defined HAVE_NTGUI)
+
/* Begin a submenu. */
static void
@@ -204,6 +207,8 @@
menu_items_submenu_depth--;
}
+#endif /* USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI */
+
/* Indicate boundary between left and right. */
static void
@@ -368,34 +373,34 @@
if (skp->notbuttons)
/* The first button. Line up previous items in this menu. */
{
- int index = skp->notbuttons; /* Index for first item this menu. */
+ int idx = skp->notbuttons; /* Index for first item this menu. */
int submenu = 0;
Lisp_Object tem;
- while (index < menu_items_used)
+ while (idx < menu_items_used)
{
tem
- = XVECTOR (menu_items)->contents[index +
MENU_ITEMS_ITEM_NAME];
+ = XVECTOR (menu_items)->contents[idx + MENU_ITEMS_ITEM_NAME];
if (NILP (tem))
{
- index++;
+ idx++;
submenu++; /* Skip sub menu. */
}
else if (EQ (tem, Qlambda))
{
- index++;
+ idx++;
submenu--; /* End sub menu. */
}
else if (EQ (tem, Qt))
- index += 3; /* Skip new pane marker. */
+ idx += 3; /* Skip new pane marker. */
else if (EQ (tem, Qquote))
- index++; /* Skip a left, right divider. */
+ idx++; /* Skip a left, right divider. */
else
{
if (!submenu && SREF (tem, 0) != '\0'
&& SREF (tem, 0) != '-')
- XVECTOR (menu_items)->contents[index +
MENU_ITEMS_ITEM_NAME]
+ XVECTOR (menu_items)->contents[idx + MENU_ITEMS_ITEM_NAME]
= concat2 (build_string (" "), tem);
- index += MENU_ITEMS_ITEM_LENGTH;
+ idx += MENU_ITEMS_ITEM_LENGTH;
}
}
skp->notbuttons = 0;
=== modified file 'src/process.c'
--- a/src/process.c 2011-04-15 08:35:53 +0000
+++ b/src/process.c 2011-04-16 22:04:41 +0000
@@ -237,7 +237,9 @@
static Lisp_Object Fget_process (Lisp_Object);
static void create_process (Lisp_Object, char **, Lisp_Object);
+#ifdef SIGIO
static int keyboard_bit_set (SELECT_TYPE *);
+#endif
static void deactivate_process (Lisp_Object);
static void status_notify (struct Lisp_Process *);
static int read_process_output (Lisp_Object, int);
@@ -5220,6 +5222,10 @@
static jmp_buf send_process_frame;
static Lisp_Object process_sent_to;
+#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD
+static void send_process_trap (int) NO_RETURN;
+#endif
+
static void
send_process_trap (int ignore)
{
@@ -5360,6 +5366,8 @@
when returning with longjmp despite being declared volatile. */
if (!setjmp (send_process_frame))
{
+ p = XPROCESS (proc); /* Repair any setjmp clobbering. */
+
process_sent_to = proc;
while (len > 0)
{
@@ -6583,6 +6591,8 @@
delete_keyboard_wait_descriptor (desc);
}
+# ifdef SIGIO
+
/* Return nonzero if *MASK has a bit set
that corresponds to one of the keyboard input descriptors. */
@@ -6598,6 +6608,7 @@
return 0;
}
+# endif
#else /* not subprocesses */
=== modified file 'src/s/sol2-6.h'
--- a/src/s/sol2-6.h 2011-01-25 04:08:28 +0000
+++ b/src/s/sol2-6.h 2011-04-16 22:06:00 +0000
@@ -44,7 +44,7 @@
#define PTY_TTY_NAME_SPRINTF \
{ \
- char *ptsname (), *ptyname; \
+ char *ptsname (int), *ptyname; \
\
sigblock (sigmask (SIGCLD)); \
if (grantpt (fd) == -1) \
@@ -60,4 +60,3 @@
#define GC_SETJMP_WORKS 1
#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
-
=== modified file 'src/s/unixware.h'
--- a/src/s/unixware.h 2011-02-16 01:35:20 +0000
+++ b/src/s/unixware.h 2011-04-16 22:06:00 +0000
@@ -35,7 +35,7 @@
within, it should be caught after sigrelse(2). */
#define PTY_TTY_NAME_SPRINTF \
{ \
- char *ptsname(), *ptyname; \
+ char *ptsname (int), *ptyname; \
\
sigblock(sigmask(SIGCLD)); \
if (grantpt(fd) == -1) \
=== modified file 'src/s/usg5-4-common.h'
--- a/src/s/usg5-4-common.h 2011-03-27 02:27:11 +0000
+++ b/src/s/usg5-4-common.h 2011-04-16 21:57:28 +0000
@@ -88,11 +88,11 @@
/* Push various streams modules onto a PTY channel. */
#define SETUP_SLAVE_PTY \
if (ioctl (xforkin, I_PUSH, "ptem") == -1) \
- fatal ("ioctl I_PUSH ptem", errno); \
+ fatal ("ioctl I_PUSH ptem"); \
if (ioctl (xforkin, I_PUSH, "ldterm") == -1) \
- fatal ("ioctl I_PUSH ldterm", errno); \
+ fatal ("ioctl I_PUSH ldterm"); \
if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \
- fatal ("ioctl I_PUSH ttcompat", errno);
+ fatal ("ioctl I_PUSH ttcompat");
/* This definition was suggested for next release. So give it a try. */
#define HAVE_SOCKETS
=== modified file 'src/sysdep.c'
--- a/src/sysdep.c 2011-04-15 10:23:56 +0000
+++ b/src/sysdep.c 2011-04-16 21:26:33 +0000
@@ -2966,6 +2966,8 @@
#if PROCFS_FILE_OFFSET_BITS_HACK == 1
#define _FILE_OFFSET_BITS 64
+#ifdef _FILE_OFFSET_BITS /* Avoid unused-macro warnings. */
+#endif
#endif /* PROCFS_FILE_OFFSET_BITS_HACK == 1 */
Lisp_Object
=== modified file 'src/termhooks.h'
--- a/src/termhooks.h 2011-04-14 02:52:33 +0000
+++ b/src/termhooks.h 2011-04-16 21:27:29 +0000
@@ -465,7 +465,7 @@
enum scroll_bar_part *part,
Lisp_Object *x,
Lisp_Object *y,
- unsigned long *time);
+ unsigned long *);
/* The window system handling code should set this if the mouse has
moved since the last call to the mouse_position_hook. Calling that
@@ -484,10 +484,10 @@
support overlapping frames, so there's no need to raise or lower
anything.
- If RAISE is non-zero, F is brought to the front, before all other
- windows. If RAISE is zero, F is sent to the back, behind all other
+ If RAISE_FLAG is non-zero, F is brought to the front, before all other
+ windows. If RAISE_FLAG is zero, F is sent to the back, behind all other
windows. */
- void (*frame_raise_lower_hook) (struct frame *f, int raise);
+ void (*frame_raise_lower_hook) (struct frame *f, int raise_flag);
/* If the value of the frame parameter changed, whis hook is called.
For example, if going from fullscreen to not fullscreen this hook
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2011-04-14 20:16:48 +0000
+++ b/src/xdisp.c 2011-04-16 22:48:31 +0000
@@ -13630,7 +13630,10 @@
return rc;
}
-static void
+#if !defined USE_TOOLKIT_SCROLL_BARS || defined USE_GTK
+static
+#endif
+void
set_vertical_scroll_bar (struct window *w)
{
EMACS_INT start, end, whole;
@@ -22709,7 +22712,7 @@
int lbearing, rbearing;
int i, width, ascent, descent;
int left_padded = 0, right_padded = 0;
- int c;
+ int c IF_LINT (= 0); /* cmp->glyph_len can't be zero; see Bug#8512 */
XChar2b char2b;
struct font_metrics *pcm;
int font_not_found_p;
=== modified file 'src/xfaces.c'
--- a/src/xfaces.c 2011-04-15 02:03:43 +0000
+++ b/src/xfaces.c 2011-04-16 21:28:14 +0000
@@ -273,6 +273,8 @@
#include <X11/Xos.h>
#define USG
#define __TIMEVAL__
+#if defined USG || defined __TIMEVAL__ /* Don't warn about unused macros. */
+#endif
#else /* not XOS_NEEDS_TIME_H */
#include <X11/Xos.h>
#endif /* not XOS_NEEDS_TIME_H */
=== modified file 'src/xfns.c'
--- a/src/xfns.c 2011-04-14 20:16:48 +0000
+++ b/src/xfns.c 2011-04-16 20:07:17 +0000
@@ -83,6 +83,8 @@
#undef USG /* ####KLUDGE for Solaris 2.2 and up */
#include <X11/Xos.h>
#define USG
+#ifdef USG /* Pacify gcc -Wunused-macros. */
+#endif
#else
#include <X11/Xos.h>
#endif
@@ -105,16 +107,13 @@
#if !defined(NO_EDITRES)
#define HACK_EDITRES
-extern void _XEditResCheckMessages ();
+extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *);
#endif /* not defined NO_EDITRES */
/* Unique id counter for widgets created by the Lucid Widget Library. */
extern LWLIB_ID widget_id_tick;
-extern void free_frame_menubar ();
-extern double atof ();
-
#ifdef USE_MOTIF
#endif /* USE_MOTIF */
@@ -428,7 +427,7 @@
void
x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
{
- int win_x, win_y, outer_x, outer_y;
+ int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0);
int real_x = 0, real_y = 0;
int had_errors = 0;
Window win = f->output_data.x->parent_desc;
@@ -2430,8 +2429,8 @@
{
int len;
char *tem, shell_position[32];
- Arg al[10];
- int ac = 0;
+ Arg gal[10];
+ int gac = 0;
int extra_borders = 0;
int menubar_size
= (f->output_data.x->menubar_widget
@@ -2492,8 +2491,8 @@
If Emacs had just one program position, we could set it in
fallback resources, but since each make-frame call can specify
different program positions, this is easier. */
- XtSetArg (al[ac], XtNx, left); ac++;
- XtSetArg (al[ac], XtNy, top); ac++;
+ XtSetArg (gal[gac], XtNx, left); gac++;
+ XtSetArg (gal[gac], XtNy, top); gac++;
}
}
@@ -2504,8 +2503,8 @@
when the frame is deleted. */
tem = (char *) xmalloc (len);
strncpy (tem, shell_position, len);
- XtSetArg (al[ac], XtNgeometry, tem); ac++;
- XtSetValues (shell_widget, al, ac);
+ XtSetArg (gal[gac], XtNgeometry, tem); gac++;
+ XtSetValues (shell_widget, gal, gac);
}
XtManageChild (pane_widget);
@@ -5206,7 +5205,6 @@
int count;
Lisp_Object deleted, frame, timer;
struct gcpro gcpro1, gcpro2;
- struct frame *f;
/* Return quickly if nothing to do. */
if (NILP (tip_timer) && NILP (tip_frame))
@@ -5225,11 +5223,13 @@
call1 (Qcancel_timer, timer);
#ifdef USE_GTK
- /* When using system tooltip, tip_frame is the Emacs frame on which
- the tip is shown. */
- f = XFRAME (frame);
- if (FRAME_LIVE_P (f) && xg_hide_tooltip (f))
- frame = Qnil;
+ {
+ /* When using system tooltip, tip_frame is the Emacs frame on which
+ the tip is shown. */
+ struct frame *f = XFRAME (frame);
+ if (FRAME_LIVE_P (f) && xg_hide_tooltip (f))
+ frame = Qnil;
+ }
#endif
if (FRAMEP (frame))
@@ -5243,7 +5243,7 @@
items is unmapped. Redisplay the menu manually... */
{
Widget w;
- f = SELECTED_FRAME ();
+ struct frame *f = SELECTED_FRAME ();
w = f->output_data.x->menubar_widget;
if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen)
@@ -5462,12 +5462,12 @@
/* Get the result. */
if (result == XmCR_OK)
{
- XmString text;
+ XmString text_string;
String data;
- XtVaGetValues (dialog, XmNtextString, &text, NULL);
- XmStringGetLtoR (text, XmFONTLIST_DEFAULT_TAG, &data);
- XmStringFree (text);
+ XtVaGetValues (dialog, XmNtextString, &text_string, NULL);
+ XmStringGetLtoR (text_string, XmFONTLIST_DEFAULT_TAG, &data);
+ XmStringFree (text_string);
file = build_string (data);
XtFree (data);
}
=== modified file 'src/xgselect.c'
--- a/src/xgselect.c 2011-03-13 08:05:40 +0000
+++ b/src/xgselect.c 2011-04-16 07:57:31 +0000
@@ -19,11 +19,14 @@
#include <config.h>
+#include <setjmp.h>
+#include "xgselect.h"
+
#if defined (USE_GTK) || defined (HAVE_GCONF)
+
#include <glib.h>
#include <errno.h>
#include <setjmp.h>
-#include "xgselect.h"
static GPollFD *gfds;
static int gfds_size;
=== modified file 'src/xmenu.c'
--- a/src/xmenu.c 2011-04-14 05:04:02 +0000
+++ b/src/xmenu.c 2011-04-16 15:38:15 +0000
@@ -108,7 +108,6 @@
#ifndef TRUE
#define TRUE 1
-#define FALSE 0
#endif /* no TRUE */
static Lisp_Object Qdebug_on_next_call;
@@ -117,8 +116,6 @@
static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object,
const char **);
#endif
-
-static int update_frame_menubar (struct frame *);
/* Flag which when set indicates a dialog or menu has been posted by
Xt on behalf of one of the widget sets. */
@@ -2185,7 +2182,7 @@
keyboard events. */
static void
-menu_help_callback (char *help_string, int pane, int item)
+menu_help_callback (char const *help_string, int pane, int item)
{
Lisp_Object *first_item;
Lisp_Object pane_name;
@@ -2245,7 +2242,7 @@
Lisp_Object
xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
- Lisp_Object title, const char **error, EMACS_UINT timestamp)
+ Lisp_Object title, const char **error_name, EMACS_UINT timestamp)
{
Window root;
XMenu *menu;
@@ -2263,13 +2260,13 @@
if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f))
abort ();
- *error = 0;
+ *error_name = 0;
if (menu_items_n_panes == 0)
return Qnil;
if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
{
- *error = "Empty menu";
+ *error_name = "Empty menu";
return Qnil;
}
@@ -2282,7 +2279,7 @@
menu = XMenuCreate (FRAME_X_DISPLAY (f), root, "emacs");
if (menu == NULL)
{
- *error = "Can't create menu";
+ *error_name = "Can't create menu";
return Qnil;
}
@@ -2302,7 +2299,8 @@
y += f->top_pos;
/* Create all the necessary panes and their items. */
- maxlines = lines = i = 0;
+ maxwidth = maxlines = lines = i = 0;
+ lpane = XM_FAILURE;
while (i < menu_items_used)
{
if (EQ (XVECTOR (menu_items)->contents[i], Qt))
@@ -2324,13 +2322,12 @@
if (lpane == XM_FAILURE)
{
XMenuDestroy (FRAME_X_DISPLAY (f), menu);
- *error = "Can't create pane";
+ *error_name = "Can't create pane";
return Qnil;
}
i += MENU_ITEMS_PANE_LENGTH;
/* Find the width of the widest item in this pane. */
- maxwidth = 0;
j = i;
while (j < menu_items_used)
{
@@ -2358,40 +2355,38 @@
{
/* Create a new item within current pane. */
Lisp_Object item_name, enable, descrip, help;
- unsigned char *item_data;
- char *help_string;
+ char *item_data;
+ char const *help_string;
item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
descrip
= XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
- help_string = STRINGP (help) ? SDATA (help) : NULL;
+ help_string = STRINGP (help) ? SSDATA (help) : NULL;
if (!NILP (descrip))
{
- int gap = maxwidth - SBYTES (item_name);
/* if alloca is fast, use that to make the space,
to reduce gc needs. */
- item_data
- = (unsigned char *) alloca (maxwidth
- + SBYTES (descrip) + 1);
- memcpy (item_data, SDATA (item_name), SBYTES (item_name));
+ item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1);
+ memcpy (item_data, SSDATA (item_name), SBYTES (item_name));
for (j = SCHARS (item_name); j < maxwidth; j++)
item_data[j] = ' ';
- memcpy (item_data + j, SDATA (descrip), SBYTES (descrip));
+ memcpy (item_data + j, SSDATA (descrip), SBYTES (descrip));
item_data[j + SBYTES (descrip)] = 0;
}
else
- item_data = SDATA (item_name);
+ item_data = SSDATA (item_name);
- if (XMenuAddSelection (FRAME_X_DISPLAY (f),
- menu, lpane, 0, item_data,
- !NILP (enable), help_string)
- == XM_FAILURE)
+ if (lpane == XM_FAILURE
+ || (XMenuAddSelection (FRAME_X_DISPLAY (f),
+ menu, lpane, 0, item_data,
+ !NILP (enable), help_string)
+ == XM_FAILURE))
{
XMenuDestroy (FRAME_X_DISPLAY (f), menu);
- *error = "Can't add selection to menu";
+ *error_name = "Can't add selection to menu";
return Qnil;
}
i += MENU_ITEMS_ITEM_LENGTH;
@@ -2468,6 +2463,7 @@
status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx,
x, y, ButtonReleaseMask, &datap,
menu_help_callback);
+ entry = pane_prefix = Qnil;
switch (status)
{
@@ -2512,16 +2508,14 @@
break;
case XM_FAILURE:
- *error = "Can't activate menu";
+ *error_name = "Can't activate menu";
case XM_IA_SELECT:
- entry = Qnil;
break;
case XM_NO_SELECT:
/* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means
the menu was invoked with a mouse event as POSITION). */
if (! for_click)
Fsignal (Qquit, Qnil);
- entry = Qnil;
break;
}
=== modified file 'src/xrdb.c'
--- a/src/xrdb.c 2011-04-14 03:05:57 +0000
+++ b/src/xrdb.c 2011-04-16 04:37:14 +0000
@@ -479,7 +479,9 @@
XrmDatabase db;
char line[256];
+#if defined USE_MOTIF || !defined HAVE_XFT || !defined USE_LUCID
const char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1";
+#endif
#ifdef USE_MOTIF
const char *courier = "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1";
=== modified file 'src/xsmfns.c'
--- a/src/xsmfns.c 2011-03-08 08:34:55 +0000
+++ b/src/xsmfns.c 2011-04-16 03:06:07 +0000
@@ -41,8 +41,8 @@
#include "process.h"
#include "keyboard.h"
-#ifndef HAVE_GTK3
-#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w)
+#if defined USE_GTK && !defined HAVE_GTK3
+#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w)
#endif
/* This is the event used when SAVE_SESSION_EVENT occurs. */
@@ -250,7 +250,7 @@
props[props_idx]->vals[vp_idx++].value = chdir_opt;
}
- for (i = 1; i < initial_argc; ++i)
+ for (i = 1; i < initial_argc; ++i)
{
props[props_idx]->vals[vp_idx].length = strlen (initial_argv[i]);
props[props_idx]->vals[vp_idx++].value = initial_argv[i];
@@ -365,11 +365,10 @@
#ifndef USE_GTK
static void
-create_client_leader_window (struct x_display_info *dpyinfo, char *client_id)
+create_client_leader_window (struct x_display_info *dpyinfo, char *client_ID)
{
Window w;
XClassHint class_hints;
- Atom sm_id;
w = XCreateSimpleWindow (dpyinfo->display,
dpyinfo->root_window,
@@ -383,7 +382,7 @@
XChangeProperty (dpyinfo->display, w, dpyinfo->Xatom_SM_CLIENT_ID,
XA_STRING, 8, PropModeReplace,
- (unsigned char *)client_id, strlen (client_id));
+ (unsigned char *) client_ID, strlen (client_ID));
dpyinfo->client_leader_window = w;
}
=== modified file 'src/xterm.c'
--- a/src/xterm.c 2011-04-13 22:19:27 +0000
+++ b/src/xterm.c 2011-04-16 21:29:00 +0000
@@ -102,7 +102,7 @@
#ifdef USE_X_TOOLKIT
#if !defined(NO_EDITRES)
#define HACK_EDITRES
-extern void _XEditResCheckMessages ();
+extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *);
#endif /* not NO_EDITRES */
/* Include toolkit specific headers for the scroll bar widget. */
@@ -187,11 +187,11 @@
/* The application context for Xt use. */
XtAppContext Xt_app_con;
static String Xt_default_resources[] = {0};
-#endif /* USE_X_TOOLKIT */
/* Non-zero means user is interacting with a toolkit scroll bar. */
static int toolkit_scroll_bar_interaction;
+#endif /* USE_X_TOOLKIT */
/* Non-zero timeout value means ignore next mouse click if it arrives
before that timeout elapses (i.e. as part of the same sequence of
@@ -349,7 +349,7 @@
static void x_sync_with_move (struct frame *, int, int, int);
static int handle_one_xevent (struct x_display_info *, XEvent *,
int *, struct input_event *);
-#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT)
+#ifdef USE_GTK
static int x_dispatch_event (XEvent *, Display *);
#endif
/* Don't declare this NO_RETURN because we want no
@@ -1451,19 +1451,6 @@
}
-/* Allocate the color COLOR->pixel on the screen and display of
- widget WIDGET in colormap CMAP. If an exact match cannot be
- allocated, try the nearest color available. Value is non-zero
- if successful. This is called from lwlib. */
-
-int
-x_alloc_nearest_color_for_widget (Widget widget, Colormap cmap, XColor *color)
-{
- struct frame *f = x_frame_of_widget (widget);
- return x_alloc_nearest_color (f, cmap, color);
-}
-
-
/* Allocate a color which is lighter or darker than *PIXEL by FACTOR
or DELTA. Try a color with RGB values multiplied by FACTOR first.
If this produces the same color as PIXEL, try a color where all RGB
@@ -3459,6 +3446,16 @@
}
+#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
+/* Handle an event saying the mouse has moved out of an Emacs frame. */
+
+void
+x_mouse_leave (struct x_display_info *dpyinfo)
+{
+ x_new_focus_frame (dpyinfo, dpyinfo->x_focus_event_frame);
+}
+#endif
+
/* The focus has changed, or we have redirected a frame's focus to
another frame (this happens when a frame uses a surrogate
mini-buffer frame). Shift the highlight as appropriate.
@@ -4221,8 +4218,8 @@
ev->data.l[4] = (long) whole;
/* Make Xt timeouts work while the scroll bar is active. */
+#ifdef USE_X_TOOLKIT
toolkit_scroll_bar_interaction = 1;
-#ifdef USE_X_TOOLKIT
x_activate_timeout_atimer ();
#endif
@@ -4535,7 +4532,7 @@
Widget widget;
Arg av[20];
int ac = 0;
- char *scroll_bar_name = SCROLL_BAR_NAME;
+ char const *scroll_bar_name = SCROLL_BAR_NAME;
unsigned long pixel;
BLOCK_INPUT;
@@ -4687,8 +4684,8 @@
f->output_data.x->edit_widget, av, ac);
{
- char *initial = "";
- char *val = initial;
+ char const *initial = "";
+ char const *val = initial;
XtVaGetValues (widget, XtNscrollVCursor, (XtPointer) &val,
#ifdef XtNarrowScrollbars
XtNarrowScrollbars, (XtPointer) &xaw3d_arrow_scroll,
@@ -5668,6 +5665,7 @@
static struct x_display_info *next_noop_dpyinfo;
+#if defined USE_X_TOOLKIT || defined USE_GTK
#define SET_SAVED_BUTTON_EVENT \
do
\
{ \
@@ -5679,6 +5677,7 @@
XSETFRAME (inev.ie.frame_or_window, f); \
} \
while (0)
+#endif
enum
{
@@ -5764,8 +5763,8 @@
#endif /* USE_GTK */
-static void xembed_send_message (struct frame *f, Time time,
- enum xembed_message message,
+static void xembed_send_message (struct frame *f, Time,
+ enum xembed_message,
long detail, long data1, long data2);
/* Handles the XEvent EVENT on display DPYINFO.
@@ -6978,15 +6977,13 @@
return count;
}
+#if defined USE_GTK || defined USE_X_TOOLKIT
/* Handles the XEvent EVENT on display DISPLAY.
This is used for event loops outside the normal event handling,
i.e. looping while a popup menu or a dialog is posted.
Returns the value handle_one_xevent sets in the finish argument. */
-#if ! (defined USE_MOTIF || defined USE_X_TOOLKIT)
-static
-#endif
int
x_dispatch_event (XEvent *event, Display *display)
{
@@ -7000,6 +6997,7 @@
return finish;
}
+#endif
/* Read events coming from the X server.
@@ -10273,10 +10271,10 @@
#ifdef USE_LUCID
{
- Display *dpy = dpyinfo->display;
XrmValue d, fr, to;
Font font;
+ dpy = dpyinfo->display;
d.addr = (XPointer)&dpy;
d.size = sizeof (Display *);
fr.addr = XtDefaultFont;
=== modified file 'src/xterm.h'
--- a/src/xterm.h 2011-04-14 03:04:14 +0000
+++ b/src/xterm.h 2011-04-16 16:44:58 +0000
@@ -982,11 +982,11 @@
extern void x_query_colors (struct frame *f, XColor *, int);
extern void x_query_color (struct frame *f, XColor *);
extern void x_clear_area (Display *, Window, int, int, int, int, int);
-#ifdef WINDOWSNT
+#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
extern void x_mouse_leave (struct x_display_info *);
#endif
-#if defined USE_MOTIF || defined USE_X_TOOLKIT
+#ifdef USE_X_TOOLKIT
extern int x_dispatch_event (XEvent *, Display *);
#endif
extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r103934: Static checks with GCC 4.6.0 and non-default toolkits.,
Paul Eggert <=