From cc7c3adcad973949ac976c3dc71bb8cf2677056c Mon Sep 17 00:00:00 2001 From: Al Date: Fri, 11 Jan 2019 13:50:51 +0100 Subject: Fix or ignore a number of compiler warnings. --- src/aboutdialog.ui | 10 +++++----- src/overwriteinfodialog.cpp | 2 +- src/pluginlist.cpp | 2 +- src/selfupdater.cpp | 3 +-- src/settings.cpp | 2 +- src/shared/leaktrace.cpp | 13 ++++++++++++- src/spawn.cpp | 2 +- 7 files changed, 22 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/aboutdialog.ui b/src/aboutdialog.ui index ac7db1fc..86b95c83 100644 --- a/src/aboutdialog.ui +++ b/src/aboutdialog.ui @@ -161,7 +161,7 @@ - + QAbstractItemView::NoSelection @@ -202,7 +202,7 @@ - + QAbstractItemView::NoSelection @@ -231,9 +231,9 @@ Translators - + - + QAbstractItemView::NoSelection @@ -363,7 +363,7 @@ Other Supporters && Contributors - + diff --git a/src/overwriteinfodialog.cpp b/src/overwriteinfodialog.cpp index 1fe3f645..4d35a2c3 100644 --- a/src/overwriteinfodialog.cpp +++ b/src/overwriteinfodialog.cpp @@ -220,7 +220,7 @@ void OverwriteInfoDialog::openFile(const QModelIndex &index) QString fileName = m_FileSystemModel->filePath(index); HINSTANCE res = ::ShellExecuteW(nullptr, L"open", ToWString(fileName).c_str(), nullptr, nullptr, SW_SHOW); - if ((int)res <= 32) { + if ((INT_PTR)res <= 32) { qCritical("failed to invoke %s: %d", fileName.toUtf8().constData(), res); } } diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 6f417331..25f9c545 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -153,7 +153,7 @@ void PluginList::highlightPlugins(const QItemSelectionModel *selection, const MO } } } - emit dataChanged(this->index(0, 0), this->index(m_ESPs.size() - 1, this->columnCount() - 1)); + emit dataChanged(this->index(0, 0), this->index(static_cast(m_ESPs.size()) - 1, this->columnCount() - 1)); } void PluginList::refresh(const QString &profileName diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp index c913af6a..b5e7684c 100644 --- a/src/selfupdater.cpp +++ b/src/selfupdater.cpp @@ -338,9 +338,8 @@ void SelfUpdater::installUpdate() } else { reportError(tr("Failed to start %1: %2") .arg(m_UpdateFile.fileName()) - .arg((int)res)); + .arg((INT_PTR)res)); } - m_UpdateFile.remove(); } diff --git a/src/settings.cpp b/src/settings.cpp index f981f811..9267cccf 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -142,7 +142,7 @@ void Settings::registerAsNXMHandler(bool force) } parameters += L" \"" + executable + L"\""; HINSTANCE res = ::ShellExecuteW(nullptr, L"open", nxmPath.c_str(), parameters.c_str(), nullptr, SW_SHOWNORMAL); - if ((int)res <= 32) { + if ((INT_PTR)res <= 32) { QMessageBox::critical(nullptr, tr("Failed"), tr("Sorry, failed to start the helper application")); } diff --git a/src/shared/leaktrace.cpp b/src/shared/leaktrace.cpp index 1ff1fa9d..466162a4 100644 --- a/src/shared/leaktrace.cpp +++ b/src/shared/leaktrace.cpp @@ -1,3 +1,8 @@ +//disable warning messages 4302 , 4311 and 4312 +#pragma warning( disable : 4302 ) +#pragma warning( disable : 4311 ) +#pragma warning( disable : 4312 ) + #include "leaktrace.h" #include "stackdata.h" #include @@ -31,7 +36,7 @@ static struct __TraceData { for (auto iter = result.begin(); iter != result.end(); ++iter) { printf("-----------------------------------\n" "%d objects not freed, allocated at:\n%s", - iter->second.size(), iter->first.toString().c_str()); + static_cast(iter->second.size()), iter->first.toString().c_str()); printf("Addresses: "); for (int i = 0; i < (std::min)(5, static_cast(iter->second.size())); ++i) { @@ -55,3 +60,9 @@ void LeakTrace::TraceDealloc(void *ptr) { __trace.deregTrace(ptr); } + +//re-enable warning messages 4302 , 4311 and 4312 +#pragma warning( default : 4302 ) +#pragma warning( default : 4311 ) +#pragma warning( default : 4312 ) + diff --git a/src/spawn.cpp b/src/spawn.cpp index f8a7bb5f..e1de5c0f 100644 --- a/src/spawn.cpp +++ b/src/spawn.cpp @@ -94,7 +94,7 @@ static bool spawn(LPCWSTR binary, LPCWSTR arguments, LPCWSTR currentDirectory, PROCESS_INFORMATION pi; BOOL success = FALSE; if (hooked) { - qDebug() << "Creating process hooked: <" << QString::fromWCharArray(commandLine, length) <<">"; + qDebug() << "Creating process hooked: <" << QString::fromWCharArray(commandLine, static_cast(length)) <<">"; success = ::CreateProcessHooked(nullptr, commandLine, nullptr, nullptr, // no special process or thread attributes -- cgit v1.3.1