Randomly fixing some MSVC warnings

This commit is contained in:
Pengfei Zhu
2022-07-01 18:50:10 +08:00
parent 17ea02a1b8
commit a2404bf243
7 changed files with 23 additions and 21 deletions
+4 -4
View File
@@ -117,11 +117,11 @@ void SDMCImporter::LoadSystemLanguage() {
return; return;
} }
ConfigSavegame config; ConfigSavegame config_savegame;
if (!config.Init(std::move(data))) { if (!config_savegame.Init(std::move(data))) {
return; return;
} }
system_language = static_cast<SMDH::TitleLanguage>(config.GetSystemLanguage()); system_language = static_cast<SMDH::TitleLanguage>(config_savegame.GetSystemLanguage());
break; break;
} }
} }
@@ -352,7 +352,7 @@ static const std::regex title_regex{"[0-9a-f]{8}"};
static std::string FindTMD(const std::string& path) { static std::string FindTMD(const std::string& path) {
std::string title_metadata; std::string title_metadata;
const bool ret = FileUtil::ForeachDirectoryEntry( FileUtil::ForeachDirectoryEntry(
nullptr, path, nullptr, path,
[&title_metadata](u64* /*num_entries_out*/, const std::string& directory, [&title_metadata](u64* /*num_entries_out*/, const std::string& directory,
const std::string& virtual_name) { const std::string& virtual_name) {
+2 -1
View File
@@ -121,7 +121,8 @@ std::size_t SDMCFile::Read(char* data, std::size_t length) {
return length_read; return length_read;
} }
std::size_t SDMCFile::Write(const char* data, std::size_t length) { std::size_t SDMCFile::Write([[maybe_unused]] const char* data,
[[maybe_unused]] std::size_t length) {
UNREACHABLE_MSG("Cannot write to a SDMCFile"); UNREACHABLE_MSG("Cannot write to a SDMCFile");
} }
+7 -7
View File
@@ -51,8 +51,8 @@ void DPIAwareDialog::OnScreenChanged() {
const double scaleX = window_handle->screen()->logicalDotsPerInchX() / 96.0; const double scaleX = window_handle->screen()->logicalDotsPerInchX() / 96.0;
const double scaleY = window_handle->screen()->logicalDotsPerInchY() / 96.0; const double scaleY = window_handle->screen()->logicalDotsPerInchY() / 96.0;
if (resized) { if (resized) {
const int new_width = static_cast<int>(scaleX * width() / previous_scaleX); const int new_width = static_cast<int>(scaleX * width() / prev_scaleX);
const int new_height = static_cast<int>(scaleY * height() / previous_scaleY); const int new_height = static_cast<int>(scaleY * height() / prev_scaleY);
setMinimumSize(0, 0); // Enforce this resize setMinimumSize(0, 0); // Enforce this resize
resize(new_width, new_height); resize(new_width, new_height);
} else { } else {
@@ -63,10 +63,10 @@ void DPIAwareDialog::OnScreenChanged() {
resized = false; // This resize isn't user-initiated resized = false; // This resize isn't user-initiated
} }
SetContentSizes(previous_width, previous_height); SetContentSizes(prev_width, prev_height);
previous_scaleX = scaleX; prev_scaleX = scaleX;
previous_scaleY = scaleY; prev_scaleY = scaleY;
previous_width = width(); prev_width = width();
previous_height = height(); prev_height = height();
} }
#endif #endif
+6 -5
View File
@@ -16,7 +16,8 @@ protected:
// Called with two zeroes to set up content sizes that are relative to dialog size. Also called // Called with two zeroes to set up content sizes that are relative to dialog size. Also called
// when screen is changed, to update those sizes. // when screen is changed, to update those sizes.
virtual void SetContentSizes(int previous_width = 0, int previous_height = 0){}; virtual void SetContentSizes([[maybe_unused]] int previous_width = 0,
[[maybe_unused]] int previous_height = 0){};
private: private:
QWindow* window_handle{}; QWindow* window_handle{};
@@ -31,9 +32,9 @@ private:
void OnScreenChanged(); void OnScreenChanged();
bool resized = false; // whether this dialog has been manually resized bool resized = false; // whether this dialog has been manually resized
double previous_scaleX{}; double prev_scaleX{};
double previous_scaleY{}; double prev_scaleY{};
int previous_width{}; int prev_width{};
int previous_height{}; int prev_height{};
#endif #endif
}; };
+2 -2
View File
@@ -184,7 +184,7 @@ ImportDialog::ImportDialog(QWidget* parent, const Core::Config& config_)
ImportDialog::~ImportDialog() = default; ImportDialog::~ImportDialog() = default;
void ImportDialog::SetContentSizes(int previous_width, int previous_height) { void ImportDialog::SetContentSizes(int previous_width, [[maybe_unused]] int previous_height) {
const int current_width = width(); const int current_width = width();
if (previous_width == 0) { // first time if (previous_width == 0) { // first time
ui->main->setColumnWidth(0, current_width * 0.66); ui->main->setColumnWidth(0, current_width * 0.66);
@@ -345,7 +345,7 @@ void ImportDialog::InsertSecondLevelItem(std::size_t row, const Core::ContentSpe
item->setCheckState(0, Qt::Unchecked); item->setCheckState(0, Qt::Unchecked);
} }
ui->main->invisibleRootItem()->child(row)->addChild(item); ui->main->invisibleRootItem()->child(static_cast<int>(row))->addChild(item);
} }
void ImportDialog::OnItemChanged(QTreeWidgetItem* item, int column) { void ImportDialog::OnItemChanged(QTreeWidgetItem* item, int column) {
+1 -1
View File
@@ -94,7 +94,7 @@ MainDialog::MainDialog(QWidget* parent)
MainDialog::~MainDialog() = default; MainDialog::~MainDialog() = default;
void MainDialog::SetContentSizes(int previous_width, int previous_height) { void MainDialog::SetContentSizes(int previous_width, [[maybe_unused]] int previous_height) {
const int current_width = width(); const int current_width = width();
if (previous_width == 0) { // first time if (previous_width == 0) { // first time
ui->main->setColumnWidth(0, 0.3 * current_width); ui->main->setColumnWidth(0, 0.3 * current_width);
+1 -1
View File
@@ -33,7 +33,7 @@ SelectNandDialog::SelectNandDialog(QWidget* parent,
} }
connect(button, &QRadioButton::toggled, this, [this, i](bool checked) { connect(button, &QRadioButton::toggled, this, [this, i](bool checked) {
if (checked) { if (checked) {
result = i; result = static_cast<int>(i);
} }
}); });
ui->contentLayout->addWidget(button); ui->contentLayout->addWidget(button);