citra_qt: Resolve C4267 warning on MSVC

This commit is contained in:
Morph 2022-05-12 00:23:57 -04:00
parent de1374c1b9
commit 0d955c452b
5 changed files with 8 additions and 7 deletions

View file

@ -48,10 +48,11 @@ CheatDialog::~CheatDialog() = default;
void CheatDialog::LoadCheats() { void CheatDialog::LoadCheats() {
cheats = Core::System::GetInstance().CheatEngine().GetCheats(); cheats = Core::System::GetInstance().CheatEngine().GetCheats();
const int cheats_count = static_cast<int>(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(); QCheckBox* enabled = new QCheckBox();
enabled->setChecked(cheats[i]->IsEnabled()); enabled->setChecked(cheats[i]->IsEnabled());
enabled->setStyleSheet(QStringLiteral("margin-left:7px;")); enabled->setStyleSheet(QStringLiteral("margin-left:7px;"));

View file

@ -950,14 +950,14 @@ void Config::SaveMultiplayerValues() {
// Write ban list // Write ban list
qt_config->beginWriteArray(QStringLiteral("username_ban_list")); qt_config->beginWriteArray(QStringLiteral("username_ban_list"));
for (std::size_t i = 0; i < UISettings::values.ban_list.first.size(); ++i) { for (std::size_t i = 0; i < UISettings::values.ban_list.first.size(); ++i) {
qt_config->setArrayIndex(i); qt_config->setArrayIndex(static_cast<int>(i));
WriteSetting(QStringLiteral("username"), WriteSetting(QStringLiteral("username"),
QString::fromStdString(UISettings::values.ban_list.first[i])); QString::fromStdString(UISettings::values.ban_list.first[i]));
} }
qt_config->endArray(); qt_config->endArray();
qt_config->beginWriteArray(QStringLiteral("ip_ban_list")); qt_config->beginWriteArray(QStringLiteral("ip_ban_list"));
for (std::size_t i = 0; i < UISettings::values.ban_list.second.size(); ++i) { for (std::size_t i = 0; i < UISettings::values.ban_list.second.size(); ++i) {
qt_config->setArrayIndex(i); qt_config->setArrayIndex(static_cast<int>(i));
WriteSetting(QStringLiteral("ip"), WriteSetting(QStringLiteral("ip"),
QString::fromStdString(UISettings::values.ban_list.second[i])); QString::fromStdString(UISettings::values.ban_list.second[i]));
} }

View file

@ -256,7 +256,7 @@ void ConfigureCamera::SetConfiguration() {
int index = GetSelectedCameraIndex(); int index = GetSelectedCameraIndex();
for (std::size_t i = 0; i < Implementations.size(); i++) { for (std::size_t i = 0; i < Implementations.size(); i++) {
if (Implementations[i] == camera_name[index]) { if (Implementations[i] == camera_name[index]) {
ui->image_source->setCurrentIndex(i); ui->image_source->setCurrentIndex(static_cast<int>(i));
} }
} }
if (camera_name[index] == "image") { if (camera_name[index] == "image") {

View file

@ -115,7 +115,7 @@ void IPCRecorderWidget::SetEnabled(bool enabled) {
} }
void IPCRecorderWidget::Clear() { void IPCRecorderWidget::Clear() {
id_offset += records.size(); id_offset += static_cast<int>(records.size());
records.clear(); records.clear();
ui->main->invisibleRootItem()->takeChildren(); ui->main->invisibleRootItem()->takeChildren();

View file

@ -390,7 +390,7 @@ void ChatRoom::SetPlayerList(const Network::RoomMember::MemberList& member_list)
return; return;
QPixmap pixmap; QPixmap pixmap;
if (!pixmap.loadFromData(reinterpret_cast<const u8*>(result.data()), if (!pixmap.loadFromData(reinterpret_cast<const u8*>(result.data()),
result.size())) static_cast<u32>(result.size())))
return; return;
icon_cache[avatar_url] = icon_cache[avatar_url] =
pixmap.scaled(48, 48, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); pixmap.scaled(48, 48, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);