summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-05-26 16:03:30 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-05-26 16:03:48 -0700
commit5256304812e89c1c02bed093d11f96d97216bdbe (patch)
tree439f5f71410af72cf80cc09e9ccaccf85fbba113
parente1b1ecd2e9858dca67ed1da90799f1ea34fc9b71 (diff)
Fix many const char * warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--isokeys.h2
-rw-r--r--psgeom.c26
-rw-r--r--utils.c20
-rw-r--r--utils.h24
-rw-r--r--xkbprint.c6
-rw-r--r--xkbprint.h4
6 files changed, 42 insertions, 40 deletions
diff --git a/isokeys.h b/isokeys.h
index 988c692..a5f155f 100644
--- a/isokeys.h
+++ b/isokeys.h
@@ -93,7 +93,7 @@
#define XKC_ISO_Last_Group 'y'
#define XKC_ISO_Last_Group_Lock 'z'
-static char *IsoKeyCaps[] = {
+static const char *IsoKeyCaps[] = {
"%!PS-AdobeFont-1.0: IsoKeyCaps",
"%%CreationDate: Sun Apr 16 22:14:26 1995",
"%%VMusage: 8064 8064",
diff --git a/psgeom.c b/psgeom.c
index e86426c..811d140 100644
--- a/psgeom.c
+++ b/psgeom.c
@@ -119,8 +119,8 @@ typedef struct {
/***====================================================================***/
typedef struct _PSFontDef {
- char *name;
- char **def;
+ const char *name;
+ const char **def;
} PSFontDef;
static PSFontDef internalFonts[] = {
@@ -157,9 +157,9 @@ ListInternalFonts(FILE *out, int first, int indent)
}
static Bool
-PSIncludeFont(FILE *out, char *font)
+PSIncludeFont(FILE *out, const char *font)
{
- char **pstr;
+ const char **pstr;
register int i;
pstr = NULL;
@@ -180,7 +180,7 @@ PSIncludeFont(FILE *out, char *font)
}
Bool
-DumpInternalFont(FILE *out, char *fontName)
+DumpInternalFont(FILE *out, const char *fontName)
{
if (strcmp(fontName, "IsoKeyCaps") != 0) {
uError("No internal font named \"%s\"\n", fontName);
@@ -404,7 +404,7 @@ ClearFontStuff(FontStuff *stuff)
}
static Bool
-CrackXLFDName(char *name, FontStuff *stuff)
+CrackXLFDName(const char *name, FontStuff *stuff)
{
char *tmp;
@@ -569,7 +569,7 @@ PSSetUpForLatin1(FILE *out, PSState *state)
}
static void
-PSReencodeLatin1Font(FILE *out, char *font)
+PSReencodeLatin1Font(FILE *out, const char *font)
{
fprintf(out, "/%s findfont reencodeISO-1\n", font);
fprintf(out, " /%s-8859-1 exch definefont pop\n", font);
@@ -577,7 +577,7 @@ PSReencodeLatin1Font(FILE *out, char *font)
}
static void
-PSSetUpFonts(FILE *out, char *textFont, int size)
+PSSetUpFonts(FILE *out, const char *textFont, int size)
{
fprintf(out, "/F%d { /%s findfont exch scalefont setfont } def\n",
FONT_TEXT, textFont);
@@ -845,7 +845,8 @@ PSPageTrailer(FILE *out, PSState *state)
PSSetFont(out, state, FONT_LATIN1, 14, False);
}
if (state->args->label == LABEL_SYMBOLS) {
- char buf[40], *sName = NULL, *lbuf;
+ char buf[40], *lbuf;
+ const char *sName = NULL;
Atom sAtom;
if (state->args->nLabelGroups == 1)
@@ -892,7 +893,8 @@ PSPageTrailer(FILE *out, PSState *state)
baseline += 16;
}
if (state->args->label == LABEL_KEYCODE) {
- char *sName = NULL, *lbuf;
+ const char *sName = NULL;
+ char *lbuf;
Atom sAtom;
if (xkb->names != NULL)
@@ -959,7 +961,7 @@ static void
PSDoodad(FILE *out, PSState *state, XkbDoodadPtr doodad)
{
XkbDescPtr xkb;
- char *name, *dname;
+ const char *name, *dname;
int sz, leading;
xkb = state->xkb;
@@ -1728,7 +1730,7 @@ FindKeysymsByName(XkbDescPtr xkb, char *name, PSState *state, KeyTop *top)
}
static void
-PSDrawLabel(FILE *out, char *label, int x, int y, int w, int h)
+PSDrawLabel(FILE *out, const char *label, int x, int y, int w, int h)
{
fprintf(out, "%d %d (%s) centeroffset\n", w, h, label);
fprintf(out, "%d add exch\n", y);
diff --git a/utils.c b/utils.c
index 7038110..7390c8e 100644
--- a/utils.c
+++ b/utils.c
@@ -204,7 +204,7 @@ uDebugNOI(char *s, ...)
static FILE *errorFile = NULL;
Boolean
-uSetErrorFile(char *name)
+uSetErrorFile(const char *name)
{
if ((errorFile != NULL) && (errorFile != stderr)) {
fprintf(errorFile, "switching to %s\n", name ? name : "stderr");
@@ -222,7 +222,7 @@ uSetErrorFile(char *name)
}
void
-uInformation(char *s, ...)
+uInformation(const char *s, ...)
{
va_list ap;
@@ -236,7 +236,7 @@ uInformation(char *s, ...)
/***====================================================================***/
void
-uAction(char *s, ...)
+uAction(const char *s, ...)
{
va_list ap;
@@ -251,7 +251,7 @@ uAction(char *s, ...)
/***====================================================================***/
void
-uWarning(char *s, ...)
+uWarning(const char *s, ...)
{
va_list ap;
@@ -266,7 +266,7 @@ uWarning(char *s, ...)
/***====================================================================***/
void
-uError(char *s, ...)
+uError(const char *s, ...)
{
va_list ap;
@@ -281,7 +281,7 @@ uError(char *s, ...)
/***====================================================================***/
void
-uFatalError(char *s, ...)
+uFatalError(const char *s, ...)
{
va_list ap;
@@ -298,7 +298,7 @@ uFatalError(char *s, ...)
/***====================================================================***/
void
-uInternalError(char *s, ...)
+uInternalError(const char *s, ...)
{
va_list ap;
@@ -314,7 +314,7 @@ uInternalError(char *s, ...)
#ifndef HAVE_STRDUP
char *
-uStringDup(char *str)
+uStringDup(const char *str)
{
char *rtrn;
@@ -328,7 +328,7 @@ uStringDup(char *str)
#ifndef HAVE_STRCASECMP
int
-uStrCaseCmp(char *str1, char *str2)
+uStrCaseCmp(const char *str1, const char *str2)
{
char buf1[512], buf2[512];
char c, *s;
@@ -355,7 +355,7 @@ uStrCaseCmp(char *str1, char *str2)
}
int
-uStrCasePrefix(char *prefix, char *str)
+uStrCasePrefix(const char *prefix, const char *str)
{
char c1;
char c2;
diff --git a/utils.h b/utils.h
index 7a08166..5db7377 100644
--- a/utils.h
+++ b/utils.h
@@ -101,13 +101,13 @@ extern void uFree(Opaque /* ptr */);
/***====================================================================***/
-extern Boolean uSetErrorFile(char *name);
-extern void uInformation(char *s, ...);
-extern void uAction(char *s, ...);
-extern void uWarning(char *s, ...);
-extern void uError(char *s, ...);
-extern void uFatalError(char *s, ...);
-extern void uInternalError(char *s, ...);
+extern Boolean uSetErrorFile(const char *name);
+extern void uInformation(const char *s, ...);
+extern void uAction(const char *s, ...);
+extern void uWarning(const char *s, ...);
+extern void uError(const char *s, ...);
+extern void uFatalError(const char *s, ...);
+extern void uInternalError(const char *s, ...);
/***====================================================================***/
@@ -122,16 +122,16 @@ extern void uInternalError(char *s, ...);
#define uStrCaseCmp(s1,s2) (strcasecmp(s1,s2))
#define uStrCasePrefix(p,s) (strncasecmp(p,s,strlen(p))==0)
#else
-extern int uStrCaseCmp(char * /* s1 */ ,
- char * /* s2 */);
+extern int uStrCaseCmp(const char * /* s1 */ ,
+ const char * /* s2 */);
-extern int uStrCasePrefix(char * /* p */ ,
- char * /* str */);
+extern int uStrCasePrefix(const char * /* p */ ,
+ const char * /* str */);
#endif
#ifdef HAVE_STRDUP
#define uStringDup(s1) (strdup(s1))
#else
-extern char *uStringDup(char * /* s1 */);
+extern char *uStringDup(const char * /* s1 */);
#endif
/***====================================================================***/
diff --git a/xkbprint.c b/xkbprint.c
index 2a48a98..a1b80db 100644
--- a/xkbprint.c
+++ b/xkbprint.c
@@ -61,7 +61,7 @@
static unsigned outputFormat = WANT_DEFAULT;
-static char * wantLocale = "C";
+static const char * wantLocale = "C";
static char * rootDir;
static char * inputFile;
static char * outputFile;
@@ -638,7 +638,7 @@ main(int argc, char *argv[])
/* XkbInitIncludePath(); */
if (inputFile != NULL) {
if (uStringEqual(inputFile, "-")) {
- static char *in = "stdin";
+ static char in[] = "stdin";
file = stdin;
inputFile = in;
@@ -750,7 +750,7 @@ main(int argc, char *argv[])
}
if (outputFile != NULL) {
if (uStringEqual(outputFile, "-")) {
- static char *of = "stdout";
+ static char of[] = "stdout";
out = stdout;
outputFile = of;
diff --git a/xkbprint.h b/xkbprint.h
index 7017526..e4bb0fc 100644
--- a/xkbprint.h
+++ b/xkbprint.h
@@ -59,8 +59,8 @@ typedef struct _XKBPrintArgs {
extern Bool
DumpInternalFont(
- FILE * /* out */ ,
- char * /* fontName */
+ FILE * /* out */ ,
+ const char * /* fontName */
);
extern Bool