aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-07-07 15:19:00 +0200
committerGitHub <noreply@github.com>2023-07-07 15:19:00 +0200
commite225a721807b00297a5733e9d60fe2b5603de77c (patch)
tree91d9e3ba54a32cb5724f0297dd842b990f065db7
parent2cb22ad280ec0b540ec6e96759d478c60562bc9a (diff)
parent13d67c6524a29daea51242d17ba0c6a2b8593747 (diff)
downloadPrismLauncher-e225a721807b00297a5733e9d60fe2b5603de77c.tar.gz
PrismLauncher-e225a721807b00297a5733e9d60fe2b5603de77c.tar.bz2
PrismLauncher-e225a721807b00297a5733e9d60fe2b5603de77c.zip
Merge pull request #1128 from pandaninjas/fix-implicit-fallthrough
-rw-r--r--launcher/LaunchController.cpp4
-rw-r--r--launcher/VersionProxyModel.cpp30
-rw-r--r--launcher/meta/Index.cpp8
-rw-r--r--launcher/minecraft/auth/AccountList.cpp12
-rw-r--r--launcher/minecraft/auth/Yggdrasil.cpp1
-rw-r--r--launcher/minecraft/mod/DataPack.cpp2
-rw-r--r--launcher/minecraft/mod/Mod.cpp3
-rw-r--r--launcher/minecraft/mod/Resource.cpp3
-rw-r--r--launcher/minecraft/mod/ResourcePack.cpp2
-rw-r--r--launcher/modplatform/flame/FlameInstanceCreationTask.cpp3
-rw-r--r--launcher/translations/TranslationsModel.cpp1
-rw-r--r--launcher/ui/instanceview/AccessibleInstanceView.cpp2
-rw-r--r--launcher/ui/pages/instance/WorldListPage.cpp1
-rw-r--r--launcher/ui/setupwizard/JavaWizardPage.cpp1
-rw-r--r--libraries/murmur2/src/MurmurHash2.cpp2
15 files changed, 43 insertions, 32 deletions
diff --git a/launcher/LaunchController.cpp b/launcher/LaunchController.cpp
index 070ee283..5d84b3bf 100644
--- a/launcher/LaunchController.cpp
+++ b/launcher/LaunchController.cpp
@@ -187,8 +187,8 @@ void LaunchController::login() {
switch(m_accountToUse->accountState()) {
case AccountState::Offline: {
m_session->wants_online = false;
- // NOTE: fallthrough is intentional
}
+ /* fallthrough */
case AccountState::Online: {
if(!m_session->wants_online) {
// we ask the user for a player name
@@ -267,8 +267,8 @@ void LaunchController::login() {
// This means some sort of soft error that we can fix with a refresh ... so let's refresh.
case AccountState::Unchecked: {
m_accountToUse->refresh();
- // NOTE: fallthrough intentional
}
+ /* fallthrough */
case AccountState::Working: {
// refresh is in progress, we need to wait for it to finish to proceed.
ProgressDialog progDialog(m_parentWidget);
diff --git a/launcher/VersionProxyModel.cpp b/launcher/VersionProxyModel.cpp
index e5c66566..63a43465 100644
--- a/launcher/VersionProxyModel.cpp
+++ b/launcher/VersionProxyModel.cpp
@@ -193,31 +193,21 @@ QVariant VersionProxyModel::data(const QModelIndex &index, int role) const
}
case Qt::ToolTipRole:
{
- switch(column)
+ if(column == Name && hasRecommended)
{
- case Name:
+ auto value = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole);
+ if(value.toBool())
{
- if(hasRecommended)
+ return tr("Recommended");
+ } else if(hasLatest) {
+ auto value = sourceModel()->data(parentIndex, BaseVersionList::LatestRole);
+ if(value.toBool())
{
- auto value = sourceModel()->data(parentIndex, BaseVersionList::RecommendedRole);
- if(value.toBool())
- {
- return tr("Recommended");
- }
- else if(hasLatest)
- {
- auto value = sourceModel()->data(parentIndex, BaseVersionList::LatestRole);
- if(value.toBool())
- {
- return tr("Latest");
- }
- }
+ return tr("Latest");
}
}
- default:
- {
- return sourceModel()->data(parentIndex, BaseVersionList::VersionIdRole);
- }
+ } else {
+ return sourceModel()->data(parentIndex, BaseVersionList::VersionIdRole);
}
}
case Qt::DecorationRole:
diff --git a/launcher/meta/Index.cpp b/launcher/meta/Index.cpp
index 242aad9f..4dccccca 100644
--- a/launcher/meta/Index.cpp
+++ b/launcher/meta/Index.cpp
@@ -45,10 +45,10 @@ QVariant Index::data(const QModelIndex &index, int role) const
switch (role)
{
case Qt::DisplayRole:
- switch (index.column())
- {
- case 0: return list->humanReadable();
- default: break;
+ if (index.column() == 0) {
+ return list->humanReadable();
+ } else {
+ break;
}
case UidRole: return list->uid();
case NameRole: return list->name();
diff --git a/launcher/minecraft/auth/AccountList.cpp b/launcher/minecraft/auth/AccountList.cpp
index c2794147..d6f42b75 100644
--- a/launcher/minecraft/auth/AccountList.cpp
+++ b/launcher/minecraft/auth/AccountList.cpp
@@ -328,6 +328,9 @@ QVariant AccountList::data(const QModelIndex &index, int role) const
case AccountState::Gone: {
return tr("Gone", "Account status");
}
+ default: {
+ return tr("Unknown", "Account status");
+ }
}
}
@@ -354,11 +357,12 @@ QVariant AccountList::data(const QModelIndex &index, int role) const
return QVariant::fromValue(account);
case Qt::CheckStateRole:
- switch (index.column())
- {
- case ProfileNameColumn:
- return account == m_defaultAccount ? Qt::Checked : Qt::Unchecked;
+ if (index.column() == ProfileNameColumn) {
+ return account == m_defaultAccount ? Qt::Checked : Qt::Unchecked;
+ } else {
+ return QVariant();
}
+
default:
return QVariant();
diff --git a/launcher/minecraft/auth/Yggdrasil.cpp b/launcher/minecraft/auth/Yggdrasil.cpp
index 29978411..d3e7ccdd 100644
--- a/launcher/minecraft/auth/Yggdrasil.cpp
+++ b/launcher/minecraft/auth/Yggdrasil.cpp
@@ -273,6 +273,7 @@ void Yggdrasil::processReply() {
AccountTaskState::STATE_FAILED_GONE,
tr("The Mojang account no longer exists. It may have been migrated to a Microsoft account.")
);
+ return;
}
default:
changeState(
diff --git a/launcher/minecraft/mod/DataPack.cpp b/launcher/minecraft/mod/DataPack.cpp
index ca75cd2a..c5754638 100644
--- a/launcher/minecraft/mod/DataPack.cpp
+++ b/launcher/minecraft/mod/DataPack.cpp
@@ -74,6 +74,7 @@ std::pair<int, bool> DataPack::compare(const Resource& other, SortType type) con
auto res = Resource::compare(other, type);
if (res.first != 0)
return res;
+ break;
}
case SortType::PACK_FORMAT: {
auto this_ver = packFormat();
@@ -83,6 +84,7 @@ std::pair<int, bool> DataPack::compare(const Resource& other, SortType type) con
return { 1, type == SortType::PACK_FORMAT };
if (this_ver < other_ver)
return { -1, type == SortType::PACK_FORMAT };
+ break;
}
}
return { 0, false };
diff --git a/launcher/minecraft/mod/Mod.cpp b/launcher/minecraft/mod/Mod.cpp
index e613ddeb..f8af9d8f 100644
--- a/launcher/minecraft/mod/Mod.cpp
+++ b/launcher/minecraft/mod/Mod.cpp
@@ -91,6 +91,7 @@ std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
auto res = Resource::compare(other, type);
if (res.first != 0)
return res;
+ break;
}
case SortType::VERSION: {
auto this_ver = Version(version());
@@ -99,11 +100,13 @@ std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
return { 1, type == SortType::VERSION };
if (this_ver < other_ver)
return { -1, type == SortType::VERSION };
+ break;
}
case SortType::PROVIDER: {
auto compare_result = QString::compare(provider().value_or("Unknown"), cast_other->provider().value_or("Unknown"), Qt::CaseInsensitive);
if (compare_result != 0)
return { compare_result, type == SortType::PROVIDER };
+ break;
}
}
return { 0, false };
diff --git a/launcher/minecraft/mod/Resource.cpp b/launcher/minecraft/mod/Resource.cpp
index a0b8a4bb..e5077260 100644
--- a/launcher/minecraft/mod/Resource.cpp
+++ b/launcher/minecraft/mod/Resource.cpp
@@ -71,6 +71,7 @@ std::pair<int, bool> Resource::compare(const Resource& other, SortType type) con
return { 1, type == SortType::ENABLED };
if (!enabled() && other.enabled())
return { -1, type == SortType::ENABLED };
+ break;
case SortType::NAME: {
QString this_name{ name() };
QString other_name{ other.name() };
@@ -81,12 +82,14 @@ std::pair<int, bool> Resource::compare(const Resource& other, SortType type) con
auto compare_result = QString::compare(this_name, other_name, Qt::CaseInsensitive);
if (compare_result != 0)
return { compare_result, type == SortType::NAME };
+ break;
}
case SortType::DATE:
if (dateTimeChanged() > other.dateTimeChanged())
return { 1, type == SortType::DATE };
if (dateTimeChanged() < other.dateTimeChanged())
return { -1, type == SortType::DATE };
+ break;
}
return { 0, false };
diff --git a/launcher/minecraft/mod/ResourcePack.cpp b/launcher/minecraft/mod/ResourcePack.cpp
index e06c1ac1..6d5978d4 100644
--- a/launcher/minecraft/mod/ResourcePack.cpp
+++ b/launcher/minecraft/mod/ResourcePack.cpp
@@ -102,6 +102,7 @@ std::pair<int, bool> ResourcePack::compare(const Resource& other, SortType type)
auto res = Resource::compare(other, type);
if (res.first != 0)
return res;
+ break;
}
case SortType::PACK_FORMAT: {
auto this_ver = packFormat();
@@ -111,6 +112,7 @@ std::pair<int, bool> ResourcePack::compare(const Resource& other, SortType type)
return { 1, type == SortType::PACK_FORMAT };
if (this_ver < other_ver)
return { -1, type == SortType::PACK_FORMAT };
+ break;
}
}
return { 0, false };
diff --git a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp
index f003ada9..e7641d64 100644
--- a/launcher/modplatform/flame/FlameInstanceCreationTask.cpp
+++ b/launcher/modplatform/flame/FlameInstanceCreationTask.cpp
@@ -470,8 +470,9 @@ void FlameCreationTask::setupDownloadJob(QEventLoop& loop)
switch (result.type) {
case Flame::File::Type::Folder: {
logWarning(tr("This 'Folder' may need extracting: %1").arg(relpath));
- // fall-through intentional, we treat these as plain old mods and dump them wherever.
+ // fallthrough intentional, we treat these as plain old mods and dump them wherever.
}
+ /* fallthrough */
case Flame::File::Type::SingleFile:
case Flame::File::Type::Mod: {
if (!result.url.isEmpty()) {
diff --git a/launcher/translations/TranslationsModel.cpp b/launcher/translations/TranslationsModel.cpp
index 23e55c51..489dff86 100644
--- a/launcher/translations/TranslationsModel.cpp
+++ b/launcher/translations/TranslationsModel.cpp
@@ -454,6 +454,7 @@ QVariant TranslationsModel::data(const QModelIndex& index, int role) const
return QString("%1%").arg(lang.percentTranslated(), 3, 'f', 1);
}
}
+ qWarning("TranslationModel::data not implemented when role is DisplayRole");
}
case Qt::ToolTipRole:
{
diff --git a/launcher/ui/instanceview/AccessibleInstanceView.cpp b/launcher/ui/instanceview/AccessibleInstanceView.cpp
index 7de3ac72..2e7b8300 100644
--- a/launcher/ui/instanceview/AccessibleInstanceView.cpp
+++ b/launcher/ui/instanceview/AccessibleInstanceView.cpp
@@ -248,8 +248,8 @@ bool AccessibleInstanceView::selectColumn(int column)
if (view()->selectionBehavior() != QAbstractItemView::SelectColumns && rowCount() > 1) {
return false;
}
- // fallthrough intentional
}
+ /* fallthrough */
case QAbstractItemView::ContiguousSelection: {
if ((!column || !view()->selectionModel()->isColumnSelected(column - 1, view()->rootIndex())) && !view()->selectionModel()->isColumnSelected(column + 1, view()->rootIndex())) {
view()->clearSelection();
diff --git a/launcher/ui/pages/instance/WorldListPage.cpp b/launcher/ui/pages/instance/WorldListPage.cpp
index b6ad159e..b2200b1a 100644
--- a/launcher/ui/pages/instance/WorldListPage.cpp
+++ b/launcher/ui/pages/instance/WorldListPage.cpp
@@ -339,6 +339,7 @@ void WorldListPage::mceditState(LoggedProcess::State state)
{
failed = true;
}
+ /* fallthrough */
case LoggedProcess::Running:
case LoggedProcess::Finished:
{
diff --git a/launcher/ui/setupwizard/JavaWizardPage.cpp b/launcher/ui/setupwizard/JavaWizardPage.cpp
index 14683778..2b70c47c 100644
--- a/launcher/ui/setupwizard/JavaWizardPage.cpp
+++ b/launcher/ui/setupwizard/JavaWizardPage.cpp
@@ -69,6 +69,7 @@ bool JavaWizardPage::validatePage()
case JavaSettingsWidget::ValidationStatus::AllOK:
{
settings->set("JavaPath", m_java_widget->javaPath());
+ return true;
}
case JavaSettingsWidget::ValidationStatus::JavaBad:
{
diff --git a/libraries/murmur2/src/MurmurHash2.cpp b/libraries/murmur2/src/MurmurHash2.cpp
index c13608f0..e7312795 100644
--- a/libraries/murmur2/src/MurmurHash2.cpp
+++ b/libraries/murmur2/src/MurmurHash2.cpp
@@ -89,8 +89,10 @@ void FourBytes_MurmurHash2(const unsigned char* data, IncrementalHashInfo& prev)
switch (prev.len) {
case 3:
prev.h ^= data[2] << 16;
+ /* fall through */
case 2:
prev.h ^= data[1] << 8;
+ /* fall through */
case 1:
prev.h ^= data[0];
prev.h *= m;