X11/src/util makekeys.c,3.7,3.8

Daniel Stone xlibs-commit@pdx.freedesktop.org
Fri Jan 28 10:48:10 PST 2005


Committed by: daniels

Update of /cvs/xlibs/X11/src/util
In directory gabe:/tmp/cvs-serv2397/src/util

Modified Files:
	makekeys.c 
Log Message:
* include/X11/Xutil.h:
* include/X11/Xlib.h:
* include/X11/Xlibint.h:
* src/ConnDis.c (_X11TransConnectDisplay):
* src/ErrDes.c (XGetErrorDatabaseText):
* src/GetWAttrs.c (XGetWindowAttributes):
* src/Host.c:
* src/KeyBind.c (UCSConvertCase) (XConvertCase):
* src/LiHosts.c:
* src/OpenDis.c:
* src/PutBEvent.c (XPutBackEvent):
* src/StrKeysym.c (XStringToKeysym):
* src/XKBBind.c (XkbRefreshKeyboardMapping):
* src/XKBCvt.c:
* src/XlibInt.c:
* src/cmsCmap.c:
* src/cmsColNm.c:
* src/imDefLkup.c (_XimGetWindowEventmask):
* src/imInsClbk.c (_XimUnRegisterIMInstantiateCallback):
* src/imLcFlt.c (_XimLocalFilter):
* src/imLcIm.c (_XimLocalIMFree):
* src/imRm.c:
* src/imThaiFlt.c (tis2ucs):
* src/imTrans.c:
* src/lcEuc.c (euc_ctstowcs) (euc_ctstombs):
* src/lcFile.c:
* src/lcSjis.c:
* src/lcUTF8.c (create_tofontcs_conv):
* src/omGeneric.c (parse_fontdata):
* src/util/makekeys.c (main):
Resync with X.Org HEAD, including a security fix for the error DB name
and a minor stack smash in XKB code, thread-safe XGetWindowAttributes
and XPutBackEvent, case-conversion cleanups and updates, and large-scale
localisation/input cleanups and adherance to the specification.


Index: makekeys.c
===================================================================
RCS file: /cvs/xlibs/X11/src/util/makekeys.c,v
retrieving revision 3.7
retrieving revision 3.8
diff -u -d -r3.7 -r3.8
--- makekeys.c	14 Dec 2001 19:54:32 -0000	3.7
+++ makekeys.c	28 Jan 2005 18:48:08 -0000	3.8
@@ -60,7 +60,7 @@
 int
 main(int argc, char *argv[])
 {
-    int ksnum;
+    int ksnum = 0;
     int max_rehash;
     Signature sig;
     register int i, j, k, z;
@@ -71,27 +71,42 @@
     int best_z = 0;
     int num_found;
     KeySym val;
+    char key[128];
+    char alias[128];
 
-    for (ksnum = 0; 1; (void)fgets(buf, sizeof(buf), stdin)) {
-	i = scanf("#define XK_%s 0x%lx", buf, &info[ksnum].val);
-	if (i == EOF)
-	    break;
-	if (i != 2)
-	    continue;
+    while (fgets(buf, sizeof(buf), stdin)) {
+        i = sscanf(buf, "#define XK_%127s 0x%lx", key, &info[ksnum].val);
+        if (i != 2) {
+            i = sscanf(buf, "#define XK_%127s XK_%127s", key, alias);
+         if (i != 2)
+             continue;
+            for (i = ksnum - 1; i >= 0; i--) {
+                if (strcmp(info[i].name, alias) == 0) {
+                    info[ksnum].val = info[i].val;
+                    break;
+                }
+            }
+            if (i < 0) {  /* Didn't find a match */
+                fprintf(stderr,
+                    "can't find matching definition %s for keysym %s\n",
+                    alias, key);
+                continue;
+            }
+        }
 	if (info[ksnum].val == XK_VoidSymbol)
 	    info[ksnum].val = 0;
-	if (info[ksnum].val > 0xffff) {
+	if (info[ksnum].val > 0x1fffffff) {
 	    fprintf(stderr,
 		    "ignoring illegal keysym (%s), remove it from .h file!\n",
-		    buf);
+		    key);
 	    continue;
 	}
-	name = malloc((unsigned)strlen(buf)+1);
+	name = malloc((unsigned)strlen(key)+1);
 	if (!name) {
 	    fprintf(stderr, "makekeys: out of memory!\n");
 	    exit(1);
 	}
-	(void)strcpy(name, buf);
+	(void)strcpy(name, key);
 	info[ksnum].name = name;
 	ksnum++;
 	if (ksnum == KTNUM) {
@@ -158,10 +173,11 @@
 	offsets[j] = k;
 	indexes[i] = k;
 	val = info[i].val;
-	printf("0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, ",
+	printf("0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, ",
 	       (sig >> 8) & 0xff, sig & 0xff,
+	       (val >> 24) & 0xff, (val >> 16) & 0xff,
 	       (val >> 8) & 0xff, val & 0xff);
-	for (name = info[i].name, k += 5; (c = *name++); k++)
+	for (name = info[i].name, k += 7; (c = *name++); k++)
 	    printf("'%c',", c);
 	printf((i == (ksnum-1)) ? "0\n" : "0,\n");
     }



More information about the xlibs-commit mailing list