xserver: Branch 'master' - 6 commits

Keith Packard keithp at kemper.freedesktop.org
Fri May 7 22:11:30 PDT 2010


 Xext/xf86bigfont.c  |   14 -----
 dix/dispatch.c      |   26 +---------
 dix/dixutils.c      |   18 +++++++
 glx/xfont.c         |   17 +-----
 hw/dmx/dmxpict.c    |    6 --
 include/dix.h       |    6 ++
 include/os.h        |   16 +++---
 mi/miarc.c          |  120 ++++-------------------------------------------
 os/access.c         |   10 +--
 os/auth.c           |   15 +++--
 os/mitauth.c        |    8 +--
 os/osdep.h          |   23 ++++-----
 os/rpcauth.c        |    8 +--
 os/xdmauth.c        |   16 +++---
 os/xdmcp.c          |   38 +++++++--------
 render/picture.c    |    2 
 render/picturestr.h |    8 +--
 render/render.c     |  131 +++++++++++++++++-----------------------------------
 xfixes/region.c     |    6 --
 19 files changed, 167 insertions(+), 321 deletions(-)

New commits:
commit 946f664b6ab421f69df3dc3213b14b085424c9e4
Author: Adam Jackson <ajax at redhat.com>
Date:   Thu May 6 17:58:29 2010 -0400

    mi: Delete wide ellipse arc cache
    
    This does make wide ellipses slower, by a factor of twoish:
    
    946000.0   521000.0 (  0.55)   10-pixel wide ellipse
     98300.0    49900.0 (  0.51)   100-pixel wide ellipse
     17700.0     9310.0 (  0.53)   500-pixel wide ellipse
     16900.0     7980.0 (  0.47)   100-pixel wide dashed ellipse
     16100.0     5370.0 (  0.33)   100-pixel wide double-dashed ellipse
    
    But no one cares, and it's a modest size win:
    
       text	   data	    bss	    dec	    hex	filename
    1773824	  69552	  59288	1902664	 1d0848	hw/vfb/Xvfb.before
    1773112	  69552	  58648	1901312	 1d0300	hw/vfb/Xvfb
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/miarc.c b/mi/miarc.c
index ddcbff7..1061436 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -385,47 +385,10 @@ typedef struct {
     char top, bot, hole;
 } miArcSpanData;
 
-typedef struct {
-    unsigned long lrustamp;
-    unsigned short lw;
-    unsigned short width, height;
-    miArcSpanData *spdata;
-} arcCacheRec;
-
-#define CACHESIZE 25
-
 static void drawQuadrant(struct arc_def *def, struct accelerators *acc,
 			 int a0, int a1, int mask, miArcFacePtr right,
 			 miArcFacePtr left, miArcSpanData *spdata);
 
-static arcCacheRec arcCache[CACHESIZE];
-static unsigned long lrustamp;
-static arcCacheRec *lastCacheHit = &arcCache[0];
-static RESTYPE cacheType;
-
-static int
-miFreeArcCache (pointer data, XID id)
-{
-    int k;
-    arcCacheRec *cent;
-
-    if (id)
-	cacheType = 0;
-
-    for (k = CACHESIZE, cent = &arcCache[0]; --k >= 0; cent++)
-    {
-	if (cent->spdata)
-	{
-	    cent->lrustamp = 0;
-	    cent->lw = 0;
-	    xfree(cent->spdata);
-	    cent->spdata = NULL;
-	}
-    }
-    lrustamp = 0;
-    return Success;
-}
-
 static void
 miComputeCircleSpans(
     int lw,
@@ -829,76 +792,21 @@ tailX(
 }
 
 static miArcSpanData *
-miComputeWideEllipse(
-    int  lw,
-    xArc *parc,
-    Bool *mustFree)
+miComputeWideEllipse(int lw, xArc *parc)
 {
-    miArcSpanData *spdata;
-    arcCacheRec *cent, *lruent;
+    miArcSpanData *spdata = NULL;
     int k;
-    arcCacheRec fakeent;
 
     if (!lw)
 	lw = 1;
-    if (parc->height <= 1500)
-    {
-	*mustFree = FALSE;
-	cent = lastCacheHit;
-	if (cent->lw == lw &&
-	    cent->width == parc->width && cent->height == parc->height)
-	{
-	    cent->lrustamp = ++lrustamp;
-	    return cent->spdata;
-	}
-	lruent = &arcCache[0];
-	for (k = CACHESIZE, cent = lruent; --k >= 0; cent++)
-	{
-	    if (cent->lw == lw &&
-		cent->width == parc->width && cent->height == parc->height)
-	    {
-		cent->lrustamp = ++lrustamp;
-		lastCacheHit = cent;
-		return cent->spdata;
-	    }
-	    if (cent->lrustamp < lruent->lrustamp)
-		lruent = cent;
-	}
-	if (!cacheType)
-	{
-	    cacheType = CreateNewResourceType(miFreeArcCache, "miArcCache");
-	    (void) AddResource(FakeClientID(0), cacheType, NULL);
-	}
-    } else {
-	lruent = &fakeent;
-	lruent->spdata = NULL;
-	*mustFree = TRUE;
-    }
     k = (parc->height >> 1) + ((lw - 1) >> 1);
-    spdata = lruent->spdata;
-    if (!spdata || spdata->k != k)
-    {
-	if (spdata)
-	    xfree(spdata);
-	spdata = xalloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2));
-	lruent->spdata = spdata;
-	if (!spdata)
-	{
-	    lruent->lrustamp = 0;
-	    lruent->lw = 0;
-	    return spdata;
-	}
-	spdata->spans = (miArcSpan *)(spdata + 1);
-	spdata->k = k;
-    }
+    spdata = xalloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2));
+    if (!spdata)
+	return NULL;
+    spdata->spans = (miArcSpan *)(spdata + 1);
+    spdata->k = k;
     spdata->top = !(lw & 1) && !(parc->width & 1);
     spdata->bot = !(parc->height & 1);
