chore: fix shadowed member and signed/unsigned mismatch

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: supress unused with [[maybe_unused]]

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: unshadow ^&^& static_cast implicit return

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: deshadow and mark unused in parse task

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: mark unused in folder models

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: deshadow and mark unused with instances

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: more deshadow and unused

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: remove uneeded simicolons

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: mark unused

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>

chore: prevent shadow

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers
2023-06-30 23:51:15 -07:00
parent 98d6904e4a
commit 8d7dcdfc5b
96 changed files with 409 additions and 413 deletions

View File

@ -143,7 +143,7 @@ inline auto getOverrideDeps() -> QList<OverrideDep>
{ "qvIfYCYJ", "P7dR8mSH", "API", ModPlatform::ResourceProvider::MODRINTH },
{ "lwVhp9o5", "Ha28R6CL", "KotlinLibraries", ModPlatform::ResourceProvider::MODRINTH } };
};
}
} // namespace ModPlatform

View File

@ -131,12 +131,12 @@ class ResourceAPI {
qWarning() << "TODO: ResourceAPI::searchProjects";
return nullptr;
}
[[nodiscard]] virtual Task::Ptr getProject(QString addonId, std::shared_ptr<QByteArray> response) const
[[nodiscard]] virtual Task::Ptr getProject([[maybe_unused]] QString addonId, [[maybe_unused]] std::shared_ptr<QByteArray> response) const
{
qWarning() << "TODO: ResourceAPI::getProject";
return nullptr;
}
[[nodiscard]] virtual Task::Ptr getProjects(QStringList addonIds, std::shared_ptr<QByteArray> response) const
[[nodiscard]] virtual Task::Ptr getProjects([[maybe_unused]] QStringList addonIds, [[maybe_unused]] std::shared_ptr<QByteArray> response) const
{
qWarning() << "TODO: ResourceAPI::getProjects";
return nullptr;

View File

@ -89,7 +89,7 @@ void Flame::FileResolvingTask::netJobFinished()
auto& out = m_toProcess.files[fileid];
try {
out.parseFromObject(Json::requireObject(file));
} catch (const JSONValidationError& e) {
} catch ([[maybe_unused]] const JSONValidationError& e) {
qDebug() << "Blocked mod on curseforge" << out.fileName;
auto hash = out.hash;
if (!hash.isEmpty()) {

View File

@ -54,7 +54,7 @@ void FlameMod::loadURLs(ModPlatform::IndexedPack& pack, QJsonObject& obj)
pack.extraDataLoaded = true;
}
void FlameMod::loadBody(ModPlatform::IndexedPack& pack, QJsonObject& obj)
void FlameMod::loadBody(ModPlatform::IndexedPack& pack, [[maybe_unused]] QJsonObject& obj)
{
pack.extraData.body = api.getModDescription(pack.addonId.toInt());
@ -75,7 +75,7 @@ static QString enumToString(int hash_algorithm)
void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
QJsonArray& arr,
const shared_qobject_ptr<QNetworkAccessManager>& network,
[[maybe_unused]] const shared_qobject_ptr<QNetworkAccessManager>& network,
const BaseInstance* inst)
{
QVector<ModPlatform::IndexedVersion> unsortedVersions;
@ -193,4 +193,5 @@ ModPlatform::IndexedVersion FlameMod::loadDependencyVersions(const ModPlatform::
};
std::sort(versions.begin(), versions.end(), orderSortPredicate);
return versions.front();
};
}

View File

@ -145,4 +145,5 @@ Task::Ptr NetworkResourceAPI::getDependencyVersion(DependencySearchArgs&& args,
});
return netJob;
};
}

View File

