mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-26 21:12:25 +00:00
Constify atom name strings
Changes MakeAtom to take a const char * and NameForAtom to return them, since many callers pass pointers to constant strings stored in read-only ELF sections. Updates in-tree callers as necessary to clear const mismatch warnings introduced by this change. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
6869efae74
commit
5623c27700
12 changed files with 33 additions and 28 deletions
|
|
@ -70,16 +70,17 @@ char *rtrn;
|
|||
char *
|
||||
XkbAtomText(Atom atm,unsigned format)
|
||||
{
|
||||
const char *atmstr;
|
||||
char *rtrn,*tmp;
|
||||
|
||||
tmp= XkbAtomGetString(atm);
|
||||
if (tmp!=NULL) {
|
||||
atmstr = XkbAtomGetString(atm);
|
||||
if (atmstr != NULL) {
|
||||
int len;
|
||||
len= strlen(tmp)+1;
|
||||
len= strlen(atmstr)+1;
|
||||
if (len>BUFFER_SIZE)
|
||||
len= BUFFER_SIZE-2;
|
||||
rtrn= tbGetBuffer(len);
|
||||
strncpy(rtrn,tmp,len);
|
||||
strncpy(rtrn,atmstr,len);
|
||||
rtrn[len]= '\0';
|
||||
}
|
||||
else {
|
||||
|
|
@ -104,7 +105,8 @@ XkbVModIndexText(XkbDescPtr xkb,unsigned ndx,unsigned format)
|
|||
{
|
||||
register int len;
|
||||
register Atom *vmodNames;
|
||||
char *rtrn,*tmp;
|
||||
char *rtrn;
|
||||
const char *tmp;
|
||||
char numBuf[20];
|
||||
|
||||
if (xkb && xkb->names)
|
||||
|
|
@ -116,8 +118,10 @@ char numBuf[20];
|
|||
tmp= "illegal";
|
||||
else if (vmodNames&&(vmodNames[ndx]!=None))
|
||||
tmp= XkbAtomGetString(vmodNames[ndx]);
|
||||
if (tmp==NULL)
|
||||
sprintf(tmp=numBuf,"%d",ndx);
|
||||
if (tmp==NULL) {
|
||||
sprintf(numBuf,"%d",ndx);
|
||||
tmp = numBuf;
|
||||
}
|
||||
|
||||
len= strlen(tmp)+1;
|
||||
if (format==XkbCFile)
|
||||
|
|
|
|||
Loading…
Reference in a new issue