Fix gcc -Wwrite-strings warnings in xf86 ddx

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
Alan Coopersmith 2011-11-07 19:19:47 -08:00
parent 8e4556f560
commit 09e4b78f79
22 changed files with 54 additions and 53 deletions

View File

@ -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;

View File

@ -51,7 +51,7 @@ typedef enum _ConfigStatus {
} ConfigStatus;
typedef struct _ModuleDefault {
char *name;
const char *name;
Bool toLoad;
XF86OptionPtr load_opt;
} ModuleDefault;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -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)
{

View File

@ -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

View File

@ -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";

View File

@ -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);

View File

@ -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 */

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -6,7 +6,7 @@
#include "BT.h"
typedef struct {
char *DeviceName;
const char *DeviceName;
} xf86BTramdacInfo;
extern xf86BTramdacInfo BTramdacDeviceInfo[];

View File

@ -6,7 +6,7 @@
#include "IBM.h"
typedef struct {
char *DeviceName;
const char *DeviceName;
} xf86IBMramdacInfo;
extern xf86IBMramdacInfo IBMramdacDeviceInfo[];

View File

@ -6,7 +6,7 @@
#include "TI.h"
typedef struct {
char *DeviceName;
const char *DeviceName;
} xf86TIramdacInfo;
extern xf86TIramdacInfo TIramdacDeviceInfo[];

View File

@ -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);

View File

@ -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)