@ -180,10 +180,10 @@ void ModrinthPackExportTask::parseApiResponse(const std::shared_ptr<QByteArray>
if (obj.isEmpty())
continue;
const QJsonArray files = obj["files"].toArray();
if (auto fileIter = std::find_if(files.begin(), files.end(),
const QJsonArray files_array = obj["files"].toArray();
if (auto fileIter = std::find_if(files_array.begin(), files_array.end(),
[&iterator](const QJsonValue& file) { return file["hashes"]["sha512"] == iterator.value(); });
fileIter != files.end()) {
fileIter != files_array.end()) {
// map the file to the url
resolvedFiles[iterator.key()] =
ResolvedFile{ fileIter->toObject()["hashes"].toObject()["sha1"].toString(), iterator.value(),
@ -293,7 +293,7 @@ QByteArray ModrinthPackExportTask::generateIndex()
obj["dependencies"] = dependencies;
}
QJsonArray files;
QJsonArray files_array;
QMapIterator<QString, ResolvedFile> iterator(resolvedFiles);
while (iterator.hasNext()) {
iterator.next();
@ -311,9 +311,9 @@ QByteArray ModrinthPackExportTask::generateIndex()
file["hashes"] = hashes;
file["fileSize"] = value.size;
files << file;
files_array << file;
}
obj["files"] = files;
obj["files"] = files_array;
return QJsonDocument(obj).toJson(QJsonDocument::Compact);
}

View File

@ -95,7 +95,7 @@ void Modrinth::loadExtraPackData(ModPlatform::IndexedPack& pack, QJsonObject& ob
void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
QJsonArray& arr,
const shared_qobject_ptr<QNetworkAccessManager>& network,
[[maybe_unused]] const shared_qobject_ptr<QNetworkAccessManager>& network,
const BaseInstance* inst)
{
QVector<ModPlatform::IndexedVersion> unsortedVersions;
@ -218,7 +218,7 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_t
return {};
}
auto Modrinth::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
auto Modrinth::loadDependencyVersions([[maybe_unused]] const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
{
QVector<ModPlatform::IndexedVersion> versions;
@ -235,4 +235,4 @@ auto Modrinth::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArr
};
std::sort(versions.begin(), versions.end(), orderSortPredicate);
return versions.length() != 0 ? versions.front() : ModPlatform::IndexedVersion();
}
}

View File

@ -89,7 +89,8 @@ auto intEntry(toml::table table, QString entry_name) -> int
return node.value_or(0);
}
auto V1::createModFormat(QDir& index_dir, ModPlatform::IndexedPack& mod_pack, ModPlatform::IndexedVersion& mod_version) -> Mod
auto V1::createModFormat([[maybe_unused]] QDir& index_dir, ModPlatform::IndexedPack& mod_pack, ModPlatform::IndexedVersion& mod_version)
-> Mod
{
Mod mod;
@ -114,7 +115,7 @@ auto V1::createModFormat(QDir& index_dir, ModPlatform::IndexedPack& mod_pack, Mo
return mod;
}
auto V1::createModFormat(QDir& index_dir, ::Mod& internal_mod, QString slug) -> Mod
auto V1::createModFormat(QDir& index_dir, [[maybe_unused]] ::Mod& internal_mod, QString slug) -> Mod
{
// Try getting metadata if it exists
Mod mod{ getIndexForMod(index_dir, slug) };

View File

@ -26,7 +26,12 @@
#include <memory>
void Technic::TechnicPackProcessor::run(SettingsObjectPtr globalSettings, const QString &instName, const QString &instIcon, const QString &stagingPath, const QString &minecraftVersion, const bool isSolder)
void Technic::TechnicPackProcessor::run(SettingsObjectPtr globalSettings,
const QString& instName,
const QString& instIcon,
const QString& stagingPath,
const QString& minecraftVersion,
[[maybe_unused]] const bool isSolder)
{
QString minecraftPath = FS::PathCombine(stagingPath, ".minecraft");
QString configPath = FS::PathCombine(stagingPath, "instance.cfg");
@ -151,17 +156,16 @@ void Technic::TechnicPackProcessor::run(SettingsObjectPtr globalSettings, const
{
QJsonDocument doc = Json::requireDocument(data);
QJsonObject root = Json::requireObject(doc, "version.json");
QString minecraftVersion = Json::ensureString(root, "inheritsFrom", QString(), "");
if (minecraftVersion.isEmpty())
{
QString packMinecraftVersion = Json::ensureString(root, "inheritsFrom", QString(), "");
if (packMinecraftVersion.isEmpty()) {
if (fmlMinecraftVersion.isEmpty())
{
emit failed(tr("Could not understand \"version.json\":\ninheritsFrom is missing"));
return;
}
minecraftVersion = fmlMinecraftVersion;
packMinecraftVersion = fmlMinecraftVersion;
}
components->setComponentVersion("net.minecraft", minecraftVersion, true);
components->setComponentVersion("net.minecraft", packMinecraftVersion, true);
for (auto library: Json::ensureArray(root, "libraries", {}))
{
if (!library.isObject())