summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2013-10-20 12:40:03 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2013-10-20 12:40:03 +0000
commitf35fa0e0d5d22c7b2f7ca3e733f7c2fbe977e4de (patch)
treea1964b374a6533b2afaecf295369e7b9d89302cd /lib
parent60a2e82f082294e2917cf0c0be1c5d5cb804b564 (diff)
Use arc4random()
Diffstat (limited to 'lib')
-rw-r--r--lib/libXft/src/xftdpy.c2
-rw-r--r--lib/libXft/src/xftdraw.c2
-rw-r--r--lib/libXft/src/xftfreetype.c5
-rw-r--r--lib/libXft/src/xftglyphs.c2
4 files changed, 6 insertions, 5 deletions
diff --git a/lib/libXft/src/xftdpy.c b/lib/libXft/src/xftdpy.c
index c5b756e25..b8f02e0ea 100644
--- a/lib/libXft/src/xftdpy.c
+++ b/lib/libXft/src/xftdpy.c
@@ -229,7 +229,7 @@ _XftDisplayManageMemory (Display *dpy)
}
while (info->glyph_memory > info->max_glyph_memory)
{
- glyph_memory = rand () % info->glyph_memory;
+ glyph_memory = arc4random_uniform (info->glyph_memory);
public = info->fonts;
while (public)
{
diff --git a/lib/libXft/src/xftdraw.c b/lib/libXft/src/xftdraw.c
index 186bcb876..5cc4d6909 100644
--- a/lib/libXft/src/xftdraw.c
+++ b/lib/libXft/src/xftdraw.c
@@ -332,7 +332,7 @@ XftDrawSrcPicture (XftDraw *draw, _Xconst XftColor *color)
/*
* Pick one to replace at random
*/
- i = (unsigned int) rand () % XFT_NUM_SOLID_COLOR;
+ i = (unsigned int) arc4random_uniform (XFT_NUM_SOLID_COLOR);
/*
* Recreate if it was for the wrong screen
*/
diff --git a/lib/libXft/src/xftfreetype.c b/lib/libXft/src/xftfreetype.c
index a3b833299..6ed17cec1 100644
--- a/lib/libXft/src/xftfreetype.c
+++ b/lib/libXft/src/xftfreetype.c
@@ -132,7 +132,7 @@ _XftUncacheFiles (void)
XftFtFile *f;
while ((n = _XftNumFiles ()) > XftMaxFreeTypeFiles)
{
- f = _XftNthFile (rand () % n);
+ f = _XftNthFile (arc4random_uniform (n));
if (f)
{
if (XftDebug() & XFT_DBG_REF)
@@ -1094,7 +1094,8 @@ XftFontManageMemory (Display *dpy)
return;
while (info->num_unref_fonts > info->max_unref_fonts)
{
- public = XftFontFindNthUnref (info, rand() % info->num_unref_fonts);
+ public = XftFontFindNthUnref (info,
+ arc4random_uniform(info->num_unref_fonts));
font = (XftFontInt *) public;
if (XftDebug () & XFT_DBG_CACHE)
diff --git a/lib/libXft/src/xftglyphs.c b/lib/libXft/src/xftglyphs.c
index 2f3dc5a6b..87e0dcf1a 100644
--- a/lib/libXft/src/xftglyphs.c
+++ b/lib/libXft/src/xftglyphs.c
@@ -880,7 +880,7 @@ _XftFontUncacheGlyph (Display *dpy, XftFont *pub)
return;
if (font->use_free_glyphs)
{
- glyph_memory = rand() % font->glyph_memory;
+ glyph_memory = arc4random_uniform(font->glyph_memory);
}
else
{