Deprecation warnings: replace qrand with QRandomGenerator

Change-Id: I80fe6f611b367c6c8a1b77e82dc791493f88929b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-03-23 11:41:53 +01:00
parent 3f744be923
commit 34fe5f75bc
3 changed files with 8 additions and 3 deletions

View File

@ -39,6 +39,7 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qdatastream.h>
#include <QtCore/qmessageauthenticationcode.h>
#include <QtCore/qrandom.h>
#include "qsslsocket_p.h"
#include "qasn1element_p.h"
@ -138,7 +139,7 @@ static QByteArray _q_PKCS12_salt()
QByteArray salt;
salt.resize(8);
for (int i = 0; i < salt.size(); ++i)
salt[i] = (qrand() & 0xff);
salt[i] = (QRandomGenerator::global()->generate() & 0xff);
return salt;
}

View File

@ -37,6 +37,8 @@
**
****************************************************************************/
#include <QtCore/qrandom.h>
#include <private/qpixmapcache_p.h>
#include <private/qpaintengine_p.h>
#include <private/qpolygonclipper_p.h>
@ -504,7 +506,7 @@ static Picture getPatternFill(int screen, const QBrush &b)
return X11->pattern_fills[i].picture;
}
// none found, replace one
int i = qrand() % 16;
int i = QRandomGenerator::global()->generate() % 16;
if (X11->pattern_fills[i].screen != screen && X11->pattern_fills[i].picture) {
XRenderFreePicture (QXcbX11Info::display(), X11->pattern_fills[i].picture);

View File

@ -37,6 +37,8 @@
**
****************************************************************************/
#include <QtCore/qrandom.h>
#include "qxcbconnection.h"
#include "qcolormap_x11_p.h"
#include "qxcbnativepainting.h"
@ -279,7 +281,7 @@ Picture QXcbX11Data::getSolidFill(int screen, const QColor &c)
return X11->solid_fills[i].picture;
}
// none found, replace one
int i = qrand() % 16;
int i = QRandomGenerator::global()->generate() % 16;
if (X11->solid_fills[i].screen != screen && X11->solid_fills[i].picture) {
XRenderFreePicture (X11->display, X11->solid_fills[i].picture);