[PATCH 1/4] Accesses to GC ops and funcs through a GCPtr are read-only.

Jamey Sharp jamey at minilop.net
Tue Jul 13 15:55:38 PDT 2010


Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
 Xext/panoramiX.c                       |    2 +-
 exa/exa.c                              |    4 ++--
 exa/exa_priv.h                         |    6 +++---
 fb/fbgc.c                              |    4 ++--
 hw/dmx/dmxgc.h                         |    4 ++--
 hw/xfree86/common/xf86VGAarbiterPriv.h |    4 ++--
 hw/xfree86/shadowfb/shadow.c           |    6 +++---
 hw/xfree86/xaa/xaalocal.h              |    4 ++--
 hw/xfree86/xaa/xaawrap.h               |    6 +++---
 hw/xwin/wingc.c                        |    4 ++--
 include/gcstruct.h                     |    4 ++--
 miext/cw/cw.h                          |    4 ++--
 miext/damage/damage.c                  |    2 +-
 miext/damage/damagestr.h               |    4 ++--
 14 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index b73c53f..58282d2 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -111,7 +111,7 @@ static DevPrivateKeyRec PanoramiXScreenKeyRec;
 typedef struct {
   DDXPointRec clipOrg;
   DDXPointRec patOrg;
-  GCFuncs *wrapFuncs;
+  const GCFuncs *wrapFuncs;
 } PanoramiXGCRec, *PanoramiXGCPtr;
 
 typedef struct {
diff --git a/exa/exa.c b/exa/exa.c
index fc15c24..1242c41 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -634,8 +634,8 @@ exaCreateGC (GCPtr pGC)
 
     swap(pExaScr, pScreen, CreateGC);
     if ((ret = (*pScreen->CreateGC) (pGC))) {
-	wrap(pExaGC, pGC, funcs, (GCFuncs *) &exaGCFuncs);
-	wrap(pExaGC, pGC, ops, (GCOps *) &exaOps);
+	wrap(pExaGC, pGC, funcs, &exaGCFuncs);
+	wrap(pExaGC, pGC, ops, &exaOps);
     }
     swap(pExaScr, pScreen, CreateGC);
 
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index e5d90d4..8e8f668 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -247,7 +247,7 @@ extern DevPrivateKeyRec exaGCPrivateKeyRec;
 }
 
 #define swap(priv, real, mem) {\
-    void *tmp = priv->Saved##mem; \
+    const void *tmp = priv->Saved##mem; \
     priv->Saved##mem = real->mem; \
     real->mem = tmp; \
 }
