diff options
author | marha <marha@users.sourceforge.net> | 2011-03-17 14:17:54 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-03-17 14:17:54 +0000 |
commit | 76b655664dad149451d0abaa15929d1b7b62e0c6 (patch) | |
tree | e7c3389fec52eaad405e2025e04555766493022c /xorg-server/xkb | |
parent | a44b2f0d059871926ffb84dabdae53ddaa390beb (diff) | |
parent | d7f1bd4112420f1d4b41c5409074eca6b34bf507 (diff) | |
download | vcxsrv-76b655664dad149451d0abaa15929d1b7b62e0c6.tar.gz vcxsrv-76b655664dad149451d0abaa15929d1b7b62e0c6.tar.bz2 vcxsrv-76b655664dad149451d0abaa15929d1b7b62e0c6.zip |
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/xkb')
-rw-r--r-- | xorg-server/xkb/XKBAlloc.c | 19 | ||||
-rw-r--r-- | xorg-server/xkb/ddxLoad.c | 22 | ||||
-rw-r--r-- | xorg-server/xkb/xkb.c | 34 |
3 files changed, 51 insertions, 24 deletions
diff --git a/xorg-server/xkb/XKBAlloc.c b/xorg-server/xkb/XKBAlloc.c index 8c439ba0b..89ba5fb4a 100644 --- a/xorg-server/xkb/XKBAlloc.c +++ b/xorg-server/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/xorg-server/xkb/ddxLoad.c b/xorg-server/xkb/ddxLoad.c index 8b3dab56d..13d2d6f1b 100644 --- a/xorg-server/xkb/ddxLoad.c +++ b/xorg-server/xkb/ddxLoad.c @@ -451,23 +451,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/xorg-server/xkb/xkb.c b/xorg-server/xkb/xkb.c index 9d6c4d4f6..136d3ac45 100644 --- a/xorg-server/xkb/xkb.c +++ b/xorg-server/xkb/xkb.c @@ -4307,10 +4307,21 @@ 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)
{
- CARD16 len,*pLen;
+ CARD16 len,*pLen, paddedLen;
if (!str)
return wire;
@@ -4322,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;
}
@@ -4434,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);
@@ -4446,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++) {
@@ -4559,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);
@@ -4571,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;
@@ -5897,16 +5914,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;
}
|