diff options
author | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-09-23 20:15:13 +0200 |
---|---|---|
committer | Tilman Sauerbeck <tilman@code-monkey.de> | 2007-09-23 20:15:13 +0200 |
commit | 829cb75130d1edd88fa1d33e277f49167daedacf (patch) | |
tree | 1eac332bfee7048c57a0b15349dc70a6b821a2c1 | |
parent | e8ffa513a109209849b11a3c608356cc28314a8e (diff) |
Fixed a bunch of const correctness bugs.
-rw-r--r-- | action.c | 4 | ||||
-rw-r--r-- | expr.h | 2 | ||||
-rw-r--r-- | geometry.c | 6 | ||||
-rw-r--r-- | keycodes.c | 4 | ||||
-rw-r--r-- | keytypes.c | 2 | ||||
-rw-r--r-- | misc.c | 9 | ||||
-rw-r--r-- | misc.h | 24 | ||||
-rw-r--r-- | parseutils.h | 2 | ||||
-rw-r--r-- | symbols.c | 2 | ||||
-rw-r--r-- | utils.c | 18 | ||||
-rw-r--r-- | utils.h | 20 | ||||
-rw-r--r-- | vmod.c | 3 | ||||
-rw-r--r-- | xkbcomp.c | 5 | ||||
-rw-r--r-- | xkbparse.y | 2 | ||||
-rw-r--r-- | xkbpath.c | 2 | ||||
-rw-r--r-- | xkbpath.h | 2 | ||||
-rw-r--r-- | xkbscan.c | 2 |
17 files changed, 55 insertions, 54 deletions
@@ -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), @@ -62,7 +62,7 @@ typedef struct _LookupPriv { } LookupPriv; typedef struct _LookupEntry { - char * name; + const char *name; unsigned result; } LookupEntry; @@ -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) @@ -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"; @@ -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"); @@ -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); @@ -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( @@ -754,7 +754,7 @@ GetGroupIndex( KeyInfo * key, unsigned what, unsigned * ndx_rtrn) { -char * name; +const char *name; ExprResult tmp; if (what==SYMBOLS) name= "symbols"; @@ -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; @@ -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 @@ -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); @@ -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"); @@ -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, @@ -157,7 +157,7 @@ register int i; } Bool -XkbAddDirectoryToPath(char *dir) +XkbAddDirectoryToPath(const char *dir) { int len; if ((dir==NULL)||(dir[0]=='\0')) { @@ -42,7 +42,7 @@ extern void XkbAddDefaultDirectoriesToPath( ); extern Bool XkbAddDirectoryToPath( - char * /* dir */ + const char * /* dir */ ); extern char * XkbDirectoryForInclude( @@ -281,7 +281,7 @@ int ch; } struct _Keyword { - char *keyword; + const char *keyword; int token; } keywords[] = { { "xkb_keymap", XKB_KEYMAP }, |