summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-09-28 18:17:15 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-16 23:01:35 -0800
commit7b6123644fe23c2eb9816cf00729253b2dd53b23 (patch)
tree15086491143cafd7973ecebc0773d75413bdc06f /src
parent0c2c504819b8788075115f848343bd45a3bb6605 (diff)
Add const attributes to fix gcc -Wwrite-strings warnings
Does not fix all of them, as some affect the API and thus need more analysis. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'src')
-rw-r--r--src/maprules.c2
-rw-r--r--src/xkbbells.c2
-rw-r--r--src/xkbconfig.c2
-rw-r--r--src/xkberrs.c4
-rw-r--r--src/xkbmisc.c2
-rw-r--r--src/xkbout.c6
-rw-r--r--src/xkbtext.c20
7 files changed, 20 insertions, 18 deletions
diff --git a/src/maprules.c b/src/maprules.c
index 3507852..81102a3 100644
--- a/src/maprules.c
+++ b/src/maprules.c
@@ -238,7 +238,7 @@ Bool endOfFile,spacePending,slashPending,inComment;
#define PART_MASK 0x000F
#define COMPONENT_MASK 0x03F0
-static char * cname[MAX_WORDS] = {
+static const char * cname[MAX_WORDS] = {
"model", "layout", "variant", "option",
"keycodes", "symbols", "types", "compat", "geometry", "keymap"
};
diff --git a/src/xkbbells.c b/src/xkbbells.c
index 1571d1e..10b2725 100644
--- a/src/xkbbells.c
+++ b/src/xkbbells.c
@@ -31,7 +31,7 @@
#include <X11/XKBlib.h>
#include "XKBbells.h"
-static char *_xkbStdBellNames[XkbBI_NumBells] = {
+static const char *_xkbStdBellNames[XkbBI_NumBells] = {
"Info",
"Warning",
"MinorError",
diff --git a/src/xkbconfig.c b/src/xkbconfig.c
index 1934983..b60017f 100644
--- a/src/xkbconfig.c
+++ b/src/xkbconfig.c
@@ -1307,7 +1307,7 @@ BAILOUT:
void
XkbCFReportError(FILE *file,char *name,int error,int line)
{
-char * msg;
+const char *msg;
switch(error) {
case XkbCF_BadAlloc:
diff --git a/src/xkberrs.c b/src/xkberrs.c
index a34417a..f28f02b 100644
--- a/src/xkberrs.c
+++ b/src/xkberrs.c
@@ -41,7 +41,7 @@
#include <X11/XKBlib.h>
#include <X11/extensions/XKBfile.h>
-char * _XkbErrMessages[] = {
+const char * _XkbErrMessages[] = {
"success", /* _XkbSuccess */
"key names not defined", /* _XkbErrMissingNames */
"key types not defined", /* _XkbErrMissingTypes */
@@ -72,6 +72,6 @@ char * _XkbErrMessages[] = {
};
unsigned _XkbErrCode;
-char * _XkbErrLocation= NULL;
+const char * _XkbErrLocation= NULL;
unsigned _XkbErrData;
diff --git a/src/xkbmisc.c b/src/xkbmisc.c
index 314580e..e0b9bd6 100644
--- a/src/xkbmisc.c
+++ b/src/xkbmisc.c
@@ -218,7 +218,7 @@ int nG,eG;
/***===================================================================***/
static Bool
-XkbWriteSectionFromName(FILE *file,char *sectionName,char *name)
+XkbWriteSectionFromName(FILE *file, const char *sectionName, const char *name)
{
fprintf(file," xkb_%-20s { include \"%s\" };\n",sectionName,name);
return True;
diff --git a/src/xkbout.c b/src/xkbout.c
index ad1fd03..91cd1ba 100644
--- a/src/xkbout.c
+++ b/src/xkbout.c
@@ -129,7 +129,7 @@ Atom kcName;
register unsigned i;
XkbDescPtr xkb;
Display * dpy;
-char * alternate;
+const char * alternate;
xkb= result->xkb;
if ((!xkb)||(!xkb->names)||(!xkb->names->keys)) {
@@ -156,7 +156,7 @@ char * alternate;
}
if (xkb->indicators!=NULL) {
for (i=0;i<XkbNumIndicators;i++) {
- char *type;
+ const char *type;
if (xkb->indicators->phys_indicators&(1<<i))
type= " ";
else type= " virtual ";
@@ -433,7 +433,7 @@ Bool showActions;
(showImplicit)) {
int typeNdx,g;
Bool multi;
- char * comment=" ";
+ const char * comment=" ";
if ((srv->explicit[i]&XkbExplicitKeyTypesMask)==0)
comment= "//";
diff --git a/src/xkbtext.c b/src/xkbtext.c
index 3eabb5d..3a82b17 100644
--- a/src/xkbtext.c
+++ b/src/xkbtext.c
@@ -229,7 +229,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"
};
@@ -423,7 +423,7 @@ char *rtrn;
/***====================================================================***/
-static char *imWhichNames[]= {
+static const char *imWhichNames[]= {
"base",
"latched",
"locked",
@@ -477,7 +477,8 @@ char * buf;
char *
XkbAccessXDetailText(unsigned state,unsigned format)
{
-char *buf,*prefix;
+char *buf;
+const char *prefix;
buf= tbGetBuffer(32);
if (format==XkbMessage) prefix= "";
@@ -495,7 +496,7 @@ char *buf,*prefix;
return buf;
}
-static char *nknNames[] = {
+static const char *nknNames[] = {
"keycodes", "geometry", "deviceID"
};
#define NUM_NKN (sizeof(nknNames)/sizeof(char *))
@@ -503,14 +504,15 @@ static char *nknNames[] = {
char *
XkbNKNDetailMaskText(unsigned detail,unsigned format)
{
-char *buf,*prefix,*suffix;
+char *buf;
+const char *prefix,*suffix;
register int i;
register unsigned bit;
int len,plen,slen;
if ((detail&XkbAllNewKeyboardEventsMask)==0) {
- char *tmp = "";
+ const char *tmp = "";
if (format==XkbCFile) tmp= "0";
else if (format==XkbMessage) tmp= "none";
buf= tbGetBuffer(strlen(tmp)+1);
@@ -518,7 +520,7 @@ int len,plen,slen;
return buf;
}
else if ((detail&XkbAllNewKeyboardEventsMask)==XkbAllNewKeyboardEventsMask){
- char * tmp;
+ const char * tmp;
if (format==XkbCFile) tmp= "XkbAllNewKeyboardEventsMask";
else tmp= "all";
buf= tbGetBuffer(strlen(tmp)+1);
@@ -568,7 +570,7 @@ int len,plen,slen;
return buf;
}
-static char *ctrlNames[] = {
+static const char *ctrlNames[] = {
"repeatKeys",
"slowKeys",
"bounceKeys",
@@ -772,7 +774,7 @@ char *rtrn;
/***====================================================================***/
static int
-TryCopyStr(char *to,char *from,int *pLeft)
+TryCopyStr(char *to,const char *from,int *pLeft)
{
register int len;
if (*pLeft>0) {