# DP: fix a couple of compile-time warnings

--- a/vroot.h
+++ b/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;
 
--- a/xlax.c
+++ b/xlax.c
@@ -71,7 +71,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 {
@@ -412,8 +412,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;
 
@@ -675,7 +675,7 @@ Display *dpy;
 int wi;
 char *str;
 {
-  int i;
+  size_t i;
   long m;
   Window root = RootWindow(dpy,DefaultScreen(dpy));
 
@@ -687,7 +687,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;
     }
@@ -703,8 +703,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;
@@ -747,8 +747,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,8 +759,8 @@ Display *disp;
 unsigned char c;
 long *m;
 {
-  KeySym ks, ksr;
-  KeyCode kc;
+  KeySym ks = -1, ksr;
+  KeyCode kc = -1;
   XKeyEvent evt;
   long mr, len;
   char str[2], out[32];
@@ -803,11 +803,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 {
@@ -827,7 +827,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);
   }
@@ -883,7 +883,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 {
@@ -903,7 +903,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);
   }
@@ -1041,7 +1041,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;
@@ -1053,7 +1054,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;
 	}
@@ -1069,8 +1070,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);
--- a/xlax.h
+++ b/xlax.h
@@ -39,8 +39,12 @@
 #include <X11/Xmu/WinUtil.h>
 
 #include <X11/cursorfont.h>
+#ifndef XK_MISCELLANY
 #define XK_MISCELLANY  1
+#endif
+#ifndef XK_LATIN1
 #define XK_LATIN1  1
+#endif
 #include <X11/keysymdef.h>
 
 #include <stdlib.h>
