[PATCH 03/44] xfree86/common: Warning fixes. Mostly const string handling.

Keith Packard keithp at keithp.com
Wed Dec 11 12:23:35 PST 2013


Also removes DPMS functiosn from Xext/dpmsproc.h

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 hw/xfree86/common/vidmodeproc.h     |  2 +-
 hw/xfree86/common/xf86.h            |  7 +++----
 hw/xfree86/common/xf86AutoConfig.c  |  4 +++-
 hw/xfree86/common/xf86Config.c      | 32 +++++++++++++++----------------
 hw/xfree86/common/xf86Config.h      |  8 ++++----
 hw/xfree86/common/xf86Configure.c   | 38 +++++++++++++++++++++++++------------
 hw/xfree86/common/xf86Extensions.c  |  1 -
 hw/xfree86/common/xf86Helper.c      | 10 ++++------
 hw/xfree86/common/xf86InPriv.h      |  3 ---
 hw/xfree86/common/xf86Init.c        |  8 +++++---
 hw/xfree86/common/xf86Mode.c        |  2 +-
 hw/xfree86/common/xf86Module.h      |  2 +-
 hw/xfree86/common/xf86Opt.h         |  2 +-
 hw/xfree86/common/xf86Option.c      |  5 +++--
 hw/xfree86/common/xf86Priv.h        |  2 +-
 hw/xfree86/common/xf86Xinput.c      | 10 +++++-----
 hw/xfree86/common/xf86pciBus.c      |  6 ++++--
 hw/xfree86/common/xf86pciBus.h      |  2 +-
 hw/xfree86/common/xf86platformBus.c |  2 +-
 hw/xfree86/common/xf86str.h         |  2 +-
 hw/xfree86/loader/loadmod.c         |  6 +++---
 hw/xfree86/parser/Module.c          |  2 +-
 hw/xfree86/parser/configProcs.h     |  2 +-
 hw/xfree86/parser/xf86Parser.h      |  4 ++--
 24 files changed, 88 insertions(+), 74 deletions(-)

diff --git a/hw/xfree86/common/vidmodeproc.h b/hw/xfree86/common/vidmodeproc.h
index 311d35c..f547efd 100644
--- a/hw/xfree86/common/vidmodeproc.h
+++ b/hw/xfree86/common/vidmodeproc.h
@@ -34,7 +34,7 @@ typedef enum {
 } VidModeSelectMonitor;
 
 typedef union {
-    pointer ptr;
+    const void *ptr;
     int i;
     float f;
 } vidMonitorValue;
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 9fc0c5b..206a9d7 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -204,8 +204,7 @@ extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set,
                                    int flags);
 
 #ifdef DPMSExtension
-extern _X_EXPORT int DPMSSet(ClientPtr client, int level);
-extern _X_EXPORT Bool DPMSSupported(void);
+#include "dpmsproc.h"
 #endif
 
 /* xf86DGA.c */
@@ -339,7 +338,7 @@ xf86LoadDrvSubModule(DriverPtr drv, const char *name);
 extern _X_EXPORT pointer
 xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
 extern _X_EXPORT pointer
-xf86LoadOneModule(char *name, pointer optlist);
+xf86LoadOneModule(const char *name, pointer optlist);
 extern _X_EXPORT void
 xf86UnloadSubModule(pointer mod);
 extern _X_EXPORT Bool
@@ -350,7 +349,7 @@ extern _X_EXPORT void
 xf86SetSilkenMouse(ScreenPtr pScreen);
 extern _X_EXPORT pointer
 xf86FindXvOptions(ScrnInfoPtr pScrn, int adapt_index, const char *port_name,
-                  char **adaptor_name, pointer *adaptor_options);
+                  const char **adaptor_name, pointer *adaptor_options);
 extern _X_EXPORT void
 xf86GetOS(const char **name, int *major, int *minor, int *teeny);
 extern _X_EXPORT ScrnInfoPtr
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index af2b7f8..4eb86de 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -300,6 +300,7 @@ copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
 {
     confScreenPtr nscreen;
     GDevPtr cptr = NULL;
+    char *identifier;
 
     nscreen = malloc(sizeof(confScreenRec));
     if (!nscreen)
@@ -313,13 +314,14 @@ copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
     }
     memcpy(cptr, odev, sizeof(GDevRec));
 
