summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-13 20:54:08 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-13 20:54:08 -0200
commitb88273dcdd403e058888fbcdf4a0470854045179 (patch)
tree72840a1d738f764ea54eba9bbecab4507cd4b2e3
parent4882f2fc26a5976fe7744286932263c83f1c61dc (diff)
Ansification and compile warning fixes.
This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings.
-rw-r--r--.gitignore4
-rw-r--r--Mailbox.c107
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac8
-rw-r--r--xbiff.c14
5 files changed, 53 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore
index f41ccc6..40d41c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,3 +18,7 @@ stamp-h1
xbiff
xbiff.1
*~
+*.o
+xbiff-*.tar.*
+ChangeLog
+tags
diff --git a/Mailbox.c b/Mailbox.c
index 5b1cabf..d7f7fb8 100644
--- a/Mailbox.c
+++ b/Mailbox.c
@@ -106,7 +106,9 @@ typedef union wait waitType;
static char defaultTranslations[] =
"<ButtonPress>: unset()";
-static void Check(), Set(), Unset();
+static void Set (Widget gw, XEvent *event, String *params, Cardinal *nparams);
+static void Check(Widget gw, XEvent *event, String *params, Cardinal *nparams);
+static void Unset(Widget gw, XEvent *event, String *params, Cardinal *nparams);
static XtActionsRec actionsList[] = {
{ "check", Check },
@@ -157,10 +159,20 @@ static XtResource resources[] = {
#undef offset
#undef goffset
-static void GetMailFile(), CloseDown();
-static void check_mailbox(), redraw_mailbox(), beep();
-static void Initialize(), Realize(), Destroy(), Redisplay();
-static Boolean SetValues();
+static void GetMailFile(MailboxWidget w);
+static void CloseDown (MailboxWidget w, int status);
+
+static void check_mailbox(MailboxWidget w, Boolean force_redraw, Boolean reset);
+static void redraw_mailbox (MailboxWidget w);
+static void beep (MailboxWidget w);
+static void Initialize (Widget request, Widget new,
+ ArgList args, Cardinal *num_args);
+static void Realize (Widget gw, XtValueMask *valuemaskp,
+ XSetWindowAttributes *attr);
+static void Destroy (Widget gw);
+static void Redisplay (Widget gw, XEvent *event, Region region);
+static Boolean SetValues (Widget gcurrent, Widget grequest, Widget gnew,
+ ArgList args, Cardinal *num_args);
MailboxClassRec mailboxClassRec = {
{ /* core fields */
@@ -212,8 +224,7 @@ WidgetClass mailboxWidgetClass = (WidgetClass) &mailboxClassRec;
* widget initialization
*/
-static GC get_mailbox_gc (w)
- MailboxWidget w;
+static GC get_mailbox_gc (MailboxWidget w)
{
XtGCMask valuemask;
XGCValues xgcv;
@@ -228,10 +239,8 @@ static GC get_mailbox_gc (w)
/* ARGSUSED */
-static void Initialize (request, new, args, num_args)
- Widget request, new;
- ArgList args;
- Cardinal *num_args;
+static void Initialize (Widget request, Widget new,
+ ArgList args, Cardinal *num_args)
{
MailboxWidget w = (MailboxWidget) new;
int shape_event_base, shape_error_base;
@@ -264,19 +273,13 @@ static void Initialize (request, new, args, num_args)
*/
/* ARGSUSED */
-static void Set (gw, event, params, nparams)
- Widget gw;
- XEvent *event;
- String *params;
- Cardinal *nparams;
+static void Set (Widget gw, XEvent *event, String *params, Cardinal *nparams)
{
MailboxWidget w = (MailboxWidget) gw;
w->mailbox.last_size = -1;
check_mailbox (w, TRUE, FALSE); /* redraw, no reset */
-
- return;
}
@@ -285,17 +288,11 @@ static void Set (gw, event, params, nparams)
*/
/* ARGSUSED */
-static void Unset (gw, event, params, nparams)
- Widget gw;
- XEvent *event;
- String *params;
- Cardinal *nparams;
+static void Unset (Widget gw, XEvent *event, String *params, Cardinal *nparams)
{
MailboxWidget w = (MailboxWidget) gw;
check_mailbox (w, TRUE, TRUE); /* redraw, reset */
-
- return;
}
@@ -304,24 +301,16 @@ static void Unset (gw, event, params, nparams)
*/
/* ARGSUSED */
-static void Check (gw, event, params, nparams)
- Widget gw;
- XEvent *event;
- String *params;
- Cardinal *nparams;
+static void Check (Widget gw, XEvent *event, String *params, Cardinal *nparams)
{
MailboxWidget w = (MailboxWidget) gw;
check_mailbox (w, TRUE, FALSE); /* redraw, no reset */
-
- return;
}
/* ARGSUSED */
-static void clock_tic (client_data, id)
- XtPointer client_data;
- XtIntervalId *id;
+static void clock_tic (XtPointer client_data, XtIntervalId *id)
{
MailboxWidget w = (MailboxWidget) client_data;
@@ -338,13 +327,8 @@ static void clock_tic (client_data, id)
return;
}
-static Pixmap make_pixmap (dpy, w, bitmap, depth, flip, widthp, heightp)
- Display *dpy;
- MailboxWidget w;
- Pixmap bitmap;
- Boolean flip;
- int depth;
- int *widthp, *heightp;
+static Pixmap make_pixmap (Display *dpy, MailboxWidget w, Pixmap bitmap,
+ int depth, Boolean flip, int *widthp, int *heightp)
{
Window root;
int x, y;
@@ -367,10 +351,8 @@ static Pixmap make_pixmap (dpy, w, bitmap, depth, flip, widthp, heightp)
width, height, depth, fore, back);
}
-static void Realize (gw, valuemaskp, attr)
- Widget gw;
- XtValueMask *valuemaskp;
- XSetWindowAttributes *attr;
+static void Realize (Widget gw, XtValueMask *valuemaskp,
+ XSetWindowAttributes *attr)
{
MailboxWidget w = (MailboxWidget) gw;
register Display *dpy = XtDisplay (w);
@@ -421,8 +403,7 @@ static void Realize (gw, valuemaskp, attr)
}
-static void Destroy (gw)
- Widget gw;
+static void Destroy (Widget gw)
{
MailboxWidget w = (MailboxWidget) gw;
Display *dpy = XtDisplay (gw);
@@ -439,14 +420,10 @@ static void Destroy (gw)
freepix (w->mailbox.empty.pixmap);
freepix (w->mailbox.shape_cache.mask);
#undef freepix
- return;
}
-static void Redisplay (gw, event, region)
- Widget gw;
- XEvent *event;
- Region region;
+static void Redisplay (Widget gw, XEvent *event, Region region)
{
MailboxWidget w = (MailboxWidget) gw;
@@ -454,9 +431,7 @@ static void Redisplay (gw, event, region)
}
-static void check_mailbox (w, force_redraw, reset)
- MailboxWidget w;
- Boolean force_redraw, reset;
+static void check_mailbox (MailboxWidget w, Boolean force_redraw, Boolean reset)
{
long mailboxsize = 0;
Boolean readSinceLastWrite = FALSE;
@@ -541,8 +516,7 @@ static void check_mailbox (w, force_redraw, reset)
* get user name for building mailbox
*/
-static void GetMailFile (w)
- MailboxWidget w;
+static void GetMailFile (MailboxWidget w)
{
char *username;
char *mailpath;
@@ -553,7 +527,6 @@ static void GetMailFile (w)
CloseDown (w, 1);
}
#else
- char *getlogin();
username = getlogin ();
if (!username) {
@@ -580,9 +553,7 @@ static void GetMailFile (w)
return;
}
-static void CloseDown (w, status)
- MailboxWidget w;
- int status;
+static void CloseDown (MailboxWidget w, int status)
{
Display *dpy = XtDisplay (w);
@@ -593,10 +564,8 @@ static void CloseDown (w, status)
/* ARGSUSED */
-static Boolean SetValues (gcurrent, grequest, gnew, args, num_args)
- Widget gcurrent, grequest, gnew;
- ArgList args;
- Cardinal *num_args;
+static Boolean SetValues (Widget gcurrent, Widget grequest, Widget gnew,
+ ArgList args, Cardinal *num_args)
{
MailboxWidget current = (MailboxWidget) gcurrent;
MailboxWidget new = (MailboxWidget) gnew;
@@ -626,8 +595,7 @@ static Boolean SetValues (gcurrent, grequest, gnew, args, num_args)
* drawing code
*/
-static void redraw_mailbox (w)
- MailboxWidget w;
+static void redraw_mailbox (MailboxWidget w)
{
register Display *dpy = XtDisplay (w);
register Window win = XtWindow (w);
@@ -679,8 +647,7 @@ static void redraw_mailbox (w)
}
-static void beep (w)
- MailboxWidget w;
+static void beep (MailboxWidget w)
{
XBell (XtDisplay (w), w->mailbox.volume);
return;
diff --git a/Makefile.am b/Makefile.am
index 80c4e30..1038037 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -72,6 +72,6 @@ MAINTAINERCLEANFILES = ChangeLog
.PHONY: ChangeLog
ChangeLog:
- (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
+ $(CHANGELOG_CMD)
dist-hook: ChangeLog
diff --git a/configure.ac b/configure.ac
index 93ee2ef..6954f9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,15 +26,20 @@ AC_INIT(xbiff,[1.0.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg]
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
+# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG
+m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.2)
+
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_INSTALL
+XORG_CWARNFLAGS
PKG_CHECK_MODULES(XAW, xaw7)
PKG_CHECK_MODULES(XBIFF, xbitmaps xext)
-XBIFF_CFLAGS="$XBIFF_CFLAGS $XAW_CFLAGS"
+XBIFF_CFLAGS="$CWARNFLAGS $XBIFF_CFLAGS $XAW_CFLAGS"
XBIFF_LIBS="$XBIFF_LIBS $XAW_LIBS"
AC_SUBST(XBIFF_CFLAGS)
@@ -42,5 +47,6 @@ AC_SUBST(XBIFF_LIBS)
XORG_MANPAGE_SECTIONS
XORG_RELEASE_VERSION
+XORG_CHANGELOG
AC_OUTPUT([Makefile])
diff --git a/xbiff.c b/xbiff.c
index ac73608..a5ecdef 100644
--- a/xbiff.c
+++ b/xbiff.c
@@ -38,7 +38,7 @@ from the X Consortium.
#include "Mailbox.h"
#include <X11/Xaw/Cardinals.h>
-const char *ProgramName;
+static const char *ProgramName;
static XrmOptionDescRec options[] = {
{ "-update", "*mailbox.update", XrmoptionSepArg, (caddr_t) NULL },
@@ -49,11 +49,7 @@ static XrmOptionDescRec options[] = {
static Atom wm_delete_window;
-static void quit (w, event, params, num_params)
- Widget w;
- XEvent *event;
- String *params;
- Cardinal *num_params;
+static void quit (Widget w, XEvent *event, String *params, Cardinal *num_params)
{
if (event->type == ClientMessage &&
event->xclient.data.l[0] != wm_delete_window) {
@@ -68,7 +64,7 @@ static XtActionsRec xbiff_actions[] = {
{ "quit", quit },
};
-static void Usage ()
+static void Usage (void)
{
static const char *help_message[] = {
"where options include:",
@@ -93,9 +89,7 @@ NULL};
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
XtAppContext xtcontext;
Widget toplevel;