aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/xkb
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-03-03 22:44:58 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-03-03 22:44:58 +0100
commit05aabb4e6f45bcb2c951ec04026f9d7bce7335b3 (patch)
tree7eb1bb1a0e4633e77edf9d3d8e3829849303f1cd /nx-X11/programs/Xserver/xkb
parent96e2556031c8aff62a4650b9cfb814991f5240e1 (diff)
parent06bb154df0a4d6e35885bce6a63057bd8f8636e8 (diff)
downloadnx-libs-05aabb4e6f45bcb2c951ec04026f9d7bce7335b3.tar.gz
nx-libs-05aabb4e6f45bcb2c951ec04026f9d7bce7335b3.tar.bz2
nx-libs-05aabb4e6f45bcb2c951ec04026f9d7bce7335b3.zip
Merge branch 'uli42-pr/fix_validatestring' into 3.6.x
Attributes GH PR #359: https://github.com/ArcticaProject/nx-libs/pull/359
Diffstat (limited to 'nx-X11/programs/Xserver/xkb')
-rw-r--r--nx-X11/programs/Xserver/xkb/ddxConfig.c2
-rw-r--r--nx-X11/programs/Xserver/xkb/ddxLoad.c4
-rw-r--r--nx-X11/programs/Xserver/xkb/maprules.c40
-rw-r--r--nx-X11/programs/Xserver/xkb/xkb.c8
-rw-r--r--nx-X11/programs/Xserver/xkb/xkbInit.c30
-rw-r--r--nx-X11/programs/Xserver/xkb/xkbconfig.c6
-rw-r--r--nx-X11/programs/Xserver/xkb/xkbfmisc.c23
-rw-r--r--nx-X11/programs/Xserver/xkb/xkbout.c2
-rw-r--r--nx-X11/programs/Xserver/xkb/xkbtext.c4
-rw-r--r--nx-X11/programs/Xserver/xkb/xkmread.c23
10 files changed, 65 insertions, 77 deletions
diff --git a/nx-X11/programs/Xserver/xkb/ddxConfig.c b/nx-X11/programs/Xserver/xkb/ddxConfig.c
index 2fd5e7610..0046b853e 100644
--- a/nx-X11/programs/Xserver/xkb/ddxConfig.c
+++ b/nx-X11/programs/Xserver/xkb/ddxConfig.c
@@ -187,7 +187,7 @@ XkbConfigRtrnPtr rtrn;
}
if (rtrn->symbols!=NULL) {
if (rtrn->phys_symbols==NULL)
- rtrn->phys_symbols= _XkbDupString(names->symbols);
+ rtrn->phys_symbols= Xstrdup(names->symbols);
if (names->symbols) _XkbFree(names->symbols);
names->symbols= rtrn->symbols;
rtrn->symbols= NULL;
diff --git a/nx-X11/programs/Xserver/xkb/ddxLoad.c b/nx-X11/programs/Xserver/xkb/ddxLoad.c
index 4934d266c..5f24e9ccc 100644
--- a/nx-X11/programs/Xserver/xkb/ddxLoad.c
+++ b/nx-X11/programs/Xserver/xkb/ddxLoad.c
@@ -542,8 +542,8 @@ char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
}
}
if ((outFile= strrchr(file,'/'))!=NULL)
- outFile= _XkbDupString(&outFile[1]);
- else outFile= _XkbDupString(file);
+ outFile= Xstrdup(&outFile[1]);
+ else outFile= Xstrdup(file);
XkbEnsureSafeMapName(outFile);
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
diff --git a/nx-X11/programs/Xserver/xkb/maprules.c b/nx-X11/programs/Xserver/xkb/maprules.c
index c89cc528a..337c8634b 100644
--- a/nx-X11/programs/Xserver/xkb/maprules.c
+++ b/nx-X11/programs/Xserver/xkb/maprules.c
@@ -426,8 +426,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';
@@ -478,17 +478,17 @@ 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->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->keymap= _XkbDupString(tmp.name[KEYMAP]);
+ 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= 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->keymap= Xstrdup(tmp.name[KEYMAP]);
rule->layout_num = rule->variant_num = 0;
for (i = 0; i < nread; i++) {
@@ -533,7 +533,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
bzero((char *)mdefs,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) {
@@ -542,7 +542,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]);
@@ -566,7 +566,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]);
@@ -602,7 +602,7 @@ Apply(char *src, char **dst)
*dst= _Concat(*dst, src);
} else {
if (*dst == NULL)
- *dst= _XkbDupString(src);
+ *dst= Xstrdup(src);
}
}
}
@@ -1045,8 +1045,8 @@ XkbRF_AddVarDescCopy(XkbRF_DescribeVarsPtr vars,XkbRF_VarDescPtr from)
XkbRF_VarDescPtr nd;
if ((nd=XkbRF_AddVarDesc(vars))!=NULL) {
- nd->name= _XkbDupString(from->name);
- nd->desc= _XkbDupString(from->desc);
+ nd->name= Xstrdup(from->name);
+ nd->desc= Xstrdup(from->desc);
}
return nd;
}
@@ -1074,7 +1074,7 @@ XkbRF_AddVarToDescribe(XkbRF_RulesPtr rules,char *name)
rules->extra= NULL;
return NULL;
}
- rules->extra_names[rules->num_extra]= _XkbDupString(name);
+ rules->extra_names[rules->num_extra]= Xstrdup(name);
bzero(&rules->extra[rules->num_extra],sizeof(XkbRF_DescribeVarsRec));
return &rules->extra[rules->num_extra++];
}
diff --git a/nx-X11/programs/Xserver/xkb/xkb.c b/nx-X11/programs/Xserver/xkb/xkb.c
index 069fd6a64..6798f2dda 100644
--- a/nx-X11/programs/Xserver/xkb/xkb.c
+++ b/nx-X11/programs/Xserver/xkb/xkb.c
@@ -5164,17 +5164,17 @@ ProcXkbGetKbdByName(ClientPtr client)
if (!names.keymap) {
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;
}
}
diff --git a/nx-X11/programs/Xserver/xkb/xkbInit.c b/nx-X11/programs/Xserver/xkb/xkbInit.c
index dc2cf0870..a93557a34 100644
--- a/nx-X11/programs/Xserver/xkb/xkbInit.c
+++ b/nx-X11/programs/Xserver/xkb/xkbInit.c
@@ -229,16 +229,16 @@ XkbSetRulesUsed(XkbRF_VarDefsPtr defs)
{
if (XkbModelUsed)
_XkbFree(XkbModelUsed);
- XkbModelUsed= (defs->model?_XkbDupString(defs->model):NULL);
+ XkbModelUsed= (defs->model?Xstrdup(defs->model):NULL);
if (XkbLayoutUsed)
_XkbFree(XkbLayoutUsed);
- XkbLayoutUsed= (defs->layout?_XkbDupString(defs->layout):NULL);
+ XkbLayoutUsed= (defs->layout?Xstrdup(defs->layout):NULL);
if (XkbVariantUsed)
_XkbFree(XkbVariantUsed);
- XkbVariantUsed= (defs->variant?_XkbDupString(defs->variant):NULL);
+ XkbVariantUsed= (defs->variant?Xstrdup(defs->variant):NULL);
if (XkbOptionsUsed)
_XkbFree(XkbOptionsUsed);
- XkbOptionsUsed= (defs->options?_XkbDupString(defs->options):NULL);
+ XkbOptionsUsed= (defs->options?Xstrdup(defs->options):NULL);
if (XkbWantRulesProp)
QueueWorkProc(XkbWriteRulesProp,NULL,NULL);
return;
@@ -250,27 +250,27 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout,
{
if (XkbRulesFile)
_XkbFree(XkbRulesFile);
- XkbRulesFile= _XkbDupString(rulesFile);
+ XkbRulesFile= Xstrdup(rulesFile);
rulesDefined= True;
if (model) {
if (XkbModelDflt)
_XkbFree(XkbModelDflt);
- XkbModelDflt= _XkbDupString(model);
+ XkbModelDflt= Xstrdup(model);
}
if (layout) {
if (XkbLayoutDflt)
_XkbFree(XkbLayoutDflt);
- XkbLayoutDflt= _XkbDupString(layout);
+ XkbLayoutDflt= Xstrdup(layout);
}
if (variant) {
if (XkbVariantDflt)
_XkbFree(XkbVariantDflt);
- XkbVariantDflt= _XkbDupString(variant);
+ XkbVariantDflt= Xstrdup(variant);
}
if (options) {
if (XkbOptionsDflt)
_XkbFree(XkbOptionsDflt);
- XkbOptionsDflt= _XkbDupString(options);
+ XkbOptionsDflt= Xstrdup(options);
}
return;
}
@@ -637,12 +637,12 @@ XkbRF_VarDefsRec defs;
* generation. Eventually they will be freed at the end of this
* function.
*/
- if (names->keymap) names->keymap = _XkbDupString(names->keymap);
- if (names->keycodes) names->keycodes = _XkbDupString(names->keycodes);
- if (names->types) names->types = _XkbDupString(names->types);
- if (names->compat) names->compat = _XkbDupString(names->compat);
- if (names->geometry) names->geometry = _XkbDupString(names->geometry);
- if (names->symbols) names->symbols = _XkbDupString(names->symbols);
+ if (names->keymap) names->keymap = Xstrdup(names->keymap);
+ if (names->keycodes) names->keycodes = Xstrdup(names->keycodes);
+ if (names->types) names->types = Xstrdup(names->types);
+ if (names->compat) names->compat = Xstrdup(names->compat);
+ if (names->geometry) names->geometry = Xstrdup(names->geometry);
+ if (names->symbols) names->symbols = Xstrdup(names->symbols);
if (defs.model && defs.layout && rules) {
XkbComponentNamesRec rNames;
diff --git a/nx-X11/programs/Xserver/xkb/xkbconfig.c b/nx-X11/programs/Xserver/xkb/xkbconfig.c
index de138ef45..5fcd594bc 100644
--- a/nx-X11/programs/Xserver/xkb/xkbconfig.c
+++ b/nx-X11/programs/Xserver/xkb/xkbconfig.c
@@ -363,7 +363,7 @@ XkbCFAddModByName( XkbConfigRtrnPtr rtrn,
last->merge= merge;
last->name= NULL;
}
- last->name= _XkbDupString(name);
+ last->name= Xstrdup(name);
}
return last;
}
@@ -487,7 +487,7 @@ unsigned what;
}
if (*str!=NULL)
_XkbFree(*str);
- *str= _XkbDupString(val.str);
+ *str= Xstrdup(val.str);
break;
case _XkbCF_InitialMods:
case _XkbCF_IgnoreLockMods:
@@ -1046,7 +1046,7 @@ DefaultFinish( XkbConfigFieldsPtr fields,
return DefaultCleanUp(rtrn);
if (what==XkbCF_Check) {
if ((rtrn->symbols==NULL)&&(rtrn->phys_symbols!=NULL))
- rtrn->symbols= _XkbDupString(rtrn->phys_symbols);
+ rtrn->symbols= Xstrdup(rtrn->phys_symbols);
}
if ((what==XkbCF_Apply)||(what==XkbCF_Check)) {
if (xkb && xkb->names && (rtrn->num_unbound_mods>0))
diff --git a/nx-X11/programs/Xserver/xkb/xkbfmisc.c b/nx-X11/programs/Xserver/xkb/xkbfmisc.c
index 43d55aa47..6545a2879 100644
--- a/nx-X11/programs/Xserver/xkb/xkbfmisc.c
+++ b/nx-X11/programs/Xserver/xkb/xkbfmisc.c
@@ -265,7 +265,8 @@ XkbWriteXKBKeymapForNames( FILE * file,
unsigned want,
unsigned need)
{
-char * name,*tmp;
+char * name;
+const char * tmp;
unsigned complete;
XkbNamesPtr old_names;
int multi_section;
@@ -333,8 +334,8 @@ XkbFileInfo finfo;
if ((xkb!=NULL) && (old_names!=NULL)) {
if (wantNames&XkmTypesMask) {
if (old_names->types!=None) {
- tmp= XkbAtomGetString(dpy,old_names->types);
- names->types= _XkbDupString(tmp);
+ tmp= NameForAtom(old_names->types);
+ names->types= Xstrdup(tmp);
}
else {
wantDflts|= XkmTypesMask;
@@ -343,8 +344,8 @@ XkbFileInfo finfo;
}
if (wantNames&XkmCompatMapMask) {
if (old_names->compat!=None) {
- tmp= XkbAtomGetString(dpy,old_names->compat);
- names->compat= _XkbDupString(tmp);
+ tmp= NameForAtom(old_names->compat);
+ names->compat= Xstrdup(tmp);
}
else wantDflts|= XkmCompatMapMask;
complete|= XkmCompatMapMask;
@@ -352,14 +353,14 @@ XkbFileInfo finfo;
if (wantNames&XkmSymbolsMask) {
if (old_names->symbols==None)
return False;
- tmp= XkbAtomGetString(dpy,old_names->symbols);
- names->symbols= _XkbDupString(tmp);
+ tmp= NameForAtom(old_names->symbols);
+ names->symbols= Xstrdup(tmp);
complete|= XkmSymbolsMask;
}
if (wantNames&XkmKeyNamesMask) {
if (old_names->keycodes!=None) {
- tmp= XkbAtomGetString(dpy,old_names->keycodes);
- names->keycodes= _XkbDupString(tmp);
+ tmp= NameForAtom(old_names->keycodes);
+ names->keycodes= Xstrdup(tmp);
}
else wantDflts|= XkmKeyNamesMask;
complete|= XkmKeyNamesMask;
@@ -367,8 +368,8 @@ XkbFileInfo finfo;
if (wantNames&XkmGeometryMask) {
if (old_names->geometry==None)
return False;
- tmp= XkbAtomGetString(dpy,old_names->geometry);
- names->geometry= _XkbDupString(tmp);
+ tmp= NameForAtom(old_names->geometry);
+ names->geometry= Xstrdup(tmp);
complete|= XkmGeometryMask;
wantNames&= ~XkmGeometryMask;
}
diff --git a/nx-X11/programs/Xserver/xkb/xkbout.c b/nx-X11/programs/Xserver/xkb/xkbout.c
index 1e546d1cb..b76617963 100644
--- a/nx-X11/programs/Xserver/xkb/xkbout.c
+++ b/nx-X11/programs/Xserver/xkb/xkbout.c
@@ -250,7 +250,7 @@ WriteXKBIndicatorMap( FILE * file,
XkbDescPtr xkb;
xkb= result->xkb;
- fprintf(file," indicator \"%s\" {\n",XkbAtomGetString(xkb->dpy,name));
+ fprintf(file," indicator \"%s\" {\n",NameForAtom(name));
if (led->flags&XkbIM_NoExplicit)
fprintf(file," !allowExplicit;\n");
if (led->flags&XkbIM_LEDDrivesKB)
diff --git a/nx-X11/programs/Xserver/xkb/xkbtext.c b/nx-X11/programs/Xserver/xkb/xkbtext.c
index 273ba5aae..7c22d25c8 100644
--- a/nx-X11/programs/Xserver/xkb/xkbtext.c
+++ b/nx-X11/programs/Xserver/xkb/xkbtext.c
@@ -75,7 +75,7 @@ XkbAtomText(Display *dpy,Atom atm,unsigned format)
{
char *rtrn,*tmp;
- tmp= (char *)XkbAtomGetString(dpy,atm);
+ tmp= (char *)NameForAtom(atm);
if (tmp!=NULL) {
int len;
len= strlen(tmp)+1;
@@ -118,7 +118,7 @@ char numBuf[20];
if (ndx>=XkbNumVirtualMods)
tmp= "illegal";
else if (vmodNames&&(vmodNames[ndx]!=None))
- tmp= (char *)XkbAtomGetString(dpy,vmodNames[ndx]);
+ tmp= (char *)NameForAtom(vmodNames[ndx]);
if (tmp==NULL)
sprintf(tmp=numBuf,"%d",ndx);
diff --git a/nx-X11/programs/Xserver/xkb/xkmread.c b/nx-X11/programs/Xserver/xkb/xkmread.c
index 1d8f6d772..71b65a4c0 100644
--- a/nx-X11/programs/Xserver/xkb/xkmread.c
+++ b/nx-X11/programs/Xserver/xkb/xkmread.c
@@ -58,19 +58,6 @@ XkbInternAtom(Display *dpy,char *str,Bool only_if_exists)
#define SEEK_SET 0
#endif
-char *
-_XkbDupString(char *str)
-{
-char *new;
-
- if (str==NULL)
- return NULL;
- new= (char *)_XkbCalloc(strlen(str)+1,sizeof(char));
- if (new)
- strcpy(new,str);
- return new;
-}
-
/***====================================================================***/
static XPointer
@@ -774,9 +761,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;
@@ -788,7 +775,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? */
@@ -952,7 +939,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++) {
@@ -1211,7 +1198,7 @@ char name[100];
return 0;
}
if (XkmGetCountedString(file,name,100)>0)
- return _XkbDupString(name);
+ return Xstrdup(name);
break;
default:
_XkbLibError(_XkbErrBadImplementation,