[PATCH 4/7] Fix gcc -Wwrite-strings warnings in various extensions

Alan Coopersmith alan.coopersmith at oracle.com
Tue Nov 8 12:42:52 PST 2011


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 Xext/security.c      |    4 ++--
 Xext/sync.c          |    4 ++--
 Xext/syncsrv.h       |    4 ++--
 Xext/xtest.c         |    2 +-
 Xi/extinit.c         |    4 ++--
 Xi/xiproperty.c      |    2 +-
 dix/devices.c        |    2 +-
 dix/extension.c      |    8 ++++----
 doc/Xserver-spec.xml |    2 +-
 include/extension.h  |    4 ++--
 include/extinit.h    |    2 +-
 include/extnsionst.h |    4 ++--
 include/input.h      |    4 ++--
 mi/miinitext.c       |    6 +++---
 render/filter.c      |    6 +++---
 render/picturestr.h  |    6 +++---
 16 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/Xext/security.c b/Xext/security.c
index 08d8158..0a63aa2 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -62,7 +62,7 @@ typedef struct {
 } SecurityStateRec;
 
 /* Extensions that untrusted clients shouldn't have access to */
-static char *SecurityTrustedExtensions[] = {
+static const char *SecurityTrustedExtensions[] = {
     "XC-MISC",
     "BIG-REQUESTS",
     "XpExtension",
@@ -98,7 +98,7 @@ static const Mask SecurityClientMask = DixGetAttrAccess;
  */
 
 static void
-SecurityAudit(char *format, ...)
+SecurityAudit(const char *format, ...)
 {
     va_list args;
 
diff --git a/Xext/sync.c b/Xext/sync.c
index 3b257f7..23360f0 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -971,7 +971,7 @@ static int FreeCounter(void *, XID);
 
 pointer
 SyncCreateSystemCounter(
-	char *name,
+	const char *name,
 	CARD64 initial,
 	CARD64 resolution,
 	SyncCounterType counterType,
@@ -1308,7 +1308,7 @@ ProcSyncListSystemCounters(ClientPtr client)
 
     for (i = len = 0; i < SyncNumSystemCounters; i++)
     {
-	char *name = SysCounterList[i]->pSysCounterInfo->name;
+	const char *name = SysCounterList[i]->pSysCounterInfo->name;
 	/* pad to 4 byte boundary */
 	len += pad_to_int32(sz_xSyncSystemCounter + strlen(name));
     }
diff --git a/Xext/syncsrv.h b/Xext/syncsrv.h
index 7ca1fba..2b70773 100644
--- a/Xext/syncsrv.h
+++ b/Xext/syncsrv.h
@@ -66,7 +66,7 @@ typedef enum {
 } SyncCounterType;
 
 typedef struct _SysCounterInfo {
-    char	*name;
+    const char	*name;
     CARD64	resolution;
     CARD64	bracket_greater;
     CARD64	bracket_less;
@@ -118,7 +118,7 @@ typedef union {
 } SyncAwaitUnion;
 
 extern pointer SyncCreateSystemCounter(
-    char *	/* name */,
+    const char */* name */,
     CARD64  	/* inital_value */,
     CARD64  	/* resolution */,
     SyncCounterType /* change characterization */,
diff --git a/Xext/xtest.c b/Xext/xtest.c
index b69de35..bd8e1d3 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -603,7 +603,7 @@ DeviceSetXTestProperty(DeviceIntPtr dev, Atom property,
  * This only creates the pair, Activate/Enable Device
  * still need to be called.
  */
-int AllocXTestDevice (ClientPtr client, char* name,
+int AllocXTestDevice (ClientPtr client, const char* name,
                      DeviceIntPtr* ptr, DeviceIntPtr* keybd,
                      DeviceIntPtr master_ptr, DeviceIntPtr master_keybd)
 {
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 7724f5f..a2c807b 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -162,7 +162,7 @@ Mask ExtExclusiveMasks[EMASKSIZE];
 static struct dev_type
 {
     Atom type;
-    char *name;
+    const char *name;
 } dev_type[] = {
     {
     0, XI_KEYBOARD}, {
@@ -1127,7 +1127,7 @@ IResetProc(ExtensionEntry * unused)
  */
 
 void
-AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
+AssignTypeAndName(DeviceIntPtr dev, Atom type, const char *name)
 {
     dev->xinput_type = type;
     dev->name = strdup(name);
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index f726030..88de119 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -48,7 +48,7 @@
 static struct dev_properties
 {
     Atom type;
-    char *name;
+    const char *name;
 } dev_properties[] = {
     {0, XI_PROP_ENABLED},
     {0, XI_PROP_XTEST_DEVICE},
diff --git a/dix/devices.c b/dix/devices.c
index da817a8..37cbcdb 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2554,7 +2554,7 @@ GetMaster(DeviceIntPtr dev, int which)
  * the value for master.
  */
 int
-AllocDevicePair (ClientPtr client, char* name,
+AllocDevicePair (ClientPtr client, const char* name,
                  DeviceIntPtr* ptr,
                  DeviceIntPtr* keybd,
                  DeviceProc ptr_proc,
diff --git a/dix/extension.c b/dix/extension.c
index c7bbac5..53aaf05 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -71,7 +71,7 @@ static int lastError = FirstExtensionError;
 static unsigned int NumExtensions = 0;
 
 ExtensionEntry *
-AddExtension(char *name, int NumEvents, int NumErrors, 
+AddExtension(const char *name, int NumEvents, int NumErrors,
 	     int (*MainProc)(ClientPtr c1), 
 	     int (*SwappedMainProc)(ClientPtr c2), 
 	     void (*CloseDownProc)(ExtensionEntry *e), 
@@ -151,7 +151,7 @@ AddExtension(char *name, int NumEvents, int NumErrors,
     return ext;
 }
 
-Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
+Bool AddExtensionAlias(const char *alias, ExtensionEntry *ext)
 {
     char *name;
     char **aliases;
@@ -172,7 +172,7 @@ Bool AddExtensionAlias(char *alias, ExtensionEntry *ext)
 }
 
 static int
-FindExtension(char *extname, int len)
+FindExtension(const char *extname, int len)
 {
     int i, j;
 
@@ -201,7 +201,7 @@ CheckExtension(const char *extname)
 {
     int n;
 
-    n = FindExtension((char*)extname, strlen(extname));
+    n = FindExtension(extname, strlen(extname));
     if (n != -1)
 	return extensions[n];
     else
diff --git a/doc/Xserver-spec.xml b/doc/Xserver-spec.xml
index 2bf4fb3..ab1c861 100644
--- a/doc/Xserver-spec.xml
+++ b/doc/Xserver-spec.xml
@@ -565,7 +565,7 @@ should be called by InitExtensions.
 	ExtensionEntry *AddExtension(name, NumEvents,NumErrors,
 		MainProc, SwappedMainProc, CloseDownProc, MinorOpcodeProc)
 
-		char *name;  /*Null terminate string; case matters*/
+		const char *name;  /*Null terminate string; case matters*/
 		int NumEvents;
 		int NumErrors;
 		int (* MainProc)(ClientPtr);/*Called if client matches server order*/
diff --git a/include/extension.h b/include/extension.h
index 29a11c3..ee6260e 100644
--- a/include/extension.h
+++ b/include/extension.h
@@ -54,9 +54,9 @@ extern _X_EXPORT unsigned short StandardMinorOpcode(ClientPtr /*client*/);
 
 extern _X_EXPORT unsigned short MinorOpcodeOfRequest(ClientPtr /*client*/);
 
-extern _X_EXPORT Bool EnableDisableExtension(char *name, Bool enable);
+extern _X_EXPORT Bool EnableDisableExtension(const char *name, Bool enable);
 
-extern _X_EXPORT void EnableDisableExtensionError(char *name, Bool enable);
+extern _X_EXPORT void EnableDisableExtensionError(const char *name, Bool enable);
 
 extern _X_EXPORT void InitExtensions(int argc, char **argv);
 
diff --git a/include/extinit.h b/include/extinit.h
index c3aa7b6..8e47beb 100644
--- a/include/extinit.h
+++ b/include/extinit.h
@@ -41,7 +41,7 @@ extern _X_EXPORT void
 AssignTypeAndName (
 	DeviceIntPtr           /* dev */,
 	Atom                   /* type */,
-	char *                 /* name */
+	const char *           /* name */
 	);
 
 #endif /* EXTINIT_H */
diff --git a/include/extnsionst.h b/include/extnsionst.h
index bb66dfb..aeefa99 100644
--- a/include/extnsionst.h
+++ b/include/extnsionst.h
@@ -92,7 +92,7 @@ extern _X_EXPORT void NotImplemented (	/* FIXME: this may move to another file..
 #define    GetGCValue(pGC, GCElement)    (pGC->GCElement)
 
 extern _X_EXPORT ExtensionEntry *AddExtension(
-    char* /*name*/,
+    const char* /*name*/,
     int /*NumEvents*/,
     int /*NumErrors*/,
     int (* /*MainProc*/)(ClientPtr /*client*/),
@@ -102,7 +102,7 @@ extern _X_EXPORT ExtensionEntry *AddExtension(
 );
 
 extern _X_EXPORT Bool AddExtensionAlias(
-    char* /*alias*/,
+    const char* /*alias*/,
     ExtensionEntry * /*extension*/);
 
 extern _X_EXPORT ExtensionEntry *CheckExtension(const char *extname);
diff --git a/include/input.h b/include/input.h
index 5dd5c1b..c0a2967 100644
--- a/include/input.h
+++ b/include/input.h
@@ -505,7 +505,7 @@ extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd);
 extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type);
 
 extern _X_EXPORT int AllocDevicePair(ClientPtr client,
-                             char* name,
+                             const char* name,
                              DeviceIntPtr* ptr,
                              DeviceIntPtr* keybd,
                              DeviceProc ptr_proc,
@@ -521,7 +521,7 @@ extern _X_EXPORT int generate_modkeymap(ClientPtr client, DeviceIntPtr dev,
 extern int change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *map,
                          int max_keys_per_mod);
 extern int AllocXTestDevice(ClientPtr client,
-                             char* name,
+                             const char* name,
                              DeviceIntPtr* ptr,
                              DeviceIntPtr* keybd,
                              DeviceIntPtr master_ptr,
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 4499f37..8836992 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -268,7 +268,7 @@ extern void GEExtensionInit(INITARGS);
  * configurable extensions.
  */
 typedef struct {
-    char *name;
+    const char *name;
     Bool *disablePtr;
 } ExtensionToggle;
 
@@ -337,7 +337,7 @@ static ExtensionToggle ExtensionToggleList[] =
     { NULL, NULL }
 };
 
-Bool EnableDisableExtension(char *name, Bool enable)
+Bool EnableDisableExtension(const char *name, Bool enable)
 {
     ExtensionToggle *ext = &ExtensionToggleList[0];
 
@@ -357,7 +357,7 @@ Bool EnableDisableExtension(char *name, Bool enable)
     return FALSE;
 }
 
-void EnableDisableExtensionError(char *name, Bool enable)
+void EnableDisableExtensionError(const char *name, Bool enable)
 {
     ExtensionToggle *ext = &ExtensionToggleList[0];
     Bool found = FALSE;
diff --git a/render/filter.c b/render/filter.c
index 8bb6d5e..0cbd47b 100644
--- a/render/filter.c
+++ b/render/filter.c
@@ -47,7 +47,7 @@ static int  nfilterNames;
  */
 
 int
-PictureGetFilterId (char *filter, int len, Bool makeit)
+PictureGetFilterId (const char *filter, int len, Bool makeit)
 {
     int	    i;
     char    *name;
@@ -125,7 +125,7 @@ PictureFreeFilterIds (void)
 
 int
 PictureAddFilter (ScreenPtr			    pScreen,
-		  char				    *filter,
+		  const char			    *filter,
 		  PictFilterValidateParamsProcPtr   ValidateParams,
 		  int				    width,
 		  int				    height)
@@ -160,7 +160,7 @@ PictureAddFilter (ScreenPtr			    pScreen,
 }
 
 Bool
-PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias)
+PictureSetFilterAlias (ScreenPtr pScreen, const char *filter, const char *alias)
 {
     PictureScreenPtr    ps = GetPictureScreen(pScreen);
     int			filter_id = PictureGetFilterId (filter, -1, FALSE);
diff --git a/render/picturestr.h b/render/picturestr.h
index 1f3f5a4..9b37671 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -433,20 +433,20 @@ extern _X_EXPORT Bool
 PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
 
 extern _X_EXPORT int
-PictureGetFilterId (char *filter, int len, Bool makeit);
+PictureGetFilterId (const char *filter, int len, Bool makeit);
 
 extern _X_EXPORT char *
 PictureGetFilterName (int id);
 
 extern _X_EXPORT int
 PictureAddFilter (ScreenPtr			    pScreen,
-		  char				    *filter,
+		  const char			    *filter,
 		  PictFilterValidateParamsProcPtr   ValidateParams,
 		  int				    width,
 		  int				    height);
 
 extern _X_EXPORT Bool
-PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias);
+PictureSetFilterAlias (ScreenPtr pScreen, const char *filter, const char *alias);
 
 extern _X_EXPORT Bool
 PictureSetDefaultFilters (ScreenPtr pScreen);
-- 
1.7.3.2



More information about the xorg-devel mailing list