(submit/xnest-gcrec) 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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-02-16 17:25:29 +01:00
parent f4dcc1c72c
commit 6a10257030
11 changed files with 45 additions and 45 deletions

View File

@ -99,7 +99,7 @@ typedef struct _LFclosure {
typedef struct _PTclosure { typedef struct _PTclosure {
ClientPtr client; ClientPtr client;
DrawablePtr pDraw; DrawablePtr pDraw;
GC *pGC; GCPtr pGC;
unsigned char *pElt; unsigned char *pElt;
unsigned char *endReq; unsigned char *endReq;
unsigned char *data; unsigned char *data;
@ -115,7 +115,7 @@ typedef struct _PTclosure {
typedef struct _ITclosure { typedef struct _ITclosure {
ClientPtr client; ClientPtr client;
DrawablePtr pDraw; DrawablePtr pDraw;
GC *pGC; GCPtr pGC;
BYTE nChars; BYTE nChars;
unsigned char *data; unsigned char *data;
int xorg; int xorg;

View File

@ -1565,7 +1565,7 @@ int
ProcCreateGC(ClientPtr client) ProcCreateGC(ClientPtr client)
{ {
int error, rc; int error, rc;
GC *pGC; GCPtr pGC;
DrawablePtr pDraw; DrawablePtr pDraw;
unsigned len; unsigned len;
@ -1582,7 +1582,7 @@ ProcCreateGC(ClientPtr client)
len = client->req_len - bytes_to_int32(sizeof(xCreateGCReq)); len = client->req_len - bytes_to_int32(sizeof(xCreateGCReq));
if (len != Ones(stuff->mask)) if (len != Ones(stuff->mask))
return BadLength; 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); stuff->gc, client);
if (error != Success) if (error != Success)
return error; return error;
@ -1594,7 +1594,7 @@ ProcCreateGC(ClientPtr client)
int int
ProcChangeGC(ClientPtr client) ProcChangeGC(ClientPtr client)
{ {
GC *pGC; GCPtr pGC;
int result; int result;
unsigned len; unsigned len;
@ -1615,8 +1615,8 @@ ProcChangeGC(ClientPtr client)
int int
ProcCopyGC(ClientPtr client) ProcCopyGC(ClientPtr client)
{ {
GC *dstGC; GCPtr dstGC;
GC *pGC; GCPtr pGC;
int result; int result;
REQUEST(xCopyGCReq); REQUEST(xCopyGCReq);
@ -1640,7 +1640,7 @@ ProcCopyGC(ClientPtr client)
int int
ProcSetDashes(ClientPtr client) ProcSetDashes(ClientPtr client)
{ {
GC *pGC; GCPtr pGC;
int result; int result;
REQUEST(xSetDashesReq); REQUEST(xSetDashesReq);
@ -1666,7 +1666,7 @@ int
ProcSetClipRectangles(ClientPtr client) ProcSetClipRectangles(ClientPtr client)
{ {
int nr, result; int nr, result;
GC *pGC; GCPtr pGC;
REQUEST(xSetClipRectanglesReq); REQUEST(xSetClipRectanglesReq);
@ -1691,7 +1691,7 @@ ProcSetClipRectangles(ClientPtr client)
int int
ProcFreeGC(ClientPtr client) ProcFreeGC(ClientPtr client)
{ {
GC *pGC; GCPtr pGC;
int rc; int rc;
REQUEST(xResourceReq); REQUEST(xResourceReq);
@ -1781,7 +1781,7 @@ ProcCopyArea(ClientPtr client)
{ {
DrawablePtr pDst; DrawablePtr pDst;
DrawablePtr pSrc; DrawablePtr pSrc;
GC *pGC; GCPtr pGC;
REQUEST(xCopyAreaReq); REQUEST(xCopyAreaReq);
RegionPtr pRgn; RegionPtr pRgn;
@ -1819,7 +1819,7 @@ int
ProcCopyPlane(ClientPtr client) ProcCopyPlane(ClientPtr client)
{ {
DrawablePtr psrcDraw, pdstDraw; DrawablePtr psrcDraw, pdstDraw;
GC *pGC; GCPtr pGC;
REQUEST(xCopyPlaneReq); REQUEST(xCopyPlaneReq);
RegionPtr pRgn; RegionPtr pRgn;
@ -1865,7 +1865,7 @@ int
ProcPolyPoint(ClientPtr client) ProcPolyPoint(ClientPtr client)
{ {
int npoint; int npoint;
GC *pGC; GCPtr pGC;
DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyPointReq); REQUEST(xPolyPointReq);
@ -1888,7 +1888,7 @@ int
ProcPolyLine(ClientPtr client) ProcPolyLine(ClientPtr client)
{ {
int npoint; int npoint;
GC *pGC; GCPtr pGC;
DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyLineReq); REQUEST(xPolyLineReq);
@ -1911,7 +1911,7 @@ int
ProcPolySegment(ClientPtr client) ProcPolySegment(ClientPtr client)
{ {
int nsegs; int nsegs;
GC *pGC; GCPtr pGC;
DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolySegmentReq); REQUEST(xPolySegmentReq);
@ -1931,7 +1931,7 @@ int
ProcPolyRectangle(ClientPtr client) ProcPolyRectangle(ClientPtr client)
{ {
int nrects; int nrects;
GC *pGC; GCPtr pGC;
DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyRectangleReq); REQUEST(xPolyRectangleReq);
@ -1952,7 +1952,7 @@ int
ProcPolyArc(ClientPtr client) ProcPolyArc(ClientPtr client)
{ {
int narcs; int narcs;
GC *pGC; GCPtr pGC;
DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyArcReq); REQUEST(xPolyArcReq);
@ -1972,7 +1972,7 @@ int
ProcFillPoly(ClientPtr client) ProcFillPoly(ClientPtr client)
{ {
int things; int things;
GC *pGC; GCPtr pGC;
DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xFillPolyReq); REQUEST(xFillPolyReq);
@ -2002,7 +2002,7 @@ int
ProcPolyFillRectangle(ClientPtr client) ProcPolyFillRectangle(ClientPtr client)
{ {
int things; int things;
GC *pGC; GCPtr pGC;
DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyFillRectangleReq); REQUEST(xPolyFillRectangleReq);
@ -2024,7 +2024,7 @@ int
ProcPolyFillArc(ClientPtr client) ProcPolyFillArc(ClientPtr client)
{ {
int narcs; int narcs;
GC *pGC; GCPtr pGC;
DrawablePtr pDraw; DrawablePtr pDraw;
REQUEST(xPolyFillArcReq); REQUEST(xPolyFillArcReq);
@ -2097,7 +2097,7 @@ ReformatImage(char *base, int nbytes, int bpp, int order)
int int
ProcPutImage(ClientPtr client) ProcPutImage(ClientPtr client)
{ {
GC *pGC; GCPtr pGC;
DrawablePtr pDraw; DrawablePtr pDraw;
long length; /* length of scanline server padded */ long length; /* length of scanline server padded */
long lengthProto; /* length of scanline protocol padded */ long lengthProto; /* length of scanline protocol padded */
@ -2368,7 +2368,7 @@ ProcPolyText(ClientPtr client)
REQUEST(xPolyTextReq); REQUEST(xPolyTextReq);
DrawablePtr pDraw; DrawablePtr pDraw;
GC *pGC; GCPtr pGC;
REQUEST_AT_LEAST_SIZE(xPolyTextReq); REQUEST_AT_LEAST_SIZE(xPolyTextReq);
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
@ -2392,7 +2392,7 @@ ProcImageText8(ClientPtr client)
{ {
int err; int err;
DrawablePtr pDraw; DrawablePtr pDraw;
GC *pGC; GCPtr pGC;
REQUEST(xImageTextReq); REQUEST(xImageTextReq);
@ -2418,7 +2418,7 @@ ProcImageText16(ClientPtr client)
{ {
int err; int err;
DrawablePtr pDraw; DrawablePtr pDraw;
GC *pGC; GCPtr pGC;
REQUEST(xImageTextReq); REQUEST(xImageTextReq);

View File

@ -1103,7 +1103,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
int err = Success, lgerr; /* err is in X error, not font error, space */ int err = Success, lgerr; /* err is in X error, not font error, space */
enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT; enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT;
FontPathElementPtr fpe; FontPathElementPtr fpe;
GC *origGC = NULL; GCPtr origGC = NULL;
int itemSize = c->reqType == X_PolyText8 ? 1 : 2; int itemSize = c->reqType == X_PolyText8 ? 1 : 2;
if (client->clientGone) { if (client->clientGone) {
@ -1213,7 +1213,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
if (lgerr == Suspended) { if (lgerr == Suspended) {
if (!ClientIsAsleep(client)) { if (!ClientIsAsleep(client)) {
int len; int len;
GC *pGC; GCPtr pGC;
PTclosurePtr new_closure; PTclosurePtr new_closure;
/* We're putting the client to sleep. We need to do a few things /* We're putting the client to sleep. We need to do a few things
@ -1354,7 +1354,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
} }
int 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) unsigned char *endReq, int xorg, int yorg, int reqType, XID did)
{ {
PTclosureRec local_closure; PTclosureRec local_closure;
@ -1409,7 +1409,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, itemSize, c->data); lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, itemSize, c->data);
if (lgerr == Suspended) { if (lgerr == Suspended) {
if (!ClientIsAsleep(client)) { if (!ClientIsAsleep(client)) {
GC *pGC; GCPtr pGC;
unsigned char *data; unsigned char *data;
ITclosurePtr new_closure; ITclosurePtr new_closure;
ITclosurePtr old_closure; ITclosurePtr old_closure;
@ -1500,7 +1500,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
} }
int 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) unsigned char *data, int xorg, int yorg, int reqType, XID did)
{ {
ITclosureRec local_closure; ITclosureRec local_closure;

View File

@ -202,7 +202,7 @@ int
dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access) dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
{ {
int rc; int rc;
GC *pGC; GCPtr pGC;
client->errorValue = id; /* EITHER font or gc */ client->errorValue = id; /* EITHER font or gc */
rc = dixLookupResourceByType((void **) pFont, id, X11_RESTYPE_FONT, client, rc = dixLookupResourceByType((void **) pFont, id, X11_RESTYPE_FONT, client,

View File

@ -72,7 +72,7 @@ static Bool CreateDefaultTile(GCPtr pGC);
static unsigned char DefaultDash[2] = { 4, 4 }; static unsigned char DefaultDash[2] = { 4, 4 };
void void
ValidateGC(DrawablePtr pDraw, GC * pGC) ValidateGC(DrawablePtr pDraw, GCPtr pGC)
{ {
(*pGC->funcs->ValidateGC) (pGC, pGC->stateChanges, pDraw); (*pGC->funcs->ValidateGC) (pGC, pGC->stateChanges, pDraw);
pGC->stateChanges = 0; pGC->stateChanges = 0;
@ -120,7 +120,7 @@ ValidateGC(DrawablePtr pDraw, GC * pGC)
_var = (_type)pUnion->ptr; pUnion++; } _var = (_type)pUnion->ptr; pUnion++; }
int int
ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion) ChangeGC(ClientPtr client, GCPtr pGC, BITS32 mask, ChangeGCValPtr pUnion)
{ {
BITS32 index2; BITS32 index2;
int error = 0; int error = 0;
@ -428,7 +428,7 @@ static const struct {
}; };
int int
ChangeGCXIDs(ClientPtr client, GC * pGC, BITS32 mask, CARD32 *pC32) ChangeGCXIDs(ClientPtr client, GCPtr pGC, BITS32 mask, CARD32 *pC32)
{ {
ChangeGCVal vals[GCLastBit + 1]; ChangeGCVal vals[GCLastBit + 1];
int i; int i;
@ -465,7 +465,7 @@ NewGCObject(ScreenPtr pScreen, int depth)
{ {
GCPtr pGC; GCPtr pGC;
pGC = dixAllocateScreenObjectWithPrivates(pScreen, GC, PRIVATE_GC); pGC = dixAllocateScreenObjectWithPrivates(pScreen, GCRec, PRIVATE_GC);
if (!pGC) { if (!pGC) {
return (GCPtr) NULL; return (GCPtr) NULL;
} }
@ -614,7 +614,7 @@ CreateDefaultTile(GCPtr pGC)
} }
int int
CopyGC(GC * pgcSrc, GC * pgcDst, BITS32 mask) CopyGC(GCPtr pgcSrc, GCPtr pgcDst, BITS32 mask)
{ {
BITS32 index2; BITS32 index2;
BITS32 maskQ; BITS32 maskQ;

View File

@ -565,7 +565,7 @@ static const int offsets[] = {
-1, /* X11_RESTYPE_NONE */ -1, /* X11_RESTYPE_NONE */
offsetof(WindowRec, devPrivates), /* X11_RESTYPE_WINDOW */ offsetof(WindowRec, devPrivates), /* X11_RESTYPE_WINDOW */
offsetof(PixmapRec, devPrivates), /* X11_RESTYPE_PIXMAP */ offsetof(PixmapRec, devPrivates), /* X11_RESTYPE_PIXMAP */
offsetof(GC, devPrivates), /* X11_RESTYPE_GC */ offsetof(GCRec, devPrivates), /* X11_RESTYPE_GC */
-1, /* X11_RESTYPE_FONT */ -1, /* X11_RESTYPE_FONT */
offsetof(CursorRec, devPrivates), /* X11_RESTYPE_CURSOR */ offsetof(CursorRec, devPrivates), /* X11_RESTYPE_CURSOR */
offsetof(ColormapRec, devPrivates), /* X11_RESTYPE_COLORMAP */ offsetof(ColormapRec, devPrivates), /* X11_RESTYPE_COLORMAP */

View File

@ -609,7 +609,7 @@ VGAarbiterDestroyClip(GCPtr pGC)
/* GC Ops */ /* GC Ops */
static void static void
VGAarbiterFillSpans(DrawablePtr pDraw, VGAarbiterFillSpans(DrawablePtr pDraw,
GC * pGC, GCPtr pGC,
int nInit, int nInit,
DDXPointPtr pptInit, int *pwidthInit, int fSorted) DDXPointPtr pptInit, int *pwidthInit, int fSorted)
{ {
@ -658,7 +658,7 @@ VGAarbiterPutImage(DrawablePtr pDraw,
static RegionPtr static RegionPtr
VGAarbiterCopyArea(DrawablePtr pSrc, VGAarbiterCopyArea(DrawablePtr pSrc,
DrawablePtr pDst, DrawablePtr pDst,
GC * pGC, GCPtr pGC,
int srcx, int srcy, int srcx, int srcy,
int width, int height, int dstx, int dsty) int width, int height, int dstx, int dsty)
{ {

View File

@ -202,7 +202,7 @@ static void VGAarbiterDestroyClip(GCPtr pGC);
static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc); static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
/* GC ops */ /* GC ops */
static void VGAarbiterFillSpans(DrawablePtr pDraw, GC * pGC, int nInit, static void VGAarbiterFillSpans(DrawablePtr pDraw, GCPtr pGC, int nInit,
DDXPointPtr pptInit, int *pwidthInit, DDXPointPtr pptInit, int *pwidthInit,
int fSorted); int fSorted);
static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc, 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, int y, int w, int h, int leftPad, int format,
char *pImage); char *pImage);
static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst, 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); int height, int dstx, int dsty);
static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
GCPtr pGC, int srcx, int srcy, int width, GCPtr pGC, int srcx, int srcy, int width,

View File

@ -279,6 +279,6 @@ typedef struct _GC {
const GCOps *ops; const GCOps *ops;
PrivateRec *devPrivates; PrivateRec *devPrivates;
RegionPtr pCompositeClip; RegionPtr pCompositeClip;
} GC; } GCRec;
#endif /* GCSTRUCT_H */ #endif /* GCSTRUCT_H */

View File

@ -79,7 +79,7 @@ with the sample server.
*/ */
void 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 */ void *pglyphBase /* start of array of glyphs */
) )
{ {
@ -180,7 +180,7 @@ miPolyGlyphBlt(DrawablePtr pDrawable, GC * pGC, int x, int y, unsigned int nglyp
} }
void 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 */ void *pglyphBase /* start of array of glyphs */
) )
{ {

View File

@ -634,7 +634,7 @@ damageAddTraps(PicturePtr pPicture,
static void static void
damageFillSpans(DrawablePtr pDrawable, 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); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
@ -753,7 +753,7 @@ damagePutImage(DrawablePtr pDrawable,
static RegionPtr static RegionPtr
damageCopyArea(DrawablePtr pSrc, damageCopyArea(DrawablePtr pSrc,
DrawablePtr pDst, DrawablePtr pDst,
GC * pGC, GCPtr pGC,
int srcx, int srcy, int width, int height, int dstx, int dsty) int srcx, int srcy, int width, int height, int dstx, int dsty)
{ {
RegionPtr ret; RegionPtr ret;