From 9c3669c6b7ff19013b3684bb74d98ec3d121e329 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 27 Feb 2017 13:52:29 +0000 Subject: Xserver/dix/atom.c (et al.): Constify atom name strings. Inspired by X.org commits: commit 08093c25a91c07ab8af7cece9bba738b827cfd1b Author: Alan Coopersmith Date: Mon Oct 24 23:16:30 2011 -0700 Convert some malloc + strncpy pairs into strndup calls Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston commit 816b79dd061e9839cec94a4986a7820b70ca8a7f Author: Mikhail Gusarov Date: Thu May 13 03:45:21 2010 +0700 Remove useless casts Signed-off-by: Mikhail Gusarov Reviewed-by: Keith Packard This PR ships a tiny change in MakeAtom, that we adopted. We did not adopt the full commit. commit 5623c27700b7b23a8dbbd8c8f45e5d4fa0c667e3 Author: Alan Coopersmith Date: Mon Feb 2 19:25:14 2009 -0800 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 Acked-by: Peter Hutterer Backported-to-NX-by: Mike Gabriel --- nx-X11/programs/Xserver/xkb/xkb.c | 2 +- nx-X11/programs/Xserver/xkb/xkbtext.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'nx-X11/programs/Xserver/xkb') diff --git a/nx-X11/programs/Xserver/xkb/xkb.c b/nx-X11/programs/Xserver/xkb/xkb.c index a78541e75..47f4a2f96 100644 --- a/nx-X11/programs/Xserver/xkb/xkb.c +++ b/nx-X11/programs/Xserver/xkb/xkb.c @@ -3529,7 +3529,7 @@ register int i,bit; static Bool _XkbCheckTypeName(Atom name,int typeNdx) { -char * str; +const char * str; str= NameForAtom(name); if ((strcmp(str,"ONE_LEVEL")==0)||(strcmp(str,"TWO_LEVEL")==0)|| diff --git a/nx-X11/programs/Xserver/xkb/xkbtext.c b/nx-X11/programs/Xserver/xkb/xkbtext.c index d9888342e..273ba5aae 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= XkbAtomGetString(dpy,atm); + tmp= (char *)XkbAtomGetString(dpy,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= XkbAtomGetString(dpy,vmodNames[ndx]); + tmp= (char *)XkbAtomGetString(dpy,vmodNames[ndx]); if (tmp==NULL) sprintf(tmp=numBuf,"%d",ndx); -- cgit v1.2.3