summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-11-11 12:54:46 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-11-11 12:54:46 +1000
commit88cb61e1e55c54982b90e2a77465faaac6a0ba89 (patch)
tree0798bc507e7b088e2bdeadd29888a4bd092b036d /xkb
parent19f43836d1006d253391926e880b14ed2e7a0cf8 (diff)
parent4ed4915bc0fbe9b4419ca4a0d4e43c2fee032ae9 (diff)
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-api
Conflicts: dix/getevents.c hw/xfree86/common/xf86Xinput.h Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'xkb')
-rw-r--r--xkb/XKBAlloc.c6
-rw-r--r--xkb/XKBGAlloc.c30
-rw-r--r--xkb/XKBMAlloc.c40
-rw-r--r--xkb/ddxLoad.c6
-rw-r--r--xkb/xkb.c37
5 files changed, 49 insertions, 70 deletions
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c
index c52e091da..bffd60fce 100644
--- a/xkb/XKBAlloc.c
+++ b/xkb/XKBAlloc.c
@@ -212,10 +212,8 @@ XkbNamesPtr names;
register XkbKeyTypePtr type;
type= map->types;
for (i=0;i<map->num_types;i++,type++) {
- if (type->level_names!=NULL) {
- free(type->level_names);
- type->level_names= NULL;
- }
+ free(type->level_names);
+ type->level_names = NULL;
}
}
}
diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c
index d1adea34e..3ec9edab8 100644
--- a/xkb/XKBGAlloc.c
+++ b/xkb/XKBGAlloc.c
@@ -50,10 +50,8 @@ _XkbFreeGeomLeafElems( Bool freeAll,
{
if ((freeAll)||(*elems==NULL)) {
*num_inout= *sz_inout= 0;
- if (*elems!=NULL) {
- free(*elems);
- *elems= NULL;
- }
+ free(*elems);
+ *elems = NULL;
return;
}
@@ -373,22 +371,16 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in;
switch (doodad->any.type) {
case XkbTextDoodad:
{
- if (doodad->text.text!=NULL) {
- free(doodad->text.text);
- doodad->text.text= NULL;
- }
- if (doodad->text.font!=NULL) {
- free(doodad->text.font);
- doodad->text.font= NULL;
- }
+ free(doodad->text.text);
+ doodad->text.text = NULL;
+ free(doodad->text.font);
+ doodad->text.font = NULL;
}
break;
case XkbLogoDoodad:
{
- if (doodad->logo.logo_name!=NULL) {
- free(doodad->logo.logo_name);
- doodad->logo.logo_name= NULL;
- }
+ free(doodad->logo.logo_name);
+ doodad->logo.logo_name = NULL;
}
break;
}
@@ -434,10 +426,8 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL))
XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE);
if (freeMap) {
- if (geom->label_font!=NULL) {
- free(geom->label_font);
- geom->label_font= NULL;
- }
+ free(geom->label_font);
+ geom->label_font = NULL;
free(geom);
}
return;
diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index 6b186c1ad..2681ba3c3 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -292,11 +292,9 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
}
type= &xkb->map->types[type_ndx];
if (map_count==0) {
- if (type->map!=NULL)
- free(type->map);
+ free(type->map);
type->map= NULL;
- if (type->preserve!=NULL)
- free(type->preserve);
+ free(type->preserve);
type->preserve= NULL;
type->map_count= 0;
}
@@ -321,9 +319,9 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
return BadAlloc;
}
}
- else if (type->preserve!=NULL) {
+ else {
free(type->preserve);
- type->preserve= NULL;
+ type->preserve = NULL;
}
type->map_count= map_count;
}
@@ -807,19 +805,13 @@ XkbClientMapPtr map;
register int i;
XkbKeyTypePtr type;
for (i=0,type=map->types;i<map->num_types;i++,type++) {
- if (type->map!=NULL) {
- free(type->map);
- type->map= NULL;
- }
- if (type->preserve!=NULL) {
- free(type->preserve);
- type->preserve= NULL;
- }
+ free(type->map);
+ type->map = NULL;
+ free(type->preserve);
+ type->preserve = NULL;
type->map_count= 0;
- if (type->level_names!=NULL) {
- free(type->level_names);
- type->level_names= NULL;
- }
+ free(type->level_names);
+ type->level_names = NULL;
}
}
free(map->types);
@@ -828,10 +820,8 @@ XkbClientMapPtr map;
}
}
if (what&XkbKeySymsMask) {
- if (map->key_sym_map!=NULL) {
- free(map->key_sym_map);
- map->key_sym_map= NULL;
- }
+ free(map->key_sym_map);
+ map->key_sym_map = NULL;
if (map->syms!=NULL) {
free(map->syms);
map->size_syms= map->num_syms= 0;
@@ -864,10 +854,8 @@ XkbServerMapPtr map;
map->explicit= NULL;
}
if (what&XkbKeyActionsMask) {
- if (map->key_acts!=NULL) {
- free(map->key_acts);
- map->key_acts= NULL;
- }
+ free(map->key_acts);
+ map->key_acts = NULL;
if (map->acts!=NULL) {
free(map->acts);
map->num_acts= map->size_acts= 0;
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 5e6ab8770..cfc6198fd 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -267,8 +267,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
strncpy(nameRtrn,keymap,nameRtrnLen);
nameRtrn[nameRtrnLen-1]= '\0';
}
- if (buf != NULL)
- free(buf);
+ free(buf);
return TRUE;
}
else
@@ -287,8 +286,7 @@ XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
}
if (nameRtrn)
nameRtrn[0]= '\0';
- if (buf != NULL)
- free(buf);
+ free(buf);
return FALSE;
}
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 4105c1c6b..bbb1d9df8 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -1677,20 +1677,6 @@ xkbSymMapWireDesc* wire = *wireRtrn;
if (!(XkbKeySymsMask&req->present))
return 1;
CHK_REQ_KEY_RANGE2(0x11,req->firstKeySym,req->nKeySyms,req,(*errorRtrn),0);
- map = &xkb->map->key_sym_map[xkb->min_key_code];
- for (i=xkb->min_key_code;i<(unsigned)req->firstKeySym;i++,map++) {
- register int g,ng,w;
- ng= XkbNumGroups(map->group_info);
- for (w=g=0;g<ng;g++) {
- if (map->kt_index[g]>=(unsigned)nTypes) {
- *errorRtrn = _XkbErrCode4(0x13,i,g,map->kt_index[g]);
- return 0;
- }
- if (mapWidths[map->kt_index[g]]>w)
- w= mapWidths[map->kt_index[g]];
- }
- symsPerKey[i] = w*ng;
- }
for (i=0;i<req->nKeySyms;i++) {
KeySym *pSyms;
register unsigned nG;
@@ -2343,8 +2329,10 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char* va
XkbDescPtr xkb;
int error;
int nTypes = 0, nActions;
- CARD8 mapWidths[XkbMaxLegalKeyCode + 1];
- CARD16 symsPerKey[XkbMaxLegalKeyCode + 1];
+ CARD8 mapWidths[XkbMaxLegalKeyCode + 1] = {0};
+ CARD16 symsPerKey[XkbMaxLegalKeyCode + 1] = {0};
+ XkbSymMapPtr map;
+ int i;
xkbi= dev->key->xkbInfo;
xkb = xkbi->desc;
@@ -2373,6 +2361,23 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char* va
client->errorValue = nTypes;
return BadValue;
}
+
+ /* symsPerKey/mapWidths must be filled regardless of client-side flags */
+ map = &xkb->map->key_sym_map[xkb->min_key_code];
+ for (i=xkb->min_key_code;i<xkb->max_key_code;i++,map++) {
+ register int g,ng,w;
+ ng= XkbNumGroups(map->group_info);
+ for (w=g=0;g<ng;g++) {
+ if (map->kt_index[g]>=(unsigned)nTypes) {
+ client->errorValue = _XkbErrCode4(0x13,i,g,map->kt_index[g]);
+ return 0;
+ }
+ if (mapWidths[map->kt_index[g]]>w)
+ w= mapWidths[map->kt_index[g]];
+ }
+ symsPerKey[i] = w*ng;
+ }
+
if ((req->present & XkbKeySymsMask) &&
(!CheckKeySyms(client,xkb,req,nTypes,mapWidths,symsPerKey,
(xkbSymMapWireDesc **)&values,&error))) {