-    if (asprintf(&cptr->identifier, "Autoconfigured Video Device %s", driver)
+    if (asprintf(&identifier, "Autoconfigured Video Device %s", driver)
         == -1) {
         free(cptr);
         free(nscreen);
         return FALSE;
     }
     cptr->driver = driver;
+    cptr->identifier = identifier;
 
     xf86ConfigLayout.screens[i].screen = nscreen;
 
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index b5efc02..6ea7d01 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -236,11 +236,11 @@ xf86ValidateFontPath(char *path)
  * use the datastructure that the parser provides and pick out the parts
  * that we need at this point
  */
-char **
+const char **
 xf86ModulelistFromConfig(pointer **optlist)
 {
     int count = 0, i = 0;
-    char **modulearray;
+    const char **modulearray;
 
     const char *ignore[] = { "GLcore", "speedo", "bitmap", "drm",
         "freetype", "type1",
@@ -374,12 +374,12 @@ xf86ModulelistFromConfig(pointer **optlist)
     return modulearray;
 }
 
-char **
+const char **
 xf86DriverlistFromConfig(void)
 {
     int count = 0;
     int j;
-    char **modulearray;
+    const char **modulearray;
     screenLayoutPtr slp;
 
     /*
@@ -446,11 +446,11 @@ xf86DriverlistFromConfig(void)
     return modulearray;
 }
 
-char **
+const char **
 xf86InputDriverlistFromConfig(void)
 {
     int count = 0;
-    char **modulearray;
+    const char **modulearray;
     InputInfoPtr *idp;
 
     /*
@@ -505,11 +505,11 @@ xf86InputDriverlistFromConfig(void)
 }
 
 static void
-fixup_video_driver_list(char **drivers)
+fixup_video_driver_list(const char **drivers)
 {
     static const char *fallback[4] = { "fbdev", "vesa", "wsfb", NULL };
-    char **end, **drv;
-    char *x;
+    const char **end, **drv;
+    const char *x;
     int i;
 
     /* walk to the end of the list */
@@ -533,10 +533,10 @@ fixup_video_driver_list(char **drivers)
     }
 }
 
-static char **
+static const char **
 GenerateDriverlist(const char *dirname)
 {
-    char **ret;
+    const char **ret;
     const char *subdirs[] = { dirname, NULL };
     static const char *patlist[] = { "(.*)_drv\\.so", NULL };
     ret = LoaderListDirs(subdirs, patlist);
@@ -548,10 +548,10 @@ GenerateDriverlist(const char *dirname)
     return ret;
 }
 
-char **
+const char **
 xf86DriverlistFromCompile(void)
 {
-    static char **driverlist = NULL;
+    static const char **driverlist = NULL;
 
     if (!driverlist)
         driverlist = GenerateDriverlist("drivers");
@@ -589,7 +589,7 @@ configFiles(XF86ConfFilesPtr fileconf)
     /* FontPath */
     must_copy = TRUE;
 
-    temp_path = defaultFontPath ? defaultFontPath : "";
+    temp_path = defaultFontPath ? defaultFontPath : (char *) "";
     if (xf86fpFlag)
         pathFrom = X_CMDLINE;
     else if (fileconf && fileconf->file_fontpath) {
@@ -606,7 +606,7 @@ configFiles(XF86ConfFilesPtr fileconf)
     }
     else
         pathFrom = X_DEFAULT;
-    temp_path = defaultFontPath ? defaultFontPath : "";
+    temp_path = defaultFontPath ? defaultFontPath : (char *) "";
 
     /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
     temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath;
@@ -2349,7 +2349,7 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout)
 ConfigStatus
 xf86HandleConfigFile(Bool autoconfig)
 {
-    char *scanptr;
+    const char *scanptr;
     Bool singlecard = 0;
     Bool implicit_layout = FALSE;
 
diff --git a/hw/xfree86/common/xf86Config.h b/hw/xfree86/common/xf86Config.h
index de06677..84013e1 100644
--- a/hw/xfree86/common/xf86Config.h
+++ b/hw/xfree86/common/xf86Config.h
@@ -59,10 +59,10 @@ typedef struct _ModuleDefault {
 /*
  * prototypes
  */
-char **xf86ModulelistFromConfig(pointer **);
-char **xf86DriverlistFromConfig(void);
-char **xf86DriverlistFromCompile(void);
-char **xf86InputDriverlistFromConfig(void);
+const char **xf86ModulelistFromConfig(pointer **);
+const char **xf86DriverlistFromConfig(void);
+const char **xf86DriverlistFromCompile(void);
+const char **xf86InputDriverlistFromConfig(void);
 Bool xf86BuiltinInputDriver(const char *);
 ConfigStatus xf86HandleConfigFile(Bool);
 
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 5bf1f14..1348b27 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -195,11 +195,15 @@ configureScreenSection(int screennum)
 {
     int i;
     int depths[] = { 1, 4, 8, 15, 16, 24 /*, 32 */  };
+    char *tmp;
     parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec)
 
-        XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum);
-    XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum);
-    XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum);
+    XNFasprintf(&tmp, "Screen%d", screennum);
+    ptr->scrn_identifier = tmp;
+    XNFasprintf(&tmp, "Monitor%d", screennum);
+    ptr->scrn_monitor_str = tmp;
+    XNFasprintf(&tmp, "Card%d", screennum);
+    ptr->scrn_device_str = tmp;
 
     for (i = 0; i < sizeof(depths) / sizeof(depths[0]); i++) {
         XF86ConfDisplayPtr display;
@@ -248,12 +252,14 @@ configureDeviceSection(int screennum)
 {
     OptionInfoPtr p;
     int i = 0;
+    char *identifier;
 
     parsePrologue(XF86ConfDevicePtr, XF86ConfDeviceRec)
 
         /* Move device info to parser structure */
-        if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1)
-        ptr->dev_identifier = NULL;
+   if (asprintf(&identifier, "Card%d", screennum) == -1)
+        identifier = NULL;
+    ptr->dev_identifier = identifier;
     ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
     ptr->dev_busid = DevToConfig[screennum].GDev.busID;
     ptr->dev_driver = DevToConfig[screennum].GDev.driver;
@@ -355,20 +361,24 @@ configureLayoutSection(void)
 
     for (scrnum = 0; scrnum < nDevToConfig; scrnum++) {
         XF86ConfAdjacencyPtr aptr;
+        char *tmp;
 
         aptr = malloc(sizeof(XF86ConfAdjacencyRec));
         aptr->list.next = NULL;
         aptr->adj_x = 0;
         aptr->adj_y = 0;
         aptr->adj_scrnum = scrnum;
-        XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum);
+        XNFasprintf(&tmp, "Screen%d", scrnum);
+        aptr->adj_screen_str = tmp;
         if (scrnum == 0) {
             aptr->adj_where = CONF_ADJ_ABSOLUTE;
             aptr->adj_refscreen = NULL;
         }
         else {
+            char *tmp;
             aptr->adj_where = CONF_ADJ_RIGHTOF;
-            XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1);
+            XNFasprintf(&tmp, "Screen%d", scrnum - 1);
+            aptr->adj_refscreen = tmp;
         }
         ptr->lay_adjacency_lst =
             (XF86ConfAdjacencyPtr) xf86addListItem((glp) ptr->lay_adjacency_lst,
@@ -389,7 +399,7 @@ configureFlagsSection(void)
 static XF86ConfModulePtr
 configureModuleSection(void)
 {
-    char **elist, **el;
+    const char **elist, **el;
 
     /* Find the list of extension & font modules. */
     const char *esubdirs[] = {
@@ -432,9 +442,11 @@ configureFilesSection(void)
 static XF86ConfMonitorPtr
 configureMonitorSection(int screennum)
 {
+    char *tmp;
     parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec)
 
-        XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
+    XNFasprintf(&tmp, "Monitor%d", screennum);
+    ptr->mon_identifier = tmp;
     ptr->mon_vendor = strdup("Monitor Vendor");
     ptr->mon_modelname = strdup("Monitor Model");
 
@@ -474,10 +486,12 @@ configureDDCMonitorSection(int screennum)
 #define displaySizeMaxLen 80
     char displaySize_string[displaySizeMaxLen];
     int displaySizeLen;
+    char *tmp;
 
     parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec)
 
-        XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
+    XNFasprintf(&tmp, "Monitor%d", screennum);
+    ptr->mon_identifier = tmp;
     ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
     XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
 
@@ -530,7 +544,7 @@ DoConfigure(void)
     char filename[PATH_MAX];
     const char *addslash = "";
     XF86ConfigPtr xf86config = NULL;
-    char **vlist, **vl;
+    const char **vlist, **vl;
     int *dev2screen;
 
     vlist = xf86DriverlistFromCompile();
@@ -768,7 +782,7 @@ void
 DoShowOptions(void)
 {
     int i = 0;
-    char **vlist = 0;
+    const char **vlist = NULL;
     char *pSymbol = 0;
     XF86ModuleData *initData = 0;
 
diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c
index f9e7916..c80de34 100644
--- a/hw/xfree86/common/xf86Extensions.c
+++ b/hw/xfree86/common/xf86Extensions.c
@@ -89,7 +89,6 @@ load_extension_config(void)
 {
     XF86ConfModulePtr mod_con = xf86configptr->conf_modules;
     XF86LoadPtr modp;
-    int i;
 
     /* Only the best. */
     if (!mod_con)
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index f1e6783..a59f4fc 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1068,9 +1068,7 @@ void
 xf86EnableDisableFBAccess(ScrnInfoPtr pScrnInfo, Bool enable)
 {
     ScreenPtr pScreen = pScrnInfo->pScreen;
-    PixmapPtr pspix;
 
-    pspix = (*pScreen->GetScreenPixmap) (pScreen);
     if (enable) {
         /*
          * Restore all of the clip lists on the screen
@@ -1566,7 +1564,7 @@ xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name)
  * xf86LoadOneModule loads a single module.
  */
 pointer
-xf86LoadOneModule(char *name, pointer opt)
+xf86LoadOneModule(const char *name, pointer opt)
 {
     int errmaj, errmin;
     char *Name;
@@ -1698,8 +1696,8 @@ xf86SetSilkenMouse(ScreenPtr pScreen)
 /* Wrote this function for the PM2 Xv driver, preliminary. */
 
 pointer
-xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, char *port_name,
-                  char **adaptor_name, pointer *adaptor_options)
+xf86FindXvOptions(ScrnInfoPtr pScrn, int adaptor_index, const char *port_name,
+                  const char **adaptor_name, pointer *adaptor_options)
 {
     confXvAdaptorPtr adaptor;
     int i;
@@ -1817,7 +1815,7 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
         pNewProp->next = NULL;
     }
     else {
-        free(pNewProp->name);
+        free((void *) pNewProp->name);
         existing = TRUE;
     }
 
diff --git a/hw/xfree86/common/xf86InPriv.h b/hw/xfree86/common/xf86InPriv.h
index 5826ac3..b8229d2 100644
--- a/hw/xfree86/common/xf86InPriv.h
+++ b/hw/xfree86/common/xf86InPriv.h
@@ -37,7 +37,4 @@
 extern InputDriverPtr *xf86InputDriverList;
 extern int xf86NumInputDrivers;
 
-/* xf86Helper.c */
-InputDriverPtr xf86LookupInputDriver(const char *name);
-
 #endif                          /* _xf86InPriv_h */
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 91ec4c8..6feedc8 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -395,7 +395,7 @@ void
 InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 {
     int i, j, k, scr_index;
-    char **modulelist;
+    const char **modulelist;
     pointer *optionlist;
     Pix24Flags screenpix24, pix24;
     MessageType pix24From = X_DEFAULT;
@@ -623,7 +623,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
 
         for (i = 0; i < xf86NumScreens; i++) {
             if (xf86Screens[i]->name == NULL) {
-                XNFasprintf(&xf86Screens[i]->name, "screen%d", i);
+                char *tmp;
+                XNFasprintf(&tmp, "screen%d", i);
+                xf86Screens[i]->name = tmp;
                 xf86MsgVerb(X_WARNING, 0,
                             "Screen driver %d has no name set, using `%s'.\n",
                             i, xf86Screens[i]->name);
@@ -1536,7 +1538,7 @@ ddxUseMsg(void)
  * xf86LoadModules iterates over a list that is being passed in.
  */
 Bool
-xf86LoadModules(char **list, pointer *optlist)
+xf86LoadModules(const char **list, pointer *optlist)
 {
     int errmaj, errmin;
     pointer opt;
diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 706ab64..15214ea 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -1998,7 +1998,7 @@ xf86DeleteMode(DisplayModePtr * modeList, DisplayModePtr mode)
             mode->next->prev = mode->prev;
     }
 
-    free(mode->name);
+    free((void *) mode->name);
     free(mode);
 }
 
diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 265b553..396f63c 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -176,7 +176,7 @@ extern _X_EXPORT pointer LoadSubModule(pointer, const char *, const char **,
 extern _X_EXPORT void UnloadSubModule(pointer);
 extern _X_EXPORT void UnloadModule(pointer);
 extern _X_EXPORT pointer LoaderSymbol(const char *);
-extern _X_EXPORT char **LoaderListDirs(const char **, const char **);
+extern _X_EXPORT const char **LoaderListDirs(const char **, const char **);
 extern _X_EXPORT void LoaderFreeDirList(char **);
 extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int);
 extern _X_EXPORT void LoaderGetOS(const char **name, int *major, int *minor,
diff --git a/hw/xfree86/common/xf86Opt.h b/hw/xfree86/common/xf86Opt.h
index f99a924..3be2a0f 100644
--- a/hw/xfree86/common/xf86Opt.h
+++ b/hw/xfree86/common/xf86Opt.h
@@ -123,7 +123,7 @@ extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec * table,
 extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec * table,
                                                 int token);
 extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec * table, int token);
-extern _X_EXPORT char *xf86GetOptValString(const OptionInfoRec * table,
+extern _X_EXPORT const char *xf86GetOptValString(const OptionInfoRec * table,
                                            int token);
 extern _X_EXPORT Bool xf86GetOptValInteger(const OptionInfoRec * table,
                                            int token, int *value);
diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
index 607c333..0e8bc1f 100644
--- a/hw/xfree86/common/xf86Option.c
+++ b/hw/xfree86/common/xf86Option.c
@@ -478,7 +478,8 @@ static Bool
 ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
                  Bool markUsed)
 {
-    char *s, *end;
+    const char *s;
+    char *end;
     Bool wasUsed = FALSE;
 
     if ((s = xf86findOptionValue(options, p->name)) != NULL) {
@@ -755,7 +756,7 @@ xf86IsOptionSet(const OptionInfoRec * table, int token)
     return p && p->found;
 }
 
-char *
+const char *
 xf86GetOptValString(const OptionInfoRec * table, int token)
 {
     OptionInfoPtr p;
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 58cfe0a..5239a6b 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -156,7 +156,7 @@ xf86CloseLog(enum ExitCode error);
 
 /* xf86Init.c */
 extern _X_EXPORT Bool
-xf86LoadModules(char **list, pointer *optlist);
+xf86LoadModules(const char **list, pointer *optlist);
 extern _X_EXPORT int
 xf86SetVerbosity(int verb);
 extern _X_EXPORT int
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 26c03c6..f563052 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -107,7 +107,7 @@ static int
  * Eval config and modify DeviceVelocityRec accordingly
  */
 static void
-ProcessVelocityConfiguration(DeviceIntPtr pDev, char *devname, pointer list,
+ProcessVelocityConfiguration(DeviceIntPtr pDev, const char *devname, pointer list,
                              DeviceVelocityPtr s)
 {
     int tempi;
@@ -661,7 +661,7 @@ MergeInputClasses(const InputInfoPtr idev, const InputAttributes * attrs)
         /* Collect class options and driver settings */
         classopts = xf86optionListDup(cl->option_lst);
         if (cl->driver) {
-            free(idev->driver);
+            free((void *) idev->driver);
             idev->driver = xstrdup(cl->driver);
             if (!idev->driver) {
                 xf86Msg(X_ERROR, "Failed to allocate memory while merging "
@@ -773,8 +773,8 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
         /* Else the entry wasn't in the xf86InputDevs list (ignore this). */
     }
 
-    free(pInp->driver);
-    free(pInp->name);
+    free((void *) pInp->driver);
+    free((void *) pInp->name);
     xf86optionListFree(pInp->options);
     free(pInp);
 }
@@ -1067,7 +1067,7 @@ xf86CheckMotionEvent4DGA(DeviceIntPtr device, int is_absolute,
 
 #if XFreeXDGA
     ScreenPtr scr = NULL;
-    int idx, i;
+    int idx = 0, i;
 
     /* The evdev driver may not always send all axes across. */
     if (valuator_mask_isset(mask, 0) || valuator_mask_isset(mask, 1)) {
diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
index 258988a..2704766 100644
--- a/hw/xfree86/common/xf86pciBus.c
+++ b/hw/xfree86/common/xf86pciBus.c
@@ -575,7 +575,7 @@ xf86PciProbeDev(DriverPtr drvp)
 }
 
 void
-xf86PciIsolateDevice(char *argument)
+xf86PciIsolateDevice(const char *argument)
 {
     int bus, device, func;
 
@@ -1484,6 +1484,7 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
                        GDevRec * GDev, int *chipset)
 {
     char busnum[8];
+    char *tmp;
 
     pVideo = (struct pci_device *) busData;
 
@@ -1493,8 +1494,9 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
         snprintf(busnum, sizeof(busnum), "%d@%d",
                  pVideo->bus & 0x00ff, pVideo->bus >> 8);
 
-    XNFasprintf(&GDev->busID, "PCI:%s:%d:%d",
+    XNFasprintf(&tmp, "PCI:%s:%d:%d",
                 busnum, pVideo->dev, pVideo->func);
+    GDev->busID = tmp;
 
     GDev->chipID = pVideo->device_id;
     GDev->chipRev = pVideo->revision;
diff --git a/hw/xfree86/common/xf86pciBus.h b/hw/xfree86/common/xf86pciBus.h
index 4972c36..b497a7f 100644
--- a/hw/xfree86/common/xf86pciBus.h
+++ b/hw/xfree86/common/xf86pciBus.h
@@ -36,7 +36,7 @@
 void xf86PciProbe(void);
 Bool xf86PciAddMatchingDev(DriverPtr drvp);
 Bool xf86PciProbeDev(DriverPtr drvp);
-void xf86PciIsolateDevice(char *argument);
+void xf86PciIsolateDevice(const char *argument);
 int xf86PciMatchDriver(char *matches[], int nmatches);
 Bool xf86PciConfigure(void *busData, struct pci_device *pDev);
 void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 33b2b7d..5875a91 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -400,7 +400,7 @@ xf86platformAddDevice(int index)
     DriverPtr drvp = NULL;
     int entity;
     screenLayoutPtr layout;
-    static char *hotplug_driver_name = "modesetting";
+    static const char *hotplug_driver_name = "modesetting";
 
     /* force load the driver for now */
     xf86LoadOneModule(hotplug_driver_name, NULL);
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index d90d1ad..fe13816 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -424,7 +424,7 @@ typedef struct {
     rgb blackColour;
     rgb whiteColour;
     int defaultVisual;
-    char **modes;
+    const char **modes;
     pointer options;
 } DispRec, *DispPtr;
 
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 2347b8e..d70ba28 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -482,7 +482,7 @@ FindModule(const char *module, const char *dirname, const char **subdirlist,
     return name;
 }
 
-char **
+const char **
 LoaderListDirs(const char **subdirlist, const char **patternlist)
 {
     char buf[PATH_MAX + 1];
@@ -490,7 +490,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
     char **elem;
     const char **subdirs;
     const char **s;
-    PatternPtr patterns;
+    PatternPtr patterns = NULL;
     PatternPtr p;
     DIR *d;
     struct dirent *dp;
@@ -571,7 +571,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
     FreePatterns(patterns);
     FreeSubdirs(subdirs);
     FreePathList(pathlist);
-    return ret;
+    return (const char **) ret;
 }
 
 void
diff --git a/hw/xfree86/parser/Module.c b/hw/xfree86/parser/Module.c
index 87ddfc6..243ba91 100644
--- a/hw/xfree86/parser/Module.c
+++ b/hw/xfree86/parser/Module.c
@@ -218,7 +218,7 @@ xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr)
 }
 
 XF86LoadPtr
-xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type,
+xf86addNewLoadDirective(XF86LoadPtr head, const char *name, int type,
                         XF86OptionPtr opts)
 {
     XF86LoadPtr new;
diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h
index 4576ee1..60509dc 100644
--- a/hw/xfree86/parser/configProcs.h
+++ b/hw/xfree86/parser/configProcs.h
@@ -67,7 +67,7 @@ int xf86validateLayout(XF86ConfigPtr p);
 XF86ConfModulePtr xf86parseModuleSection(void);
 void xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr);
 extern _X_EXPORT XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head,
-                                                     char *name, int type,
+                                                     const char *name, int type,
                                                      XF86OptionPtr opts);
 void xf86freeModules(XF86ConfModulePtr ptr);
 
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index 1f66329..0fcf405 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -180,7 +180,7 @@ typedef struct {
     GenericListRec list;
     const char *mon_identifier;
     const char *mon_vendor;
-    const char *mon_modelname;
+    char *mon_modelname;
     int mon_width;              /* in mm */
     int mon_height;             /* in mm */
     XF86ConfModeLinePtr mon_modeline_lst;
@@ -304,7 +304,7 @@ typedef struct {
 
 typedef struct {
     GenericListRec list;
-    const char *identifier;
+    char *identifier;
     const char *driver;
     struct xorg_list match_product;
     struct xorg_list match_vendor;
-- 
1.8.4.4



More information about the xorg-devel mailing list