[PATCH 6/7] Fix gcc -Wwrite-strings warnings in xf86 ddx
Alan Coopersmith
alan.coopersmith at oracle.com
Tue Nov 8 12:42:54 PST 2011
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
hw/xfree86/common/xf86Config.c | 12 ++++++------
hw/xfree86/common/xf86Config.h | 2 +-
hw/xfree86/common/xf86Configure.c | 20 ++++++++++----------
hw/xfree86/common/xf86Globals.c | 2 +-
hw/xfree86/common/xf86Mode.c | 4 ++--
hw/xfree86/common/xf86Opt.h | 4 ++--
hw/xfree86/common/xf86Option.c | 6 +++---
hw/xfree86/common/xf86PM.c | 4 ++--
hw/xfree86/common/xf86Priv.h | 2 +-
hw/xfree86/common/xf86pciBus.c | 2 +-
hw/xfree86/doc/ddxDesign.xml | 2 +-
hw/xfree86/i2c/msp3430.c | 5 +++--
hw/xfree86/parser/Flags.c | 2 +-
hw/xfree86/parser/configProcs.h | 6 +++---
hw/xfree86/parser/scan.c | 18 +++++++++---------
hw/xfree86/parser/xf86Optrec.h | 2 +-
hw/xfree86/parser/xf86Parser.h | 2 +-
hw/xfree86/ramdac/BTPriv.h | 2 +-
hw/xfree86/ramdac/IBMPriv.h | 2 +-
hw/xfree86/ramdac/TIPriv.h | 2 +-
hw/xfree86/utils/gtf/gtf.c | 4 ++--
hw/xfree86/vbe/vbe.c | 2 +-
22 files changed, 54 insertions(+), 53 deletions(-)
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index cc79973..228021b 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -248,9 +248,9 @@ xf86ModulelistFromConfig(pointer **optlist)
{
int count = 0, i = 0;
char **modulearray;
- char *ignore[] = { "GLcore", "speedo", "bitmap", "drm",
- "freetype", "type1",
- NULL };
+ const char *ignore[] = { "GLcore", "speedo", "bitmap", "drm",
+ "freetype", "type1",
+ NULL };
pointer *optarray;
XF86LoadPtr modp;
Bool found;
@@ -522,7 +522,7 @@ fixup_video_driver_list(char **drivers)
}
static char **
-GenerateDriverlist(char * dirname)
+GenerateDriverlist(const char * dirname)
{
char **ret;
const char *subdirs[] = { dirname, NULL };
@@ -553,7 +553,7 @@ xf86DriverlistFromCompile(void)
* available is printed.
*/
static void
-xf86ConfigError(char *msg, ...)
+xf86ConfigError(const char *msg, ...)
{
va_list ap;
@@ -2301,7 +2301,7 @@ ConfigStatus
xf86HandleConfigFile(Bool autoconfig)
{
const char *filename, *dirname, *sysdirname;
- char *filesearch, *dirsearch;
+ const char *filesearch, *dirsearch;
MessageType filefrom = X_DEFAULT;
MessageType dirfrom = X_DEFAULT;
char *scanptr;
diff --git a/hw/xfree86/common/xf86Config.h b/hw/xfree86/common/xf86Config.h
index de28704..411fc2c 100644
--- a/hw/xfree86/common/xf86Config.h
+++ b/hw/xfree86/common/xf86Config.h
@@ -51,7 +51,7 @@ typedef enum _ConfigStatus {
} ConfigStatus;
typedef struct _ModuleDefault {
- char *name;
+ const char *name;
Bool toLoad;
XF86OptionPtr load_opt;
} ModuleDefault;
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 61e89ed..24f367e 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -58,17 +58,17 @@ Bool xf86DoConfigurePass1 = TRUE;
static Bool foundMouse = FALSE;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-static char *DFLT_MOUSE_DEV = "/dev/sysmouse";
-static char *DFLT_MOUSE_PROTO = "auto";
+static const char *DFLT_MOUSE_DEV = "/dev/sysmouse";
+static const char *DFLT_MOUSE_PROTO = "auto";
#elif defined(linux)
-static char DFLT_MOUSE_DEV[] = "/dev/input/mice";
-static char DFLT_MOUSE_PROTO[] = "auto";
+static const char *DFLT_MOUSE_DEV = "/dev/input/mice";
+static const char *DFLT_MOUSE_PROTO = "auto";
#elif defined(WSCONS_SUPPORT)
-static char *DFLT_MOUSE_DEV = "/dev/wsmouse";
-static char *DFLT_MOUSE_PROTO = "wsmouse";
+static const char *DFLT_MOUSE_DEV = "/dev/wsmouse";
+static const char *DFLT_MOUSE_PROTO = "wsmouse";
#else
-static char *DFLT_MOUSE_DEV = "/dev/mouse";
-static char *DFLT_MOUSE_PROTO = "auto";
+static const char *DFLT_MOUSE_DEV = "/dev/mouse";
+static const char *DFLT_MOUSE_PROTO = "auto";
#endif
/*
@@ -516,9 +516,9 @@ void
DoConfigure(void)
{
int i,j, screennum = -1;
- char *home = NULL;
+ const char *home = NULL;
char filename[PATH_MAX];
- char *addslash = "";
+ const char *addslash = "";
XF86ConfigPtr xf86config = NULL;
char **vlist, **vl;
int *dev2screen;
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index f467996..d576fb9 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -163,7 +163,7 @@ const char *xf86VisualNames[] = {
};
/* Parameters set only from the command line */
-char *xf86ServerName = "no-name";
+const char *xf86ServerName = "no-name";
Bool xf86fpFlag = FALSE;
Bool xf86sFlag = FALSE;
Bool xf86bsEnableFlag = FALSE;
diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 644e5ce..d202d40 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -96,7 +96,7 @@
static void
printModeRejectMessage(int index, DisplayModePtr p, int status)
{
- char *type;
+ const char *type;
if (p->type & M_T_BUILTIN)
type = "built-in ";
@@ -2065,7 +2065,7 @@ xf86PrintModes(ScrnInfoPtr scrp)
{
DisplayModePtr p;
float hsync, refresh = 0;
- char *desc, *desc2, *prefix, *uprefix;
+ const char *desc, *desc2, *prefix, *uprefix;
if (scrp == NULL)
return;
diff --git a/hw/xfree86/common/xf86Opt.h b/hw/xfree86/common/xf86Opt.h
index 88392dc..b0fdaa6 100644
--- a/hw/xfree86/common/xf86Opt.h
+++ b/hw/xfree86/common/xf86Opt.h
@@ -72,7 +72,7 @@ typedef struct {
extern _X_EXPORT int xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt);
extern _X_EXPORT double xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt);
-extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name, char *deflt);
+extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt);
extern _X_EXPORT int xf86SetBoolOption(XF86OptionPtr list, const char *name, int deflt );
extern _X_EXPORT double xf86SetPercentOption(XF86OptionPtr list, const char *name, double deflt );
extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt);
@@ -91,7 +91,7 @@ extern _X_EXPORT char *xf86OptionName(XF86OptionPtr opt);
extern _X_EXPORT char *xf86OptionValue(XF86OptionPtr opt);
extern _X_EXPORT void xf86OptionListReport(XF86OptionPtr parm);
extern _X_EXPORT XF86OptionPtr xf86FindOption(XF86OptionPtr options, const char *name);
-extern _X_EXPORT char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
+extern _X_EXPORT const char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
extern _X_EXPORT void xf86MarkOptionUsed(XF86OptionPtr option);
extern _X_EXPORT void xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name);
extern _X_EXPORT Bool xf86CheckIfOptionUsed(XF86OptionPtr option);
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index d1d74f5..dc0a018 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -187,7 +187,7 @@ LookupRealOption(XF86OptionPtr optlist, const char *name, double deflt,
static char *
-LookupStrOption(XF86OptionPtr optlist, const char *name, char *deflt, Bool markUsed)
+LookupStrOption(XF86OptionPtr optlist, const char *name, const char *deflt, Bool markUsed)
{
OptionInfoRec o;
@@ -243,7 +243,7 @@ xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt)
char *
-xf86SetStrOption(XF86OptionPtr optlist, const char *name, char *deflt)
+xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt)
{
return LookupStrOption(optlist, name, deflt, TRUE);
}
@@ -416,7 +416,7 @@ xf86FindOption(XF86OptionPtr options, const char *name)
}
-char *
+const char *
xf86FindOptionValue(XF86OptionPtr options, const char *name)
{
return xf86findOptionValue(options, name);
diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c
index 16b6bdc..47e0297 100644
--- a/hw/xfree86/common/xf86PM.c
+++ b/hw/xfree86/common/xf86PM.c
@@ -41,7 +41,7 @@ pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event) = NULL;
static Bool suspended = FALSE;
static int
-eventName(pmEvent event, char **str)
+eventName(pmEvent event, const char **str)
{
switch(event) {
case XF86_APM_SYS_STANDBY: *str="System Standby Request"; return 0;
@@ -179,7 +179,7 @@ xf86HandlePMEvents(int fd, pointer data)
if ((n = xf86PMGetEventFromOs(fd,events,MAX_NO_EVENTS))) {
do {
for (i = 0; i < n; i++) {
- char *str = NULL;
+ const char *str = NULL;
int verb = eventName(events[i],&str);
xf86MsgVerb(X_INFO,verb,"PM Event received: %s\n",str);
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 1fe3d7e..8c69859 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -69,7 +69,7 @@ extern _X_EXPORT Pix24Flags xf86Pix24;
extern _X_EXPORT rgb xf86Weight;
extern _X_EXPORT Bool xf86FlipPixels;
extern _X_EXPORT Gamma xf86Gamma;
-extern _X_EXPORT char *xf86ServerName;
+extern _X_EXPORT const char *xf86ServerName;
/* Other parameters */
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index c009aba..716628e 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1061,7 +1061,7 @@ videoPtrToDriverList(struct pci_device *dev,
int i;
/* Add more entries here if we ever return more than 4 drivers for
any device */
- char *driverList[5] = { NULL, NULL, NULL, NULL, NULL };
+ const char *driverList[5] = { NULL, NULL, NULL, NULL, NULL };
switch (dev->vendor_id)
{
diff --git a/hw/xfree86/doc/ddxDesign.xml b/hw/xfree86/doc/ddxDesign.xml
index 0d5e952..869274b 100644
--- a/hw/xfree86/doc/ddxDesign.xml
+++ b/hw/xfree86/doc/ddxDesign.xml
@@ -3187,7 +3187,7 @@ would not need to use these directly.
<blockquote><para>
<programlisting>
- char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
+ const char *xf86FindOptionValue(XF86OptionPtr options, const char *name);
</programlisting>
<blockquote><para>
Takes a list of options and an option name, and returns the value
diff --git a/hw/xfree86/i2c/msp3430.c b/hw/xfree86/i2c/msp3430.c
index 2f244e4..df8adc4 100644
--- a/hw/xfree86/i2c/msp3430.c
+++ b/hw/xfree86/i2c/msp3430.c
@@ -20,7 +20,7 @@
void InitMSP34xxG(MSP3430Ptr m);
void InitMSP34x5D(MSP3430Ptr m);
void CheckModeMSP34x5D(MSP3430Ptr m);
-char *MSP_getProductName (CARD16 product_id);
+static const char *MSP_getProductName (CARD16 product_id);
void mpause(int milliseconds);
#define __MSPDEBUG__ 0
@@ -305,7 +305,8 @@ void MSP3430SetSource(MSP3430Ptr m, CARD8 value)
#endif
-char *MSP_getProductName (CARD16 product_id)
+static const char *
+MSP_getProductName (CARD16 product_id)
{
switch (product_id) {
case 0x0400: return "MSP3400D";
diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c
index f0a6170..87fd3ed 100644
--- a/hw/xfree86/parser/Flags.c
+++ b/hw/xfree86/parser/Flags.c
@@ -330,7 +330,7 @@ xf86findOption (XF86OptionPtr list, const char *name)
* returned. If the option is not found, a NULL is returned.
*/
-char *
+const char *
xf86findOptionValue (XF86OptionPtr list, const char *name)
{
XF86OptionPtr p = xf86findOption (list, name);
diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h
index 7d8a8e5..114cdfe 100644
--- a/hw/xfree86/parser/configProcs.h
+++ b/hw/xfree86/parser/configProcs.h
@@ -95,9 +95,9 @@ int xf86getSubToken(char **comment);
int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec *tab);
void xf86unGetToken(int token);
char *xf86tokenString(void);
-void xf86parseError(char *format, ...);
-void xf86validationError(char *format, ...);
-void xf86setSection(char *section);
+void xf86parseError(const char *format, ...);
+void xf86validationError(const char *format, ...);
+void xf86setSection(const char *section);
int xf86getStringToken(xf86ConfigSymTabRec *tab);
/* write.c */
/* DRI.c */
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 8470789..e25b1ad 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -90,7 +90,7 @@
#define CONFIG_BUF_LEN 1024
#define CONFIG_MAX_FILES 64
-static int StringToToken (char *, xf86ConfigSymTabRec *);
+static int StringToToken (const char *, xf86ConfigSymTabRec *);
static struct {
FILE *file;
@@ -992,11 +992,11 @@ xf86setBuiltinConfig(const char *config[])
}
void
-xf86parseError (char *format,...)
+xf86parseError (const char *format,...)
{
va_list ap;
- char *filename = numFiles ? configFiles[curFileIndex].path :
- "<builtin configuration>";
+ const char *filename = numFiles ? configFiles[curFileIndex].path
+ : "<builtin configuration>";
ErrorF ("Parse error on line %d of section %s in file %s\n\t",
configLineNo, configSection, filename);
@@ -1008,11 +1008,11 @@ xf86parseError (char *format,...)
}
void
-xf86validationError (char *format,...)
+xf86validationError (const char *format,...)
{
va_list ap;
- char *filename = numFiles ? configFiles[curFileIndex].path :
- "<builtin configuration>";
+ const char *filename = numFiles ? configFiles[curFileIndex].path
+ : "<builtin configuration>";
ErrorF ("Data incomplete in file %s\n\t", filename);
va_start (ap, format);
@@ -1023,7 +1023,7 @@ xf86validationError (char *format,...)
}
void
-xf86setSection (char *section)
+xf86setSection (const char *section)
{
free(configSection);
configSection = strdup(section);
@@ -1040,7 +1040,7 @@ xf86getStringToken (xf86ConfigSymTabRec * tab)
}
static int
-StringToToken (char *str, xf86ConfigSymTabRec * tab)
+StringToToken (const char *str, xf86ConfigSymTabRec * tab)
{
int i;
diff --git a/hw/xfree86/parser/xf86Optrec.h b/hw/xfree86/parser/xf86Optrec.h
index 61a8c5f..b8e9d61 100644
--- a/hw/xfree86/parser/xf86Optrec.h
+++ b/hw/xfree86/parser/xf86Optrec.h
@@ -77,7 +77,7 @@ extern _X_EXPORT char *xf86optionValue(XF86OptionPtr opt);
extern _X_EXPORT XF86OptionPtr xf86newOption(char *name, char *value);
extern _X_EXPORT XF86OptionPtr xf86nextOption(XF86OptionPtr list);
extern _X_EXPORT XF86OptionPtr xf86findOption(XF86OptionPtr list, const char *name);
-extern _X_EXPORT char *xf86findOptionValue(XF86OptionPtr list, const char *name);
+extern _X_EXPORT const char *xf86findOptionValue(XF86OptionPtr list, const char *name);
extern _X_EXPORT XF86OptionPtr xf86optionListCreate(const char **options, int count, int used);
extern _X_EXPORT XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail);
extern _X_EXPORT int xf86nameCompare (const char *s1, const char *s2);
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index a8785c5..c12bd56 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -479,7 +479,7 @@ XF86ConfigRec, *XF86ConfigPtr;
typedef struct
{
int token; /* id of the token */
- char *name; /* pointer to the LOWERCASED name */
+ const char *name; /* pointer to the LOWERCASED name */
}
xf86ConfigSymTabRec, *xf86ConfigSymTabPtr;
diff --git a/hw/xfree86/ramdac/BTPriv.h b/hw/xfree86/ramdac/BTPriv.h
index 184b481..5273776 100644
--- a/hw/xfree86/ramdac/BTPriv.h
+++ b/hw/xfree86/ramdac/BTPriv.h
@@ -6,7 +6,7 @@
#include "BT.h"
typedef struct {
- char *DeviceName;
+ const char *DeviceName;
} xf86BTramdacInfo;
extern xf86BTramdacInfo BTramdacDeviceInfo[];
diff --git a/hw/xfree86/ramdac/IBMPriv.h b/hw/xfree86/ramdac/IBMPriv.h
index a33da91..309a193 100644
--- a/hw/xfree86/ramdac/IBMPriv.h
+++ b/hw/xfree86/ramdac/IBMPriv.h
@@ -6,7 +6,7 @@
#include "IBM.h"
typedef struct {
- char *DeviceName;
+ const char *DeviceName;
} xf86IBMramdacInfo;
extern xf86IBMramdacInfo IBMramdacDeviceInfo[];
diff --git a/hw/xfree86/ramdac/TIPriv.h b/hw/xfree86/ramdac/TIPriv.h
index 191c9b5..20e07f5 100644
--- a/hw/xfree86/ramdac/TIPriv.h
+++ b/hw/xfree86/ramdac/TIPriv.h
@@ -6,7 +6,7 @@
#include "TI.h"
typedef struct {
- char *DeviceName;
+ const char *DeviceName;
} xf86TIramdacInfo;
extern xf86TIramdacInfo TIramdacDeviceInfo[];
diff --git a/hw/xfree86/utils/gtf/gtf.c b/hw/xfree86/utils/gtf/gtf.c
index bd5de7d..87fcb3f 100644
--- a/hw/xfree86/utils/gtf/gtf.c
+++ b/hw/xfree86/utils/gtf/gtf.c
@@ -151,7 +151,7 @@ typedef struct __options
/* prototypes */
-void print_value(int n, char *name, float val);
+void print_value(int n, const char *name, float val);
void print_xf86_mode (mode *m);
void print_fb_mode (mode *m);
mode *vert_refresh (int h_pixels, int v_lines, float freq,
@@ -168,7 +168,7 @@ options *parse_command_line (int argc, char *argv[]);
int global_verbose = 0;
-void print_value(int n, char *name, float val)
+void print_value(int n, const char *name, float val)
{
if (global_verbose) {
printf("%2d: %-27s: %15f\n", n, name, val);
diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c
index 06a6284..6ecca68 100644
--- a/hw/xfree86/vbe/vbe.c
+++ b/hw/xfree86/vbe/vbe.c
@@ -170,7 +170,7 @@ vbeFree(vbeInfoPtr pVbe)
static Bool
vbeProbeDDC(vbeInfoPtr pVbe)
{
- char *ddc_level;
+ const char *ddc_level;
int screen = pVbe->pInt10->scrnIndex;
if (pVbe->ddc == DDC_NONE)
--
1.7.3.2
More information about the xorg-devel
mailing list