[PATCH] dixfonts: Deobfuscate GC ops calls.

Alex Deucher alexdeucher at gmail.com
Tue Jul 13 21:42:13 PDT 2010


On Wed, Jul 14, 2010 at 12:26 AM, Jamey Sharp <jamey at minilop.net> wrote:
> 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.

Ah, sorry, I totally missed that it was passed to polytext.  Looks good.

Reviewed-by: Alex Deucher <alexdeucher at gmail.com>

Alex


More information about the xorg-devel mailing list