summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-07 19:19:47 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-11-23 12:15:07 -0800
commit09e4b78f7944234865f4648940453303af0c2663 (patch)
treebc4cbd06031a196ee1a79c5563771bed21d3f08e
parent8e4556f560487f3d07812834d4785441d0a8323c (diff)
Fix gcc -Wwrite-strings warnings in xf86 ddx
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--hw/xfree86/common/xf86Config.c12
-rw-r--r--hw/xfree86/common/xf86Config.h2
-rw-r--r--hw/xfree86/common/xf86Configure.c20
-rw-r--r--hw/xfree86/common/xf86Globals.c2
-rw-r--r--hw/xfree86/common/xf86Mode.c4
-rw-r--r--hw/xfree86/common/xf86Opt.h4
-rw-r--r--hw/xfree86/common/xf86Option.c6
-rw-r--r--hw/xfree86/common/xf86PM.c4
-rw-r--r--hw/xfree86/common/xf86Priv.h2
-rw-r--r--hw/xfree86/common/xf86pciBus.c2
-rw-r--r--hw/xfree86/doc/ddxDesign.xml2
-rw-r--r--hw/xfree86/i2c/msp3430.c5
-rw-r--r--hw/xfree86/parser/Flags.c2
-rw-r--r--hw/xfree86/parser/configProcs.h6
-rw-r--r--hw/xfree86/parser/scan.c18
-rw-r--r--hw/xfree86/parser/xf86Optrec.h2
-rw-r--r--hw/xfree86/parser/xf86Parser.h2
-rw-r--r--hw/xfree86/ramdac/BTPriv.h2
-rw-r--r--hw/xfree86/ramdac/IBMPriv.h2
-rw-r--r--hw/xfree86/ramdac/TIPriv.h2
-rw-r--r--hw/xfree86/utils/gtf/gtf.c4
-rw-r--r--hw/xfree86/vbe/vbe.c2
22 files changed, 54 insertions, 53 deletions
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index cc7997364..228021b21 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 de287041a..411fc2cc1 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 61e89ed05..24f367ec0 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 f46799615..d576fb915 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 644e5ce80..d202d4079 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 88392dc6d..b0fdaa6b6 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 d1d74f5a5..dc0a01899 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 16b6bdc4a..47e0297d6 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 1fe3d7e0d..8c698591e 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 b3d3b9e4c..b95b25359 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -1062,7 +1062,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 a1212a629..ca5efc9be 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 2f244e4c2..df8adc435 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 f0a61707b..87fd3edf6 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 7d8a8e53a..114cdfe33 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 847078986..e25b1ad48 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 61a8c5ff5..b8e9d6192 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 a8785c5fa..c12bd5645 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 184b4811c..52737768f 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 a33da9106..309a193ad 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 191c9b5ce..20e07f5cc 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 bd5de7da9..87fcb3f0e 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 06a628457..6ecca6858 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)