summaryrefslogtreecommitdiff
path: root/dix/dispatch.c
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-05-06 11:00:37 -0700
committerKeith Packard <keithp@keithp.com>2010-05-07 21:56:36 -0700
commit35761d5f811406bc0b6a68c1b02bdb699142745c (patch)
tree5286fcdbbc0fcf47f4c29ca55ee8f235bd4d23cb /dix/dispatch.c
parent2eab697adba4b1858a530750e9a35fba79a7bf26 (diff)
Introduce dixLookupFontable for "FONT or GC" parameters.
Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'dix/dispatch.c')
-rw-r--r--dix/dispatch.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 982c808c7..a2cffacda 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1283,22 +1283,13 @@ ProcQueryFont(ClientPtr client)
{
xQueryFontReply *reply;
FontPtr pFont;
- GC *pGC;
int rc;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- client->errorValue = stuff->id; /* EITHER font or gc */
- rc = dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT, client,
- DixGetAttrAccess);
- if (rc == BadValue) {
- rc = dixLookupResourceByType((pointer *)&pGC, stuff->id, RT_GC, client,
- DixGetAttrAccess);
- if (rc == Success)
- pFont = pGC->font;
- }
+ rc = dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess);
if (rc != Success)
- return (rc == BadValue) ? BadFont: rc;
+ return rc;
{
xCharInfo *pmax = FONTINKMAX(pFont);
@@ -1339,24 +1330,15 @@ ProcQueryTextExtents(ClientPtr client)
{
xQueryTextExtentsReply reply;
FontPtr pFont;
- GC *pGC;
ExtentInfoRec info;
unsigned long length;
int rc;
REQUEST(xQueryTextExtentsReq);
REQUEST_AT_LEAST_SIZE(xQueryTextExtentsReq);
- client->errorValue = stuff->fid; /* EITHER font or gc */
- rc = dixLookupResourceByType((pointer *)&pFont, stuff->fid, RT_FONT, client,
- DixGetAttrAccess);
- if (rc == BadValue) {
- rc = dixLookupResourceByType((pointer *)&pGC, stuff->fid, RT_GC, client,
- DixGetAttrAccess);
- if (rc == Success)
- pFont = pGC->font;
- }
+ rc = dixLookupFontable(&pFont, stuff->fid, client, DixGetAttrAccess);
if (rc != Success)
- return (rc == BadValue) ? BadFont: rc;
+ return rc;
length = client->req_len - bytes_to_int32(sizeof(xQueryTextExtentsReq));
length = length << 1;