diff options
author | TheKodeToad <TheKodeToad@proton.me> | 2023-08-13 13:10:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-13 13:10:58 +0100 |
commit | a44cb6430eac81e6e89283c50b57142ca7f05747 (patch) | |
tree | f51678d129432b0a68d22de0178ccb8fd4f9a927 /launcher/minecraft/PackProfile.cpp | |
parent | 44153a28e369943ea16545146fec81f7a62e44dd (diff) | |
parent | 35358f8180468af1572c35425b1f60c899d6b07d (diff) | |
download | PrismLauncher-a44cb6430eac81e6e89283c50b57142ca7f05747.tar.gz PrismLauncher-a44cb6430eac81e6e89283c50b57142ca7f05747.tar.bz2 PrismLauncher-a44cb6430eac81e6e89283c50b57142ca7f05747.zip |
Merge pull request #1107 from Ryex/chore/add-compiler-warnings
Introduce more strict compiler warnings and fix them
Diffstat (limited to 'launcher/minecraft/PackProfile.cpp')
-rw-r--r-- | launcher/minecraft/PackProfile.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/launcher/minecraft/PackProfile.cpp b/launcher/minecraft/PackProfile.cpp index e8fd2157..00809bb0 100644 --- a/launcher/minecraft/PackProfile.cpp +++ b/launcher/minecraft/PackProfile.cpp @@ -226,11 +226,11 @@ static bool loadPackProfile(PackProfile * parent, const QString & filename, cons auto orderArray = Json::requireArray(obj.value("components")); for(auto item: orderArray) { - auto obj = Json::requireObject(item, "Component must be an object."); - container.append(componentFromJsonV1(parent, componentJsonPattern, obj)); + auto comp_obj = Json::requireObject(item, "Component must be an object."); + container.append(componentFromJsonV1(parent, componentJsonPattern, comp_obj)); } } - catch (const JSONValidationError &err) + catch ([[maybe_unused]] const JSONValidationError &err) { qCritical() << "Couldn't parse" << componentsFile.fileName() << ": bad file format"; container.clear(); @@ -415,7 +415,7 @@ void PackProfile::insertComponent(size_t index, ComponentPtr component) qWarning() << "Attempt to add a component that is already present!"; return; } - beginInsertRows(QModelIndex(), index, index); + beginInsertRows(QModelIndex(), static_cast<int>(index), static_cast<int>(index)); d->components.insert(index, component); d->componentIndex[id] = component; endInsertRows(); @@ -428,7 +428,7 @@ void PackProfile::componentDataChanged() auto objPtr = qobject_cast<Component *>(sender()); if(!objPtr) { - qWarning() << "PackProfile got dataChenged signal from a non-Component!"; + qWarning() << "PackProfile got dataChanged signal from a non-Component!"; return; } if(objPtr->getID() == "net.minecraft") { @@ -446,7 +446,7 @@ void PackProfile::componentDataChanged() } index++; } - qWarning() << "PackProfile got dataChenged signal from a Component which does not belong to it!"; + qWarning() << "PackProfile got dataChanged signal from a Component which does not belong to it!"; } bool PackProfile::remove(const int index) @@ -533,9 +533,9 @@ ComponentPtr PackProfile::getComponent(const QString &id) return (*iter); } -ComponentPtr PackProfile::getComponent(int index) +ComponentPtr PackProfile::getComponent(size_t index) { - if(index < 0 || index >= d->components.size()) + if(index >= static_cast<size_t>(d->components.size())) { return nullptr; } @@ -616,7 +616,7 @@ QVariant PackProfile::data(const QModelIndex &index, int role) const return QVariant(); } -bool PackProfile::setData(const QModelIndex& index, const QVariant& value, int role) +bool PackProfile::setData(const QModelIndex& index, [[maybe_unused]] const QVariant& value, int role) { if (!index.isValid() || index.row() < 0 || index.row() >= rowCount(index.parent())) { |