[PATCH 2/4] Replace SecurityLookupIDByType() with dixLookupResourceByType(), take 1.
Cyril Brulebois
kibi at debian.org
Fri Nov 12 03:19:00 PST 2010
This patch has been prepared with the following Coccinelle semantic patch:
@@
expression a, b, c, d;
identifier r;
@@
-r = SecurityLookupIDByType(a, b, c, d);
+int lookup_ret;
+lookup_ret = dixLookupResourceByType((pointer) &r, b, c, a, d);
+r = (lookup_ret == Success) ? r : NULL;
It was further edited to remove duplicate lookup_ret declarations.
Signed-off-by: Cyril Brulebois <kibi at debian.org>
---
hw/dmx/dmxpict.c | 75 +++++++++++++++++++++++++++++++++++++----------------
1 files changed, 52 insertions(+), 23 deletions(-)
diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
index 915e767..d4c8e64 100644
--- a/hw/dmx/dmxpict.c
+++ b/hw/dmx/dmxpict.c
@@ -267,13 +267,17 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client)
GlyphSetPtr glyphSet;
dmxGlyphPrivPtr glyphPriv;
int i;
+ int lookup_ret;
/* Look up glyphSet that was just created ???? */
/* Store glyphsets from backends in glyphSet->devPrivate ????? */
/* Make sure we handle all errors here!! */
-
- glyphSet = SecurityLookupIDByType(client, stuff->gsid, GlyphSetType,
- DixDestroyAccess);
+
+ lookup_ret = dixLookupResourceByType((pointer) &glyphSet,
+ stuff->gsid, GlyphSetType,
+ client, DixDestroyAccess);
+ glyphSet = (lookup_ret == Success) ? glyphSet : NULL;
+
glyphPriv = malloc(sizeof(dmxGlyphPrivRec));
if (!glyphPriv) return BadAlloc;
glyphPriv->glyphSets = NULL;
@@ -311,11 +315,14 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client)
static int dmxProcRenderFreeGlyphSet(ClientPtr client)
{
GlyphSetPtr glyphSet;
+ int lookup_ret;
REQUEST(xRenderFreeGlyphSetReq);
REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
- glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType,
- DixDestroyAccess);
+ lookup_ret = dixLookupResourceByType((pointer) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixDestroyAccess);
+ glyphSet = (lookup_ret == Success) ? glyphSet : NULL;
if (glyphSet && glyphSet->refcnt == 1) {
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
@@ -356,9 +363,12 @@ static int dmxProcRenderAddGlyphs(ClientPtr client)
xGlyphInfo *gi;
CARD8 *bits;
int nbytes;
+ int lookup_ret;
- glyphSet = SecurityLookupIDByType(client, stuff->glyphset,
- GlyphSetType, DixReadAccess);
+ lookup_ret = dixLookupResourceByType((pointer) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixReadAccess);
+ glyphSet = (lookup_ret == Success) ? glyphSet : NULL;
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
nglyphs = stuff->nglyphs;
@@ -397,11 +407,14 @@ static int dmxProcRenderAddGlyphs(ClientPtr client)
static int dmxProcRenderFreeGlyphs(ClientPtr client)
{
GlyphSetPtr glyphSet;
+ int lookup_ret;
REQUEST(xRenderFreeGlyphsReq);
REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
- glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType,
- DixWriteAccess);
+ lookup_ret = dixLookupResourceByType((pointer) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixWriteAccess);
+ glyphSet = (lookup_ret == Success) ? glyphSet : NULL;
if (glyphSet) {
dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
@@ -472,14 +485,22 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
GlyphSetPtr glyphSet;
dmxGlyphPrivPtr glyphPriv;
- pSrc = SecurityLookupIDByType(client, stuff->src, PictureType,
- DixReadAccess);
+ int lookup_ret;
+
+ lookup_ret = dixLookupResourceByType((pointer) &pSrc,
+ stuff->src, PictureType,
+ client, DixReadAccess);
+ pSrc = (lookup_ret == Success) ? pSrc : NULL;
+
pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
if (!pSrcPriv->pict)
return ret;
- pDst = SecurityLookupIDByType(client, stuff->dst, PictureType,
- DixWriteAccess);
+ lookup_ret = dixLookupResourceByType((pointer) &pDst,
+ stuff->dst, PictureType,
+ client, DixWriteAccess);
+ pDst = (lookup_ret == Success) ? pDst : NULL;
+
pDstPriv = DMX_GET_PICT_PRIV(pDst);
if (!pDstPriv->pict)
return ret;
@@ -494,10 +515,14 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
if (!dmxScreen->beDisplay)
return ret;
- if (stuff->maskFormat)
- pFmt = SecurityLookupIDByType(client, stuff->maskFormat,
- PictFormatType, DixReadAccess);
- else
+ if (stuff->maskFormat) {
+ lookup_ret = dixLookupResourceByType((pointer) &pFmt,
+ stuff->maskFormat,
+ PictFormatType,
+ client,
+ DixReadAccess);
+ pFmt = (lookup_ret == Success) ? pFmt : NULL;
+ } else
pFmt = NULL;
pFormat = dmxFindFormat(dmxScreen, pFmt);
@@ -546,8 +571,10 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
curGlyph = glyphs;
curElt = elts;
- glyphSet = SecurityLookupIDByType(client, stuff->glyphset,
- GlyphSetType, DixReadAccess);
+ lookup_ret = dixLookupResourceByType((pointer) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixReadAccess);
+ glyphSet = (lookup_ret == Success) ? glyphSet : NULL;
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
while (buffer + sizeof(xGlyphElt) < end) {
@@ -555,10 +582,12 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client)
buffer += sizeof(xGlyphElt);
if (elt->len == 0xff) {
- glyphSet = SecurityLookupIDByType(client,
- *((CARD32 *)buffer),
- GlyphSetType,
- DixReadAccess);
+ lookup_ret = dixLookupResourceByType((pointer) &glyphSet,
+ *((CARD32 *)buffer),
+ GlyphSetType,
+ client,
+ DixReadAccess);
+ glyphSet = (lookup_ret == Success) ? glyphSet : NULL;
glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
buffer += 4;
} else {
--
1.7.2.3
More information about the xorg-devel
mailing list