From 5193f25ea33eed31d6a75cdc1a86427c23d8033c Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Sat, 8 May 2010 19:08:47 -0700 Subject: [PATCH] Define GCAllBits as the union of all valid CreateGC masks. Signed-off-by: Jamey Sharp Reviewed-by: Keith Packard --- dix/gc.c | 8 ++++---- include/gcstruct.h | 2 ++ miext/cw/cw.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dix/gc.c b/dix/gc.c index 1f2d4d05b..43d16db4d 100644 --- a/dix/gc.c +++ b/dix/gc.c @@ -424,7 +424,7 @@ ChangeGCXIDs(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32) { ChangeGCVal vals[GCLastBit + 1]; int i; - if (mask & ~((1 << (GCLastBit + 1)) - 1)) + if (mask & ~GCAllBits) { clientErrorValue = mask; return BadValue; @@ -534,7 +534,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus, if (*pStatus != Success) goto out; - pGC->stateChanges = (1 << (GCLastBit+1)) - 1; + pGC->stateChanges = GCAllBits; if (!(*pGC->pScreen->CreateGC)(pGC)) *pStatus = BadAlloc; else if (mask) @@ -837,7 +837,7 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth) pGC->lastWinOrg.x = 0; pGC->lastWinOrg.y = 0; - pGC->stateChanges = (1 << (GCLastBit+1)) - 1; + pGC->stateChanges = GCAllBits; if (!(*pScreen->CreateGC)(pGC)) { FreeGC(pGC, (XID)0); @@ -1118,7 +1118,7 @@ GetScratchGC(unsigned depth, ScreenPtr pScreen) pGC->clipOrg.y = 0; if (pGC->clientClipType != CT_NONE) (*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0); - pGC->stateChanges = (1 << (GCLastBit+1)) - 1; + pGC->stateChanges = GCAllBits; return pGC; } /* if we make it this far, need to roll our own */ diff --git a/include/gcstruct.h b/include/gcstruct.h index 8d9b05575..b9fc5cace 100644 --- a/include/gcstruct.h +++ b/include/gcstruct.h @@ -59,6 +59,8 @@ SOFTWARE. #include "privates.h" #include +#define GCAllBits ((1 << (GCLastBit + 1)) - 1) + /* * functions which modify the state of the GC */ diff --git a/miext/cw/cw.c b/miext/cw/cw.c index 460862f5f..2d8fd12cf 100644 --- a/miext/cw/cw.c +++ b/miext/cw/cw.c @@ -129,7 +129,7 @@ cwCreateBackingGC(GCPtr pGC, DrawablePtr pDrawable) return FALSE; pPriv->serialNumber = 0; - pPriv->stateChanges = (1 << (GCLastBit + 1)) - 1; + pPriv->stateChanges = GCAllBits; return TRUE; }