Merge pull request #5675 from knst/fix-ubuntu-23-10

fix: reduce warnings during build on Ubuntu 23.10
This commit is contained in:
PastaPastaPasta 2023-11-06 09:15:49 -06:00 committed by GitHub
commit 8f597a3f2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 14 deletions

View File

@ -59,12 +59,12 @@ static void strings_1_tostring(benchmark::Bench& bench)
static void strings_2_multi_lexical_cast(benchmark::Bench& bench)
{
int i{0};
bench.run([&] {
bench.run([&] { static_cast<void>(
boost::lexical_cast<std::string>(i) +
boost::lexical_cast<std::string>(i+1) +
boost::lexical_cast<std::string>(i+2) +
boost::lexical_cast<std::string>(i+3) +
boost::lexical_cast<std::string>(i+4);
boost::lexical_cast<std::string>(i+4));
++i;
});
}
@ -72,8 +72,8 @@ static void strings_2_multi_lexical_cast(benchmark::Bench& bench)
static void strings_2_multi_numberToString(benchmark::Bench& bench)
{
int i{0};
bench.run([&] {
NumberToString(i) + NumberToString(i+1) + NumberToString(i+2) + NumberToString(i+3) + NumberToString(i+4);
bench.run([&] { static_cast<void>(
NumberToString(i) + NumberToString(i+1) + NumberToString(i+2) + NumberToString(i+3) + NumberToString(i+4));
++i;
});
}
@ -81,8 +81,8 @@ static void strings_2_multi_numberToString(benchmark::Bench& bench)
static void strings_2_multi_tostring(benchmark::Bench& bench)
{
int i{0};
bench.run([&] {
ToString(i) + ToString(i+1) + ToString(i+2) + ToString(i+3) + ToString(i+4);
bench.run([&] { static_cast<void>(
ToString(i) + ToString(i+1) + ToString(i+2) + ToString(i+3) + ToString(i+4));
++i;
});
}

View File

@ -1305,7 +1305,7 @@ bool loadFonts()
auto supportedWeights = [](FontFamily family) -> std::vector<QFont::Weight> {
auto getTestWidth = [&](QFont::Weight weight) -> int {
QFont font = getFont(family, weight, false, defaultFontSize);
return QFontMetrics(font).width("Check the width of this text to see if the weight change has an impact!");
return TextWidth(QFontMetrics(font), ("Check the width of this text to see if the weight change has an impact!"));
};
std::vector<QFont::Weight> vecWeights{QFont::Thin, QFont::ExtraLight, QFont::Light,
QFont::Normal, QFont::Medium, QFont::DemiBold,

View File

@ -6,7 +6,7 @@
#include <qt/trafficgraphdata.h>
#include <algorithm>
#include <sstream>
#include <QTime>
#include <QRandomGenerator>
void TrafficGraphDataTests::simpleCurrentSampleQueueTests()
{
@ -137,13 +137,12 @@ void compareQueues(const TrafficGraphData::SampleQueue& expected, const TrafficG
void testRangeSwitch(TrafficGraphData::GraphRange baseRange, TrafficGraphData::GraphRange toRange,int size)
{
QTime time = QTime::currentTime();
qsrand((uint)time.msec());
TrafficGraphData trafficGraphDataBase(baseRange);
TrafficGraphData trafficGraphData(toRange);
auto* generator = QRandomGenerator::global();
for (int i = 1; i <= size; i++){
int in = qrand() % 1000;
int out = qrand() % 1000;
int in = generator->generate() % 1000;
int out = generator->generate() % 1000;
trafficGraphData.update(TrafficSample(in, out));
trafficGraphDataBase.update(TrafficSample(in, out));
}

View File

@ -173,8 +173,8 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *)
QFontMetrics fmTotal(fontTotal);
QFontMetrics fmInOut(fontInOut);
const int nSizeMark = fmInOut.height() + 2 * nPadding;
const int nWidthText = fmInOut.width(strReceived) + 2 * nPadding;
const int nWidthBytes = fmInOut.width("1000 GB") + 2 * nPadding;
const int nWidthText = GUIUtil::TextWidth(fmInOut, strReceived) + 2 * nPadding;
const int nWidthBytes = GUIUtil::TextWidth(fmInOut, "1000 GB") + 2 * nPadding;
const int nHeightTotals = fmTotal.height() + 2 * nPadding;
const int nHeightInOut = fmInOut.height() + 2 * nPadding;
const int nWidthStats = nSizeMark + nWidthText + nWidthBytes + 2 * nPadding;