@@ -332,8 +332,8 @@ typedef struct {
 
 typedef struct {
     /* GC values from the layer below. */
-    GCOps *Savedops;
-    GCFuncs *Savedfuncs;
+    const GCOps *Savedops;
+    const GCFuncs *Savedfuncs;
 } ExaGCPrivRec, *ExaGCPrivPtr;
 
 typedef struct {
diff --git a/fb/fbgc.c b/fb/fbgc.c
index b27a030..43150c7 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -64,8 +64,8 @@ const GCOps	fbGCOps = {
 Bool
 fbCreateGC(GCPtr pGC)
 {
-    pGC->ops = (GCOps *) &fbGCOps;
-    pGC->funcs = (GCFuncs *) &fbGCFuncs;
+    pGC->ops = &fbGCOps;
+    pGC->funcs = &fbGCFuncs;
 
     /* fb wants to translate before scan conversion */
     pGC->miTranslate = 1;
diff --git a/hw/dmx/dmxgc.h b/hw/dmx/dmxgc.h
index 4ff3cd8..6598d2a 100644
--- a/hw/dmx/dmxgc.h
+++ b/hw/dmx/dmxgc.h
@@ -41,8 +41,8 @@
 
 /** GC private area. */
 typedef struct _dmxGCPriv {
-    GCOps   *ops;
-    GCFuncs *funcs;
+    const GCOps   *ops;
+    const GCFuncs *funcs;
     XlibGC   gc;
     Bool     msc;
 } dmxGCPrivRec, *dmxGCPrivPtr;
diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h
index 9b4a597..28e5002 100644
--- a/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -143,8 +143,8 @@ typedef struct _VGAarbiterScreen {
 } VGAarbiterScreenRec, *VGAarbiterScreenPtr;
 
 typedef struct _VGAarbiterGC {
-    GCOps                       *wrapOps;
-    GCFuncs                     *wrapFuncs;
+    const GCOps                 *wrapOps;
+    const GCFuncs               *wrapFuncs;
 } VGAarbiterGCRec, *VGAarbiterGCPtr;
 
 /* Screen funcs */
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index 0af53d1..151e595 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -80,8 +80,8 @@ typedef struct {
 } ShadowScreenRec, *ShadowScreenPtr;
 
 typedef struct {
-   GCOps   *ops;
-   GCFuncs *funcs;
+   const GCOps   *ops;
+   const GCFuncs *funcs;
 } ShadowGCRec, *ShadowGCPtr;
 
 static DevPrivateKeyRec ShadowScreenKeyRec;
@@ -112,7 +112,7 @@ static DevPrivateKeyRec ShadowGCKeyRec;
 #define SHADOW_GC_OP_PROLOGUE(pGC)\
     ShadowScreenPtr pPriv = GET_SCREEN_PRIVATE(pGC->pScreen); \
     ShadowGCPtr pGCPriv = GET_GC_PRIVATE(pGC);\
-    GCFuncs *oldFuncs = pGC->funcs;\
+    const GCFuncs *oldFuncs = pGC->funcs;\
     pGC->funcs = pGCPriv->funcs;\
     pGC->ops = pGCPriv->ops
 
diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h
index a9a70da..054f1de 100644
--- a/hw/xfree86/xaa/xaalocal.h
+++ b/hw/xfree86/xaa/xaalocal.h
@@ -61,8 +61,8 @@ typedef struct _XAAScreen {
 #define OPS_ARE_ACCEL		0x00000002
 
 typedef struct _XAAGC {
-    GCOps 	*wrapOps;
-    GCFuncs 	*wrapFuncs;
+    const GCOps *wrapOps;
+    const GCFuncs *wrapFuncs;
     GCOps 	*XAAOps;
     int		DashLength;
     unsigned char* DashPattern;
diff --git a/hw/xfree86/xaa/xaawrap.h b/hw/xfree86/xaa/xaawrap.h
index 3f3c261..d824eb9 100644
--- a/hw/xfree86/xaa/xaawrap.h
+++ b/hw/xfree86/xaa/xaawrap.h
@@ -25,13 +25,13 @@
 
 #define XAA_GC_OP_PROLOGUE(pGC)\
     XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
-    GCFuncs *oldFuncs = pGC->funcs;\
+    const GCFuncs *oldFuncs = pGC->funcs;\
     pGC->funcs = pGCPriv->wrapFuncs;\
     pGC->ops = pGCPriv->wrapOps
 
 #define XAA_GC_OP_PROLOGUE_WITH_RETURN(pGC)\
     XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
-    GCFuncs *oldFuncs = pGC->funcs;\
+    const GCFuncs *oldFuncs = pGC->funcs;\
     if(!RegionNumRects(pGC->pCompositeClip)) return; \
     pGC->funcs = pGCPriv->wrapFuncs;\
     pGC->ops = pGCPriv->wrapOps
@@ -46,7 +46,7 @@
 #define XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw)\
     XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&(pGC)->devPrivates, XAAGetGCKey()); \
     XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDraw));\
-    GCFuncs *oldFuncs = pGC->funcs;\
+    const GCFuncs *oldFuncs = pGC->funcs;\
     pGC->funcs = pGCPriv->wrapFuncs;\
     pGC->ops = pGCPriv->wrapOps; \
     SYNC_CHECK(pGC)
diff --git a/hw/xwin/wingc.c b/hw/xwin/wingc.c
index e351c50..1ec8105 100644
--- a/hw/xwin/wingc.c
+++ b/hw/xwin/wingc.c
@@ -137,8 +137,8 @@ winCreateGCNativeGDI (GCPtr pGC)
 	  pGC->depth);
 #endif
 
-  pGC->ops = (GCOps *) &winGCOps;
-  pGC->funcs = (GCFuncs *) &winGCFuncs;
+  pGC->ops = &winGCOps;
+  pGC->funcs = &winGCFuncs;
 
   /* We want all coordinates passed to spans functions to be screen relative */
   pGC->miTranslate = TRUE;
diff --git a/include/gcstruct.h b/include/gcstruct.h
index 4fea02c..855ca9f 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -306,8 +306,8 @@ typedef struct _GC {
     pointer		clientClip;
     unsigned long	stateChanges;	/* masked with GC_<kind> */
     unsigned long       serialNumber;
-    GCFuncs		*funcs;
-    GCOps		*ops;
+    const GCFuncs	*funcs;
+    const GCOps		*ops;
     PrivateRec		*devPrivates;
     /*
      * The following were moved here from private storage to allow device-
diff --git a/miext/cw/cw.h b/miext/cw/cw.h
index 31eb9e5..f0b1043 100644
--- a/miext/cw/cw.h
+++ b/miext/cw/cw.h
@@ -40,8 +40,8 @@ typedef struct {
 				     * backing pixmap. */
     unsigned long   serialNumber;   /* clientClip computed time */
     unsigned long   stateChanges;   /* changes in parent gc since last copy */
-    GCOps	    *wrapOps;	    /* wrapped ops */
-    GCFuncs	    *wrapFuncs;	    /* wrapped funcs */
+    const GCOps     *wrapOps;       /* wrapped ops */
+    const GCFuncs   *wrapFuncs;     /* wrapped funcs */
 } cwGCRec, *cwGCPtr;
 
 extern _X_EXPORT DevPrivateKeyRec cwGCKeyRec;
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index 2ea5e63..6b4c8ac 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -463,7 +463,7 @@ damageCreateGC(GCPtr pGC)
 
 #define DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable) \
     damageGCPriv(pGC);  \
-    GCFuncs *oldFuncs = pGC->funcs; \
+    const GCFuncs *oldFuncs = pGC->funcs; \
     unwrap(pGCPriv, pGC, funcs);  \
     unwrap(pGCPriv, pGC, ops); \
 
diff --git a/miext/damage/damagestr.h b/miext/damage/damagestr.h
index b224958..16b6797 100644
--- a/miext/damage/damagestr.h
+++ b/miext/damage/damagestr.h
@@ -79,8 +79,8 @@ typedef struct _damageScrPriv {
 } DamageScrPrivRec, *DamageScrPrivPtr;
 
 typedef struct _damageGCPriv {
-    GCOps   *ops;
-    GCFuncs *funcs;
+    const GCOps   *ops;
+    const GCFuncs *funcs;
 } DamageGCPrivRec, *DamageGCPrivPtr;
 
 /* XXX should move these into damage.c, damageScrPrivateIndex is static */
-- 
1.7.0



More information about the xorg-devel mailing list