From 46eeeec810a53ed7c3e46cbf6d5495adf07ce869 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 16 Feb 2024 17:25:29 +0100 Subject: [PATCH] fix name clash on 'GC' between Xlib and Xserver Both xlib as well as the Xserver use the same identifier "GC" for different types. While on xlib it's just the numerical ID of a GC, the xserver defines a struct for it by the same name. This is this ugly and needs ridiculous hacks for Xserver code that needs xlib. Easy to solve by just renaming the GC typedef to GCRec (consistent with how we're naming other structs) and replacing GC* by GCPtr. Signed-off-by: Enrico Weigelt, metux IT consult --- dix/closestr.h | 4 +-- dix/dispatch.c | 44 +++++++++++++------------- dix/dixfonts.c | 10 +++--- dix/dixutils.c | 2 +- dix/gc.c | 10 +++--- dix/privates.c | 2 +- hw/xfree86/common/xf86VGAarbiter.c | 4 +-- hw/xfree86/common/xf86VGAarbiterPriv.h | 4 +-- include/gcstruct.h | 2 +- mi/miglblt.c | 4 +-- miext/damage/damage.c | 4 +-- 11 files changed, 45 insertions(+), 45 deletions(-) diff --git a/dix/closestr.h b/dix/closestr.h index 60e6f09bc..c4a981b46 100644 --- a/dix/closestr.h +++ b/dix/closestr.h @@ -99,7 +99,7 @@ typedef struct _LFclosure { typedef struct _PTclosure { ClientPtr client; DrawablePtr pDraw; - GC *pGC; + GCPtr pGC; unsigned char *pElt; unsigned char *endReq; unsigned char *data; @@ -115,7 +115,7 @@ typedef struct _PTclosure { typedef struct _ITclosure { ClientPtr client; DrawablePtr pDraw; - GC *pGC; + GCPtr pGC; BYTE nChars; unsigned char *data; int xorg; diff --git a/dix/dispatch.c b/dix/dispatch.c index 5f1c77026..de372ca0c 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1545,7 +1545,7 @@ int ProcCreateGC(ClientPtr client) { int error, rc; - GC *pGC; + GCPtr pGC; DrawablePtr pDraw; unsigned len; @@ -1562,7 +1562,7 @@ ProcCreateGC(ClientPtr client) len = client->req_len - bytes_to_int32(sizeof(xCreateGCReq)); if (len != Ones(stuff->mask)) return BadLength; - pGC = (GC *) CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error, + pGC = (GCPtr) CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error, stuff->gc, client); if (error != Success) return error; @@ -1574,7 +1574,7 @@ ProcCreateGC(ClientPtr client) int ProcChangeGC(ClientPtr client) { - GC *pGC; + GCPtr pGC; int result; unsigned len; @@ -1595,8 +1595,8 @@ ProcChangeGC(ClientPtr client) int ProcCopyGC(ClientPtr client) { - GC *dstGC; - GC *pGC; + GCPtr dstGC; + GCPtr pGC; int result; REQUEST(xCopyGCReq); @@ -1620,7 +1620,7 @@ ProcCopyGC(ClientPtr client) int ProcSetDashes(ClientPtr client) { - GC *pGC; + GCPtr pGC; int result; REQUEST(xSetDashesReq); @@ -1646,7 +1646,7 @@ int ProcSetClipRectangles(ClientPtr client) { int nr, result; - GC *pGC; + GCPtr pGC; REQUEST(xSetClipRectanglesReq); @@ -1671,7 +1671,7 @@ ProcSetClipRectangles(ClientPtr client) int ProcFreeGC(ClientPtr client) { - GC *pGC; + GCPtr pGC; int rc; REQUEST(xResourceReq); @@ -1761,7 +1761,7 @@ ProcCopyArea(ClientPtr client) { DrawablePtr pDst; DrawablePtr pSrc; - GC *pGC; + GCPtr pGC; REQUEST(xCopyAreaReq); RegionPtr pRgn; @@ -1799,7 +1799,7 @@ int ProcCopyPlane(ClientPtr client) { DrawablePtr psrcDraw, pdstDraw; - GC *pGC; + GCPtr pGC; REQUEST(xCopyPlaneReq); RegionPtr pRgn; @@ -1845,7 +1845,7 @@ int ProcPolyPoint(ClientPtr client) { int npoint; - GC *pGC; + GCPtr pGC; DrawablePtr pDraw; REQUEST(xPolyPointReq); @@ -1868,7 +1868,7 @@ int ProcPolyLine(ClientPtr client) { int npoint; - GC *pGC; + GCPtr pGC; DrawablePtr pDraw; REQUEST(xPolyLineReq); @@ -1891,7 +1891,7 @@ int ProcPolySegment(ClientPtr client) { int nsegs; - GC *pGC; + GCPtr pGC; DrawablePtr pDraw; REQUEST(xPolySegmentReq); @@ -1911,7 +1911,7 @@ int ProcPolyRectangle(ClientPtr client) { int nrects; - GC *pGC; + GCPtr pGC; DrawablePtr pDraw; REQUEST(xPolyRectangleReq); @@ -1932,7 +1932,7 @@ int ProcPolyArc(ClientPtr client) { int narcs; - GC *pGC; + GCPtr pGC; DrawablePtr pDraw; REQUEST(xPolyArcReq); @@ -1952,7 +1952,7 @@ int ProcFillPoly(ClientPtr client) { int things; - GC *pGC; + GCPtr pGC; DrawablePtr pDraw; REQUEST(xFillPolyReq); @@ -1982,7 +1982,7 @@ int ProcPolyFillRectangle(ClientPtr client) { int things; - GC *pGC; + GCPtr pGC; DrawablePtr pDraw; REQUEST(xPolyFillRectangleReq); @@ -2004,7 +2004,7 @@ int ProcPolyFillArc(ClientPtr client) { int narcs; - GC *pGC; + GCPtr pGC; DrawablePtr pDraw; REQUEST(xPolyFillArcReq); @@ -2077,7 +2077,7 @@ ReformatImage(char *base, int nbytes, int bpp, int order) int ProcPutImage(ClientPtr client) { - GC *pGC; + GCPtr pGC; DrawablePtr pDraw; long length; /* length of scanline server padded */ long lengthProto; /* length of scanline protocol padded */ @@ -2346,7 +2346,7 @@ ProcPolyText(ClientPtr client) REQUEST(xPolyTextReq); DrawablePtr pDraw; - GC *pGC; + GCPtr pGC; REQUEST_AT_LEAST_SIZE(xPolyTextReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); @@ -2370,7 +2370,7 @@ ProcImageText8(ClientPtr client) { int err; DrawablePtr pDraw; - GC *pGC; + GCPtr pGC; REQUEST(xImageTextReq); @@ -2396,7 +2396,7 @@ ProcImageText16(ClientPtr client) { int err; DrawablePtr pDraw; - GC *pGC; + GCPtr pGC; REQUEST(xImageTextReq); diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 25c5ad0ce..c2275d0bb 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -1102,7 +1102,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) int err = Success, lgerr; /* err is in X error, not font error, space */ enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT; FontPathElementPtr fpe; - GC *origGC = NULL; + GCPtr origGC = NULL; int itemSize = c->reqType == X_PolyText8 ? 1 : 2; if (client->clientGone) { @@ -1212,7 +1212,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) if (lgerr == Suspended) { if (!ClientIsAsleep(client)) { int len; - GC *pGC; + GCPtr pGC; PTclosurePtr new_closure; /* We're putting the client to sleep. We need to do a few things @@ -1357,7 +1357,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) } int -PolyText(ClientPtr client, DrawablePtr pDraw, GC * pGC, unsigned char *pElt, +PolyText(ClientPtr client, DrawablePtr pDraw, GCPtr pGC, unsigned char *pElt, unsigned char *endReq, int xorg, int yorg, int reqType, XID did) { PTclosureRec local_closure = { @@ -1412,7 +1412,7 @@ doImageText(ClientPtr client, ITclosurePtr c) lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, itemSize, c->data); if (lgerr == Suspended) { if (!ClientIsAsleep(client)) { - GC *pGC; + GCPtr pGC; unsigned char *data; ITclosurePtr old_closure; @@ -1505,7 +1505,7 @@ doImageText(ClientPtr client, ITclosurePtr c) } int -ImageText(ClientPtr client, DrawablePtr pDraw, GC * pGC, int nChars, +ImageText(ClientPtr client, DrawablePtr pDraw, GCPtr pGC, int nChars, unsigned char *data, int xorg, int yorg, int reqType, XID did) { ITclosureRec local_closure; diff --git a/dix/dixutils.c b/dix/dixutils.c index 877d76a90..066ed0586 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -202,7 +202,7 @@ int dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access) { int rc; - GC *pGC; + GCPtr pGC; client->errorValue = id; /* EITHER font or gc */ rc = dixLookupResourceByType((void **) pFont, id, X11_RESTYPE_FONT, client, diff --git a/dix/gc.c b/dix/gc.c index 0ea8009fa..53888f514 100644 --- a/dix/gc.c +++ b/dix/gc.c @@ -73,7 +73,7 @@ static Bool CreateDefaultTile(GCPtr pGC); static unsigned char DefaultDash[2] = { 4, 4 }; void -ValidateGC(DrawablePtr pDraw, GC * pGC) +ValidateGC(DrawablePtr pDraw, GCPtr pGC) { (*pGC->funcs->ValidateGC) (pGC, pGC->stateChanges, pDraw); pGC->stateChanges = 0; @@ -121,7 +121,7 @@ ValidateGC(DrawablePtr pDraw, GC * pGC) _var = (_type)pUnion->ptr; pUnion++; } int -ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion) +ChangeGC(ClientPtr client, GCPtr pGC, BITS32 mask, ChangeGCValPtr pUnion) { BITS32 index2; int error = 0; @@ -427,7 +427,7 @@ static const struct { }; int -ChangeGCXIDs(ClientPtr client, GC * pGC, BITS32 mask, CARD32 *pC32) +ChangeGCXIDs(ClientPtr client, GCPtr pGC, BITS32 mask, CARD32 *pC32) { ChangeGCVal vals[GCLastBit + 1]; int i; @@ -464,7 +464,7 @@ NewGCObject(ScreenPtr pScreen, int depth) { GCPtr pGC; - pGC = dixAllocateScreenObjectWithPrivates(pScreen, GC, PRIVATE_GC); + pGC = dixAllocateScreenObjectWithPrivates(pScreen, GCRec, PRIVATE_GC); if (!pGC) { return (GCPtr) NULL; } @@ -612,7 +612,7 @@ CreateDefaultTile(GCPtr pGC) } int -CopyGC(GC * pgcSrc, GC * pgcDst, BITS32 mask) +CopyGC(GCPtr pgcSrc, GCPtr pgcDst, BITS32 mask) { BITS32 index2; BITS32 maskQ; diff --git a/dix/privates.c b/dix/privates.c index 8f025e239..72cda714f 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -564,7 +564,7 @@ static const int offsets[] = { -1, /* X11_RESTYPE_NONE */ offsetof(WindowRec, devPrivates), /* X11_RESTYPE_WINDOW */ offsetof(PixmapRec, devPrivates), /* X11_RESTYPE_PIXMAP */ - offsetof(GC, devPrivates), /* X11_RESTYPE_GC */ + offsetof(GCRec, devPrivates), /* X11_RESTYPE_GC */ -1, /* X11_RESTYPE_FONT */ offsetof(CursorRec, devPrivates), /* X11_RESTYPE_CURSOR */ offsetof(ColormapRec, devPrivates), /* X11_RESTYPE_COLORMAP */ diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c index 7c86621f3..448c72b4f 100644 --- a/hw/xfree86/common/xf86VGAarbiter.c +++ b/hw/xfree86/common/xf86VGAarbiter.c @@ -601,7 +601,7 @@ VGAarbiterDestroyClip(GCPtr pGC) /* GC Ops */ static void VGAarbiterFillSpans(DrawablePtr pDraw, - GC * pGC, + GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted) { @@ -650,7 +650,7 @@ VGAarbiterPutImage(DrawablePtr pDraw, static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst, - GC * pGC, + GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h index 03db55700..573afd8d9 100644 --- a/hw/xfree86/common/xf86VGAarbiterPriv.h +++ b/hw/xfree86/common/xf86VGAarbiterPriv.h @@ -202,7 +202,7 @@ static void VGAarbiterDestroyClip(GCPtr pGC); static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc); /* GC ops */ -static void VGAarbiterFillSpans(DrawablePtr pDraw, GC * pGC, int nInit, +static void VGAarbiterFillSpans(DrawablePtr pDraw, GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted); static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc, @@ -212,7 +212,7 @@ static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *pImage); static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst, - GC * pGC, int srcx, int srcy, int width, + GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty); static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int width, diff --git a/include/gcstruct.h b/include/gcstruct.h index cb1b56655..0450ffa74 100644 --- a/include/gcstruct.h +++ b/include/gcstruct.h @@ -279,6 +279,6 @@ typedef struct _GC { const GCOps *ops; PrivateRec *devPrivates; RegionPtr pCompositeClip; -} GC; +} GCRec; #endif /* GCSTRUCT_H */ diff --git a/mi/miglblt.c b/mi/miglblt.c index accd55ffe..a3e625a20 100644 --- a/mi/miglblt.c +++ b/mi/miglblt.c @@ -79,7 +79,7 @@ with the sample server. */ void -miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */ +miPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */ void *pglyphBase /* start of array of glyphs */ ) { @@ -180,7 +180,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyp } void -miImageGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */ +miImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr * ppci, /* array of character info */ void *pglyphBase /* start of array of glyphs */ ) { diff --git a/miext/damage/damage.c b/miext/damage/damage.c index bc296f8af..499055f11 100644 --- a/miext/damage/damage.c +++ b/miext/damage/damage.c @@ -627,7 +627,7 @@ damageAddTraps(PicturePtr pPicture, static void damageFillSpans(DrawablePtr pDrawable, - GC * pGC, int npt, DDXPointPtr ppt, int *pwidth, int fSorted) + GCPtr pGC, int npt, DDXPointPtr ppt, int *pwidth, int fSorted) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); @@ -746,7 +746,7 @@ damagePutImage(DrawablePtr pDrawable, static RegionPtr damageCopyArea(DrawablePtr pSrc, DrawablePtr pDst, - GC * pGC, + GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { RegionPtr ret;