[Xquartz-changes] xserver: Branch 'master' - 3 commits
Jeremy Huddleston
jeremyhu at freedesktop.org
Mon Mar 22 12:02:16 PDT 2010
configure.ac | 2 +-
dix/window.c | 18 ++++++++++++++++++
exa/exa_glyphs.c | 8 ++++++++
glx/glxcmdsswap.c | 8 ++++----
glx/indirect_dispatch.c | 2 --
include/dix-config.h.in | 3 +++
6 files changed, 34 insertions(+), 7 deletions(-)
New commits:
commit 2fc4806d9fea85c00845409387a195dd3f58e05a
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Mon Mar 22 11:42:21 2010 -0700
Use arc4random instead of rand where available
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/configure.ac b/configure.ac
index d379b3a..361f380 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,7 +206,7 @@ dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
strtol getopt getopt_long vsnprintf walkcontext backtrace \
- getisax getzoneid shmctl64 strcasestr ffs])
+ getisax getzoneid shmctl64 strcasestr ffs arc4random])
AC_FUNC_ALLOCA
dnl Old HAS_* names used in os/*.c.
AC_CHECK_FUNC([getdtablesize],
diff --git a/dix/window.c b/dix/window.c
index c7201df..303cf4d 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -3189,10 +3189,17 @@ dixSaveScreens(ClientPtr client, int on, int mode)
if (logoScreenSaver)
(*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, FALSE);
#endif
+#ifdef HAVE_ARC4RANDOM
+ (*pWin->drawable.pScreen->MoveWindow)(pWin,
+ (short)(-(arc4random() % RANDOM_WIDTH)),
+ (short)(-(arc4random() % RANDOM_WIDTH)),
+ pWin->nextSib, VTMove);
+#else
(*pWin->drawable.pScreen->MoveWindow)(pWin,
(short)(-(rand() % RANDOM_WIDTH)),
(short)(-(rand() % RANDOM_WIDTH)),
pWin->nextSib, VTMove);
+#endif
#ifndef NOLOGOHACK
if (logoScreenSaver)
DrawLogo(pWin);
@@ -3732,7 +3739,11 @@ DrawLogo(WindowPtr pWin)
if (!pGC)
return;
+#ifdef HAVE_ARC4RANDOM
+ if ((arc4random() % 100) <= 17) /* make the probability for white fairly low */
+#else
if ((rand() % 100) <= 17) /* make the probability for white fairly low */
+#endif
fore[0].val = pScreen->whitePixel;
else
fore[0].val = pScreen->blackPixel;
@@ -3776,10 +3787,17 @@ DrawLogo(WindowPtr pWin)
size = width;
if (height < width)
size = height;
+#ifdef HAVE_ARC4RANDOM
+ size = RANDOM_WIDTH + arc4random() % (size - RANDOM_WIDTH);
+ size &= ~1;
+ x += arc4random() % (width - size);
+ y += arc4random() % (height - size);
+#else
size = RANDOM_WIDTH + rand() % (size - RANDOM_WIDTH);
size &= ~1;
x += rand() % (width - size);
y += rand() % (height - size);
+#endif
/*
* Draw what will be the thin strokes.
diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index fd14e9b..8c9e591 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -223,7 +223,11 @@ exaRealizeGlyphCaches(ScreenPtr pScreen,
for (j = 0; j < cache->hashSize; j++)
cache->hashEntries[j] = -1;
+#ifdef HAVE_ARC4RANDOM
+ cache->evictionPosition = arc4random() % cache->size;
+#else
cache->evictionPosition = rand() % cache->size;
+#endif
}
/* Each cache references the picture individually */
@@ -504,7 +508,11 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen,
exaGlyphCacheHashInsert(cache, pGlyph, pos);
/* And pick a new eviction position */
+#ifdef HAVE_ARC4RANDOM
+ cache->evictionPosition = arc4random() % cache->size;
+#else
cache->evictionPosition = rand() % cache->size;
+#endif
}
exaGlyphCacheUploadGlyph(pScreen, cache, x, y, pGlyph);
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 058c8fd..2ded353 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -54,6 +54,9 @@
/* Support XDM-AUTH*-1 */
#undef HASXDMAUTH
+/* Define to 1 if you have the `arc4random' function. */
+#undef HAVE_ARC4RANDOM
+
/* Define to 1 if you have the `getdtablesize' function. */
#undef HAS_GETDTABLESIZE
commit 8f424ef5a15745e3c7fc049ebc1d85f69edab1e5
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Mon Mar 22 09:33:09 2010 -0700
GLX: Fix initialization of some glXDispSwap requests
__glXDispSwap_DestroyPbuffer
__glXDispSwap_DestroyGLXPbufferSGIX
__glXDispSwap_ChangeDrawableAttributes
__glXDispSwap_ChangeDrawableAttributesSGIX
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
Reviewed-by: Ian Romanick <idr at freedesktop.org>
diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c
index f1c0ce6..c414dc8 100644
--- a/glx/glxcmdsswap.c
+++ b/glx/glxcmdsswap.c
@@ -354,7 +354,7 @@ int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
{
- xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) req;
+ xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_INT(&req->pbuffer);
@@ -364,7 +364,7 @@ int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
{
- xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) req;
+ xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_INT(&req->pbuffer);
@@ -375,7 +375,7 @@ int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
{
xGLXChangeDrawableAttributesReq *req =
- (xGLXChangeDrawableAttributesReq *) req;
+ (xGLXChangeDrawableAttributesReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
CARD32 *attribs;
@@ -392,7 +392,7 @@ int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl,
GLbyte *pc)
{
xGLXChangeDrawableAttributesSGIXReq *req =
- (xGLXChangeDrawableAttributesSGIXReq *) req;
+ (xGLXChangeDrawableAttributesSGIXReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
CARD32 *attribs;
commit b45d93e5b65fb819f9083ad2a8c10d0f2ff1abfc
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date: Mon Mar 22 09:30:51 2010 -0700
GLX: Remove a redundant initialization
Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
diff --git a/glx/indirect_dispatch.c b/glx/indirect_dispatch.c
index 6665519..ecd2bc8 100644
--- a/glx/indirect_dispatch.c
+++ b/glx/indirect_dispatch.c
@@ -98,8 +98,6 @@ void __glXDisp_CallLists(GLbyte * pc)
const GLenum type = *(GLenum *)(pc + 4);
const GLvoid * lists = (const GLvoid *)(pc + 8);
- lists = (const GLvoid *) (pc + 8);
-
CALL_CallLists( GET_DISPATCH(), (
n,
type,
More information about the Xquartz-changes
mailing list