fix: msvc warnings (#4651)
* fix: C4189 local variable is initialized but not referenced
* fix: C4706 assignment within conditional expression
* fix: C4018 signed/unsigned mismatch
* fix: warning C4996 High-DPI scaling is always enabled.
* fix: C4996: QApplication::fontMetrics() is deprecated
eed5514eaf
This commit is contained in:
parent
5fe95ad5b0
commit
977a190646
|
@ -50,7 +50,7 @@ std::string tr_net_strerror(int err)
|
|||
#ifdef _WIN32
|
||||
|
||||
auto buf = std::array<char, 512>{};
|
||||
auto const len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, err, 0, std::data(buf), std::size(buf), nullptr);
|
||||
(void)FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, err, 0, std::data(buf), std::size(buf), nullptr);
|
||||
return std::string{ tr_strvStrip(std::data(buf)) };
|
||||
|
||||
#else
|
||||
|
|
|
@ -370,7 +370,7 @@ Application::Application(int& argc, char** argv)
|
|||
|
||||
void Application::loadTranslations()
|
||||
{
|
||||
QStringList const qt_qm_dirs = QStringList() << QLibraryInfo::location(QLibraryInfo::TranslationsPath) <<
|
||||
auto const qt_qm_dirs = QStringList() << QLibraryInfo::location(QLibraryInfo::TranslationsPath) <<
|
||||
#ifdef TRANSLATIONS_DIR
|
||||
QStringLiteral(TRANSLATIONS_DIR) <<
|
||||
#endif
|
||||
|
@ -664,9 +664,6 @@ int tr_main(int argc, char** argv)
|
|||
{
|
||||
InteropHelper::initialize();
|
||||
|
||||
Application::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
Application::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
|
||||
Application const app(argc, argv);
|
||||
return QApplication::exec();
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ void FileTreeDelegate::paint(QPainter* painter, QStyleOptionViewItem const& opti
|
|||
p.rect = option.rect;
|
||||
p.rect.setSize(QSize(option.rect.width() - 4, option.rect.height() - 8));
|
||||
p.rect.moveCenter(option.rect.center());
|
||||
p.fontMetrics = QApplication::fontMetrics();
|
||||
p.fontMetrics = QFontMetrics{ QApplication::font() };
|
||||
p.minimum = 0;
|
||||
p.maximum = 100;
|
||||
p.textAlignment = Qt::AlignCenter;
|
||||
|
|
|
@ -409,7 +409,7 @@ TEST_F(AnnouncerUdpTest, canMultiScrape)
|
|||
auto buf = libtransmission::Buffer{};
|
||||
buf.addUint32(ScrapeAction);
|
||||
buf.addUint32(scrape_transaction_id);
|
||||
for (size_t i = 0; i < expected_response.row_count; ++i)
|
||||
for (int i = 0; i < expected_response.row_count; ++i)
|
||||
{
|
||||
buf.addUint32(expected_response.rows[i].seeders);
|
||||
buf.addUint32(expected_response.rows[i].downloads);
|
||||
|
|
|
@ -950,13 +950,11 @@ static void printDetails(tr_variant* top)
|
|||
{
|
||||
fmt::print(" Labels: ");
|
||||
|
||||
size_t child_pos = 0;
|
||||
tr_variant const* child;
|
||||
while ((child = tr_variantListChild(l, child_pos++)))
|
||||
for (size_t child_idx = 0, n_children = tr_variantListSize(l); child_idx < n_children; ++child_idx)
|
||||
{
|
||||
if (tr_variantGetStrView(child, &sv))
|
||||
if (tr_variantGetStrView(tr_variantListChild(l, child_idx++), &sv))
|
||||
{
|
||||
fmt::print(child_pos == 1 ? "{:s}" : ", {:s}", sv);
|
||||
fmt::print(child_idx == 1 ? "{:s}" : ", {:s}", sv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2039,18 +2037,13 @@ static void filterIds(tr_variant* top, Config& config)
|
|||
case 'l': // label
|
||||
if (tr_variant * l; tr_variantDictFindList(d, TR_KEY_labels, &l))
|
||||
{
|
||||
size_t child_pos = 0;
|
||||
tr_variant const* child;
|
||||
std::string_view sv;
|
||||
while ((child = tr_variantListChild(l, child_pos++)))
|
||||
for (size_t child_idx = 0, n_children = tr_variantListSize(l); child_idx < n_children; ++child_idx)
|
||||
{
|
||||
if (tr_variantGetStrView(child, &sv))
|
||||
if (auto sv = std::string_view{};
|
||||
tr_variantGetStrView(tr_variantListChild(l, child_idx), &sv) && arg == sv)
|
||||
{
|
||||
if (arg == sv)
|
||||
{
|
||||
include = !include;
|
||||
break;
|
||||
}
|
||||
include = !include;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue