aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/xkb
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-04 15:38:04 +0000
committermarha <marha@users.sourceforge.net>2011-03-04 15:38:04 +0000
commit3592ad31cfc72ffff3c9024eecea7d3b987c7954 (patch)
tree0e3b50cb6bcd0839b591d318a41d04b7cbd8e6e2 /xorg-server/xkb
parent79409465b0b8d5d38e6b94deb1943316f40c66eb (diff)
parent0a5888393c68f6f7db86206d1f277232db18240b (diff)
downloadvcxsrv-3592ad31cfc72ffff3c9024eecea7d3b987c7954.tar.gz
vcxsrv-3592ad31cfc72ffff3c9024eecea7d3b987c7954.tar.bz2
vcxsrv-3592ad31cfc72ffff3c9024eecea7d3b987c7954.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/xkb')
-rw-r--r--xorg-server/xkb/XKBGAlloc.c17
-rw-r--r--xorg-server/xkb/ddxLoad.c21
-rw-r--r--xorg-server/xkb/maprules.c33
-rw-r--r--xorg-server/xkb/xkb.c18
-rw-r--r--xorg-server/xkb/xkbAccessX.c2
-rw-r--r--xorg-server/xkb/xkbActions.c8
-rw-r--r--xorg-server/xkb/xkbInit.c20
-rw-r--r--xorg-server/xkb/xkbfmisc.c10
-rw-r--r--xorg-server/xkb/xkmread.c21
9 files changed, 65 insertions, 85 deletions
diff --git a/xorg-server/xkb/XKBGAlloc.c b/xorg-server/xkb/XKBGAlloc.c
index d5e49349e..db32dc8c5 100644
--- a/xorg-server/xkb/XKBGAlloc.c
+++ b/xorg-server/xkb/XKBGAlloc.c
@@ -647,9 +647,7 @@ register XkbPropertyPtr prop;
for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
if ((prop->name)&&(strcmp(name,prop->name)==0)) {
free(prop->value);
- prop->value= malloc(strlen(value)+1);
- if (prop->value)
- strcpy(prop->value,value);
+ prop->value= strdup(value);
return prop;
}
}
@@ -658,17 +656,15 @@ register XkbPropertyPtr prop;
return NULL;
}
prop= &geom->properties[geom->num_properties];
- prop->name= malloc(strlen(name)+1);
- if (!name)
+ prop->name= strdup(name);
+ if (!prop->name)
return NULL;
- strcpy(prop->name,name);
- prop->value= malloc(strlen(value)+1);
- if (!value) {
+ prop->value= strdup(value);
+ if (!prop->value) {
free(prop->name);
prop->name= NULL;
return NULL;
}
- strcpy(prop->value,value);
geom->num_properties++;
return prop;
}
@@ -720,10 +716,9 @@ register XkbColorPtr color;
}
color= &geom->colors[geom->num_colors];
color->pixel= pixel;
- color->spec= malloc(strlen(spec)+1);
+ color->spec= strdup(spec);
if (!color->spec)
return NULL;
- strcpy(color->spec,spec);
geom->num_colors++;
return color;
}
diff --git a/xorg-server/xkb/ddxLoad.c b/xorg-server/xkb/ddxLoad.c
index decad1e33..8b3dab56d 100644
--- a/xorg-server/xkb/ddxLoad.c
+++ b/xorg-server/xkb/ddxLoad.c
@@ -307,15 +307,16 @@ FILE * file;
&&(!isalpha(xkm_output_dir[0]) || xkm_output_dir[1]!=':')
#endif
) {
- if (strlen(XkbBaseDirectory)+strlen(xkm_output_dir)
- +strlen(mapName)+6 <= PATH_MAX)
- {
- sprintf(buf,"%s/%s%s.xkm",XkbBaseDirectory,
- xkm_output_dir,mapName);
- }
+ if (snprintf(buf, PATH_MAX, "%s/%s%s.xkm", XkbBaseDirectory,
+ xkm_output_dir, mapName) >= PATH_MAX)
+ buf[0] = '\0';
+ }
+ else
+ {
+ if (snprintf(buf, PATH_MAX, "%s%s.xkm", xkm_output_dir, mapName)
+ >= PATH_MAX)
+ buf[0] = '\0';
}
- else if (strlen(xkm_output_dir)+strlen(mapName)+5 <= PATH_MAX)
- sprintf(buf,"%s%s.xkm",xkm_output_dir,mapName);
if (buf[0] != '\0')
file= fopen(buf,"rb");
else file= NULL;
@@ -392,11 +393,11 @@ XkbRF_RulesPtr rules;
if (!rules_name)
return FALSE;
- if (strlen(XkbBaseDirectory) + strlen(rules_name) + 8 > PATH_MAX) {
+ if (snprintf(buf, PATH_MAX, "%s/rules/%s", XkbBaseDirectory, rules_name)
+ >= PATH_MAX) {
LogMessage(X_ERROR, "XKB: Rules name is too long\n");
return FALSE;
}
- sprintf(buf,"%s/rules/%s", XkbBaseDirectory, rules_name);
file = fopen(buf, "r");
if (!file) {
diff --git a/xorg-server/xkb/maprules.c b/xorg-server/xkb/maprules.c
index 2a118ae6a..9d49eeb1b 100644
--- a/xorg-server/xkb/maprules.c
+++ b/xorg-server/xkb/maprules.c
@@ -391,8 +391,8 @@ Bool append = FALSE;
}
if (*words == '\0')
return FALSE;
- group->name = _XkbDupString(gname);
- group->words = _XkbDupString(words);
+ group->name = Xstrdup(gname);
+ group->words = Xstrdup(words);
for (i = 1, words = group->words; *words; words++) {
if ( *words == ' ') {
*words++ = '\0';
@@ -443,16 +443,16 @@ Bool append = FALSE;
rule->flags|= XkbRF_Append;
else
rule->flags|= XkbRF_Normal;
- rule->model= _XkbDupString(tmp.name[MODEL]);
- rule->layout= _XkbDupString(tmp.name[LAYOUT]);
- rule->variant= _XkbDupString(tmp.name[VARIANT]);
- rule->option= _XkbDupString(tmp.name[OPTION]);
+ rule->model= Xstrdup(tmp.name[MODEL]);
+ rule->layout= Xstrdup(tmp.name[LAYOUT]);
+ rule->variant= Xstrdup(tmp.name[VARIANT]);
+ rule->option= Xstrdup(tmp.name[OPTION]);
- rule->keycodes= _XkbDupString(tmp.name[KEYCODES]);
- rule->symbols= _XkbDupString(tmp.name[SYMBOLS]);
- rule->types= _XkbDupString(tmp.name[TYPES]);
- rule->compat= _XkbDupString(tmp.name[COMPAT]);
- rule->geometry= _XkbDupString(tmp.name[GEOMETRY]);
+ rule->keycodes= Xstrdup(tmp.name[KEYCODES]);
+ rule->symbols= Xstrdup(tmp.name[SYMBOLS]);
+ rule->types= Xstrdup(tmp.name[TYPES]);
+ rule->compat= Xstrdup(tmp.name[COMPAT]);
+ rule->geometry= Xstrdup(tmp.name[GEOMETRY]);
rule->layout_num = rule->variant_num = 0;
for (i = 0; i < nread; i++) {
@@ -497,7 +497,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
memset((char *)mdefs, 0, sizeof(XkbRF_MultiDefsRec));
mdefs->model = defs->model;
- mdefs->options = _XkbDupString(defs->options);
+ mdefs->options = Xstrdup(defs->options);
if (mdefs->options) squeeze_spaces(mdefs->options);
if (defs->layout) {
@@ -506,7 +506,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
} else {
char *p;
int i;
- mdefs->layout[1] = _XkbDupString(defs->layout);
+ mdefs->layout[1] = Xstrdup(defs->layout);
if (mdefs->layout[1] == NULL)
return FALSE;
squeeze_spaces(mdefs->layout[1]);
@@ -530,7 +530,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
} else {
char *p;
int i;
- mdefs->variant[1] = _XkbDupString(defs->variant);
+ mdefs->variant[1] = Xstrdup(defs->variant);
if (mdefs->variant[1] == NULL)
return FALSE;
squeeze_spaces(mdefs->variant[1]);
@@ -566,7 +566,7 @@ Apply(char *src, char **dst)
*dst= _Concat(*dst, src);
} else {
if (*dst == NULL)
- *dst= _XkbDupString(src);
+ *dst= Xstrdup(src);
}
}
}
@@ -945,9 +945,8 @@ Bool ok;
if ((!base)||(!rules))
return FALSE;
if (locale) {
- if (strlen(base)+strlen(locale)+2 > PATH_MAX)
+ if (snprintf(buf, PATH_MAX, "%s-%s", base, locale) >= PATH_MAX)
return FALSE;
- sprintf(buf,"%s-%s", base, locale);
}
else {
if (strlen(base)+1 > PATH_MAX)
diff --git a/xorg-server/xkb/xkb.c b/xorg-server/xkb/xkb.c
index 3ce7e690c..9d6c4d4f6 100644
--- a/xorg-server/xkb/xkb.c
+++ b/xorg-server/xkb/xkb.c
@@ -5621,17 +5621,17 @@ ProcXkbGetKbdByName(ClientPtr client)
else fwant= stuff->want|stuff->need;
if ((!names.compat)&&
(fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) {
- names.compat= _XkbDupString("%");
+ names.compat= Xstrdup("%");
}
if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) {
- names.types= _XkbDupString("%");
+ names.types= Xstrdup("%");
}
if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) {
- names.symbols= _XkbDupString("%");
+ names.symbols= Xstrdup("%");
}
geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0));
if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) {
- names.geometry= _XkbDupString("%");
+ names.geometry= Xstrdup("%");
geom_changed= FALSE;
}
@@ -5885,12 +5885,10 @@ ProcXkbGetKbdByName(ClientPtr client)
nkn.changed|= XkbNKN_GeometryMask;
XkbSendNewKeyboardNotify(dev,&nkn);
- if (!IsMaster(dev) && dev->u.master)
- {
- DeviceIntPtr master = dev->u.master;
- if (master->u.lastSlave == dev)
- {
- XkbCopyDeviceKeymap(dev->u.master, dev);
+ if (!IsMaster(dev)) {
+ DeviceIntPtr master = GetMaster(dev, MASTER_KEYBOARD);
+ if (master && master->lastSlave == dev) {
+ XkbCopyDeviceKeymap(master, dev);
XkbSendNewKeyboardNotify(dev,&nkn);
}
}
diff --git a/xorg-server/xkb/xkbAccessX.c b/xorg-server/xkb/xkbAccessX.c
index 70b1c6013..7c6f0bed6 100644
--- a/xorg-server/xkb/xkbAccessX.c
+++ b/xorg-server/xkb/xkbAccessX.c
@@ -694,7 +694,7 @@ ProcessInputProc backupproc;
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
DeviceEvent *event = &ev->device_event;
- dev = (IsMaster(mouse) || mouse->u.master) ? GetMaster(mouse, MASTER_KEYBOARD) : mouse;
+ dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
if (dev && dev->key)
{
diff --git a/xorg-server/xkb/xkbActions.c b/xorg-server/xkb/xkbActions.c
index 83e5eaf41..c9649115e 100644
--- a/xorg-server/xkb/xkbActions.c
+++ b/xorg-server/xkb/xkbActions.c
@@ -1365,9 +1365,9 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, Valuat
if (IsMaster(dev)) {
mpointer = GetMaster(dev, MASTER_POINTER);
- lastSlave = mpointer->u.lastSlave;
+ lastSlave = mpointer->lastSlave;
ptr = GetXTestDevice(mpointer);
- } else if (!dev->u.master)
+ } else if (IsFloating(dev))
ptr = dev;
else
return;
@@ -1398,7 +1398,7 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
int Point[]={x, y};
/* ignore attached SDs */
- if (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) != NULL)
+ if (!IsMaster(dev) && !IsFloating(dev))
return;
if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY)
@@ -1428,7 +1428,7 @@ XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
if (IsMaster(dev)) {
DeviceIntPtr mpointer = GetMaster(dev, MASTER_POINTER);
ptr = GetXTestDevice(mpointer);
- } else if (!dev->u.master)
+ } else if (IsFloating(dev))
ptr = dev;
else
return;
diff --git a/xorg-server/xkb/xkbInit.c b/xorg-server/xkb/xkbInit.c
index 74284dd2a..e71032992 100644
--- a/xorg-server/xkb/xkbInit.c
+++ b/xorg-server/xkb/xkbInit.c
@@ -221,15 +221,15 @@ static void
XkbSetRulesUsed(XkbRMLVOSet *rmlvo)
{
free(XkbRulesUsed);
- XkbRulesUsed= (rmlvo->rules?_XkbDupString(rmlvo->rules):NULL);
+ XkbRulesUsed= (rmlvo->rules?Xstrdup(rmlvo->rules):NULL);
free(XkbModelUsed);
- XkbModelUsed= (rmlvo->model?_XkbDupString(rmlvo->model):NULL);
+ XkbModelUsed= (rmlvo->model?Xstrdup(rmlvo->model):NULL);
free(XkbLayoutUsed);
- XkbLayoutUsed= (rmlvo->layout?_XkbDupString(rmlvo->layout):NULL);
+ XkbLayoutUsed= (rmlvo->layout?Xstrdup(rmlvo->layout):NULL);
free(XkbVariantUsed);
- XkbVariantUsed= (rmlvo->variant?_XkbDupString(rmlvo->variant):NULL);
+ XkbVariantUsed= (rmlvo->variant?Xstrdup(rmlvo->variant):NULL);
free(XkbOptionsUsed);
- XkbOptionsUsed= (rmlvo->options?_XkbDupString(rmlvo->options):NULL);
+ XkbOptionsUsed= (rmlvo->options?Xstrdup(rmlvo->options):NULL);
if (XkbWantRulesProp)
QueueWorkProc(XkbWriteRulesProp,NULL,NULL);
return;
@@ -240,23 +240,23 @@ XkbSetRulesDflts(XkbRMLVOSet *rmlvo)
{
if (rmlvo->rules) {
free(XkbRulesDflt);
- XkbRulesDflt= _XkbDupString(rmlvo->rules);
+ XkbRulesDflt= Xstrdup(rmlvo->rules);
}
if (rmlvo->model) {
free(XkbModelDflt);
- XkbModelDflt= _XkbDupString(rmlvo->model);
+ XkbModelDflt= Xstrdup(rmlvo->model);
}
if (rmlvo->layout) {
free(XkbLayoutDflt);
- XkbLayoutDflt= _XkbDupString(rmlvo->layout);
+ XkbLayoutDflt= Xstrdup(rmlvo->layout);
}
if (rmlvo->variant) {
free(XkbVariantDflt);
- XkbVariantDflt= _XkbDupString(rmlvo->variant);
+ XkbVariantDflt= Xstrdup(rmlvo->variant);
}
if (rmlvo->options) {
free(XkbOptionsDflt);
- XkbOptionsDflt= _XkbDupString(rmlvo->options);
+ XkbOptionsDflt= Xstrdup(rmlvo->options);
}
return;
}
diff --git a/xorg-server/xkb/xkbfmisc.c b/xorg-server/xkb/xkbfmisc.c
index 382b6ebba..42b73012c 100644
--- a/xorg-server/xkb/xkbfmisc.c
+++ b/xorg-server/xkb/xkbfmisc.c
@@ -241,7 +241,7 @@ unsigned wantNames,wantConfig,wantDflts;
if (wantNames&XkmTypesMask) {
if (old_names->types!=None) {
tmp= NameForAtom(old_names->types);
- names->types= _XkbDupString(tmp);
+ names->types= Xstrdup(tmp);
}
else {
wantDflts|= XkmTypesMask;
@@ -251,7 +251,7 @@ unsigned wantNames,wantConfig,wantDflts;
if (wantNames&XkmCompatMapMask) {
if (old_names->compat!=None) {
tmp= NameForAtom(old_names->compat);
- names->compat= _XkbDupString(tmp);
+ names->compat= Xstrdup(tmp);
}
else wantDflts|= XkmCompatMapMask;
complete|= XkmCompatMapMask;
@@ -260,13 +260,13 @@ unsigned wantNames,wantConfig,wantDflts;
if (old_names->symbols==None)
return FALSE;
tmp= NameForAtom(old_names->symbols);
- names->symbols= _XkbDupString(tmp);
+ names->symbols= Xstrdup(tmp);
complete|= XkmSymbolsMask;
}
if (wantNames&XkmKeyNamesMask) {
if (old_names->keycodes!=None) {
tmp= NameForAtom(old_names->keycodes);
- names->keycodes= _XkbDupString(tmp);
+ names->keycodes= Xstrdup(tmp);
}
else wantDflts|= XkmKeyNamesMask;
complete|= XkmKeyNamesMask;
@@ -275,7 +275,7 @@ unsigned wantNames,wantConfig,wantDflts;
if (old_names->geometry==None)
return FALSE;
tmp= NameForAtom(old_names->geometry);
- names->geometry= _XkbDupString(tmp);
+ names->geometry= Xstrdup(tmp);
complete|= XkmGeometryMask;
wantNames&= ~XkmGeometryMask;
}
diff --git a/xorg-server/xkb/xkmread.c b/xorg-server/xkb/xkmread.c
index 81f09fe3b..d6693ed84 100644
--- a/xorg-server/xkb/xkmread.c
+++ b/xorg-server/xkb/xkmread.c
@@ -51,19 +51,6 @@ XkbInternAtom(char *str,Bool only_if_exists)
return MakeAtom(str,strlen(str),!only_if_exists);
}
-char *
-_XkbDupString(const char *str)
-{
-char *new;
-
- if (str==NULL)
- return NULL;
- new= calloc(strlen(str)+1,sizeof(char));
- if (new)
- strcpy(new,str);
- return new;
-}
-
/***====================================================================***/
static void *
@@ -845,9 +832,9 @@ int nRead=0;
doodad->text.height= doodadWire.text.height;
doodad->text.color_ndx= doodadWire.text.color_ndx;
nRead+= XkmGetCountedString(file,buf,100);
- doodad->text.text= _XkbDupString(buf);
+ doodad->text.text= Xstrdup(buf);
nRead+= XkmGetCountedString(file,buf,100);
- doodad->text.font= _XkbDupString(buf);
+ doodad->text.font= Xstrdup(buf);
break;
case XkbIndicatorDoodad:
doodad->indicator.shape_ndx= doodadWire.indicator.shape_ndx;
@@ -859,7 +846,7 @@ int nRead=0;
doodad->logo.color_ndx= doodadWire.logo.color_ndx;
doodad->logo.shape_ndx= doodadWire.logo.shape_ndx;
nRead+= XkmGetCountedString(file,buf,100);
- doodad->logo.logo_name= _XkbDupString(buf);
+ doodad->logo.logo_name= Xstrdup(buf);
break;
default:
/* report error? */
@@ -1021,7 +1008,7 @@ XkbGeometrySizesRec sizes;
geom->width_mm= wireGeom.width_mm;
geom->height_mm= wireGeom.height_mm;
nRead+= XkmGetCountedString(file,buf,100);
- geom->label_font= _XkbDupString(buf);
+ geom->label_font= Xstrdup(buf);
if (wireGeom.num_properties>0) {
char val[1024];
for (i=0;i<wireGeom.num_properties;i++) {