[PATCH] dixfonts: Deobfuscate GC ops calls.

Jamey Sharp jamey at minilop.net
Tue Jul 13 21:26:37 PDT 2010


On Tue, Jul 13, 2010 at 7:12 PM, Alex Deucher <alexdeucher at gmail.com> wrote:
> On Tue, Jul 13, 2010 at 6:35 PM, Jamey Sharp <jamey at minilop.net> wrote:
>> @@ -1387,8 +1384,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));
>
>
> What's going on here?  c->xorg += *((INT8 *)(c->pElt + 1)); followed
> by c->xorg = ...
> Can the += line be removed?

Not exactly: c->xorg is passed to the PolyText op, which returns the
new value for c->xorg. I agree it looks funny, but I believe it was
correct before, and I don't think I've changed how it works. We could
use a local variable instead of the closure's xorg field but I don't
think that's really better.

Jamey


More information about the xorg-devel mailing list