huge nit: added const refs, everywhere

Signed-off-by: timoreo <contact@timoreo.fr>
This commit is contained in:
timoreo
2022-09-26 11:50:31 +02:00
parent 4f6d964217
commit 9ff364b0d3
16 changed files with 33 additions and 28 deletions

View File

@ -121,7 +121,7 @@ bool ModrinthCreationTask::updateInstance()
// TODO: Currently 'overrides' will always override the stuff on update. How do we preserve unchanged overrides?
// FIXME: We may want to do something about disabled mods.
auto old_overrides = Override::readOverrides("overrides", old_index_folder);
for (auto entry : old_overrides) {
for (const auto& entry : old_overrides) {
if (entry.isEmpty())
continue;
qDebug() << "Scheduling" << entry << "for removal";
@ -129,7 +129,7 @@ bool ModrinthCreationTask::updateInstance()
}
auto old_client_overrides = Override::readOverrides("client-overrides", old_index_folder);
for (auto entry : old_overrides) {
for (const auto& entry : old_overrides) {
if (entry.isEmpty())
continue;
qDebug() << "Scheduling" << entry << "for removal";
@ -235,7 +235,7 @@ bool ModrinthCreationTask::createInstance()
dl->addValidator(new Net::ChecksumValidator(file.hashAlgorithm, file.hash));
m_files_job->addNetAction(dl);
if (file.downloads.size() > 0) {
if (!file.downloads.empty()) {
// FIXME: This really needs to be put into a ConcurrentTask of
// MultipleOptionsTask's , once those exist :)
connect(dl.get(), &NetAction::failed, [this, &file, path, dl] {
@ -281,7 +281,7 @@ bool ModrinthCreationTask::createInstance()
return ended_well;
}
bool ModrinthCreationTask::parseManifest(QString index_path, std::vector<Modrinth::File>& files, bool set_managed_info, bool show_optional_dialog)
bool ModrinthCreationTask::parseManifest(const QString& index_path, std::vector<Modrinth::File>& files, bool set_managed_info, bool show_optional_dialog)
{
try {
auto doc = Json::requireDocument(index_path);
@ -300,7 +300,7 @@ bool ModrinthCreationTask::parseManifest(QString index_path, std::vector<Modrint
auto jsonFiles = Json::requireIsArrayOf<QJsonObject>(obj, "files", "modrinth.index.json");
bool had_optional = false;
for (auto modInfo : jsonFiles) {
for (const auto& modInfo : jsonFiles) {
Modrinth::File file;
file.path = Json::requireString(modInfo, "path");

View File

@ -27,7 +27,7 @@ class ModrinthCreationTask final : public InstanceCreationTask {
bool createInstance() override;
private:
bool parseManifest(QString, std::vector<Modrinth::File>&, bool set_managed_info = true, bool show_optional_dialog = true);
bool parseManifest(const QString&, std::vector<Modrinth::File>&, bool set_managed_info = true, bool show_optional_dialog = true);
QString getManagedPackID() const;
private: