Fix various -Wdeprecated-enum-float-conversions around the code
In two cases, it was as easy as replacing an unnamed enum's values with constexpr variables. In the case of QSimplex, I opted for qToUnderlying(), as the enum made sense on its own. Change-Id: Ifcf5be14bd2f35e50adabdbd7ecdb2e83f6bf5b4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
18113e22e9
commit
8e0c2d7d22
@ -551,7 +551,7 @@ qreal QSimplex::solver(SolverFactor factor)
|
||||
|
||||
// Return the value calculated by the simplex plus the value of the
|
||||
// fixed variables.
|
||||
return (factor * valueAt(0, columns - 1)) + resultOffset;
|
||||
return (qToUnderlying(factor) * valueAt(0, columns - 1)) + resultOffset;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -750,18 +750,16 @@ void tst_QRandomGenerator::qualityReal()
|
||||
return;
|
||||
RandomGenerator rng(control);
|
||||
|
||||
enum {
|
||||
SampleSize = 16000,
|
||||
constexpr int SampleSize = 16000;
|
||||
|
||||
// Expected value: sample size times proportion of the range:
|
||||
PerfectOctile = SampleSize / 8,
|
||||
PerfectHalf = SampleSize / 2,
|
||||
// Expected value: sample size times proportion of the range:
|
||||
constexpr int PerfectOctile = SampleSize / 8;
|
||||
constexpr int PerfectHalf = SampleSize / 2;
|
||||
|
||||
// Variance is (1 - proportion of range) * expected; sqrt() for standard deviations.
|
||||
// Should usually be within twice that and almost never outside four times:
|
||||
RangeHalf = 252, // floor(4 * sqrt((1 - 0.5) * PerfectHalf))
|
||||
RangeOctile = 167 // floor(4 * sqrt((1 - 0.125) * PerfectOctile))
|
||||
};
|
||||
// Variance is (1 - proportion of range) * expected; sqrt() for standard deviations.
|
||||
// Should usually be within twice that and almost never outside four times:
|
||||
constexpr int RangeHalf = 252; // floor(4 * sqrt((1 - 0.5) * PerfectHalf))
|
||||
constexpr int RangeOctile = 167; // floor(4 * sqrt((1 - 0.125) * PerfectOctile))
|
||||
|
||||
double data[SampleSize];
|
||||
std::generate(std::begin(data), std::end(data), [&rng] { return rng.generateDouble(); });
|
||||
|
@ -631,9 +631,11 @@ void tst_qnetworkreply::uploadPerformance()
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
}
|
||||
|
||||
constexpr qint64 MiB = 1024 * 1024;
|
||||
|
||||
void tst_qnetworkreply::httpUploadPerformance()
|
||||
{
|
||||
enum {UploadSize = 128*1024*1024}; // 128 MB
|
||||
constexpr qint64 UploadSize = 128 * MiB;
|
||||
|
||||
ThreadedDataReaderHttpServer reader;
|
||||
FixedSizeDataGenerator generator(UploadSize);
|
||||
@ -701,7 +703,7 @@ void tst_qnetworkreply::httpDownloadPerformance()
|
||||
QFETCH(bool, serverSendsContentLength);
|
||||
QFETCH(bool, chunkedEncoding);
|
||||
|
||||
enum {UploadSize = 128*1024*1024}; // 128 MB
|
||||
constexpr qint64 UploadSize = 128 * MiB;
|
||||
|
||||
HttpDownloadPerformanceServer server(UploadSize, serverSendsContentLength, chunkedEncoding);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user