summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilman Sauerbeck <tilman@code-monkey.de>2007-09-23 20:15:13 +0200
committerTilman Sauerbeck <tilman@code-monkey.de>2007-09-23 20:15:13 +0200
commit829cb75130d1edd88fa1d33e277f49167daedacf (patch)
tree1eac332bfee7048c57a0b15349dc70a6b821a2c1
parente8ffa513a109209849b11a3c608356cc28314a8e (diff)
downloadxorg-app-xkbcomp-829cb75130d1edd88fa1d33e277f49167daedacf.tar.gz
Fixed a bunch of const correctness bugs.
-rw-r--r--action.c4
-rw-r--r--expr.h2
-rw-r--r--geometry.c6
-rw-r--r--keycodes.c4
-rw-r--r--keytypes.c2
-rw-r--r--misc.c9
-rw-r--r--misc.h24
-rw-r--r--parseutils.h2
-rw-r--r--symbols.c2
-rw-r--r--utils.c18
-rw-r--r--utils.h20
-rw-r--r--vmod.c3
-rw-r--r--xkbcomp.c5
-rw-r--r--xkbparse.y2
-rw-r--r--xkbpath.c2
-rw-r--r--xkbpath.h2
-rw-r--r--xkbscan.c2
17 files changed, 55 insertions, 54 deletions
diff --git a/action.c b/action.c
index 023d1eb..8b0ba65 100644
--- a/action.c
+++ b/action.c
@@ -185,7 +185,7 @@ static char buf[32];
/***====================================================================***/
static Bool
-ReportMismatch(unsigned action,unsigned field,char *type)
+ReportMismatch(unsigned action, unsigned field, const char *type)
{
ERROR2("Value of %s field must be of type %s\n",fieldText(field),type);
ACTION1("Action %s definition ignored\n",
@@ -214,7 +214,7 @@ ReportActionNotArray(unsigned action,unsigned field)
}
static Bool
-ReportNotFound(unsigned action,unsigned field,char *what,char *bad)
+ReportNotFound(unsigned action, unsigned field, const char *what, char *bad)
{
ERROR2("%s named %s not found\n",what,bad);
ACTION2("Ignoring the %s field of an %s action\n",fieldText(field),
diff --git a/expr.h b/expr.h
index 3946cf0..065716d 100644
--- a/expr.h
+++ b/expr.h
@@ -62,7 +62,7 @@ typedef struct _LookupPriv {
} LookupPriv;
typedef struct _LookupEntry {
- char * name;
+ const char *name;
unsigned result;
} LookupEntry;
diff --git a/geometry.c b/geometry.c
index b6463cc..8e47d7e 100644
--- a/geometry.c
+++ b/geometry.c
@@ -740,7 +740,7 @@ ShapeInfo * si;
}
static ShapeInfo *
-FindShape(GeometryInfo *info,Atom name,char *type,char *which)
+FindShape(GeometryInfo *info, Atom name, const char *type, const char *which)
{
ShapeInfo * old;
@@ -1310,7 +1310,7 @@ SetShapeDoodadField( DoodadInfo * di,
GeometryInfo * info)
{
ExprResult tmp;
-char * typeName;
+const char *typeName;
typeName= (di->type==XkbSolidDoodad?"solid doodad":"outline doodad");
if ((!uStrCaseCmp(field,"corner"))||(!uStrCaseCmp(field,"cornerradius"))) {
@@ -1804,7 +1804,7 @@ ExprResult tmp;
static int
SetKeyField( KeyInfo *key,
- char *field,
+ const char *field,
ExprDef *arrayNdx,
ExprDef *value,
GeometryInfo *info)
diff --git a/keycodes.c b/keycodes.c
index 6b2fdd8..a86592e 100644
--- a/keycodes.c
+++ b/keycodes.c
@@ -147,7 +147,7 @@ AddIndicatorName(KeyNamesInfo *info,IndicatorNameInfo *new)
{
IndicatorNameInfo *old;
Bool replace;
-char * action;
+const char *action;
replace= (new->defs.merge==MergeReplace)||
(new->defs.merge==MergeOverride);
@@ -200,7 +200,7 @@ char * action;
if ((old->name==new->name)&&(old->virtual==new->virtual))
action= "Identical definitions ignored\n";
else {
- char *oldType,*newType;
+ const char *oldType,*newType;
Atom using,ignoring;
if (old->virtual) oldType= "virtual indicator";
else oldType= "real indicator";
diff --git a/keytypes.c b/keytypes.c
index e436136..b09345b 100644
--- a/keytypes.c
+++ b/keytypes.c
@@ -258,7 +258,7 @@ KeyTypeInfo *old;
}
static Bool
-ReportTypeBadWidth(char *type,int has,int needs)
+ReportTypeBadWidth(const char *type, int has, int needs)
{
ERROR3("Key type \"%s\" has %d levels, must have %d\n",type,has,needs);
ACTION("Illegal type definition ignored\n");
diff --git a/misc.c b/misc.c
index 1d6f7b4..91688f7 100644
--- a/misc.c
+++ b/misc.c
@@ -111,7 +111,7 @@ int oldLine = lineNum;
/***====================================================================***/
int
-ReportNotArray(char *type,char *field,char *name)
+ReportNotArray(const char *type, const char *field, const char *name)
{
ERROR2("The %s %s field is not an array\n",type,field);
ACTION1("Ignoring illegal assignment in %s\n",name);
@@ -119,7 +119,7 @@ ReportNotArray(char *type,char *field,char *name)
}
int
-ReportShouldBeArray(char *type,char *field,char *name)
+ReportShouldBeArray(const char *type, const char *field, char *name)
{
ERROR2("Missing subscript for %s %s\n",type,field);
ACTION1("Ignoring illegal assignment in %s\n",name);
@@ -127,7 +127,8 @@ ReportShouldBeArray(char *type,char *field,char *name)
}
int
-ReportBadType(char *type,char *field,char *name,char *wanted)
+ReportBadType(const char *type, const char *field,
+ const char *name, const char *wanted)
{
ERROR3("The %s %s field must be a %s\n",type,field,wanted);
ACTION1("Ignoring illegal assignment in %s\n",name);
@@ -143,7 +144,7 @@ ReportBadIndexType(char *type,char *field,char *name,char *wanted)
}
int
-ReportBadField(char *type,char *field,char *name)
+ReportBadField(const char *type, const char *field, const char *name)
{
ERROR3("Unknown %s field %s in %s\n",type,field,name);
ACTION1("Ignoring assignment to unknown field in %s\n",name);
diff --git a/misc.h b/misc.h
index 5546169..fd16db4 100644
--- a/misc.h
+++ b/misc.h
@@ -60,22 +60,22 @@ extern XPointer AddCommonInfo(
);
extern int ReportNotArray(
- char * /* type */,
- char * /* field */,
- char * /* name */
+ const char * /* type */,
+ const char * /* field */,
+ const char * /* name */
);
extern int ReportShouldBeArray(
- char * /* type */,
- char * /* field */,
+ const char * /* type */,
+ const char * /* field */,
char * /* name */
);
extern int ReportBadType(
- char * /* type */,
- char * /* field */,
- char * /* name */,
- char * /* wanted */
+ const char * /* type */,
+ const char * /* field */,
+ const char * /* name */,
+ const char * /* wanted */
);
extern int ReportBadIndexType(
@@ -86,9 +86,9 @@ extern int ReportBadIndexType(
);
extern int ReportBadField(
- char * /* type */,
- char * /* field */,
- char * /* name */
+ const char * /* type */,
+ const char * /* field */,
+ const char * /* name */
);
extern int ReportMultipleDefs(
diff --git a/parseutils.h b/parseutils.h
index 2f29e9e..a431fac 100644
--- a/parseutils.h
+++ b/parseutils.h
@@ -228,7 +228,7 @@ extern XkbFile *CreateXKBFile(
);
extern void yyerror(
- char * /* s */
+ const char * /* s */
);
extern int yywrap(
diff --git a/symbols.c b/symbols.c
index 75c2aaa..ffc26b2 100644
--- a/symbols.c
+++ b/symbols.c
@@ -754,7 +754,7 @@ GetGroupIndex( KeyInfo * key,
unsigned what,
unsigned * ndx_rtrn)
{
-char * name;
+const char *name;
ExprResult tmp;
if (what==SYMBOLS) name= "symbols";
diff --git a/utils.c b/utils.c
index 93850d4..aa4dc89 100644
--- a/utils.c
+++ b/utils.c
@@ -213,7 +213,7 @@ uSetErrorFile(char *name)
}
void
-uInformation(char *s, ...)
+uInformation(const char *s, ...)
{
va_list args;
@@ -226,7 +226,7 @@ va_list args;
/***====================================================================***/
void
-uAction(char *s, ...)
+uAction(const char *s, ...)
{
va_list args;
@@ -242,7 +242,7 @@ va_list args;
/***====================================================================***/
void
-uWarning(char *s, ...)
+uWarning(const char *s, ...)
{
va_list args;
@@ -261,7 +261,7 @@ va_list args;
/***====================================================================***/
void
-uError(char *s, ...)
+uError(const char *s, ...)
{
va_list args;
@@ -280,7 +280,7 @@ va_list args;
/***====================================================================***/
void
-uFatalError(char *s, ...)
+uFatalError(const char *s, ...)
{
va_list args;
@@ -302,7 +302,7 @@ va_list args;
/***====================================================================***/
void
-uInternalError(char *s, ...)
+uInternalError(const char *s, ...)
{
va_list args;
@@ -352,7 +352,7 @@ uFinishUp(void)
#ifndef HAVE_STRDUP
char *
-uStringDup(char *str)
+uStringDup(const char *str)
{
char *rtrn;
@@ -366,7 +366,7 @@ char *rtrn;
#ifndef HAVE_STRCASECMP
int
-uStrCaseCmp(char *str1,char *str2)
+uStrCaseCmp(const char *str1, const char *str2)
{
char buf1[512],buf2[512];
char c, *s;
@@ -392,7 +392,7 @@ uStrCaseCmp(char *str1,char *str2)
}
int
-uStrCasePrefix(char *my_prefix,char *str)
+uStrCasePrefix(const char *my_prefix, char *str)
{
char c1;
char c2;
diff --git a/utils.h b/utils.h
index d57e6da..ab84a4f 100644
--- a/utils.h
+++ b/utils.h
@@ -130,7 +130,7 @@ extern Boolean uSetErrorFile(
#define INFO uInformation
extern void uInformation(
- char * /* s */, ...
+ const char * /* s */, ...
)
#if defined(__GNUC__) && \
((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
@@ -147,7 +147,7 @@ __attribute__((format(printf, 1, 2)))
#define ACTION uAction
extern void uAction(
- char * /* s */, ...
+ const char * /* s */, ...
)
#if defined(__GNUC__) && \
((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
@@ -164,7 +164,7 @@ __attribute__((format(printf, 1, 2)))
#define WARN uWarning
extern void uWarning(
- char * /* s */, ...
+ const char * /* s */, ...
)
#if defined(__GNUC__) && \
((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
@@ -181,7 +181,7 @@ __attribute__((format(printf, 1, 2)))
#define ERROR uError
extern void uError(
- char * /* s */, ...
+ const char * /* s */, ...
)
#if defined(__GNUC__) && \
((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
@@ -198,7 +198,7 @@ __attribute__((format(printf, 1, 2)))
#define FATAL uFatalError
extern void uFatalError(
- char * /* s */, ...
+ const char * /* s */, ...
)
#if defined(__GNUC__) && \
((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
@@ -216,7 +216,7 @@ __attribute__((format(printf, 1, 2)))
#define WSGO uInternalError
extern void uInternalError(
- char * /* s */, ...
+ const char * /* s */, ...
)
#if defined(__GNUC__) && \
((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 6)))
@@ -256,11 +256,11 @@ extern void uFinishUp(
#define uStrCasePrefix(p,s) (strncasecmp(p,s,strlen(p))==0)
#else
extern int uStrCaseCmp(
- char * /* s1 */,
- char * /* s2 */
+ const char * /* s1 */,
+ const char * /* s2 */
);
extern int uStrCasePrefix(
- char * /* p */,
+ const char * /* p */,
char * /* str */
);
#endif
@@ -268,7 +268,7 @@ extern int uStrCasePrefix(
#define uStringDup(s1) (strdup(s1))
#else
extern char *uStringDup(
- char * /* s1 */
+ const char * /* s1 */
);
#endif
diff --git a/vmod.c b/vmod.c
index 6d9628c..9a8bd0d 100644
--- a/vmod.c
+++ b/vmod.c
@@ -90,7 +90,8 @@ Atom stmtName;
if (stmt->value==NULL)
return True;
else {
- char *str1,*str2 = "";
+ char *str1;
+ const char *str2 = "";
if (!ExprResolveModMask(stmt->value,&mod,NULL,NULL)) {
str1= XkbAtomText(NULL,stmt->name,XkbMessage);
ACTION1("Declaration of %s ignored\n",str1);
diff --git a/xkbcomp.c b/xkbcomp.c
index f54f4f0..c55994b 100644
--- a/xkbcomp.c
+++ b/xkbcomp.c
@@ -76,7 +76,7 @@
#define INPUT_XKB 1
#define INPUT_XKM 2
-static char *fileTypeExt[] = {
+static const char *fileTypeExt[] = {
"XXX",
"xkm",
"h",
@@ -721,9 +721,8 @@ Status status;
}
if (inputFile!=NULL) {
if (uStringEqual(inputFile,"-")) {
- static char *in= "stdin";
file= stdin;
- inputFile= in;
+ inputFile= "stdin";
}
else {
file= fopen(inputFile,"r");
diff --git a/xkbparse.y b/xkbparse.y
index f3eb7fe..52afa2b 100644
--- a/xkbparse.y
+++ b/xkbparse.y
@@ -779,7 +779,7 @@ MapName : STRING { $$= scanStr; scanStr= NULL; }
;
%%
void
-yyerror(char *s)
+yyerror(const char *s)
{
if (warningLevel>0) {
(void)fprintf(stderr,"%s: line %d of %s\n",s,lineNum,
diff --git a/xkbpath.c b/xkbpath.c
index ffedd5a..0e1beab 100644
--- a/xkbpath.c
+++ b/xkbpath.c
@@ -157,7 +157,7 @@ register int i;
}
Bool
-XkbAddDirectoryToPath(char *dir)
+XkbAddDirectoryToPath(const char *dir)
{
int len;
if ((dir==NULL)||(dir[0]=='\0')) {
diff --git a/xkbpath.h b/xkbpath.h
index 64f07c9..75c137d 100644
--- a/xkbpath.h
+++ b/xkbpath.h
@@ -42,7 +42,7 @@ extern void XkbAddDefaultDirectoriesToPath(
);
extern Bool XkbAddDirectoryToPath(
- char * /* dir */
+ const char * /* dir */
);
extern char * XkbDirectoryForInclude(
diff --git a/xkbscan.c b/xkbscan.c
index 8d70220..ef2227d 100644
--- a/xkbscan.c
+++ b/xkbscan.c
@@ -281,7 +281,7 @@ int ch;
}
struct _Keyword {
- char *keyword;
+ const char *keyword;
int token;
} keywords[] = {
{ "xkb_keymap", XKB_KEYMAP },