Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
1b87e382
Commit
1b87e382
authored
Jun 05, 2020
by
Patrick José Pereira
Browse files
UnitTest: Remove deprecated qrand
Signed-off-by:
Patrick José Pereira
<
patrickelectric@gmail.com
>
parent
415388a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/qgcunittest/UnitTest.cc
View file @
1b87e382
...
...
@@ -20,6 +20,7 @@
#include
"AppSettings.h"
#include
"SettingsManager.h"
#include
<QRandomGenerator>
#include
<QTemporaryFile>
#include
<QTime>
...
...
@@ -464,12 +465,12 @@ QString UnitTest::createRandomFile(uint32_t byteCount)
QTemporaryFile
tempFile
;
QTime
time
=
QTime
::
currentTime
();
qsrand
((
uint
)
time
.
msec
());
QRandomGenerator
::
global
()
->
seed
(
time
.
msec
());
tempFile
.
setAutoRemove
(
false
);
if
(
tempFile
.
open
())
{
for
(
uint32_t
bytesWritten
=
0
;
bytesWritten
<
byteCount
;
bytesWritten
++
)
{
unsigned
char
byte
=
(
qrand
()
*
0xFF
)
/
RAND_MAX
;
unsigned
char
byte
=
(
QRandomGenerator
::
global
()
->
generate
()
*
0xFF
)
/
RAND_MAX
;
tempFile
.
write
((
char
*
)
&
byte
,
1
);
}
tempFile
.
close
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment