From 0d955c452bb8a76fe0e68a04fe7e779b646e768f Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Thu, 12 May 2022 00:23:57 -0400 Subject: [PATCH] citra_qt: Resolve C4267 warning on MSVC --- src/citra_qt/cheats.cpp | 5 +++-- src/citra_qt/configuration/config.cpp | 4 ++-- src/citra_qt/configuration/configure_camera.cpp | 2 +- src/citra_qt/debugger/ipc/recorder.cpp | 2 +- src/citra_qt/multiplayer/chat_room.cpp | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/citra_qt/cheats.cpp b/src/citra_qt/cheats.cpp index 25379b72c..25e173687 100644 --- a/src/citra_qt/cheats.cpp +++ b/src/citra_qt/cheats.cpp @@ -48,10 +48,11 @@ CheatDialog::~CheatDialog() = default; void CheatDialog::LoadCheats() { cheats = Core::System::GetInstance().CheatEngine().GetCheats(); + const int cheats_count = static_cast(cheats.size()); - ui->tableCheats->setRowCount(cheats.size()); + ui->tableCheats->setRowCount(cheats_count); - for (size_t i = 0; i < cheats.size(); i++) { + for (int i = 0; i < cheats_count; i++) { QCheckBox* enabled = new QCheckBox(); enabled->setChecked(cheats[i]->IsEnabled()); enabled->setStyleSheet(QStringLiteral("margin-left:7px;")); diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index 770a7fe30..f318b2825 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -950,14 +950,14 @@ void Config::SaveMultiplayerValues() { // Write ban list qt_config->beginWriteArray(QStringLiteral("username_ban_list")); for (std::size_t i = 0; i < UISettings::values.ban_list.first.size(); ++i) { - qt_config->setArrayIndex(i); + qt_config->setArrayIndex(static_cast(i)); WriteSetting(QStringLiteral("username"), QString::fromStdString(UISettings::values.ban_list.first[i])); } qt_config->endArray(); qt_config->beginWriteArray(QStringLiteral("ip_ban_list")); for (std::size_t i = 0; i < UISettings::values.ban_list.second.size(); ++i) { - qt_config->setArrayIndex(i); + qt_config->setArrayIndex(static_cast(i)); WriteSetting(QStringLiteral("ip"), QString::fromStdString(UISettings::values.ban_list.second[i])); } diff --git a/src/citra_qt/configuration/configure_camera.cpp b/src/citra_qt/configuration/configure_camera.cpp index a89dc3151..b58ea95d3 100644 --- a/src/citra_qt/configuration/configure_camera.cpp +++ b/src/citra_qt/configuration/configure_camera.cpp @@ -256,7 +256,7 @@ void ConfigureCamera::SetConfiguration() { int index = GetSelectedCameraIndex(); for (std::size_t i = 0; i < Implementations.size(); i++) { if (Implementations[i] == camera_name[index]) { - ui->image_source->setCurrentIndex(i); + ui->image_source->setCurrentIndex(static_cast(i)); } } if (camera_name[index] == "image") { diff --git a/src/citra_qt/debugger/ipc/recorder.cpp b/src/citra_qt/debugger/ipc/recorder.cpp index b4ed84ad0..1ec281ae2 100644 --- a/src/citra_qt/debugger/ipc/recorder.cpp +++ b/src/citra_qt/debugger/ipc/recorder.cpp @@ -115,7 +115,7 @@ void IPCRecorderWidget::SetEnabled(bool enabled) { } void IPCRecorderWidget::Clear() { - id_offset += records.size(); + id_offset += static_cast(records.size()); records.clear(); ui->main->invisibleRootItem()->takeChildren(); diff --git a/src/citra_qt/multiplayer/chat_room.cpp b/src/citra_qt/multiplayer/chat_room.cpp index 440736978..ffd9a0b68 100644 --- a/src/citra_qt/multiplayer/chat_room.cpp +++ b/src/citra_qt/multiplayer/chat_room.cpp @@ -390,7 +390,7 @@ void ChatRoom::SetPlayerList(const Network::RoomMember::MemberList& member_list) return; QPixmap pixmap; if (!pixmap.loadFromData(reinterpret_cast(result.data()), - result.size())) + static_cast(result.size()))) return; icon_cache[avatar_url] = pixmap.scaled(48, 48, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);