summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-10 21:32:15 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-10 21:32:15 -0800
commit933b5d1f1fe9273d1a984707687b36ec61c4c5af (patch)
tree55380b7ce47074746febfd95e16ebb93381c2b7e /src
parent696be14bcb4daef5280b425e297223c6ae530cb5 (diff)
Fix gcc -Wwrite-strings warnings that don't require public API changes
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src')
-rw-r--r--src/WrFFrI.c9
-rw-r--r--src/XpmI.h19
-rw-r--r--src/data.c6
-rw-r--r--src/parse.c5
-rw-r--r--src/scan.c2
5 files changed, 23 insertions, 18 deletions
diff --git a/src/WrFFrI.c b/src/WrFFrI.c
index 83c11fa..b592fa1 100644
--- a/src/WrFFrI.c
+++ b/src/WrFFrI.c
@@ -51,7 +51,7 @@
#endif
/* MS Windows define a function called WriteFile @#%#&!!! */
-LFUNC(xpmWriteFile, int, (FILE *file, XpmImage *image, char *name,
+LFUNC(xpmWriteFile, int, (FILE *file, XpmImage *image, const char *name,
XpmInfo *info));
LFUNC(WriteColors, void, (FILE *file, XpmColor *colors, unsigned int ncolors));
@@ -104,7 +104,8 @@ XpmWriteFileFromXpmImage(
XpmInfo *info)
{
xpmData mdata;
- char *name, *dot, *s, new_name[BUFSIZ] = {0};
+ const char *name;
+ char *dot, *s, new_name[BUFSIZ] = {0};
int ErrorStatus;
/* open file to write */
@@ -143,7 +144,7 @@ XpmWriteFileFromXpmImage(
name = new_name;
}
/* change '-' to '_' */
- s = name;
+ s = new_name;
while ((dot = strchr(s, '-'))) {
*dot = '_';
s = dot;
@@ -165,7 +166,7 @@ static int
xpmWriteFile(
FILE *file,
XpmImage *image,
- char *name,
+ const char *name,
XpmInfo *info)
{
/* calculation variables */
diff --git a/src/XpmI.h b/src/XpmI.h
index 9690622..280525d 100644
--- a/src/XpmI.h
+++ b/src/XpmI.h
@@ -114,7 +114,8 @@ typedef struct {
unsigned int line;
int CommentLength;
char Comment[XPMMAXCMTLEN];
- char *Bcmt, *Ecmt, Bos, Eos;
+ const char *Bcmt, *Ecmt;
+ char Bos, Eos;
int format; /* 1 if XPM1, 0 otherwise */
#ifdef CXPMPROG
int lineNum;
@@ -132,15 +133,15 @@ typedef struct {
#define SPC ' '
typedef struct {
- char *type; /* key word */
- char *Bcmt; /* string beginning comments */
- char *Ecmt; /* string ending comments */
+ const char *type; /* key word */
+ const char *Bcmt; /* string beginning comments */
+ const char *Ecmt; /* string ending comments */
char Bos; /* character beginning strings */
char Eos; /* character ending strings */
- char *Strs; /* strings separator */
- char *Dec; /* data declaration string */
- char *Boa; /* string beginning assignment */
- char *Eoa; /* string ending assignment */
+ const char *Strs; /* strings separator */
+ const char *Dec; /* data declaration string */
+ const char *Boa; /* string beginning assignment */
+ const char *Eoa; /* string ending assignment */
} xpmDataType;
extern xpmDataType xpmDataTypes[];
@@ -157,7 +158,7 @@ typedef struct {
/* Maximum number of rgb mnemonics allowed in rgb text file. */
#define MAX_RGBNAMES 1024
-extern char *xpmColorKeys[];
+extern const char *xpmColorKeys[];
#define TRANSPARENT_COLOR "None" /* this must be a string! */
diff --git a/src/data.c b/src/data.c
index 347aa46..898889c 100644
--- a/src/data.c
+++ b/src/data.c
@@ -61,7 +61,8 @@ ParseComment(xpmData *data)
register char c;
register unsigned int n = 0;
unsigned int notend;
- char *s, *s2;
+ char *s;
+ const char *s2;
s = data->Comment;
*s = data->Bcmt[0];
@@ -119,7 +120,8 @@ ParseComment(xpmData *data)
register int c;
register unsigned int n = 0, a;
unsigned int notend;
- char *s, *s2;
+ char *s;
+ const char *s2;
s = data->Comment;
*s = data->Bcmt[0];
diff --git a/src/parse.c b/src/parse.c
index 7dc2aa7..ff23a47 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -70,7 +70,7 @@ LFUNC(ParsePixels, int, (xpmData *data, unsigned int width,
unsigned int cpp, XpmColor *colorTable,
xpmHashTable *hashtable, unsigned int **pixels));
-char *xpmColorKeys[] = {
+const char *xpmColorKeys[] = {
"s", /* key #1: symbol */
"m", /* key #2: mono visual */
"g4", /* key #3: 4 grays visual */
@@ -205,7 +205,8 @@ xpmParseColors(
unsigned int lastwaskey; /* key read */
char buf[BUFSIZ+1];
char curbuf[BUFSIZ]; /* current buffer */
- char **sptr, *s;
+ const char **sptr;
+ char *s;
XpmColor *color;
XpmColor *colorTable;
char **defaults;
diff --git a/src/scan.c b/src/scan.c
index e51d1ab..54c8da5 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -53,7 +53,7 @@
* minus \ and " for string compat
* and ? to avoid ANSI trigraphs. */
-static char *printable =
+static const char *printable =
" .XoO+@#$%&*=-;:>,<1234567890qwertyuipasdfghjklzxcvbnmMNBVCZ\
ASDFGHJKLPIUYTREWQ!~^/()_`'][{}|";