Skip to content

Commit

Permalink
Merge pull request swl-x#126 from patrickelectric/fix_rand
Browse files Browse the repository at this point in the history
filepathoperations: Use QRandomGenerator over deprecated qrand
  • Loading branch information
lfdominguez authored Jun 24, 2020
2 parents 1da4a97 + 9251fc6 commit e72b601
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion services/filepathoperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "filepathoperations.h"
#include <QCoreApplication>
#include <QRandomGenerator>

FilePathOperations::FilePathOperations()
{
Expand Down Expand Up @@ -62,7 +63,7 @@ QString FilePathOperations::GenerateTempFileName(const QString& filename)
do {
// Generate temporary file name.
result = QString("%1-%2-temp-%3.%4").arg(filename)
.arg(qrand()).arg(QCoreApplication::applicationPid())
.arg(QRandomGenerator::global()->generate()).arg(QCoreApplication::applicationPid())
.arg(QFileInfo(filename).suffix());
} while (QFileInfo(result).exists()); // Regenerate if exists.

Expand Down

0 comments on commit e72b601

Please sign in to comment.