Fix up a bunch of clang warnings and errors. This includes some bug
fixes, because clang found a couple things that were decidedly wrong/broken; therefore PKGREVISION -> 3. This package has too many patches (it only looks like a moderate number compared to xview) and many/most of them should be rolled into a jumbo patch and posted as a distfile. One of these years...
This commit is contained in:
parent
d476ab601f
commit
1a30992bd9
11 changed files with 630 additions and 49 deletions
|
@ -1,8 +1,8 @@
|
|||
# $NetBSD: Makefile,v 1.12 2011/06/19 09:30:49 alnsn Exp $
|
||||
# $NetBSD: Makefile,v 1.13 2011/09/19 07:15:52 dholland Exp $
|
||||
|
||||
DISTNAME= xmx-2.1alpha.pl7
|
||||
PKGNAME= xmx-2.1a7
|
||||
PKGREVISION= 2
|
||||
PKGREVISION= 3
|
||||
CATEGORIES= x11
|
||||
MASTER_SITES= ftp://ftp.cs.brown.edu/pub/xmx/
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
$NetBSD: distinfo,v 1.6 2011/07/03 20:15:58 dholland Exp $
|
||||
$NetBSD: distinfo,v 1.7 2011/09/19 07:15:52 dholland Exp $
|
||||
|
||||
SHA1 (xmx-2.1alpha.pl7.tar.gz) = b517b20a7bfa352b12ffb7dd260d50ea6c1ec21b
|
||||
RMD160 (xmx-2.1alpha.pl7.tar.gz) = 18560824a35ffc55ce90fa63d1894362afa45405
|
||||
Size (xmx-2.1alpha.pl7.tar.gz) = 498352 bytes
|
||||
SHA1 (patch-aa) = 029b20a8630ccf99cfb95381414671d5963cd49b
|
||||
SHA1 (patch-ab) = cca7e590b5432e5fed68658ff10dd21981c0aed7
|
||||
SHA1 (patch-ac) = 2b5ecb1f621d86ff00637a7e8070b6419354a8f4
|
||||
SHA1 (patch-ab) = 542962f3f21d39ddbb8ac585934fa7ced1c7d3dd
|
||||
SHA1 (patch-ac) = 720dc25a7b45534967c3ce3363d443d949525ea6
|
||||
SHA1 (patch-ad) = 0a61fcd53dcc23cac02588a750dec829ac554376
|
||||
SHA1 (patch-ae) = 50bb4842042e9297484c6bb8986212e82d84dbd4
|
||||
SHA1 (patch-ae) = 29a67d85c02e74e8850f4b58e8c28d5332b29b95
|
||||
SHA1 (patch-af) = f495e95579f2d4c0f6f97b5933f1f420992a3968
|
||||
SHA1 (patch-ag) = ec6d1d0a6e0a96c7b40f86763b04e32e74a8f6ef
|
||||
SHA1 (patch-ah) = 913a8b122e570c1f105761ee83889e09d2e3e8dd
|
||||
SHA1 (patch-ag) = 9f20298dbccee1c4acfd7495bdf86a62bc9a665d
|
||||
SHA1 (patch-ah) = 66bbff2795d877ce9557c1819a12bba6e9e09974
|
||||
SHA1 (patch-ai) = 19ca5fa6a18639df41dbd6d6bce275a64293e3b5
|
||||
SHA1 (patch-aj) = da1ce04aa5b4c0701686bd1295880c9774634f63
|
||||
SHA1 (patch-ak) = 52080a7d9ffc0c614e998a76733cace6c29234e7
|
||||
SHA1 (patch-al) = 905f48024c4101a6678a036566684c4c8ecd858e
|
||||
SHA1 (patch-am) = 4f6b01d9d3c843af850ff79acd21be3aa0b6f5e5
|
||||
SHA1 (patch-ba) = ef2aae029305f9b5fa975805622466db418f197d
|
||||
SHA1 (patch-ba) = e7f905a5fcd776eb417c3a592f674264ff97716d
|
||||
SHA1 (patch-bb) = 595b93c221294fa5c61753c944acdf0f06d28748
|
||||
SHA1 (patch-bc) = 95653bf85c440158fe332cf114b3af22ffef5980
|
||||
SHA1 (patch-bd) = 37db161da309dd0178756d17be1c5b87c91a8f4b
|
||||
|
@ -82,7 +82,8 @@ SHA1 (patch-dk) = 6934d373b18fa2558156fc91c160d4e54fda6f07
|
|||
SHA1 (patch-ea) = 4fc96cc0846af3c465205f7c428a453185f15b0d
|
||||
SHA1 (patch-eb) = 66c4b8b6b3fed8c431cfb60ce6d52a9d0805ca5f
|
||||
SHA1 (patch-ec) = 9ce390570b6144471dc02fffdb0bd5ff714bddf0
|
||||
SHA1 (patch-ed) = e200f4b965fbfdb16fa4554028772cbf2693b2d0
|
||||
SHA1 (patch-ed) = 4637d40b1a149ab062f8c57730c89eb98e6b0ba1
|
||||
SHA1 (patch-ee) = 9a22f1d7312e21c07c12dbbe308b492606ff1343
|
||||
SHA1 (patch-ef) = 2b0bf5a3bb2fc25ed545d082cdf724cb0e627f8a
|
||||
SHA1 (patch-ef) = b6a6e4fefc075900a7b700e548f17f9ac1e228fc
|
||||
SHA1 (patch-eg) = fffaaddaf67708b90c44b76ac4b9a301ffef6530
|
||||
SHA1 (patch-eh) = 5ab3f93b24cdbe0cb8f5b8be9b0da22bb1ba98a5
|
||||
|
|
|
@ -1,15 +1,89 @@
|
|||
$NetBSD: patch-ab,v 1.2 2011/07/03 20:15:58 dholland Exp $
|
||||
$NetBSD: patch-ab,v 1.3 2011/09/19 07:15:52 dholland Exp $
|
||||
|
||||
- use modern C
|
||||
- use isdigit() correctly
|
||||
- silence warnings about assignments within if conditions
|
||||
- fix parenthesization, caught by clang
|
||||
|
||||
--- lib/Xmc/common.c~ 1998-04-01 18:51:21.000000000 -0500
|
||||
+++ lib/Xmc/common.c 2008-08-31 00:16:29.000000000 -0400
|
||||
@@ -27,6 +27,8 @@
|
||||
--- lib/Xmc/common.c.orig 1998-04-01 23:51:21.000000000 +0000
|
||||
+++ lib/Xmc/common.c
|
||||
@@ -27,8 +27,14 @@
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#include <sys/socket.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
+#include <arpa/inet.h>
|
||||
#include <xmc.h>
|
||||
#include <xmclib.h>
|
||||
#include <xmcp.h>
|
||||
@@ -103,7 +109,7 @@ Xmc_event_shift
|
||||
{
|
||||
XmcEventList *elp;
|
||||
|
||||
- if (elp = muxp->qhead) {
|
||||
+ if ((elp = muxp->qhead) != NULL) {
|
||||
*event = elp->event;
|
||||
muxp->qhead = elp->next;
|
||||
if (muxp->qhead == 0)
|
||||
@@ -212,7 +218,7 @@ Xmc_newId
|
||||
{
|
||||
static ulong_t id;
|
||||
|
||||
- return muxp->base | (++id << muxp->shift) & muxp->mask;
|
||||
+ return muxp->base | ((++id << muxp->shift) & muxp->mask);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -642,7 +648,7 @@ Xmc_parse_display
|
||||
if (n == 0 || n > sizeof(nbuf) - 1) /* sanity check */
|
||||
return -1;
|
||||
for (i=0; i<n; i++)
|
||||
- if (isdigit(display[i]))
|
||||
+ if (isdigit((unsigned char)display[i]))
|
||||
nbuf[i] = display[i];
|
||||
else
|
||||
return -1;
|
||||
@@ -658,7 +664,7 @@ Xmc_parse_display
|
||||
if (n == 0 || n > sizeof(nbuf) - 1)
|
||||
return -1;
|
||||
for (i=0; i<n; i++)
|
||||
- if (isdigit(display[i]))
|
||||
+ if (isdigit((unsigned char)display[i]))
|
||||
nbuf[i] = display[i];
|
||||
else
|
||||
return -1;
|
||||
@@ -666,7 +672,7 @@ Xmc_parse_display
|
||||
scrno = atoi(nbuf);
|
||||
}
|
||||
|
||||
- if (n = strlen(hostbuf)) {
|
||||
+ if ((n = strlen(hostbuf)) != 0) {
|
||||
if ((cp = (char *)malloc(n + 1)) == 0)
|
||||
return 0;
|
||||
strcpy(cp, hostbuf);
|
||||
@@ -713,8 +719,8 @@ Xmc_host_addr
|
||||
static ulong_t iaddr;
|
||||
static struct hostent *hp;
|
||||
|
||||
- if (isdigit(*hostname)) {
|
||||
- for (cp=hostname; *cp && (isdigit(*cp) || *cp == '.'); cp++);
|
||||
+ if (isdigit((unsigned char)*hostname)) {
|
||||
+ for (cp=hostname; *cp && (isdigit((unsigned char)*cp) || *cp == '.'); cp++);
|
||||
if (*cp == '\0') { /* it's an inet number */
|
||||
if ((long)(iaddr = inet_addr(hostname)) != -1) {
|
||||
*famp = AddrFamInternet;
|
||||
@@ -724,7 +730,7 @@ Xmc_host_addr
|
||||
}
|
||||
}
|
||||
}
|
||||
- if (hp = gethostbyname(hostname)) {
|
||||
+ if ((hp = gethostbyname(hostname)) != NULL) {
|
||||
*famp = Xmc_family_utox(hp->h_addrtype);
|
||||
*lenp = hp->h_length;
|
||||
*addrp = *hp->h_addr_list;
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
$NetBSD: patch-ac,v 1.2 2011/07/03 20:15:58 dholland Exp $
|
||||
$NetBSD: patch-ac,v 1.3 2011/09/19 07:15:52 dholland Exp $
|
||||
|
||||
- use modern C
|
||||
|
||||
--- lib/Xmc/AddDis.c~ 1998-02-01 14:02:27.000000000 -0500
|
||||
+++ lib/Xmc/AddDis.c 2008-08-31 00:17:18.000000000 -0400
|
||||
@@ -20,6 +20,7 @@
|
||||
--- lib/Xmc/AddDis.c.orig 1998-02-01 19:02:27.000000000 +0000
|
||||
+++ lib/Xmc/AddDis.c
|
||||
@@ -20,6 +20,8 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
#include <xmc.h>
|
||||
#include <xmclib.h>
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
$NetBSD: patch-ae,v 1.2 2011/07/03 20:15:58 dholland Exp $
|
||||
$NetBSD: patch-ae,v 1.3 2011/09/19 07:15:52 dholland Exp $
|
||||
|
||||
- use modern C
|
||||
- return something from the error handler insertion routines (caught by clang)
|
||||
- fix a format string (caught by clang)
|
||||
|
||||
--- lib/Xmc/ErrHndlr.c~ 1998-02-01 14:03:30.000000000 -0500
|
||||
+++ lib/Xmc/ErrHndlr.c 2008-08-31 00:18:23.000000000 -0400
|
||||
--- lib/Xmc/ErrHndlr.c.orig 1998-02-01 19:03:30.000000000 +0000
|
||||
+++ lib/Xmc/ErrHndlr.c
|
||||
@@ -21,6 +21,7 @@
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
@ -12,3 +14,42 @@ $NetBSD: patch-ae,v 1.2 2011/07/03 20:15:58 dholland Exp $
|
|||
#include <xmc.h>
|
||||
#include <xmclib.h>
|
||||
#include <xmcp.h>
|
||||
@@ -44,10 +45,14 @@ XmcSetErrorHandler
|
||||
DB XmcErrorHandler handler
|
||||
DE
|
||||
{
|
||||
+ XmcErrorHandler prev;
|
||||
+
|
||||
+ prev = error_handler;
|
||||
if (handler)
|
||||
error_handler = handler;
|
||||
else
|
||||
error_handler = default_eh;
|
||||
+ return prev;
|
||||
}
|
||||
|
||||
XmcIOErrorHandler
|
||||
@@ -56,10 +61,14 @@ XmcSetIOErrorHandler
|
||||
DB XmcIOErrorHandler handler
|
||||
DE
|
||||
{
|
||||
+ XmcIOErrorHandler prev;
|
||||
+
|
||||
+ prev = io_error_handler;
|
||||
if (handler)
|
||||
io_error_handler = handler;
|
||||
else
|
||||
io_error_handler = default_io_eh;
|
||||
+ return prev;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -121,7 +130,7 @@ default_eh
|
||||
fprintf(stderr, "XMC Protocol Error:\n");
|
||||
fprintf(stderr, "\tcode %d\n", ep->errorCode);
|
||||
fprintf(stderr, "\trequest code %d\n", ep->opcode);
|
||||
- fprintf(stderr, "\tdata 0x%08x\n", ep->data);
|
||||
+ fprintf(stderr, "\tdata 0x%08lx\n", ep->data);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
$NetBSD: patch-ag,v 1.2 2011/07/03 20:15:58 dholland Exp $
|
||||
$NetBSD: patch-ag,v 1.3 2011/09/19 07:15:52 dholland Exp $
|
||||
|
||||
- use modern C
|
||||
- silence warnings about assignments within if conditions
|
||||
|
||||
--- lib/Xmc/ListDis.c~ 1998-02-01 15:07:47.000000000 -0500
|
||||
+++ lib/Xmc/ListDis.c 2008-08-31 00:19:09.000000000 -0400
|
||||
--- lib/Xmc/ListDis.c.orig 1998-02-01 20:07:47.000000000 +0000
|
||||
+++ lib/Xmc/ListDis.c
|
||||
@@ -20,6 +20,8 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
@ -13,3 +14,12 @@ $NetBSD: patch-ag,v 1.2 2011/07/03 20:15:58 dholland Exp $
|
|||
#include <xmc.h>
|
||||
#include <xmclib.h>
|
||||
#include <xmcp.h>
|
||||
@@ -50,7 +52,7 @@ XmcListDisplays
|
||||
return 0;
|
||||
|
||||
sz = r->length - sz_xmcListDisplaysReply;
|
||||
- if (dp = (DispId *)malloc(sz)) {
|
||||
+ if ((dp = malloc(sz)) != NULL) {
|
||||
bcopy((char *)(r+1), (char *)dp, sz);
|
||||
*ndisp = r->nDisplays;
|
||||
}
|
||||
|
|
|
@ -1,16 +1,27 @@
|
|||
$NetBSD: patch-ah,v 1.2 2011/07/03 20:15:58 dholland Exp $
|
||||
$NetBSD: patch-ah,v 1.3 2011/09/19 07:15:52 dholland Exp $
|
||||
|
||||
- use modern C
|
||||
- silence warnings about assignments within if conditions
|
||||
|
||||
--- lib/Xmc/Open.c~ 1998-02-12 09:13:22.000000000 -0500
|
||||
+++ lib/Xmc/Open.c 2008-08-31 00:19:40.000000000 -0400
|
||||
@@ -32,6 +32,9 @@
|
||||
--- lib/Xmc/Open.c.orig 1998-02-12 14:13:22.000000000 +0000
|
||||
+++ lib/Xmc/Open.c
|
||||
@@ -32,6 +32,10 @@
|
||||
#ifdef SVR4
|
||||
#include <sys/filio.h>
|
||||
#endif
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <netdb.h>
|
||||
#include <xmc.h>
|
||||
@@ -118,7 +122,7 @@ XmcOpen
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
- if (muxp = (Mux *)malloc(sizeof(Mux))) {
|
||||
+ if ((muxp = malloc(sizeof(Mux))) != NULL) {
|
||||
muxp->fd = fd;
|
||||
muxp->hostname = hostname;
|
||||
Xmc_zerobuf(&muxp->inbuf);
|
||||
|
|
|
@ -1,10 +1,102 @@
|
|||
$NetBSD: patch-ba,v 1.2 2011/07/03 20:15:59 dholland Exp $
|
||||
$NetBSD: patch-ba,v 1.3 2011/09/19 07:15:52 dholland Exp $
|
||||
|
||||
- use modern C
|
||||
- silence compiler warnings about assignments within if conditionals
|
||||
- remove uses of implicit int to avoid warning noise
|
||||
- use printf("%s", str) instead of printf(str)
|
||||
- apply some const
|
||||
|
||||
--- server/args.c~ 1998-03-27 10:11:58.000000000 -0500
|
||||
+++ server/args.c 2008-08-31 00:25:23.000000000 -0400
|
||||
@@ -686,6 +686,9 @@ tok
|
||||
--- server/args.c.orig 1998-03-27 15:11:58.000000000 +0000
|
||||
+++ server/args.c
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
#define USAGE "usage: %s [:displaynum] [-option...]\n"
|
||||
|
||||
-static char *options[] = {
|
||||
+static const char *options[] = {
|
||||
"-a # ignored\n",
|
||||
"-af filename read command line arguments from filename\n",
|
||||
"-auth path select authorization file\n",
|
||||
@@ -97,7 +97,7 @@ static char *options[] = {
|
||||
"-wm forces default backing store to WhenMapped\n",
|
||||
"-view disp... the following displays may only watch\n",
|
||||
"-x extension ignored\n",
|
||||
- (char *)0};
|
||||
+ NULL};
|
||||
|
||||
/*
|
||||
** private data
|
||||
@@ -420,7 +420,7 @@ args_get
|
||||
if (util_parse_display(hosts[i], &host, &family,
|
||||
&display, &screen, &window)==0) {
|
||||
host_pattern(host);
|
||||
- if (name = host_match(&family, &length, &address))
|
||||
+ if ((name = host_match(&family, &length, &address)) != NULL)
|
||||
(void) server_alloc(did++, name, strlen(name), family, length,
|
||||
address, display, screen, modes[i], window, 0);
|
||||
}
|
||||
@@ -432,17 +432,22 @@ args_get
|
||||
**
|
||||
** Print usage message and options.
|
||||
*/
|
||||
+
|
||||
+#ifdef __GNUC__
|
||||
+static void usage(int) __attribute__((__noreturn__));
|
||||
+#endif
|
||||
+
|
||||
static void
|
||||
usage
|
||||
AL((status))
|
||||
DB int status
|
||||
DE
|
||||
{
|
||||
- register i;
|
||||
+ register int i;
|
||||
|
||||
fprintf(stderr, USAGE, command);
|
||||
for (i=0; options[i]; i++)
|
||||
- fprintf(stderr, options[i]);
|
||||
+ fprintf(stderr, "%s", options[i]);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
@@ -518,7 +523,7 @@ opt_str_arg
|
||||
char *rv;
|
||||
|
||||
if (fp)
|
||||
- if (rv = tok(fp))
|
||||
+ if ((rv = tok(fp)) != NULL)
|
||||
return rv;
|
||||
else {
|
||||
fclose(fp);
|
||||
@@ -540,7 +545,7 @@ opt_debug_arg
|
||||
{
|
||||
int i, level;
|
||||
char *rv;
|
||||
- static char *debugopts[] = {
|
||||
+ static const char *debugopts[] = {
|
||||
"1 trace incoming client X protocol\n",
|
||||
"2 trace outgoing virtual client X protocol\n",
|
||||
"3 trace incoming server X protocol\n",
|
||||
@@ -573,7 +578,7 @@ opt_debug_arg
|
||||
"w trace byte swapping operations\n",
|
||||
"x trace XMC protocol\n",
|
||||
"? print this message\n",
|
||||
- (char *)0};
|
||||
+ NULL};
|
||||
|
||||
if (fp && (rv = tok(fp)) == 0) {
|
||||
fclose(fp);
|
||||
@@ -621,7 +626,7 @@ opt_debug_arg
|
||||
case '?':
|
||||
fprintf(stderr, "debug options:\n");
|
||||
for (i=0; debugopts[i]; i++)
|
||||
- fprintf(stderr, debugopts[i]);
|
||||
+ fprintf(stderr, "%s", debugopts[i]);
|
||||
exit(0);
|
||||
default:
|
||||
warn("unknown debug option '%c'\n", *rv);
|
||||
@@ -686,6 +691,9 @@ tok
|
||||
buf[i++] = (char)ch;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
$NetBSD: patch-ed,v 1.2 2011/07/03 20:16:00 dholland Exp $
|
||||
$NetBSD: patch-ed,v 1.3 2011/09/19 07:15:52 dholland Exp $
|
||||
|
||||
- use modern C
|
||||
- terminate calls to XtVa[GS]etValues properly (caught by clang)
|
||||
- declare functions not returning values as void (otherwise clang belches)
|
||||
|
||||
--- clients/xmtg/ui.c.orig 1998-04-01 18:55:00.000000000 -0500
|
||||
+++ clients/xmtg/ui.c 2008-08-31 02:40:34.000000000 -0400
|
||||
--- clients/xmtg/ui.c.orig 1998-04-01 23:55:00.000000000 +0000
|
||||
+++ clients/xmtg/ui.c
|
||||
@@ -22,10 +22,14 @@
|
||||
*/
|
||||
/* next line is debugging...TODO */
|
||||
|
@ -19,12 +21,134 @@ $NetBSD: patch-ed,v 1.2 2011/07/03 20:16:00 dholland Exp $
|
|||
#endif
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
@@ -440,7 +444,7 @@ ui_get_add_info(adp, strp, modep)
|
||||
@@ -121,7 +125,7 @@ ui_create(top, floor, seat, view, gridp)
|
||||
** Telepointer toggle
|
||||
*/
|
||||
w = XtCreateManagedWidget("teleptr", toggleWidgetClass, parent, 0,0);
|
||||
- XtVaSetValues(w, XtNstate, True, 0);
|
||||
+ XtVaSetValues(w, XtNstate, True, (void *)NULL);
|
||||
XtAddCallback(w, XtNcallback, teleptr_cb, 0);
|
||||
|
||||
/*
|
||||
@@ -186,9 +190,9 @@ ui_create_radio(name, parent, value, lea
|
||||
w = XtCreateManagedWidget(name, toggleWidgetClass, parent, 0, 0);
|
||||
|
||||
if (leader)
|
||||
- XtVaSetValues(w, XtNradioData, value, XtNradioGroup, leader, 0);
|
||||
+ XtVaSetValues(w, XtNradioData, value, XtNradioGroup, leader, (void *)NULL);
|
||||
else
|
||||
- XtVaSetValues(w, XtNradioData, value, 0);
|
||||
+ XtVaSetValues(w, XtNradioData, value, (void *)NULL);
|
||||
|
||||
if (buttonp)
|
||||
*buttonp = w;
|
||||
@@ -202,6 +206,7 @@ blort(w, c, d)
|
||||
printf("BLORT!\n");
|
||||
}
|
||||
|
||||
+void
|
||||
ui_create_add_dialog(dp, parent, prompt, floor, seat, view)
|
||||
dialog_t *dp;
|
||||
Widget parent;
|
||||
@@ -229,7 +234,7 @@ XtAddCallback(dp->enable, XtNcallback, b
|
||||
w = XtCreateManagedWidget("add_label", labelWidgetClass, dp->dialog,0,0);
|
||||
XtVaSetValues(w, XtNlabel, prompt,
|
||||
XtNborderWidth, 0,
|
||||
- 0);
|
||||
+ (void *)NULL);
|
||||
|
||||
input = XtCreateManagedWidget( "input",
|
||||
asciiTextWidgetClass,
|
||||
@@ -239,7 +244,7 @@ XtAddCallback(dp->enable, XtNcallback, b
|
||||
XtVaSetValues(input, XtNeditType, XawtextEdit,
|
||||
XtNpieceSize, 128,
|
||||
XtNtype, XawAsciiString,
|
||||
- 0);
|
||||
+ (void *)NULL);
|
||||
|
||||
/*
|
||||
** Floor/Seat/View radio group
|
||||
@@ -247,7 +252,7 @@ XtAddCallback(dp->enable, XtNcallback, b
|
||||
w = XtCreateManagedWidget("mode_label", labelWidgetClass,dp->dialog,0,0);
|
||||
XtVaSetValues(w, XtNlabel, "Input mode:",
|
||||
XtNborderWidth, 0,
|
||||
- 0);
|
||||
+ (void *)NULL);
|
||||
ui_create_radio("floor", dp->dialog, floor, 0, &radio);
|
||||
ui_create_radio("seat", dp->dialog, seat, radio, 0);
|
||||
ui_create_radio("view", dp->dialog, view, radio, 0);
|
||||
@@ -261,6 +266,7 @@ XtAddCallback(dp->enable, XtNcallback, b
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
ui_create_drop_dialog(dp, parent, prompt)
|
||||
dialog_t *dp;
|
||||
Widget parent;
|
||||
@@ -285,7 +291,7 @@ ui_create_drop_dialog(dp, parent, prompt
|
||||
w = XtCreateManagedWidget("drop_label", labelWidgetClass, dp->dialog,0,0);
|
||||
XtVaSetValues(w, XtNlabel, prompt,
|
||||
XtNborderWidth, 0,
|
||||
- 0);
|
||||
+ (void *)NULL);
|
||||
|
||||
ui_create_dialog_dismiss("accept", dp, drop_cb, 0);
|
||||
ui_create_dialog_dismiss("cancel", dp, 0, 0);
|
||||
@@ -333,7 +339,7 @@ ui_create_dialog(name, dp, parent, promp
|
||||
dp->shell,
|
||||
0,
|
||||
0);
|
||||
- XtVaSetValues(dp->dialog, XtNlabel, prompt, XtNvalue, "", 0);
|
||||
+ XtVaSetValues(dp->dialog, XtNlabel, prompt, XtNvalue, "", (void *)NULL);
|
||||
XtAddCallback(dp->enable, XtNcallback, center_popup, (XtPointer)dp);
|
||||
XtAddCallback(dp->enable,XtNcallback,XtCallbackNone,(XtPointer)dp->shell);
|
||||
}
|
||||
@@ -427,7 +433,7 @@ ui_get_toggle_state(w)
|
||||
{
|
||||
Boolean state;
|
||||
|
||||
- XtVaGetValues(w, XtNstate, &state, 0);
|
||||
+ XtVaGetValues(w, XtNstate, &state, (void *)NULL);
|
||||
|
||||
return (state == True);
|
||||
}
|
||||
@@ -439,8 +445,8 @@ ui_get_add_info(adp, strp, modep)
|
||||
int *modep;
|
||||
{
|
||||
|
||||
XtVaGetValues(adp->input, XtNstring, strp, 0);
|
||||
- XtVaGetValues(adp->input, XtNstring, strp, 0);
|
||||
- *modep = (int)XawToggleGetCurrent(adp->mode_radio);
|
||||
+ XtVaGetValues(adp->input, XtNstring, strp, (void *)NULL);
|
||||
+ *modep = (int)(intptr_t)XawToggleGetCurrent(adp->mode_radio);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -531,8 +537,8 @@ center_popup(w, client_data, call_data)
|
||||
if (!XtIsRealized(dp->shell))
|
||||
XtRealizeWidget(dp->shell);
|
||||
|
||||
- XtVaGetValues(dp->top, XtNwidth, &sw, XtNheight, &sh, 0);
|
||||
- XtVaGetValues(dp->shell, XtNwidth, &dw, XtNheight, &dh, 0);
|
||||
+ XtVaGetValues(dp->top, XtNwidth, &sw, XtNheight, &sh, (void *)NULL);
|
||||
+ XtVaGetValues(dp->shell, XtNwidth, &dw, XtNheight, &dh, (void *)NULL);
|
||||
x = (Position)(sw/2 - dw/2);
|
||||
y = (Position)(sh/2 - dh/2);
|
||||
XtTranslateCoords(dp->top, x, y, &x, &y);
|
||||
@@ -542,7 +548,7 @@ center_popup(w, client_data, call_data)
|
||||
printf("center_popup: doing XtVaSetValues of x and y...");
|
||||
fflush(stdout);
|
||||
*/
|
||||
- XtVaSetValues(dp->shell, XtNx, x, XtNy, y, 0);
|
||||
+ XtVaSetValues(dp->shell, XtNx, x, XtNy, y, (void *)NULL);
|
||||
printf("done.\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
@@ -569,7 +575,7 @@ ui_error
|
||||
#endif
|
||||
|
||||
vsprintf(buf, msg, pvar);
|
||||
- XtVaSetValues(errors->text, XtNstring, buf, 0);
|
||||
+ XtVaSetValues(errors->text, XtNstring, buf, (void *)NULL);
|
||||
|
||||
XtPopup(errors->shell, XtGrabNone);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,22 @@
|
|||
$NetBSD: patch-ef,v 1.2 2011/07/03 20:16:00 dholland Exp $
|
||||
$NetBSD: patch-ef,v 1.3 2011/09/19 07:15:52 dholland Exp $
|
||||
|
||||
- use modern C
|
||||
- use stdarg.h for printf wrappers instead of ancient-style fake varargs
|
||||
- declare printf functions as such for format checking
|
||||
- mark functions not returning values as void; otherwise clang belches
|
||||
- remove uses of implicit int to avoid warning noise
|
||||
- silence warnings about assignment within an if conditional
|
||||
|
||||
--- clients/xmxinit/xmxinit.c~ 1995-04-19 23:05:04.000000000 -0400
|
||||
+++ clients/xmxinit/xmxinit.c 2008-08-31 02:38:46.000000000 -0400
|
||||
@@ -30,7 +30,6 @@ Modified from X11R6 MIT source for xinit
|
||||
--- clients/xmxinit/xmxinit.c.orig 1995-04-20 03:05:04.000000000 +0000
|
||||
+++ clients/xmxinit/xmxinit.c
|
||||
@@ -24,13 +24,13 @@ Modified from X11R6 MIT source for xinit
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Xmu/SysUtil.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
#ifndef SYSV
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
@ -12,7 +24,36 @@ $NetBSD: patch-ef,v 1.2 2011/07/03 20:16:00 dholland Exp $
|
|||
#include <setjmp.h>
|
||||
|
||||
#ifndef X_NOT_STDC_ENV
|
||||
@@ -86,8 +85,8 @@ char **client = clientargv + 2; /* make
|
||||
@@ -41,6 +41,12 @@ extern char *getenv();
|
||||
extern char **environ;
|
||||
char **newenviron = NULL;
|
||||
|
||||
+#if defined(__GNUC__) || defined(__CLANG__)
|
||||
+#define PF(a, b) __attribute__((__format__(__printf__, a, b)))
|
||||
+#else
|
||||
+#define PF(a, b)
|
||||
+#endif
|
||||
+
|
||||
#ifndef SHELL
|
||||
#define SHELL "sh"
|
||||
#endif
|
||||
@@ -59,6 +65,15 @@ char **newenviron = NULL;
|
||||
#define setpgrp setpgid
|
||||
#endif
|
||||
|
||||
+static void shutdown(void);
|
||||
+int processTimeout(int timeout, char *string);
|
||||
+void set_environment(void);
|
||||
+void Fatal(const char *fmt, ...) PF(1, 2);
|
||||
+void Error(const char *fmt, ...) PF(1, 2);
|
||||
+void vError(const char *fmt, va_list ap) PF(1, 0);
|
||||
+int startServer(char *server[]);
|
||||
+pid_t startClient(char *client[]);
|
||||
+
|
||||
char *bindir = BINDIR;
|
||||
|
||||
#ifndef XMXINITRC
|
||||
@@ -86,8 +101,8 @@ char **client = clientargv + 2; /* make
|
||||
char *displayNum;
|
||||
char *program;
|
||||
Display *xd; /* server connection */
|
||||
|
@ -23,7 +64,59 @@ $NetBSD: patch-ef,v 1.2 2011/07/03 20:16:00 dholland Exp $
|
|||
int status;
|
||||
#else
|
||||
union wait status;
|
||||
@@ -350,7 +349,7 @@ processTimeout(timeout, string)
|
||||
@@ -95,9 +110,6 @@ union wait status;
|
||||
#endif /* SYSV */
|
||||
int serverpid = -1;
|
||||
int clientpid = -1;
|
||||
-extern int errno;
|
||||
-
|
||||
-static shutdown();
|
||||
|
||||
#ifdef SIGNALRETURNSINT
|
||||
#define SIGVAL int
|
||||
@@ -146,6 +158,7 @@ static Execute (vec)
|
||||
return;
|
||||
}
|
||||
|
||||
+int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
register char **argv;
|
||||
@@ -197,7 +210,7 @@ register char **argv;
|
||||
*/
|
||||
if (argc == 0 ||
|
||||
(**argv != '/' && **argv != '.')) {
|
||||
- if (*sptr = getenv("XMX"))
|
||||
+ if ((*sptr = getenv("XMX")) != NULL)
|
||||
sptr++;
|
||||
else
|
||||
*sptr++ = default_server;
|
||||
@@ -312,13 +325,14 @@ register char **argv;
|
||||
* waitforserver - wait for X server to start up
|
||||
*/
|
||||
|
||||
-waitforserver()
|
||||
+int
|
||||
+waitforserver(void)
|
||||
{
|
||||
int ncycles = 120; /* # of cycles to wait */
|
||||
int cycles; /* Wait cycle count */
|
||||
|
||||
for (cycles = 0; cycles < ncycles; cycles++) {
|
||||
- if (xd = XOpenDisplay(displayNum)) {
|
||||
+ if ((xd = XOpenDisplay(displayNum)) != NULL) {
|
||||
return(TRUE);
|
||||
}
|
||||
else {
|
||||
@@ -336,6 +350,7 @@ waitforserver()
|
||||
/*
|
||||
* return TRUE if we timeout waiting for pid to exit, FALSE otherwise.
|
||||
*/
|
||||
+int
|
||||
processTimeout(timeout, string)
|
||||
int timeout;
|
||||
char *string;
|
||||
@@ -350,7 +365,7 @@ processTimeout(timeout, string)
|
||||
break;
|
||||
alarm(0);
|
||||
#else /* SYSV */
|
||||
|
@ -32,15 +125,81 @@ $NetBSD: patch-ef,v 1.2 2011/07/03 20:16:00 dholland Exp $
|
|||
if ((pidfound = waitpid(serverpid, &status, WNOHANG)) == serverpid)
|
||||
break;
|
||||
#else
|
||||
@@ -588,10 +587,8 @@ Fatal(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9
|
||||
Error(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9)
|
||||
char *fmt;
|
||||
@@ -375,6 +390,7 @@ processTimeout(timeout, string)
|
||||
return( serverpid != pidfound );
|
||||
}
|
||||
|
||||
+int
|
||||
startServer(server)
|
||||
char *server[];
|
||||
{
|
||||
@@ -457,6 +473,7 @@ startServer(server)
|
||||
return(serverpid);
|
||||
}
|
||||
|
||||
+pid_t
|
||||
startClient(client)
|
||||
char *client[];
|
||||
{
|
||||
@@ -490,8 +507,8 @@ static int ignorexio (dpy)
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
-static
|
||||
-shutdown()
|
||||
+static void
|
||||
+shutdown(void)
|
||||
{
|
||||
/* have kept display opened, so close it now */
|
||||
if (clientpid > 0) {
|
||||
@@ -544,7 +561,8 @@ shutdown()
|
||||
* make a new copy of environment that has room for DISPLAY
|
||||
*/
|
||||
|
||||
-set_environment ()
|
||||
+void
|
||||
+set_environment(void)
|
||||
{
|
||||
int nenvvars;
|
||||
char **newPtr, **oldPtr;
|
||||
@@ -578,20 +596,32 @@ set_environment ()
|
||||
return;
|
||||
}
|
||||
|
||||
-Fatal(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9)
|
||||
- char *fmt;
|
||||
+void
|
||||
+Fatal(const char *fmt, ...)
|
||||
{
|
||||
- Error(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9);
|
||||
+ va_list ap;
|
||||
+
|
||||
+ va_start(ap, fmt);
|
||||
+ vError(fmt, ap);
|
||||
+ va_end(ap);
|
||||
exit(ERR_EXIT);
|
||||
}
|
||||
|
||||
-Error(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9)
|
||||
- char *fmt;
|
||||
+void
|
||||
+Error(const char *fmt, ...)
|
||||
{
|
||||
- extern char *sys_errlist[];
|
||||
-
|
||||
+ va_list ap;
|
||||
|
||||
+ va_start(ap, fmt);
|
||||
+ vError(fmt, ap);
|
||||
+ va_end(ap);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+vError(const char *fmt, va_list ap)
|
||||
+{
|
||||
fprintf(stderr, "%s: ", program);
|
||||
if (errno > 0 && errno < sys_nerr)
|
||||
- fprintf (stderr, "%s (errno %d): ", sys_errlist[errno], errno);
|
||||
- fprintf(stderr, fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9);
|
||||
+ fprintf (stderr, "%s (errno %d): ", strerror(errno), errno);
|
||||
fprintf(stderr, fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9);
|
||||
+ vfprintf(stderr, fmt, ap);
|
||||
}
|
||||
|
|
68
x11/xmx/patches/patch-eh
Normal file
68
x11/xmx/patches/patch-eh
Normal file
|
@ -0,0 +1,68 @@
|
|||
$NetBSD: patch-eh,v 1.1 2011/09/19 07:15:52 dholland Exp $
|
||||
|
||||
- silence warning about assignment in an if condition
|
||||
- fix parenthesization, caught by clang
|
||||
|
||||
--- clients/xmtg/pathfind.c~ 1997-05-21 17:15:13.000000000 +0000
|
||||
+++ clients/xmtg/pathfind.c
|
||||
@@ -72,7 +72,7 @@ pathfind
|
||||
if (i) {
|
||||
if ((dirp = opendir(pbuf)) == 0)
|
||||
continue;
|
||||
- while (dep = readdir(dirp)) {
|
||||
+ while ((dep = readdir(dirp)) != NULL) {
|
||||
if (strcmp(name, dep->d_name) == 0) {
|
||||
pbuf[i] = '\0'; /* reset path */
|
||||
(void)strcat(pbuf, "/");
|
||||
@@ -86,25 +86,25 @@ pathfind
|
||||
for (mp=mode; *mp && okay; mp++) {
|
||||
switch (*mp) {
|
||||
case 'r':
|
||||
- if ( st.st_mode & S_IROTH == 0 &&
|
||||
- (st.st_mode & S_IRUSR == 0 || uid != st.st_uid))
|
||||
- if (st.st_mode & S_IRGRP == 0 || gid != st.st_gid)
|
||||
+ if ( (st.st_mode & S_IROTH) == 0 &&
|
||||
+ ((st.st_mode & S_IRUSR) == 0 || uid != st.st_uid))
|
||||
+ if ((st.st_mode & S_IRGRP) == 0 || gid != st.st_gid)
|
||||
okay = 0;
|
||||
else
|
||||
chkgrp = 1;
|
||||
break;
|
||||
case 'w':
|
||||
- if ( st.st_mode & S_IWOTH == 0 &&
|
||||
- (st.st_mode & S_IWUSR == 0 || uid != st.st_uid))
|
||||
- if (st.st_mode & S_IWGRP == 0 || gid != st.st_gid)
|
||||
+ if ( (st.st_mode & S_IWOTH) == 0 &&
|
||||
+ ((st.st_mode & S_IWUSR) == 0 || uid != st.st_uid))
|
||||
+ if ((st.st_mode & S_IWGRP) == 0 || gid != st.st_gid)
|
||||
okay = 0;
|
||||
else
|
||||
chkgrp = 1;
|
||||
break;
|
||||
case 'x':
|
||||
- if ( st.st_mode & S_IXOTH == 0 &&
|
||||
- (st.st_mode & S_IXUSR == 0 || uid != st.st_uid))
|
||||
- if (st.st_mode & S_IXGRP == 0 || gid != st.st_gid)
|
||||
+ if ( (st.st_mode & S_IXOTH == 0) &&
|
||||
+ ((st.st_mode & S_IXUSR == 0) || uid != st.st_uid))
|
||||
+ if ((st.st_mode & S_IXGRP == 0) || gid != st.st_gid)
|
||||
okay = 0;
|
||||
else
|
||||
chkgrp = 1;
|
||||
@@ -125,13 +125,13 @@ pathfind
|
||||
okay = S_ISFIFO(st.st_mode);
|
||||
break;
|
||||
case 'u':
|
||||
- okay = (st.st_mode & S_ISUID != 0);
|
||||
+ okay = ((st.st_mode & S_ISUID) != 0);
|
||||
break;
|
||||
case 'g':
|
||||
- okay = (st.st_mode & S_ISGID != 0);
|
||||
+ okay = ((st.st_mode & S_ISGID) != 0);
|
||||
break;
|
||||
case 'k':
|
||||
- okay = (st.st_mode & S_ISVTX != 0);
|
||||
+ okay = ((st.st_mode & S_ISVTX) != 0);
|
||||
break;
|
||||
case 's':
|
||||
okay = (st.st_size != 0);
|
Loading…
Reference in a new issue