-    lruent->lrustamp = ++lrustamp;
-    lruent->lw = lw;
-    lruent->width = parc->width;
-    lruent->height = parc->height;
-    if (lruent != &fakeent)
-	lastCacheHit = lruent;
     if (parc->width == parc->height)
 	miComputeCircleSpans(lw, parc, spdata);
     else
@@ -917,7 +825,6 @@ miFillWideEllipse(
     int *widths;
     int *wids;
     miArcSpanData *spdata;
-    Bool mustFree;
     miArcSpan *span;
     int xorg, yorgu, yorgl;
     int n;
@@ -928,7 +835,7 @@ miFillWideEllipse(
     if (!widths)
 	return;
     points = (DDXPointPtr)((char *)widths + n);
-    spdata = miComputeWideEllipse((int)pGC->lineWidth, parc, &mustFree);
+    spdata = miComputeWideEllipse((int)pGC->lineWidth, parc);
     if (!spdata)
     {
 	xfree(widths);
@@ -1020,8 +927,7 @@ miFillWideEllipse(
 	    wids += 2;
 	}
     }
-    if (mustFree)
-	xfree(spdata);
+    xfree(spdata);
     (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
 
     xfree(widths);
@@ -3358,9 +3264,8 @@ drawArc (
 	int			flipRight = 0, flipLeft = 0;			
 	int			copyEnd = 0;
 	miArcSpanData		*spdata;
-	Bool			mustFree;
 
-	spdata = miComputeWideEllipse(l, tarc, &mustFree);
+	spdata = miComputeWideEllipse(l, tarc);
 	if (!spdata)
 	    return;
 
@@ -3572,8 +3477,7 @@ drawArc (
 			left->counterClock = temp;
 		}
 	}
-	if (mustFree)
-	    xfree(spdata);
+	xfree(spdata);
 }
 
 static void
commit 580b99bb8af4ea093953c2b885bd4272aaf02baf
Author: Jamey Sharp <jamey at minilop.net>
Date:   Thu May 6 11:00:39 2010 -0700

    Return BadPicture, not BadPixmap, if alpha-map is invalid.
    
    I believe this is what was intended.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/render/picture.c b/render/picture.c
index 18bfea2..48693b8 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1115,7 +1115,7 @@ ChangePicture (PicturePtr	pPicture,
 			if (error != Success)
 			{
 			    client->errorValue = pid;
-			    error = (error == BadValue) ? BadPixmap : error;
+			    error = (error == BadValue) ? RenderErrBase + BadPicture : error;
 			    break;
 			}
 			if (pAlpha->pDrawable == NULL ||
commit c677fc611b124c44adfcfb95718798105f26357b
Author: Jamey Sharp <jamey at minilop.net>
Date:   Thu May 6 11:00:38 2010 -0700

    VERIFY_PICTURE always returns BadPicture. Don't bother specifying.
    
    Same goes for VERIFY_ALPHA, VERIFY_XIN_PICTURE, and VERIFY_XIN_ALPHA.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c
index 072e3a6..8398be7 100644
--- a/hw/dmx/dmxpict.c
+++ b/hw/dmx/dmxpict.c
@@ -622,8 +622,7 @@ static int dmxProcRenderSetPictureTransform(ClientPtr client)
     REQUEST(xRenderSetPictureTransformReq);
 
     REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
-    VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess,
-		   RenderErrBase + BadPicture);
+    VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
 
     /* For the following to work with PanoramiX, it assumes that Render
      * wraps the ProcRenderVector after dmxRenderInit has been called.
@@ -663,8 +662,7 @@ static int dmxProcRenderSetPictureFilter(ClientPtr client)
     REQUEST(xRenderSetPictureFilterReq);
 
     REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
-    VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess,
-		   RenderErrBase + BadPicture);
+    VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
 
     /* For the following to work with PanoramiX, it assumes that Render
      * wraps the ProcRenderVector after dmxRenderInit has been called.
diff --git a/render/picturestr.h b/render/picturestr.h
index 6a8d76d..5a796f4 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -408,18 +408,18 @@ extern _X_EXPORT RESTYPE	GlyphSetType;
 #define GetPictureWindow(w) ((PicturePtr)dixLookupPrivate(&(w)->devPrivates, PictureWindowPrivateKey))
 #define SetPictureWindow(w,p) dixSetPrivate(&(w)->devPrivates, PictureWindowPrivateKey, p)
 
-#define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\
+#define VERIFY_PICTURE(pPicture, pid, client, mode) {\
     int rc = dixLookupResourceByType((pointer)&(pPicture), pid,\
 	                             PictureType, client, mode);\
     if (rc != Success)\
-	return (rc == BadValue) ? err : rc;\
+	return (rc == BadValue) ? RenderErrBase + BadPicture : rc;\
 }
 
-#define VERIFY_ALPHA(pPicture, pid, client, mode, err) {\
+#define VERIFY_ALPHA(pPicture, pid, client, mode) {\
     if (pid == None) \
 	pPicture = 0; \
     else { \
-	VERIFY_PICTURE(pPicture, pid, client, mode, err); \
+	VERIFY_PICTURE(pPicture, pid, client, mode); \
     } \
 } \
 
diff --git a/render/render.c b/render/render.c
index 2d9e47a..3c505d6 100644
--- a/render/render.c
+++ b/render/render.c
@@ -631,8 +631,7 @@ ProcRenderChangePicture (ClientPtr client)
     int len;
 
     REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
 
     len = client->req_len - bytes_to_int32(sizeof(xRenderChangePictureReq));
     if (Ones(stuff->mask) != len)
@@ -651,8 +650,7 @@ ProcRenderSetPictureClipRectangles (ClientPtr client)
     int		    result;
 
     REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
     if (!pPicture->pDrawable)
         return BadDrawable;
 
@@ -677,8 +675,7 @@ ProcRenderFreePicture (ClientPtr client)
 
     REQUEST_SIZE_MATCH(xRenderFreePictureReq);
 
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixDestroyAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixDestroyAccess);
     FreeResource (stuff->picture, RT_NONE);
     return(client->noClientException);
 }
@@ -709,14 +706,11 @@ ProcRenderComposite (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
-    VERIFY_ALPHA (pMask, stuff->mask, client, DixReadAccess, 
-		  RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_ALPHA (pMask, stuff->mask, client, DixReadAccess);
     if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) ||
 	(pMask && pMask->pDrawable && pDst->pDrawable->pScreen != pMask->pDrawable->pScreen))
 	return BadMatch;
@@ -755,10 +749,8 @@ ProcRenderTrapezoids (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
@@ -797,10 +789,8 @@ ProcRenderTriangles (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
@@ -839,10 +829,8 @@ ProcRenderTriStrip (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
@@ -881,10 +869,8 @@ ProcRenderTriFan (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
@@ -1301,10 +1287,8 @@ ProcRenderCompositeGlyphs (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess,
-		    RenderErrBase + BadPicture);
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen)
@@ -1458,8 +1442,7 @@ ProcRenderFillRectangles (ClientPtr client)
 	client->errorValue = stuff->op;
 	return BadValue;
     }
-    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess);
     if (!pDst->pDrawable)
         return BadDrawable;
     
@@ -1524,8 +1507,7 @@ ProcRenderCreateCursor (ClientPtr client)
     REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
     LEGAL_NEW_RESOURCE(stuff->cid, client);
     
-    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess);
     if (!pSrc->pDrawable)
         return BadDrawable;
     pScreen = pSrc->pDrawable->pScreen;
@@ -1711,8 +1693,7 @@ ProcRenderSetPictureTransform (ClientPtr client)
     int		result;
 
     REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
     result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform);
     if (client->noClientException != Success)
         return(client->noClientException);
@@ -1841,8 +1822,7 @@ ProcRenderSetPictureFilter (ClientPtr client)
     char	*name;
     
     REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq);
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess);
     name = (char *) (stuff + 1);
     params = (xFixed *) (name + pad_to_int32(stuff->nbytes));
     nparams = ((xFixed *) stuff + client->req_len) - params;
@@ -1903,8 +1883,7 @@ ProcRenderAddTraps (ClientPtr client)
     REQUEST(xRenderAddTrapsReq);
 
     REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq);
-    VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, 
-		    RenderErrBase + BadPicture);
+    VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess);
     if (!pPicture->pDrawable)
         return BadDrawable;
     ntraps = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
@@ -2659,18 +2638,18 @@ SProcRenderDispatch (ClientPtr client)
 #include "panoramiX.h"
 #include "panoramiXsrv.h"
 
-#define VERIFY_XIN_PICTURE(pPicture, pid, client, mode, err) {\
+#define VERIFY_XIN_PICTURE(pPicture, pid, client, mode) {\
     int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\
                                      XRT_PICTURE, client, mode);\
     if (rc != Success)\
-	return (rc == BadValue) ? err : rc;\
+	return (rc == BadValue) ? RenderErrBase + BadPicture : rc;\
 }
 
-#define VERIFY_XIN_ALPHA(pPicture, pid, client, mode, err) {\
+#define VERIFY_XIN_ALPHA(pPicture, pid, client, mode) {\
     if (pid == None) \
 	pPicture = 0; \
     else { \
-	VERIFY_XIN_PICTURE(pPicture, pid, client, mode, err); \
+	VERIFY_XIN_PICTURE(pPicture, pid, client, mode); \
     } \
 } \
 
@@ -2730,8 +2709,7 @@ PanoramiXRenderChangePicture (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq);
     
-    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess,
-		       RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
     
     FOR_NSCREENS_BACKWARD(j) {
         stuff->picture = pict->info[j].id;
@@ -2751,8 +2729,7 @@ PanoramiXRenderSetPictureClipRectangles (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq);
     
-    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess,
-		       RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
     
     FOR_NSCREENS_BACKWARD(j) {
         stuff->picture = pict->info[j].id;
@@ -2772,8 +2749,7 @@ PanoramiXRenderSetPictureTransform (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq);
     
-    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess,
-		       RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
     
     FOR_NSCREENS_BACKWARD(j) {
         stuff->picture = pict->info[j].id;
@@ -2793,8 +2769,7 @@ PanoramiXRenderSetPictureFilter (ClientPtr client)
 
     REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
     
-    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess,
-		       RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess);
     
     FOR_NSCREENS_BACKWARD(j) {
         stuff->picture = pict->info[j].id;
@@ -2816,8 +2791,7 @@ PanoramiXRenderFreePicture (ClientPtr client)
 
     client->errorValue = stuff->picture;
 
-    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess,
-		       RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess);
     
 
     FOR_NSCREENS_BACKWARD(j) {
@@ -2842,12 +2816,9 @@ PanoramiXRenderComposite (ClientPtr client)
 
     REQUEST_SIZE_MATCH(xRenderCompositeReq);
     
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, 
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_ALPHA (msk, stuff->mask, client, DixReadAccess, 
-		      RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, 
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_ALPHA (msk, stuff->mask, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
     
     orig = *stuff;
     
@@ -2890,10 +2861,8 @@ PanoramiXRenderCompositeGlyphs (ClientPtr client)
     INT16	    xSrc, ySrc;
 
     REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq);
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess,
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess,
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
 
     if (client->req_len << 2 >= (sizeof (xRenderCompositeGlyphsReq) +
 				 sizeof (xGlyphElt)))
@@ -2933,8 +2902,7 @@ PanoramiXRenderFillRectangles (ClientPtr client)
     int		    extra_len;
 
     REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, 
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
     extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq);
     if (extra_len &&
 	(extra = (char *) xalloc (extra_len)))
@@ -2980,10 +2948,8 @@ PanoramiXRenderTrapezoids(ClientPtr client)
     
     REQUEST_AT_LEAST_SIZE (xRenderTrapezoidsReq);
     
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess,
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess,
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
 
     extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq);
 
@@ -3042,10 +3008,8 @@ PanoramiXRenderTriangles(ClientPtr client)
     
     REQUEST_AT_LEAST_SIZE (xRenderTrianglesReq);
     
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess,
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess,
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
 
     extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq);
 
@@ -3100,10 +3064,8 @@ PanoramiXRenderTriStrip(ClientPtr client)
     
     REQUEST_AT_LEAST_SIZE (xRenderTriStripReq);
     
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess,
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess,
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
 
     extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq);
 
@@ -3154,10 +3116,8 @@ PanoramiXRenderTriFan(ClientPtr client)
     
     REQUEST_AT_LEAST_SIZE (xRenderTriFanReq);
     
-    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess,
-			RenderErrBase + BadPicture);
-    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess,
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess);
+    VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess);
 
     extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq);
 
@@ -3208,8 +3168,7 @@ PanoramiXRenderAddTraps (ClientPtr client)
     INT16    	    x_off, y_off;
 
     REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq);
-    VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess, 
-			RenderErrBase + BadPicture);
+    VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess);
     extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq);
     if (extra_len &&
 	(extra = (char *) xalloc (extra_len)))
diff --git a/xfixes/region.c b/xfixes/region.c
index 795caf0..5d195a3 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -270,8 +270,7 @@ ProcXFixesCreateRegionFromPicture (ClientPtr client)
     REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq);
     LEGAL_NEW_RESOURCE (stuff->region, client);
 
-    VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess,
-		   RenderErrBase + BadPicture);
+    VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess);
     
     switch (pPicture->clientClipType) {
     case CT_PIXMAP:
@@ -770,8 +769,7 @@ ProcXFixesSetPictureClipRegion (ClientPtr client)
     REQUEST(xXFixesSetPictureClipRegionReq);
     
     REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
-    VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess,
-		   RenderErrBase + BadPicture);
+    VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
     pScreen = pPicture->pDrawable->pScreen;
     ps = GetPictureScreen (pScreen);
     VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
commit 35761d5f811406bc0b6a68c1b02bdb699142745c
Author: Jamey Sharp <jamey at minilop.net>
Date:   Thu May 6 11:00:37 2010 -0700

    Introduce dixLookupFontable for "FONT or GC" parameters.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index a4eb3f6..68c5d52 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -427,18 +427,8 @@ ProcXF86BigfontQueryFont(
 	    return BadLength;
     }
 #endif
-    client->errorValue = stuff->id;		/* EITHER font or gc */
-    dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT,
-			    client, DixGetAttrAccess);
-    if (!pFont) {
-	GC *pGC;
-	dixLookupResourceByType((pointer *)&pGC, stuff->id, RT_GC,
-				client, DixGetAttrAccess);
-        if (!pGC)
-            return BadFont;    /* procotol spec says only error is BadFont */
-
-	pFont = pGC->font;
-    }
+    if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) != Success)
+	return BadFont;    /* procotol spec says only error is BadFont */
 
     pmax = FONTINKMAX(pFont);
     pmin = FONTINKMIN(pFont);
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 982c808..a2cffac 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;
diff --git a/dix/dixutils.c b/dix/dixutils.c
index 8278d44..d610836 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -92,6 +92,7 @@ Author:  Adobe Systems Incorporated
 #include "windowstr.h"
 #include "dixstruct.h"
 #include "pixmapstr.h"
