doPolyText: forget about FontChange's XID after looking up pFont.

As of e2929db7b7, doPolyText uses pFont
consistently rather than looking it up again from the saved XID.

clang noticed that "oldfid = fid" could run when fid hadn't been
initialized yet.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Jamey Sharp 2010-05-21 11:12:26 -07:00 committed by Keith Packard
parent 989db930d7
commit d8cbcbc01d

View File

@ -1173,7 +1173,6 @@ int
doPolyText(ClientPtr client, PTclosurePtr c) doPolyText(ClientPtr client, PTclosurePtr c)
{ {
FontPtr pFont = c->pGC->font, oldpFont; FontPtr pFont = c->pGC->font, oldpFont;
Font fid, oldfid;
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;
@ -1221,6 +1220,7 @@ doPolyText(ClientPtr client, PTclosurePtr c)
{ {
if (*c->pElt == FontChange) if (*c->pElt == FontChange)
{ {
Font fid;
if (c->endReq - c->pElt < FontShiftSize) if (c->endReq - c->pElt < FontShiftSize)
{ {
err = BadLength; err = BadLength;
@ -1228,7 +1228,6 @@ doPolyText(ClientPtr client, PTclosurePtr c)
} }
oldpFont = pFont; oldpFont = pFont;
oldfid = fid;
fid = ((Font)*(c->pElt+4)) /* big-endian */ fid = ((Font)*(c->pElt+4)) /* big-endian */
| ((Font)*(c->pElt+3)) << 8 | ((Font)*(c->pElt+3)) << 8
@ -1238,9 +1237,8 @@ doPolyText(ClientPtr client, PTclosurePtr c)
client, DixUseAccess); client, DixUseAccess);
if (err != Success) if (err != Success)
{ {
/* restore pFont and fid for step 4 (described below) */ /* restore pFont for step 4 (described below) */
pFont = oldpFont; pFont = oldpFont;
fid = oldfid;
/* If we're in START_SLEEP mode, the following step /* If we're in START_SLEEP mode, the following step
shortens the request... in the unlikely event that shortens the request... in the unlikely event that