aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/xkb/xkbtext.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-25 08:32:21 +0100
committermarha <marha@users.sourceforge.net>2011-11-25 08:32:21 +0100
commit849d328b25c2f3c87d539e1fe7af38e7580a0409 (patch)
tree349c425a87ddb3aaa1d7832d5a8e68252fc73ddb /xorg-server/xkb/xkbtext.c
parenta8a12d4c8be177f63cae7dc96c2b52f09e228a76 (diff)
parenta0b4a1330be6a36ad095222d2ea83927cd33514d (diff)
downloadvcxsrv-849d328b25c2f3c87d539e1fe7af38e7580a0409.tar.gz
vcxsrv-849d328b25c2f3c87d539e1fe7af38e7580a0409.tar.bz2
vcxsrv-849d328b25c2f3c87d539e1fe7af38e7580a0409.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/glx/glxdriswrast.c xorg-server/glx/single2.c xorg-server/hw/xwin/winconfig.c xorg-server/os/osinit.c xorg-server/os/xdmcp.c xorg-server/xkb/xkbInit.c
Diffstat (limited to 'xorg-server/xkb/xkbtext.c')
-rw-r--r--xorg-server/xkb/xkbtext.c189
1 files changed, 93 insertions, 96 deletions
diff --git a/xorg-server/xkb/xkbtext.c b/xorg-server/xkb/xkbtext.c
index 9f49d59ff..8ef2b05b0 100644
--- a/xorg-server/xkb/xkbtext.c
+++ b/xorg-server/xkb/xkbtext.c
@@ -81,8 +81,7 @@ char *rtrn,*tmp;
if (len>BUFFER_SIZE)
len= BUFFER_SIZE-2;
rtrn= tbGetBuffer(len);
- strncpy(rtrn,atmstr,len);
- rtrn[len]= '\0';
+ strlcpy(rtrn,atmstr,len);
}
else {
rtrn= tbGetBuffer(1);
@@ -120,7 +119,7 @@ char numBuf[20];
else if (vmodNames&&(vmodNames[ndx]!=None))
tmp= NameForAtom(vmodNames[ndx]);
if (tmp==NULL) {
- sprintf(numBuf,"%d",ndx);
+ snprintf(numBuf,sizeof(numBuf),"%d",ndx);
tmp = numBuf;
}
@@ -216,7 +215,7 @@ char *str,buf[BUFFER_SIZE];
return rtrn;
}
-static char *modNames[XkbNumModifiers] = {
+static const char *modNames[XkbNumModifiers] = {
"Shift", "Lock", "Control", "Mod1", "Mod2", "Mod3", "Mod4", "Mod5"
};
@@ -228,17 +227,17 @@ char buf[100];
if (format==XkbCFile) {
if (ndx<XkbNumModifiers)
- sprintf(buf,"%sMapIndex",modNames[ndx]);
+ snprintf(buf,sizeof(buf),"%sMapIndex",modNames[ndx]);
else if (ndx==XkbNoModifier)
- sprintf(buf,"XkbNoModifier");
- else sprintf(buf,"0x%02x",ndx);
+ snprintf(buf,sizeof(buf),"XkbNoModifier");
+ else snprintf(buf,sizeof(buf),"0x%02x",ndx);
}
else {
if (ndx<XkbNumModifiers)
strcpy(buf,modNames[ndx]);
else if (ndx==XkbNoModifier)
strcpy(buf,"none");
- else sprintf(buf,"ILLEGAL_%02x",ndx);
+ else snprintf(buf,sizeof(buf),"ILLEGAL_%02x",ndx);
}
rtrn= tbGetBuffer(strlen(buf)+1);
strcpy(rtrn,buf);
@@ -335,12 +334,12 @@ static char *buf;
char *
XkbKeysymText(KeySym sym,unsigned format)
{
-static char buf[32],*rtrn;
+static char buf[32];
if (sym==NoSymbol)
- strcpy(rtrn=buf,"NoSymbol");
- else sprintf(rtrn=buf, "0x%lx", (long)sym);
- return rtrn;
+ strcpy(buf,"NoSymbol");
+ else snprintf(buf, sizeof(buf), "0x%lx", (long)sym);
+ return buf;
}
char *
@@ -368,15 +367,15 @@ char *buf;
/***====================================================================***/
-static char *siMatchText[5] = {
+static const char *siMatchText[5] = {
"NoneOf", "AnyOfOrNone", "AnyOf", "AllOf", "Exactly"
};
-char *
+const char *
XkbSIMatchText(unsigned type,unsigned format)
{
static char buf[40];
-char *rtrn;
+const char *rtrn;
switch (type&XkbSI_OpMask) {
case XkbSI_NoneOf: rtrn= siMatchText[0]; break;
@@ -384,13 +383,13 @@ char *rtrn;
case XkbSI_AnyOf: rtrn= siMatchText[2]; break;
case XkbSI_AllOf: rtrn= siMatchText[3]; break;
case XkbSI_Exactly: rtrn= siMatchText[4]; break;
- default: sprintf(buf,"0x%x",type&XkbSI_OpMask);
+ default: snprintf(buf,sizeof(buf),"0x%x",type&XkbSI_OpMask);
return buf;
}
if (format==XkbCFile) {
if (type&XkbSI_LevelOneOnly)
- sprintf(buf,"XkbSI_LevelOneOnly|XkbSI_%s",rtrn);
- else sprintf(buf,"XkbSI_%s",rtrn);
+ snprintf(buf,sizeof(buf),"XkbSI_LevelOneOnly|XkbSI_%s",rtrn);
+ else snprintf(buf,sizeof(buf),"XkbSI_%s",rtrn);
rtrn= buf;
}
return rtrn;
@@ -398,7 +397,7 @@ char *rtrn;
/***====================================================================***/
-static char *imWhichNames[]= {
+static const char *imWhichNames[]= {
"base",
"latched",
"locked",
@@ -449,7 +448,7 @@ char * buf;
return buf;
}
-static char *ctrlNames[] = {
+static const char *ctrlNames[] = {
"repeatKeys",
"slowKeys",
"bounceKeys",
@@ -617,7 +616,7 @@ char * buf;
return buf;
}
-static char *actionTypeNames[XkbSA_NumActions]= {
+static const char *actionTypeNames[XkbSA_NumActions]= {
"NoAction",
"SetMods", "LatchMods", "LockMods",
"SetGroup", "LatchGroup", "LockGroup",
@@ -632,28 +631,28 @@ static char *actionTypeNames[XkbSA_NumActions]= {
"DeviceBtn", "LockDeviceBtn"
};
-char *
+const char *
XkbActionTypeText(unsigned type,unsigned format)
{
static char buf[32];
-char *rtrn;
+const char *rtrn;
if (type<=XkbSA_LastAction) {
rtrn= actionTypeNames[type];
if (format==XkbCFile) {
- sprintf(buf,"XkbSA_%s",rtrn);
+ snprintf(buf,sizeof(buf),"XkbSA_%s",rtrn);
return buf;
}
return rtrn;
}
- sprintf(buf,"Private");
+ snprintf(buf,sizeof(buf),"Private");
return buf;
}
/***====================================================================***/
static int
-TryCopyStr(char *to,char *from,int *pLeft)
+TryCopyStr(char *to,const char *from,int *pLeft)
{
register int len;
if (*pLeft>0) {
@@ -713,10 +712,10 @@ char tbuf[32];
act= &action->group;
TryCopyStr(buf,"group=",sz);
if (act->flags&XkbSA_GroupAbsolute)
- sprintf(tbuf,"%d",XkbSAGroup(act)+1);
+ snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act)+1);
else if (XkbSAGroup(act)<0)
- sprintf(tbuf,"%d",XkbSAGroup(act));
- else sprintf(tbuf,"+%d",XkbSAGroup(act));
+ snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act));
+ else snprintf(tbuf,sizeof(tbuf),"+%d",XkbSAGroup(act));
TryCopyStr(buf,tbuf,sz);
if (act->type==XkbSA_LockGroup)
return TRUE;
@@ -739,13 +738,13 @@ char tbuf[32];
x= XkbPtrActionX(act);
y= XkbPtrActionY(act);
if ((act->flags&XkbSA_MoveAbsoluteX)||(x<0))
- sprintf(tbuf,"x=%d",x);
- else sprintf(tbuf,"x=+%d",x);
+ snprintf(tbuf,sizeof(tbuf),"x=%d",x);
+ else snprintf(tbuf,sizeof(tbuf),"x=+%d",x);
TryCopyStr(buf,tbuf,sz);
if ((act->flags&XkbSA_MoveAbsoluteY)||(y<0))
- sprintf(tbuf,",y=%d",y);
- else sprintf(tbuf,",y=+%d",y);
+ snprintf(tbuf,sizeof(tbuf),",y=%d",y);
+ else snprintf(tbuf,sizeof(tbuf),",y=+%d",y);
TryCopyStr(buf,tbuf,sz);
if (act->flags&XkbSA_NoAcceleration)
TryCopyStr(buf,",!accel",sz);
@@ -762,26 +761,25 @@ char tbuf[32];
act= &action->btn;
TryCopyStr(buf,"button=",sz);
if ((act->button>0)&&(act->button<6)) {
- sprintf(tbuf,"%d",act->button);
+ snprintf(tbuf,sizeof(tbuf),"%d",act->button);
TryCopyStr(buf,tbuf,sz);
}
else TryCopyStr(buf,"default",sz);
if (act->count>0) {
- sprintf(tbuf,",count=%d",act->count);
+ snprintf(tbuf,sizeof(tbuf),",count=%d",act->count);
TryCopyStr(buf,tbuf,sz);
}
if (action->type==XkbSA_LockPtrBtn) {
switch (act->flags&(XkbSA_LockNoUnlock|XkbSA_LockNoLock)) {
case XkbSA_LockNoLock:
- sprintf(tbuf,",affect=unlock"); break;
+ TryCopyStr(buf,",affect=unlock",sz); break;
case XkbSA_LockNoUnlock:
- sprintf(tbuf,",affect=lock"); break;
+ TryCopyStr(buf,",affect=lock",sz); break;
case XkbSA_LockNoUnlock|XkbSA_LockNoLock:
- sprintf(tbuf,",affect=neither"); break;
+ TryCopyStr(buf,",affect=neither",sz); break;
default:
- sprintf(tbuf,",affect=both"); break;
+ TryCopyStr(buf,",affect=both",sz); break;
}
- TryCopyStr(buf,tbuf,sz);
}
return TRUE;
}
@@ -798,8 +796,8 @@ char tbuf[32];
if (act->affect==XkbSA_AffectDfltBtn) {
TryCopyStr(buf,"affect=button,button=",sz);
if ((act->flags&XkbSA_DfltBtnAbsolute)||(XkbSAPtrDfltValue(act)<0))
- sprintf(tbuf,"%d",XkbSAPtrDfltValue(act));
- else sprintf(tbuf,"+%d",XkbSAPtrDfltValue(act));
+ snprintf(tbuf,sizeof(tbuf),"%d",XkbSAPtrDfltValue(act));
+ else snprintf(tbuf,sizeof(tbuf),"+%d",XkbSAPtrDfltValue(act));
TryCopyStr(buf,tbuf,sz);
}
return TRUE;
@@ -815,10 +813,10 @@ char tbuf[64];
if (act->flags&XkbSA_ISODfltIsGroup) {
TryCopyStr(tbuf,"group=",sz);
if (act->flags&XkbSA_GroupAbsolute)
- sprintf(tbuf,"%d",XkbSAGroup(act)+1);
+ snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act)+1);
else if (XkbSAGroup(act)<0)
- sprintf(tbuf,"%d",XkbSAGroup(act));
- else sprintf(tbuf,"+%d",XkbSAGroup(act));
+ snprintf(tbuf,sizeof(tbuf),"%d",XkbSAGroup(act));
+ else snprintf(tbuf,sizeof(tbuf),"+%d",XkbSAGroup(act));
TryCopyStr(buf,tbuf,sz);
}
else {
@@ -848,17 +846,17 @@ char tbuf[64];
nOut++;
}
if ((act->affect&XkbSA_ISONoAffectGroup)==0) {
- sprintf(tbuf,"%sgroups",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sgroups",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if ((act->affect&XkbSA_ISONoAffectPtr)==0) {
- sprintf(tbuf,"%spointer",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%spointer",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if ((act->affect&XkbSA_ISONoAffectCtrls)==0) {
- sprintf(tbuf,"%scontrols",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%scontrols",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
@@ -876,8 +874,8 @@ char tbuf[32];
act= &action->screen;
if ((act->flags&XkbSA_SwitchAbsolute)||(XkbSAScreen(act)<0))
- sprintf(tbuf,"screen=%d",XkbSAScreen(act));
- else sprintf(tbuf,"screen=+%d",XkbSAScreen(act));
+ snprintf(tbuf,sizeof(tbuf),"screen=%d",XkbSAScreen(act));
+ else snprintf(tbuf,sizeof(tbuf),"screen=+%d",XkbSAScreen(act));
TryCopyStr(buf,tbuf,sz);
if (act->flags&XkbSA_SwitchApplication)
TryCopyStr(buf,",!same",sz);
@@ -904,67 +902,67 @@ char tbuf[32];
else {
int nOut= 0;
if (tmp&XkbRepeatKeysMask) {
- sprintf(tbuf,"%sRepeatKeys",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sRepeatKeys",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbSlowKeysMask) {
- sprintf(tbuf,"%sSlowKeys",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sSlowKeys",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbBounceKeysMask) {
- sprintf(tbuf,"%sBounceKeys",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sBounceKeys",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbStickyKeysMask) {
- sprintf(tbuf,"%sStickyKeys",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sStickyKeys",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbMouseKeysMask) {
- sprintf(tbuf,"%sMouseKeys",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sMouseKeys",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbMouseKeysAccelMask) {
- sprintf(tbuf,"%sMouseKeysAccel",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sMouseKeysAccel",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbAccessXKeysMask) {
- sprintf(tbuf,"%sAccessXKeys",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sAccessXKeys",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbAccessXTimeoutMask) {
- sprintf(tbuf,"%sAccessXTimeout",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sAccessXTimeout",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbAccessXFeedbackMask) {
- sprintf(tbuf,"%sAccessXFeedback",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sAccessXFeedback",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbAudibleBellMask) {
- sprintf(tbuf,"%sAudibleBell",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sAudibleBell",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbOverlay1Mask) {
- sprintf(tbuf,"%sOverlay1",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sOverlay1",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbOverlay2Mask) {
- sprintf(tbuf,"%sOverlay2",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sOverlay2",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
if (tmp&XkbIgnoreGroupLockMask) {
- sprintf(tbuf,"%sIgnoreGroupLock",(nOut>0?"+":""));
+ snprintf(tbuf,sizeof(tbuf),"%sIgnoreGroupLock",(nOut>0?"+":""));
TryCopyStr(buf,tbuf,sz);
nOut++;
}
@@ -991,12 +989,12 @@ char tbuf[32];
else if (act->flags&XkbSA_MessageOnPress)
TryCopyStr(buf,"KeyPress",sz);
else TryCopyStr(buf,"KeyRelease",sz);
- sprintf(tbuf,",data[0]=0x%02x",act->message[0]); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[1]=0x%02x",act->message[1]); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[2]=0x%02x",act->message[2]); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[3]=0x%02x",act->message[3]); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[4]=0x%02x",act->message[4]); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[5]=0x%02x",act->message[5]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[0]=0x%02x",act->message[0]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[1]=0x%02x",act->message[1]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[2]=0x%02x",act->message[2]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[3]=0x%02x",act->message[3]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[4]=0x%02x",act->message[4]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[5]=0x%02x",act->message[5]); TryCopyStr(buf,tbuf,sz);
return TRUE;
}
@@ -1017,9 +1015,9 @@ unsigned vmods,vmods_mask;
(xkb->names->keys[kc].name[0]!='\0')) {
char *kn;
kn= XkbKeyNameText(xkb->names->keys[kc].name,XkbXKBFile);
- sprintf(tbuf,"key=%s",kn);
+ snprintf(tbuf,sizeof(tbuf),"key=%s",kn);
}
- else sprintf(tbuf,"key=%d",kc);
+ else snprintf(tbuf,sizeof(tbuf),"key=%d",kc);
TryCopyStr(buf,tbuf,sz);
if ((act->mods_mask==0)&&(vmods_mask==0))
return TRUE;
@@ -1055,26 +1053,25 @@ XkbDeviceBtnAction * act;
char tbuf[32];
act= &action->devbtn;
- sprintf(tbuf,"device= %d",act->device); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),"device= %d",act->device); TryCopyStr(buf,tbuf,sz);
TryCopyStr(buf,",button=",sz);
- sprintf(tbuf,"%d",act->button);
+ snprintf(tbuf,sizeof(tbuf),"%d",act->button);
TryCopyStr(buf,tbuf,sz);
if (act->count>0) {
- sprintf(tbuf,",count=%d",act->count);
+ snprintf(tbuf,sizeof(tbuf),",count=%d",act->count);
TryCopyStr(buf,tbuf,sz);
}
if (action->type==XkbSA_LockDeviceBtn) {
switch (act->flags&(XkbSA_LockNoUnlock|XkbSA_LockNoLock)) {
case XkbSA_LockNoLock:
- sprintf(tbuf,",affect=unlock"); break;
+ TryCopyStr(buf,",affect=unlock",sz); break;
case XkbSA_LockNoUnlock:
- sprintf(tbuf,",affect=lock"); break;
+ TryCopyStr(buf,",affect=lock",sz); break;
case XkbSA_LockNoUnlock|XkbSA_LockNoLock:
- sprintf(tbuf,",affect=neither"); break;
+ TryCopyStr(buf,",affect=neither",sz); break;
default:
- sprintf(tbuf,",affect=both"); break;
+ TryCopyStr(buf,",affect=both",sz); break;
}
- TryCopyStr(buf,tbuf,sz);
}
return TRUE;
}
@@ -1087,14 +1084,14 @@ XkbAnyAction * act;
char tbuf[32];
act= &action->any;
- sprintf(tbuf,"type=0x%02x",act->type); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[0]=0x%02x",act->data[0]); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[1]=0x%02x",act->data[1]); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[2]=0x%02x",act->data[2]); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[3]=0x%02x",act->data[3]); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[4]=0x%02x",act->data[4]); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[5]=0x%02x",act->data[5]); TryCopyStr(buf,tbuf,sz);
- sprintf(tbuf,",data[6]=0x%02x",act->data[6]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),"type=0x%02x",act->type); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[0]=0x%02x",act->data[0]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[1]=0x%02x",act->data[1]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[2]=0x%02x",act->data[2]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[3]=0x%02x",act->data[3]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[4]=0x%02x",act->data[4]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[5]=0x%02x",act->data[5]); TryCopyStr(buf,tbuf,sz);
+ snprintf(tbuf,sizeof(tbuf),",data[6]=0x%02x",act->data[6]); TryCopyStr(buf,tbuf,sz);
return TRUE;
}
@@ -1136,7 +1133,7 @@ char buf[ACTION_SZ],*tmp;
int sz;
if (format==XkbCFile) {
- sprintf(buf,
+ snprintf(buf,sizeof(buf),
"{ %20s, { 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x } }",
XkbActionTypeText(action->type,XkbCFile),
action->any.data[0],action->any.data[1],action->any.data[2],
@@ -1144,7 +1141,7 @@ int sz;
action->any.data[6]);
}
else {
- sprintf(buf,"%s(",XkbActionTypeText(action->type,XkbXKBFile));
+ snprintf(buf,sizeof(buf),"%s(",XkbActionTypeText(action->type,XkbXKBFile));
sz= ACTION_SZ-strlen(buf)+2; /* room for close paren and NULL */
if (action->type<(unsigned)XkbSA_NumActions)
(*copyActionArgs[action->type])(xkb,action,buf,&sz);
@@ -1164,8 +1161,8 @@ char buf[256],*tmp;
if (format==XkbCFile) {
if (behavior->type==XkbKB_Default)
- sprintf(buf,"{ 0, 0 }");
- else sprintf(buf,"{ %3d, 0x%02x }",behavior->type,behavior->data);
+ snprintf(buf,sizeof(buf),"{ 0, 0 }");
+ else snprintf(buf,sizeof(buf),"{ %3d, 0x%02x }",behavior->type,behavior->data);
}
else {
unsigned type,permanent;
@@ -1173,14 +1170,14 @@ char buf[256],*tmp;
permanent=((behavior->type&XkbKB_Permanent)!=0);
if (type==XkbKB_Lock) {
- sprintf(buf,"lock= %s",(permanent?"Permanent":"TRUE"));
+ snprintf(buf,sizeof(buf),"lock= %s",(permanent?"Permanent":"TRUE"));
}
else if (type==XkbKB_RadioGroup) {
int g;
char *tmp;
g= ((behavior->data)&(~XkbKB_RGAllowNone))+1;
if (XkbKB_RGAllowNone&behavior->data) {
- sprintf(buf,"allowNone,");
+ snprintf(buf,sizeof(buf),"allowNone,");
tmp= &buf[strlen(buf)];
}
else tmp= buf;
@@ -1198,12 +1195,12 @@ char buf[256],*tmp;
kn= XkbKeyNameText(xkb->names->keys[kc].name,XkbXKBFile);
else {
static char tbuf[8];
- sprintf(tbuf,"%d",kc);
+ snprintf(tbuf,sizeof(tbuf),"%d",kc);
kn= tbuf;
}
if (permanent)
- sprintf(buf,"permanentOverlay%d= %s",ndx,kn);
- else sprintf(buf,"overlay%d= %s",ndx,kn);
+ snprintf(buf,sizeof(buf),"permanentOverlay%d= %s",ndx,kn);
+ else snprintf(buf,sizeof(buf),"overlay%d= %s",ndx,kn);
}
}
tmp= tbGetBuffer(strlen(buf)+1);