+#include "gcstruct.h"
 #include "scrnintstr.h"
 #define  XK_LATIN1
 #include <X11/keysymdef.h>
@@ -236,6 +237,23 @@ dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access)
 }
 
 int
+dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
+{
+    int rc;
+    GC *pGC;
+    client->errorValue = id;		/* EITHER font or gc */
+    rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client, access);
+    if (rc != BadValue)
+	return rc;
+    rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access);
+    if (rc == BadValue)
+	return BadFont;
+    if (rc == Success)
+	*pFont = pGC->font;
+    return rc;
+}
+
+int
 dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
 {
     pointer pRes;
diff --git a/glx/xfont.c b/glx/xfont.c
index b8b466d..e3c7f32 100644
--- a/glx/xfont.c
+++ b/glx/xfont.c
@@ -155,7 +155,6 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc)
     ClientPtr client = cl->client;
     xGLXUseXFontReq *req;
     FontPtr pFont;
-    GC *pGC;
     GLuint currentListIndex;
     __GLXcontext *cx;
     int error;
@@ -181,19 +180,9 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc)
     ** containing a font.
     */
 
-    error = dixLookupResourceByType((pointer *)&pFont,
-				    req->font, RT_FONT,
-				    client, DixReadAccess);
-    if (error != Success) {
-	error = dixLookupResourceByType((pointer *)&pGC,
-					req->font, RT_GC,
-					client, DixReadAccess);
-        if (error != Success) {
-	    client->errorValue = req->font;
-            return error == BadGC ? BadFont : error;
-	}
-	pFont = pGC->font;
-    }
+    error = dixLookupFontable(&pFont, req->font, client, DixReadAccess);
+    if (error != Success)
+	return error;
 
     return MakeBitmapsFromFont(pFont, req->first, req->count,
 				    req->listBase);
