xserver: Branch 'master' - 4 commits

Keith Packard keithp at kemper.freedesktop.org
Wed Mar 16 22:15:39 PDT 2011


 hw/xfree86/man/xorg.conf.man |   13 ++++++++++---
 include/xkbsrv.h             |    5 +++++
 xkb/XKBAlloc.c               |   19 +++++++++++++++++++
 xkb/ddxLoad.c                |   22 +++++++++++-----------
 xkb/xkb.c                    |   34 +++++++++++++++++++++-------------
 5 files changed, 66 insertions(+), 27 deletions(-)

New commits:
commit dc9ce695a69ca0787f58f8d160212a7a41acb703
Author: Rami Ylimäki <rami.ylimaki at vincit.fi>
Date:   Wed Mar 9 15:45:40 2011 +0200

    xkb: Initialize pad bytes sent in replies of geometry requests.
    
    Valgrind complains about uninitialized data being written to clients.
    
    Reviewed-by: Erkki Seppälä <erkki.seppala at vincit.fi>
    Signed-off-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/xkb/xkb.c b/xkb/xkb.c
index 4786489..4044d33 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -4321,7 +4321,7 @@ ProcXkbSetNames(ClientPtr client)
 static char *
 XkbWriteCountedString(char *wire,char *str,Bool swap)
 {
-    CARD16 len,*pLen;
+    CARD16 len,*pLen, paddedLen;
 
     if (!str)
         return wire;
@@ -4333,8 +4333,9 @@ XkbWriteCountedString(char *wire,char *str,Bool swap)
 	register int n;
 	swaps(pLen,n);
     }
-    memcpy(&wire[2],str,len);
-    wire+= ((2+len+3)/4)*4;
+    paddedLen= pad_to_int32(sizeof(len)+len)-sizeof(len);
+    strncpy(&wire[sizeof(len)],str,paddedLen);
+    wire+= sizeof(len)+paddedLen;
     return wire;
 }
 
@@ -4445,6 +4446,7 @@ xkbShapeWireDesc *	shapeWire;
 	if (shape->approx!=NULL)
 	     shapeWire->approxNdx= XkbOutlineIndex(shape,shape->approx);
 	else shapeWire->approxNdx= XkbNoShape;
