dixfonts: Deobfuscate GC ops calls.
Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
This commit is contained in:
parent
bbbf795e6b
commit
2051e0f371
|
@ -1170,6 +1170,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
|
|||
enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT;
|
||||
FontPathElementPtr fpe;
|
||||
GC *origGC = NULL;
|
||||
int itemSize = c->reqType == X_PolyText8 ? 1 : 2;
|
||||
|
||||
if (client->clientGone)
|
||||
{
|
||||
|
@ -1255,10 +1256,6 @@ doPolyText(ClientPtr client, PTclosurePtr c)
|
|||
val.ptr = pFont;
|
||||
ChangeGC(NullClient, c->pGC, GCFont, &val);
|
||||
ValidateGC(c->pDraw, c->pGC);
|
||||
if (c->reqType == X_PolyText8)
|
||||
c->polyText = (PolyTextPtr) c->pGC->ops->PolyText8;
|
||||
else
|
||||
c->polyText = (PolyTextPtr) c->pGC->ops->PolyText16;
|
||||
}
|
||||
|
||||
/* Undo the refcnt++ we performed when going to sleep */
|
||||
|
@ -1270,7 +1267,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
|
|||
else /* print a string */
|
||||
{
|
||||
unsigned char *pNextElt;
|
||||
pNextElt = c->pElt + TextEltHeader + (*c->pElt)*c->itemSize;
|
||||
pNextElt = c->pElt + TextEltHeader + (*c->pElt) * itemSize;
|
||||
if ( pNextElt > c->endReq)
|
||||
{
|
||||
err = BadLength;
|
||||
|
@ -1283,7 +1280,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
|
|||
}
|
||||
if (c->pDraw)
|
||||
{
|
||||
lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, c->itemSize,
|
||||
lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, itemSize,
|
||||
c->pElt + TextEltHeader);
|
||||
}
|
||||
else lgerr = Successful;
|
||||
|
@ -1381,8 +1378,12 @@ doPolyText(ClientPtr client, PTclosurePtr c)
|
|||
if (c->pDraw)
|
||||
{
|
||||
c->xorg += *((INT8 *)(c->pElt + 1)); /* must be signed */
|
||||
c->xorg = (* c->polyText)(c->pDraw, c->pGC, c->xorg, c->yorg,
|
||||
*c->pElt, c->pElt + TextEltHeader);
|
||||
if (c->reqType == X_PolyText8)
|
||||
c->xorg = (* c->pGC->ops->PolyText8)(c->pDraw, c->pGC, c->xorg, c->yorg,
|
||||
*c->pElt, (char *) (c->pElt + TextEltHeader));
|
||||
else
|
||||
c->xorg = (* c->pGC->ops->PolyText16)(c->pDraw, c->pGC, c->xorg, c->yorg,
|
||||
*c->pElt, (unsigned short *) (c->pElt + TextEltHeader));
|
||||
}
|
||||
c->pElt = pNextElt;
|
||||
}
|
||||
|
@ -1442,16 +1443,7 @@ PolyText(ClientPtr client, DrawablePtr pDraw, GC *pGC, unsigned char *pElt,
|
|||
local_closure.pDraw = pDraw;
|
||||
local_closure.xorg = xorg;
|
||||
local_closure.yorg = yorg;
|
||||
if ((local_closure.reqType = reqType) == X_PolyText8)
|
||||
{
|
||||
local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText8;
|
||||
local_closure.itemSize = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
local_closure.polyText = (PolyTextPtr) pGC->ops->PolyText16;
|
||||
local_closure.itemSize = 2;
|
||||
}
|
||||
local_closure.reqType = reqType;
|
||||
local_closure.pGC = pGC;
|
||||
local_closure.did = did;
|
||||
local_closure.err = Success;
|
||||
|
@ -1469,6 +1461,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
|
|||
{
|
||||
int err = Success, lgerr; /* err is in X error, not font error, space */
|
||||
FontPathElementPtr fpe;
|
||||
int itemSize = c->reqType == X_ImageText8 ? 1 : 2;
|
||||
|
||||
if (client->clientGone)
|
||||
{
|
||||
|
@ -1493,7 +1486,7 @@ doImageText(ClientPtr client, ITclosurePtr c)
|
|||
}
|
||||
}
|
||||
|
||||
lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, c->itemSize, c->data);
|
||||
lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, itemSize, c->data);
|
||||
if (lgerr == Suspended)
|
||||
{
|
||||
if (!ClientIsAsleep(client)) {
|
||||
|
@ -1515,14 +1508,14 @@ doImageText(ClientPtr client, ITclosurePtr c)
|
|||
*new_closure = *c;
|
||||
c = new_closure;
|
||||
|
||||
data = malloc(c->nChars * c->itemSize);
|
||||
data = malloc(c->nChars * itemSize);
|
||||
if (!data)
|
||||
{
|
||||
free(c);
|
||||
err = BadAlloc;
|
||||
goto bail;
|
||||
}
|
||||
memmove(data, c->data, c->nChars * c->itemSize);
|
||||
memmove(data, c->data, c->nChars * itemSize);
|
||||
c->data = data;
|
||||
|
||||
pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
|
||||
|
@ -1562,8 +1555,12 @@ doImageText(ClientPtr client, ITclosurePtr c)
|
|||
}
|
||||
if (c->pDraw)
|
||||
{
|
||||
(* c->imageText)(c->pDraw, c->pGC, c->xorg, c->yorg,
|
||||
c->nChars, c->data);
|
||||
if (c->reqType == X_ImageText8)
|
||||
(* c->pGC->ops->ImageText8)(c->pDraw, c->pGC, c->xorg, c->yorg,
|
||||
c->nChars, (char *) c->data);
|
||||
else
|
||||
(* c->pGC->ops->ImageText16)(c->pDraw, c->pGC, c->xorg, c->yorg,
|
||||
c->nChars, (unsigned short *) c->data);
|
||||
}
|
||||
|
||||
bail:
|
||||
|
@ -1601,16 +1598,7 @@ ImageText(ClientPtr client, DrawablePtr pDraw, GC *pGC, int nChars,
|
|||
local_closure.data = data;
|
||||
local_closure.xorg = xorg;
|
||||
local_closure.yorg = yorg;
|
||||
if ((local_closure.reqType = reqType) == X_ImageText8)
|
||||
{
|
||||
local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText8;
|
||||
local_closure.itemSize = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
local_closure.imageText = (ImageTextPtr) pGC->ops->ImageText16;
|
||||
local_closure.itemSize = 2;
|
||||
}
|
||||
local_closure.reqType = reqType;
|
||||
local_closure.did = did;
|
||||
|
||||
(void) doImageText(client, &local_closure);
|
||||
|
|
|
@ -97,16 +97,6 @@ typedef struct _LFclosure {
|
|||
|
||||
/* PolyText */
|
||||
|
||||
typedef
|
||||
int (* PolyTextPtr)(
|
||||
DrawablePtr /* pDraw */,
|
||||
GCPtr /* pGC */,
|
||||
int /* x */,
|
||||
int /* y */,
|
||||
int /* count */,
|
||||
void * /* chars or shorts */
|
||||
);
|
||||
|
||||
typedef struct _PTclosure {
|
||||
ClientPtr client;
|
||||
DrawablePtr pDraw;
|
||||
|
@ -117,24 +107,12 @@ typedef struct _PTclosure {
|
|||
int xorg;
|
||||
int yorg;
|
||||
CARD8 reqType;
|
||||
PolyTextPtr polyText;
|
||||
int itemSize;
|
||||
XID did;
|
||||
int err;
|
||||
} PTclosureRec;
|
||||
|
||||
/* ImageText */
|
||||
|
||||
typedef
|
||||
void (* ImageTextPtr)(
|
||||
DrawablePtr /* pDraw */,
|
||||
GCPtr /* pGC */,
|
||||
int /* x */,
|
||||
int /* y */,
|
||||
int /* count */,
|
||||
void * /* chars or shorts */
|
||||
);
|
||||
|
||||
typedef struct _ITclosure {
|
||||
ClientPtr client;
|
||||
DrawablePtr pDraw;
|
||||
|
@ -144,8 +122,6 @@ typedef struct _ITclosure {
|
|||
int xorg;
|
||||
int yorg;
|
||||
CARD8 reqType;
|
||||
ImageTextPtr imageText;
|
||||
int itemSize;
|
||||
XID did;
|
||||
} ITclosureRec;
|
||||
#endif /* CLOSESTR_H */
|
||||
|
|
Loading…
Reference in New Issue
Block a user