xace: add hooks + new access codes: core protocol font requests

This commit is contained in:
Eamon Walsh 2007-08-16 12:02:59 -04:00 committed by Eamon Walsh
parent e89301c879
commit fe9bc481ef

View File

@ -1354,23 +1354,21 @@ ProcQueryFont(ClientPtr client)
xQueryFontReply *reply; xQueryFontReply *reply;
FontPtr pFont; FontPtr pFont;
GC *pGC; GC *pGC;
int rc;
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
client->errorValue = stuff->id; /* EITHER font or gc */ client->errorValue = stuff->id; /* EITHER font or gc */
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, rc = dixLookupResource((pointer *)&pFont, stuff->id, RT_FONT, client,
DixReadAccess); DixGetAttrAccess);
if (!pFont) if (rc == BadValue) {
{ rc = dixLookupResource((pointer *)&pGC, stuff->id, RT_GC, client,
pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, DixGetAttrAccess);
DixReadAccess); if (rc == Success)
if (!pGC) pFont = pGC->font;
{
client->errorValue = stuff->id;
return(BadFont); /* procotol spec says only error is BadFont */
}
pFont = pGC->font;
} }
if (rc != Success)
return (rc == BadValue) ? BadFont: rc;
{ {
xCharInfo *pmax = FONTINKMAX(pFont); xCharInfo *pmax = FONTINKMAX(pFont);
@ -1409,28 +1407,27 @@ ProcQueryFont(ClientPtr client)
int int
ProcQueryTextExtents(ClientPtr client) ProcQueryTextExtents(ClientPtr client)
{ {
REQUEST(xQueryTextExtentsReq);
xQueryTextExtentsReply reply; xQueryTextExtentsReply reply;
FontPtr pFont; FontPtr pFont;
GC *pGC; GC *pGC;
ExtentInfoRec info; ExtentInfoRec info;
unsigned long length; unsigned long length;
int rc;
REQUEST(xQueryTextExtentsReq);
REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq); REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq);
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->fid, RT_FONT, client->errorValue = stuff->fid; /* EITHER font or gc */
DixReadAccess); rc = dixLookupResource((pointer *)&pFont, stuff->fid, RT_FONT, client,
if (!pFont) DixGetAttrAccess);
{ if (rc == BadValue) {
pGC = (GC *)SecurityLookupIDByType(client, stuff->fid, RT_GC, rc = dixLookupResource((pointer *)&pGC, stuff->fid, RT_GC, client,
DixReadAccess); DixGetAttrAccess);
if (!pGC) if (rc == Success)
{ pFont = pGC->font;
client->errorValue = stuff->fid;
return(BadFont);
}
pFont = pGC->font;
} }
if (rc != Success)
return (rc == BadValue) ? BadFont: rc;
length = client->req_len - (sizeof(xQueryTextExtentsReq) >> 2); length = client->req_len - (sizeof(xQueryTextExtentsReq) >> 2);
length = length << 1; length = length << 1;
if (stuff->oddLength) if (stuff->oddLength)