pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

xlax: fix compiler warnings.



Module Name:	pkgsrc-wip
Committed By:	Paolo Vincenzo Olivo <vins%NetBSD.org@localhost>
Pushed By:	vms
Date:		Tue Dec 6 18:07:57 2022 +0100
Changeset:	96004248d8d7361f02fad158e1ababb87f13a4ea

Modified Files:
	xlax/Makefile
	xlax/distinfo
	xlax/patches/patch-xlax.c
Added Files:
	xlax/patches/patch-vroot.h

Log Message:
xlax: fix compiler warnings.

Also, use REPLACE_PERL instead of SUBST routine.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=96004248d8d7361f02fad158e1ababb87f13a4ea

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 xlax/Makefile              |  14 ++---
 xlax/distinfo              |   3 +-
 xlax/patches/patch-vroot.h |  15 +++++
 xlax/patches/patch-xlax.c  | 144 ++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 164 insertions(+), 12 deletions(-)

diffs:
diff --git a/xlax/Makefile b/xlax/Makefile
index 0d6ffa465f..15041276a3 100644
--- a/xlax/Makefile
+++ b/xlax/Makefile
@@ -18,11 +18,7 @@ MAKE_FLAGS+=	LOCAL_LDFLAGS=${LDFLAGS:Q}
 INSTALLATION_DIRS=	bin ${PKGMANDIR}/man1
 INSTALLATION_DIRS+=	lib/X11/app-defaults
 
-SUBST_CLASSES+=		paths
-SUBST_MESSAGE.paths=	Fixing perl hashbang.
-SUBST_STAGE.paths=	pre-configure
-SUBST_FILES.paths=	mkxlax
-SUBST_SED.paths=	-e 's|/usr/bin/perl|${PERL5}|g'
+REPLACE_PERL+=	mkxlax
 
 post-patch:
 	${RUN} ${CP} ${FILESDIR}/stddef.h ${WRKSRC}
@@ -32,13 +28,13 @@ do-install:
 	${INSTALL_SCRIPT} ${WRKSRC}/mkxlax ${DESTDIR}${PREFIX}/bin
 
 .for m in xlax mkxlax
