[PATCH 14/25] CompareISOLatin1Lowered: constify arguments

Alan Coopersmith alan.coopersmith at oracle.com
Sun Dec 11 10:16:27 PST 2011


Allows callers to avoid deconstifying arguments when calling, fixing
gcc warning:

filter.c: In function 'PictureGetFilterId':
filter.c:59:2: warning: cast discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 dix/dixutils.c  |    4 ++--
 include/dix.h   |    4 ++--
 render/filter.c |    3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dix/dixutils.c b/dix/dixutils.c
index 1e31346..00bbde6 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -167,8 +167,8 @@ ISOLatin1ToLower (unsigned char source)
 
 
 int
-CompareISOLatin1Lowered(unsigned char *s1, int s1len, 
-			unsigned char *s2, int s2len)
+CompareISOLatin1Lowered(const unsigned char *s1, int s1len,
+			const unsigned char *s2, int s2len)
 {
     unsigned char   c1, c2;
     
diff --git a/include/dix.h b/include/dix.h
index cfbfa1f..2d8d315 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -175,9 +175,9 @@ extern _X_HIDDEN Bool CreateConnectionBlock(void);
 /* dixutils.c */
 
 extern _X_EXPORT int CompareISOLatin1Lowered(
-    unsigned char * /*a*/,
+    const unsigned char * /*a*/,
     int alen,
-    unsigned char * /*b*/,
+    const unsigned char * /*b*/,
     int blen);
 
 extern _X_EXPORT int dixLookupWindow(
diff --git a/render/filter.c b/render/filter.c
index 0cbd47b..c513ee8 100644
--- a/render/filter.c
+++ b/render/filter.c
@@ -56,7 +56,8 @@ PictureGetFilterId (const char *filter, int len, Bool makeit)
     if (len < 0)
 	len = strlen (filter);
     for (i = 0; i < nfilterNames; i++)
-	if (!CompareISOLatin1Lowered ((unsigned char *) filterNames[i], -1, (unsigned char *) filter, len))
+	if (!CompareISOLatin1Lowered ((const unsigned char *) filterNames[i], -1,
+				      (const unsigned char *) filter, len))
 	    return i;
     if (!makeit)
 	return -1;
-- 
1.7.3.2



More information about the xorg-devel mailing list