+	shapeWire->pad= 0;
 	if (swap) {
 	    register int n;
 	    swapl(&shapeWire->name,n);
@@ -4457,6 +4459,7 @@ xkbShapeWireDesc *	shapeWire;
 	    olWire= (xkbOutlineWireDesc *)wire;
 	    olWire->nPoints= ol->num_points;
 	    olWire->cornerRadius= ol->corner_radius;
+	    olWire->pad= 0;
 	    wire= (char *)&olWire[1];
 	    ptWire= (xkbPointWireDesc *)wire;
 	    for (p=0,pt=ol->points;p<ol->num_points;p++,pt++) {
@@ -4570,6 +4573,8 @@ xkbOverlayWireDesc *	olWire;
    olWire= (xkbOverlayWireDesc *)wire;
    olWire->name= ol->name;
    olWire->nRows= ol->num_rows;
+   olWire->pad1= 0;
+   olWire->pad2= 0;
    if (swap) {
 	register int n;
 	swapl(&olWire->name,n);
@@ -4582,6 +4587,7 @@ xkbOverlayWireDesc *	olWire;
 	rowWire= (xkbOverlayRowWireDesc *)wire;
 	rowWire->rowUnder= row->row_under;
 	rowWire->nKeys= row->num_keys;
+	rowWire->pad1= 0;
 	wire= (char *)&rowWire[1];
 	for (k=0,key=row->keys;k<row->num_keys;k++,key++) {
 	    xkbOverlayKeyWireDesc *	keyWire;
commit ee3a4951a49312a2b68025db00c71472eb84293f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Mar 10 09:30:02 2011 +1000

    xkb: Document XkbWriteCountedString.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Daniel Stone <daniel at fooishbar.org>

diff --git a/xkb/xkb.c b/xkb/xkb.c
index fb44b24..4786489 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -4307,6 +4307,17 @@ ProcXkbSetNames(ClientPtr client)
 
 #define	XkbSizeCountedString(s)  ((s)?((((2+strlen(s))+3)/4)*4):4)
 
+/**
+ * Write the zero-terminated string str into wire as a pascal string with a
+ * 16-bit length field prefixed before the actual string.
+ *
+ * @param wire The destination array, usually the wire struct
+ * @param str The source string as zero-terminated C string
+ * @param swap If TRUE, the length field is swapped.
+ *
+ * @return The input string in the format <string length><string> with a
+ * (swapped) 16 bit string length, non-zero terminated.
+ */
 static char *
 XkbWriteCountedString(char *wire,char *str,Bool swap)
 {
commit 5c47f8beac7f87680c6f7331483b9cf94a1dbc86
Author: Rami Ylimäki <rami.ylimaki at vincit.fi>
Date:   Fri Mar 11 14:30:49 2011 +0200

    xkb: Release XKB component names when compiling keymap.
    
    Reviewed-by: Erkki Seppälä <erkki.seppala at vincit.fi>
    Signed-off-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 422bae0..c6f86f5 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -447,6 +447,11 @@ extern _X_EXPORT void	XkbFreeKeyboard(
 	Bool			/* freeDesc */
 );
 
+extern _X_EXPORT void	XkbFreeComponentNames(
+	XkbComponentNamesPtr	/* names */,
+	Bool			/* freeNames */
+);
+
 extern _X_EXPORT  void XkbSetActionKeyMods(
 	XkbDescPtr		/* xkb */,
 	XkbAction *		/* act */,
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c
index bffd60f..b70ac17 100644
--- a/xkb/XKBAlloc.c
+++ b/xkb/XKBAlloc.c
@@ -333,3 +333,22 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll)
 	free(xkb);
     return;
 }
+
+
+/***====================================================================***/
+
+void
+XkbFreeComponentNames(XkbComponentNamesPtr names, Bool freeNames)
+{
+    if (names)
+    {
+        free(names->keycodes);
+        free(names->types);
+        free(names->compat);
+        free(names->symbols);
+        free(names->geometry);
+        memset(names, 0, sizeof(XkbComponentNamesRec));
+    }
+    if (freeNames)
+        free(names);
+}
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index dc3c844..e102035 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -447,23 +447,23 @@ XkbRMLVOtoKcCGST(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, XkbComponentNamesPtr kccg
 static XkbDescPtr
 XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, int need)
 {
-    XkbDescPtr xkb;
+    XkbDescPtr xkb = NULL;
     unsigned int provided;
-    XkbComponentNamesRec kccgst;
+    XkbComponentNamesRec kccgst = {0};
     char name[PATH_MAX];
 
-    if (!XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst))
-        return NULL;
-
-    provided = XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need,
-                                       &xkb, name, PATH_MAX);
-    if ((need & provided) != need) {
-        if (xkb) {
-            XkbFreeKeyboard(xkb, 0, TRUE);
-            xkb = NULL;
+    if (XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst)) {
+        provided = XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need,
+                                           &xkb, name, PATH_MAX);
+        if ((need & provided) != need) {
+            if (xkb) {
+                XkbFreeKeyboard(xkb, 0, TRUE);
+                xkb = NULL;
+            }
         }
     }
 
+    XkbFreeComponentNames(&kccgst, FALSE);
     return xkb;
 }
 
diff --git a/xkb/xkb.c b/xkb/xkb.c
index d701ea1..fb44b24 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -5895,16 +5895,7 @@ ProcXkbGetKbdByName(ClientPtr client)
 	XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE);
 	new= NULL;
     }
-    free(names.keycodes);
-    names.keycodes = NULL;
-    free(names.types);
-    names.types = NULL;
-    free(names.compat);
-    names.compat = NULL;
-    free(names.symbols);
-    names.symbols = NULL;
-    free(names.geometry);
-    names.geometry = NULL;
+    XkbFreeComponentNames(&names, FALSE);
     return Success;
 }
 
commit 6f46ae3c69c48f389560af1491ed1729ba45866f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Mar 15 13:20:03 2011 +1000

    man: list the drivers that are ignored when hotplugging (#35209)
    
    X.Org Bug 35209 <http://bugs.freedesktop.org/show_bug.cgi?id=35209>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Cyril Brulebois <kibi at debian.org>
    Reviewed-by: Julien Cristau <jcristau at debian.org>

diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index e3fd0ea..4bec316 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -814,11 +814,18 @@ Example: the MIT-SHM extension can be disabled with the following entry:
 The config file may have multiple
 .B InputDevice
 sections.
-Recent X servers employ input hotplugging to add input devices, with the HAL
-backend being the default backend for X servers since 1.4. It is usually not
+Recent X servers employ HAL or udev backends for input device enumeration
+and input hotplugging. It is usually not
 necessary to provide
 .B InputDevice
-sections in the xorg.conf if hotplugging is enabled.
+sections in the xorg.conf if hotplugging is in use. If hotplugging is
+enabled,
+.B InputDevice
+sections using the
+.B mouse, kbd
+and
+.B vmmouse
+driver will be ignored.
 .PP
 If hotplugging is disabled, there will normally
 be at least two: one for the core (primary) keyboard


More information about the xorg-commit mailing list