-	${INSTALL_MAN} ${WRKSRC}/${m}.man 									\
-	${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/${m}.1
+	${INSTALL_MAN} ${WRKSRC}/${m}.man 				\
+	  ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1/${m}.1
 .endfor
 
 post-install:
-	${INSTALL_DATA} ${FILESDIR}/xlax.ad 								\
-	${DESTDIR}${PREFIX}/lib/X11/app-defaults/Xlax
+	${INSTALL_DATA} ${FILESDIR}/xlax.ad 				\
+	  ${DESTDIR}${PREFIX}/lib/X11/app-defaults/Xlax
 
 .include "../../mk/bsd.prefs.mk"
 
diff --git a/xlax/distinfo b/xlax/distinfo
index 27ac2b4aa4..59ee7d1a71 100644
--- a/xlax/distinfo
+++ b/xlax/distinfo
@@ -3,5 +3,6 @@ $NetBSD$
 BLAKE2s (xlax2.4.tar.gz) = 90e7169a24fd5c1805ff27576b876cfbc4991be4e95e2bc58644a9d0fcffdb68
 SHA512 (xlax2.4.tar.gz) = 294aad75a5ca8dc396c6e07044f66b36e7a99d6cb10a3d89f39660223e0b5063d302b34dd804b272df9d951a7f2bcf1cf1c8a3746d97ae1fb836c9bbcc9e2dd9
 Size (xlax2.4.tar.gz) = 15804 bytes
-SHA1 (patch-xlax.c) = f50f7b211dd20977ed5493b7f08ff7ba54f584ac
+SHA1 (patch-vroot.h) = 86fd4d6637bf37503c21e1891e19bf0b8a579e5e
+SHA1 (patch-xlax.c) = fde6e86dfbcfcebde1840aa69f5862fbdb8f0e23
 SHA1 (patch-xlax.h) = e6e146997a48a2ed6f15b56657e6a911fedee9c9
diff --git a/xlax/patches/patch-vroot.h b/xlax/patches/patch-vroot.h
new file mode 100644
index 0000000000..605e49b56b
--- /dev/null
+++ b/xlax/patches/patch-vroot.h
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Fix compile-time warnings.
+
+--- vroot.h.orig	2008-07-31 20:18:25.000000000 +0000
++++ vroot.h
+@@ -75,7 +75,7 @@ VirtualRootWindowOfScreen(screen)
+ 	if (screen != save_screen) {
+ 		Display *dpy = DisplayOfScreen(screen);
+ 		Atom __SWM_VROOT = None;
+-		int i;
++		unsigned int i;
+ 		Window rootReturn, parentReturn, *children;
+ 		unsigned int numChildren;
+ 
diff --git a/xlax/patches/patch-xlax.c b/xlax/patches/patch-xlax.c
index b794b8cec7..3890e45ce2 100644
--- a/xlax/patches/patch-xlax.c
+++ b/xlax/patches/patch-xlax.c
@@ -1,7 +1,7 @@
 $NetBSD$
 
-Fix warnings about prepocessor defined macros. 
-Use libbsd on Linux to support strlcpy().
+* Fix warning about int signedness mismatch.
+* Use libbsd on Linux to support strlcpy().
 
 --- xlax.c.orig	2008-07-31 20:18:25.000000000 +0000
 +++ xlax.c
@@ -17,3 +17,143 @@ Use libbsd on Linux to support strlcpy().
  #include "xlax.h"
  #include "vroot.h"
  
+@@ -70,7 +75,7 @@ XErrorEvent *myerr;
+   XGetErrorText(mydisp, myerr->error_code, msg, 80);
+   (void) fprintf(stderr, "%s\n", msg);
+   if (myerr->error_code == BadWindow) {
+-    fprintf(stderr, "Removing window %d\n", myerr->resourceid);
++    fprintf(stderr, "Removing window %lu\n", (unsigned long)myerr->resourceid);
+     Remove_Window(myerr->resourceid);
+     return 0;
+   } else {
+@@ -411,8 +416,8 @@ Display *dpy;
+ Window top;
+ {
+   Window *children, dummy;
+-  unsigned int nchildren;
+-  int i, x;
++  unsigned int i, nchildren;
++  int x;
+   Window w=0;
+   XClassHint class_hint;
+ 
+@@ -674,7 +679,7 @@ Display *dpy;
+ int wi;
+ char *str;
+ {
+-  int i;
++  size_t i;
+   long m;
+   Window root = RootWindow(dpy,DefaultScreen(dpy));
+ 
+@@ -686,7 +691,7 @@ char *str;
+   }
+   for (i=0; i<strlen(str)&&i<MAXEVENTS; ++i) {
+     /* skip if we don't have a keycode mapping for this character */
+-    if (kcmap[str[i]] < 0) {
++    if (kcmap[(unsigned char)str[i]] < 0) {
+       fprintf(stderr,"No key mapping for %c!\n", str[i]);
+       continue;
+     }
+@@ -702,8 +707,8 @@ char *str;
+     Windows[wi].events[i].x_root=0;
+     Windows[wi].events[i].y_root=0;
+     Windows[wi].events[i].same_screen=1;
+-    Windows[wi].events[i].keycode=kcmap[str[i]];
+-    Windows[wi].events[i].state=modmap[str[i]];
++    Windows[wi].events[i].keycode=kcmap[(unsigned char)str[i]];
++    Windows[wi].events[i].state=modmap[(unsigned char)str[i]];
+   }
+   Windows[wi].eventindex=i;
+   cnt = 0;
+@@ -746,8 +751,8 @@ Display *disp;
+       evt.state=states[m];
+       len=XLookupString(&evt, out, 32, NULL, NULL);
+       if (len == 1) {
+-        kcmap[out[0]] = i;
+-        modmap[out[0]] = states[m];
++        kcmap[(unsigned char)out[0]] = i;
++        modmap[(unsigned char)out[0]] = states[m];
+       }
+     }
+   }
+@@ -759,7 +764,7 @@ unsigned char c;
+ long *m;
+ {
+   KeySym ks, ksr;
+-  KeyCode kc;
++  KeyCode kc = -1;
+   XKeyEvent evt;
+   long mr, len;
+   char str[2], out[32];
+@@ -802,11 +807,11 @@ long *m;
+       *m = ShiftMask | ControlMask;
+       return(kc);
+     }
+-    fprintf(stderr, "Didn't resolve keycode! (c=%d, ks=%d,kc=%d\n",c,ks,kc);
++    fprintf(stderr, "Didn't resolve keycode! (c=%d, ks=%lu,kc=%d\n",c,(unsigned long)ks,kc);
+     *m = ControlMask;
+     return(0);
+   } else if (c>127) {
+-    fprintf(stderr, "Didn't resolve keycode! (c=%d, ks=%d,kc=%d\n",c,ks,kc);
++    fprintf(stderr, "Didn't resolve keycode! (c=%d, ks=%lu,kc=%d\n",c,(unsigned long)ks,kc);
+     *m = 0;
+     return(0);
+   } else {
+@@ -826,7 +831,7 @@ long *m;
+       *m = ShiftMask;
+       return(kc);
+     }
+-    fprintf(stderr, "Didn't resolve keycode! (c=%d, ks=%d,kc=%d\n",c,ks,kc);
++    fprintf(stderr, "Didn't resolve keycode! (c=%d, ks=%lu,kc=%d\n",c,(unsigned long)ks,kc);
+     *m = 0;
+     return(0);
+   }
+@@ -882,7 +887,7 @@ long *m;
+       *m = ShiftMask | ControlMask;
+       return(kc);
+     }
+-    fprintf(stderr, "Didn't resolve keycode! (c=%d, ks=%d,kc=%d\n",c,ks,kc);
++    fprintf(stderr, "Didn't resolve keycode! (c=%d, ks=%lu,kc=%d\n",c,(unsigned long)ks,kc);
+     *m = ControlMask;
+     return(0);
+   } else {
+@@ -902,7 +907,7 @@ long *m;
+       *m = ShiftMask;
+       return(kc);
+     }
+-    fprintf(stderr, "Didn't resolve keycode! (c=%d, ks=%d,kc=%d\n",c,ks,kc);
++    fprintf(stderr, "Didn't resolve keycode! (c=%d, ks=%lu,kc=%d\n",c,(unsigned long)ks,kc);
+     *m = 0;
+     return(0);
+   }
+@@ -1040,7 +1045,8 @@ caddr_t  client_data;	/* unused */
+ caddr_t  call_data;	/* unused */
+ 
+ {
+-  int x, y, n;
++  int x, n;
++  size_t y;
+   char *sel;
+   XKeyEvent evt;
+   long m;
+@@ -1052,7 +1058,7 @@ caddr_t  call_data;	/* unused */
+     if (Windows[x].active == 1) {
+       for (y = 0; y < strlen(sel); y++) {
+ 	/* skip if we don't have a keycode mapping for this character */
+-	if (kcmap[sel[y]] < 0) {
++	if (kcmap[(unsigned char)sel[y]] < 0) {
+ 	  fprintf(stderr,"No key mapping for %c!\n", sel[y]);
+ 	  continue;
+ 	}
+@@ -1068,8 +1074,8 @@ caddr_t  call_data;	/* unused */
+ 	evt.x_root=0;
+ 	evt.y_root=0;
+ 	evt.same_screen=1;
+-	evt.keycode=kcmap[sel[y]];
+-	evt.state=modmap[sel[y]];
++	evt.keycode=kcmap[(unsigned char)sel[y]];
++	evt.state=modmap[(unsigned char)sel[y]];
+ 
+ 	XSendEvent(dpy, Windows[x].wind, True, 
+ 		   KeyPressMask, (XEvent *) &evt);


Home | Main Index | Thread Index | Old Index