diff --git a/include/dix.h b/include/dix.h
index dc86257..893338f 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -199,6 +199,12 @@ extern _X_EXPORT int dixLookupGC(
     ClientPtr client,
     Mask access_mode);
 
+extern _X_EXPORT int dixLookupFontable(
+    FontPtr *result,
+    XID id,
+    ClientPtr client,
+    Mask access_mode);
+
 extern _X_EXPORT int dixLookupClient(
     ClientPtr *result,
     XID id,
commit 2eab697adba4b1858a530750e9a35fba79a7bf26
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Fri May 7 09:32:34 2010 -0700

    Constify function prototypes in auth & xdmcp code
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Tested-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/include/os.h b/include/os.h
index 453ab82..3b07bde 100644
--- a/include/os.h
+++ b/include/os.h
@@ -285,7 +285,7 @@ extern _X_EXPORT int AddHost(
     ClientPtr	/*client*/,
     int         /*family*/,
     unsigned    /*length*/,
-    pointer     /*pAddr*/);
+    const void */*pAddr*/);
 
 extern _X_EXPORT Bool ForEachHostInFamily (
     int	    /*family*/,
@@ -369,9 +369,9 @@ extern _X_EXPORT int AuthorizationFromID (
 
 extern _X_EXPORT XID CheckAuthorization(
     unsigned int /*namelength*/,
-    char * /*name*/,
+    const char * /*name*/,
     unsigned int /*datalength*/,
-    char * /*data*/,
+    const char * /*data*/,
     ClientPtr /*client*/,
     char ** /*reason*/
 );
@@ -380,22 +380,22 @@ extern _X_EXPORT void ResetAuthorization(void);
 
 extern _X_EXPORT int RemoveAuthorization (
     unsigned short	name_length,
-    char		*name,
+    const char		*name,
     unsigned short	data_length,
-    char		*data);
+    const char		*data);
 
 extern _X_EXPORT int AddAuthorization(
     unsigned int	/*name_length*/,
-    char *		/*name*/,
+    const char *	/*name*/,
     unsigned int	/*data_length*/,
     char *		/*data*/);
 
 #ifdef XCSECURITY
 extern _X_EXPORT XID GenerateAuthorization(
     unsigned int   /* name_length */,
-    char	*  /* name */,
+    const char	*  /* name */,
     unsigned int   /* data_length */,
-    char	*  /* data */,
+    const char	*  /* data */,
     unsigned int * /* data_length_return */,
     char	** /* data_return */);
 #endif
diff --git a/os/access.c b/os/access.c
index 74c340a..d057e04 100644
--- a/os/access.c
+++ b/os/access.c
@@ -215,11 +215,11 @@ static int ConvertAddr(struct sockaddr * /*saddr*/,
 		       pointer * /*addr*/);
 
 static int CheckAddr(int /*family*/,
-		     pointer /*pAddr*/,
+		     const void * /*pAddr*/,
 		     unsigned /*length*/);
 
 static Bool NewHost(int /*family*/,
-		    pointer /*addr*/,
+		    const void  * /*addr*/,
 		    int /*len*/,
 		    int /* addingLocalHosts */);
 
@@ -1316,7 +1316,7 @@ int
 AddHost (ClientPtr	client,
 	 int            family,
 	 unsigned       length,        /* of bytes in pAddr */
-	 pointer        pAddr)
+	 const void *   pAddr)
 {
     int rc, len;
 
@@ -1377,7 +1377,7 @@ ForEachHostInFamily (int	    family,
  * called when starting or resetting the server */
 static Bool
 NewHost (int		family,
-	 pointer	addr,
+	 const void *	addr,
 	 int		len,
 	 int		addingLocalHosts)
 {
@@ -1512,7 +1512,7 @@ GetHosts (
 static int
 CheckAddr (
     int			family,
-    pointer		pAddr,
+    const void *	pAddr,
     unsigned		length)
 {
     int	len;
diff --git a/os/auth.c b/os/auth.c
index a852e1c..7685751 100644
--- a/os/auth.c
+++ b/os/auth.c
@@ -159,9 +159,9 @@ RegisterAuthorizations (void)
 XID
 CheckAuthorization (
     unsigned int name_length,
-    char	*name,
+    const char	*name,
     unsigned int data_length,
-    char	*data,
+    const char	*data,
     ClientPtr client,
     char	**reason)	/* failure message.  NULL for default msg */
 {
@@ -256,9 +256,9 @@ AuthorizationFromID (
 int
 RemoveAuthorization (
 	unsigned short	name_length,
-	char		*name,
+	const char	*name,
 	unsigned short	data_length,
-	char		*data)
+	const char	*data)
 {
     int	i;
 
@@ -274,7 +274,8 @@ RemoveAuthorization (
 }
 
 int
-AddAuthorization (unsigned name_length, char *name, unsigned data_length, char *data)
+AddAuthorization (unsigned name_length, const char *name,
+		  unsigned data_length, char *data)
 {
     int	i;
 
@@ -294,9 +295,9 @@ AddAuthorization (unsigned name_length, char *name, unsigned data_length, char *
 XID
 GenerateAuthorization(
 	unsigned name_length,
-	char	*name,
+	const char	*name,
 	unsigned data_length,
-	char	*data,
+	const char	*data,
 	unsigned *data_length_return,
 	char	**data_return)
 {
diff --git a/os/mitauth.c b/os/mitauth.c
index a7968cb..1a26dce 100644
--- a/os/mitauth.c
+++ b/os/mitauth.c
@@ -50,7 +50,7 @@ static struct auth {
 int
 MitAddCookie (
     unsigned short	data_length,
-    char		*data,
+    const char		*data,
     XID			id)
 {
     struct auth	*new;
@@ -74,7 +74,7 @@ MitAddCookie (
 XID
 MitCheckCookie (
     unsigned short	data_length,
-    char		*data,
+    const char		*data,
     ClientPtr		client,
     char		**reason)
 {
@@ -139,7 +139,7 @@ MitFromID (
 int
 MitRemoveCookie (
 	unsigned short	data_length,
-	char		*data)
+	const char	*data)
 {
     struct auth	*auth, *prev;
 
@@ -167,7 +167,7 @@ static char cookie[16]; /* 128 bits */
 XID
 MitGenerateCookie (
     unsigned	data_length,
-    char	*data,
+    const char	*data,
     XID		id,
     unsigned	*data_length_return,
     char	**data_return)
diff --git a/os/osdep.h b/os/osdep.h
index 7b1c699..1d87592 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -114,7 +114,8 @@ SOFTWARE.
 #if defined(XDMCP) || defined(HASXDMAUTH)
 typedef Bool (*ValidatorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
 typedef Bool (*GeneratorFunc)(ARRAY8Ptr Auth, ARRAY8Ptr Data, int packet_type);
-typedef Bool (*AddAuthorFunc)(unsigned name_length, char *name, unsigned data_length, char *data);
+typedef Bool (*AddAuthorFunc)(unsigned name_length, const char *name,
+			      unsigned data_length, char *data);
 #endif
 
 typedef struct _connectionInput {
@@ -138,19 +139,19 @@ struct _osComm;
 #define AuthInitArgs void
 typedef void (*AuthInitFunc) (AuthInitArgs);
 
-#define AuthAddCArgs unsigned short data_length, char *data, XID id
+#define AuthAddCArgs unsigned short data_length, const char *data, XID id
 typedef int (*AuthAddCFunc) (AuthAddCArgs);
 
-#define AuthCheckArgs unsigned short data_length, char *data, ClientPtr client, char **reason
+#define AuthCheckArgs unsigned short data_length, const char *data, ClientPtr client, char **reason
 typedef XID (*AuthCheckFunc) (AuthCheckArgs);
 
 #define AuthFromIDArgs XID id, unsigned short *data_lenp, char **datap
 typedef int (*AuthFromIDFunc) (AuthFromIDArgs);
 
-#define AuthGenCArgs unsigned data_length, char *data, XID id, unsigned *data_length_return, char **data_return
+#define AuthGenCArgs unsigned data_length, const char *data, XID id, unsigned *data_length_return, char **data_return
 typedef XID (*AuthGenCFunc) (AuthGenCArgs);
 
-#define AuthRemCArgs unsigned short data_length, char *data
+#define AuthRemCArgs unsigned short data_length, const char *data
 typedef int (*AuthRemCFunc) (AuthRemCArgs);
 
 #define AuthRstCArgs void
@@ -254,29 +255,29 @@ extern void XdmcpUseMsg (void);
 extern int XdmcpOptions(int argc, char **argv, int i);
 extern void XdmcpRegisterConnection (
     int	    type,
-    char    *address,
+    const char    *address,
     int	    addrlen);
 extern void XdmcpRegisterAuthorizations (void);
-extern void XdmcpRegisterAuthorization (char *name, int namelen);
+extern void XdmcpRegisterAuthorization (const char *name, int namelen);
 extern void XdmcpInit (void);
 extern void XdmcpReset (void);
 extern void XdmcpOpenDisplay(int sock);
 extern void XdmcpCloseDisplay(int sock);
 extern void XdmcpRegisterAuthentication (
-    char    *name,
+    const char    *name,
     int	    namelen,
-    char    *data,
+    const char    *data,
     int	    datalen,
     ValidatorFunc Validator,
     GeneratorFunc Generator,
     AddAuthorFunc AddAuth);
 
 struct sockaddr_in;
-extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr);
+extern void XdmcpRegisterBroadcastAddress (const struct sockaddr_in *addr);
 #endif
 
 #ifdef HASXDMAUTH
-extern void XdmAuthenticationInit (char *cookie, int cookie_length);
+extern void XdmAuthenticationInit (const char *cookie, int cookie_length);
 #endif
 
 #endif /* _OSDEP_H_ */
diff --git a/os/rpcauth.c b/os/rpcauth.c
index 5ddbe21..ec7c01f 100644
--- a/os/rpcauth.c
+++ b/os/rpcauth.c
@@ -55,7 +55,7 @@ extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);
 static enum auth_stat why;
 
 static char * 
-authdes_ezdecode(char *inmsg, int len)
+authdes_ezdecode(const char *inmsg, int len)
 {
     struct rpc_msg  msg;
     char            cred_area[MAX_AUTH_BYTES];
@@ -127,7 +127,7 @@ CheckNetName (
 static char rpc_error[MAXNETNAMELEN+50];
 
 _X_HIDDEN XID
-SecureRPCCheck (unsigned short data_length, char *data, 
+SecureRPCCheck (unsigned short data_length, const char *data,
     ClientPtr client, char **reason)
 {
     char *fullname;
@@ -158,7 +158,7 @@ SecureRPCInit (void)
 }
 
 _X_HIDDEN int
-SecureRPCAdd (unsigned short data_length, char *data, XID id)
+SecureRPCAdd (unsigned short data_length, const char *data, XID id)
 {
     if (data_length)
 	AddHost ((pointer) 0, FamilyNetname, data_length, data);
@@ -186,7 +186,7 @@ SecureRPCFromID (XID id, unsigned short *data_lenp, char **datap)
 }
 
 _X_HIDDEN int
-SecureRPCRemove (unsigned short data_length, char *data)
+SecureRPCRemove (unsigned short data_length, const char *data)
 {
     return 0;
 }
diff --git a/os/xdmauth.c b/os/xdmauth.c
index e19e4f9..7fab731 100644
--- a/os/xdmauth.c
+++ b/os/xdmauth.c
@@ -96,7 +96,7 @@ XdmAuthenticationGenerator (ARRAY8Ptr privateData, ARRAY8Ptr outgoingData,
 }
 
 static Bool
-XdmAuthenticationAddAuth (int name_len, char *name, 
+XdmAuthenticationAddAuth (int name_len, const char *name,
     int data_len, char *data)
 {
     Bool    ret;
@@ -114,7 +114,7 @@ XdmAuthenticationAddAuth (int name_len, char *name,
 		 'A' <= c && c <= 'F' ? c - 'A' + 10 : -1)
 
 static int
-HexToBinary (char *in, char *out, int len)
+HexToBinary (const char *in, char *out, int len)
 {
     int	    top, bottom;
 
@@ -137,7 +137,7 @@ HexToBinary (char *in, char *out, int len)
 }
 
 void
-XdmAuthenticationInit (char *cookie, int cookie_len)
+XdmAuthenticationInit (const char *cookie, int cookie_len)
 {
     bzero (privateKey.data, 8);
     if (!strncmp (cookie, "0x", 2) || !strncmp (cookie, "0X", 2))
@@ -188,7 +188,7 @@ static Bool	    gotClock;
 #define TwentyFiveMinutes (25 * 60)
 
 static Bool
-XdmClientAuthCompare (XdmClientAuthPtr a, XdmClientAuthPtr b)
+XdmClientAuthCompare (const XdmClientAuthPtr a, const XdmClientAuthPtr b)
 {
     int	i;
 
@@ -201,7 +201,7 @@ XdmClientAuthCompare (XdmClientAuthPtr a, XdmClientAuthPtr b)
 }
 
 static void
-XdmClientAuthDecode (unsigned char *plain, XdmClientAuthPtr auth)
+XdmClientAuthDecode (const unsigned char *plain, XdmClientAuthPtr auth)
 {
     int	    i, j;
 
@@ -327,7 +327,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length,
 }
 
 int
-XdmAddCookie (unsigned short data_length, char *data, XID id)
+XdmAddCookie (unsigned short data_length, const char *data, XID id)
 {
     XdmAuthorizationPtr	new;
     unsigned char	*rho_bits, *key_bits;
@@ -375,7 +375,7 @@ XdmAddCookie (unsigned short data_length, char *data, XID id)
 }
 
 XID
-XdmCheckCookie (unsigned short cookie_length, char *cookie, 
+XdmCheckCookie (unsigned short cookie_length, const char *cookie,
     ClientPtr xclient, char **reason)
 {
     XdmAuthorizationPtr	auth;
@@ -464,7 +464,7 @@ XdmFromID (XID id, unsigned short *data_lenp, char **datap)
 }
 
 int
-XdmRemoveCookie (unsigned short data_length, char *data)
+XdmRemoveCookie (unsigned short data_length, const char *data)
 {
     XdmAuthorizationPtr	auth;
     XdmAuthKeyPtr	key_bits, rho_bits;
diff --git a/os/xdmcp.c b/os/xdmcp.c
index c1d650d..cae7d40 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -132,14 +132,14 @@ static struct multicastinfo {
 #endif
 
 static void XdmcpAddHost(
-    struct sockaddr    *from,
+    const struct sockaddr    *from,
     int			fromlen,
     ARRAY8Ptr		AuthenticationName,
     ARRAY8Ptr		hostname,
     ARRAY8Ptr		status);
 
 static void XdmcpSelectHost(
-    struct sockaddr	*host_sockaddr,
+    const struct sockaddr *host_sockaddr,
     int			host_len,
     ARRAY8Ptr		AuthenticationName);
 
@@ -169,10 +169,10 @@ static void send_keepalive_msg(void);
 static void recv_alive_msg(unsigned /*length*/);
 
 static void XdmcpFatal(
-    char * /*type*/,
+    const char * /*type*/,
     ARRAY8Ptr /*status*/);
  
-static void XdmcpWarning(char * /*str*/);
+static void XdmcpWarning(const char * /*str*/);
 
 static void get_manager_by_name(
     int /*argc*/,
@@ -210,7 +210,7 @@ static void XdmcpWakeupHandler(
 static ARRAY8 ManufacturerDisplayID;
 
 static void
-XdmcpRegisterManufacturerDisplayID (char *name, int length)
+XdmcpRegisterManufacturerDisplayID (const char *name, int length)
 {
     int	    i;
 
@@ -332,7 +332,7 @@ static struct sockaddr_in   BroadcastAddresses[MAX_BROADCAST];
 static int		    NumBroadcastAddresses;
 
 void
-XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr)
+XdmcpRegisterBroadcastAddress (const struct sockaddr_in *addr)
 {
     struct sockaddr_in	*bcast;
     if (NumBroadcastAddresses >= MAX_BROADCAST)
@@ -364,9 +364,9 @@ static AuthenticationFuncsPtr	AuthenticationFuncsList;
 
 void
 XdmcpRegisterAuthentication (
-    char    *name,
+    const char    *name,
     int	    namelen,
-    char    *data,
+    const char    *data,
     int	    datalen,
     ValidatorFunc Validator,
     GeneratorFunc Generator,
@@ -420,7 +420,7 @@ static ARRAY8Ptr	AuthenticationData = &noAuthenticationData;
 static AuthenticationFuncsPtr	AuthenticationFuncs;
 
 static void
-XdmcpSetAuthentication (ARRAY8Ptr name)
+XdmcpSetAuthentication (const ARRAY8Ptr name)
 {
     int	i;
 
@@ -445,7 +445,7 @@ static long		xdmcpGeneration;
 void
 XdmcpRegisterConnection (
     int	    type,
-    char    *address,
+    const char    *address,
     int	    addrlen)
 {
     int	    i;
@@ -528,7 +528,7 @@ XdmcpRegisterAuthorizations (void)
 }
 
 void
-XdmcpRegisterAuthorization (char *name, int namelen)
+XdmcpRegisterAuthorization (const char *name, int namelen)
 {
     ARRAY8  authName;
     int	    i;
@@ -554,7 +554,7 @@ XdmcpRegisterAuthorization (char *name, int namelen)
 static ARRAY8	DisplayClass;
 
 static void
-XdmcpRegisterDisplayClass (char *name, int length)
+XdmcpRegisterDisplayClass (const char *name, int length)
 {
     int	    i;
 
@@ -728,7 +728,7 @@ XdmcpWakeupHandler(
 
 static void
 XdmcpSelectHost(
-    struct sockaddr	*host_sockaddr,
+    const struct sockaddr	*host_sockaddr,
     int			host_len,
     ARRAY8Ptr		AuthenticationName)
 {
@@ -748,7 +748,7 @@ XdmcpSelectHost(
 /*ARGSUSED*/
 static void
 XdmcpAddHost(
-    struct sockaddr    *from,
+    const struct sockaddr    *from,
     int			fromlen,
     ARRAY8Ptr		AuthenticationName,
     ARRAY8Ptr		hostname,
@@ -854,7 +854,7 @@ send_packet(void)
  */
 
 static void
-XdmcpDeadSession (char *reason)
+XdmcpDeadSession (const char *reason)
 {
     ErrorF ("XDM: %s, declaring session dead\n", reason);
     state = XDM_INIT_STATE;
@@ -1448,7 +1448,7 @@ recv_alive_msg (unsigned length)
 
 static  void
 XdmcpFatal (
-    char	*type,
+    const char	*type,
     ARRAY8Ptr	status)
 {
     FatalError ("XDMCP fatal error: %s %*.*s\n", type,
@@ -1456,15 +1456,15 @@ XdmcpFatal (
 }
 
 static  void
-XdmcpWarning(char *str)
+XdmcpWarning(const char *str)
 {
     ErrorF("XDMCP warning: %s\n", str);
 }
 
 static void
 get_addr_by_name(
-    char *	argtype,
-    char *	namestr,
+    const char *argtype,
+    const char *namestr,
     int		port,
     int		socktype,
     SOCKADDR_TYPE *addr,
commit e2e2747f40c4b9e23dba38ea656d4c082e83a794
Author: Matthias Hopf <mhopf at suse.de>
Date:   Fri May 7 18:46:30 2010 +0200

    Fix mod() definition.
    
    Presumably no implications, especially security-wise.
    
    Signed-off-by: Matthias Hopf <mhopf at suse.de>
    Reviewed-by: Matt Turner <mattst88 at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/miarc.c b/mi/miarc.c
index 5fd1a67..ddcbff7 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -1524,7 +1524,7 @@ miRoundCap(
 
 # define Dsin(d)	((d) == 0.0 ? 0.0 : ((d) == 90.0 ? 1.0 : sin(d*M_PI/180.0)))
 # define Dcos(d)	((d) == 0.0 ? 1.0 : ((d) == 90.0 ? 0.0 : cos(d*M_PI/180.0)))
-# define mod(a,b)	((a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
+# define mod(a,b)	((a) >= 0 ? (a) % (b) : (b) - (-(a)) % (b))
 
 static double
 miDcos (double a)


More information about the xorg-commit mailing list