chore: fixe some codeql warnings

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2025-06-05 00:34:45 +03:00
parent 0136c2e82a
commit 4f5db2e49f
No known key found for this signature in database
GPG key ID: 55EF5DA53DB36318
11 changed files with 14 additions and 11 deletions

View file

@ -1,3 +1,4 @@
#pragma once
#include <QString>
namespace SysInfo {

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <QAnyStringView>
#include <QDateTime>
#include <QList>

View file

@ -159,7 +159,7 @@ bool loadAssetsIndexJson(const QString& assetsId, const QString& path, AssetsInd
if (key == "hash") {
object.hash = value.toString();
} else if (key == "size") {
object.size = value.toDouble();
object.size = value.toLongLong();
}
}

View file

@ -462,7 +462,7 @@ void Component::waitLoadMeta()
}
}
void Component::setUpdateAction(UpdateAction action)
void Component::setUpdateAction(const UpdateAction& action)
{
m_updateAction = action;
}

View file

@ -106,7 +106,7 @@ class Component : public QObject, public ProblemProvider {
void waitLoadMeta();
void setUpdateAction(UpdateAction action);
void setUpdateAction(const UpdateAction& action);
void clearUpdateAction();
UpdateAction getUpdateAction();

View file

@ -570,7 +570,7 @@ void ComponentUpdateTask::performUpdateActions()
component->setVersion(cv.targetVersion);
component->waitLoadMeta();
},
[&component, &instance](const UpdateActionLatestRecommendedCompatible lrc) {
[&component, &instance](const UpdateActionLatestRecommendedCompatible& lrc) {
qCDebug(instanceProfileResolveC)
<< instance->name() << "|"
<< "UpdateActionLatestRecommendedCompatible" << component->getID() << ":" << component->getVersion()

View file

@ -41,7 +41,7 @@
#include <QUuid>
namespace {
void tokenToJSONV3(QJsonObject& parent, Token t, const char* tokenName)
void tokenToJSONV3(QJsonObject& parent, const Token& t, const char* tokenName)
{
if (!t.persistent) {
return;

View file

@ -87,7 +87,7 @@ ModPlatform::Dependency GetModDependenciesTask::getOverride(const ModPlatform::D
{
if (auto isQuilt = m_loaderType & ModPlatform::Quilt; isQuilt || m_loaderType & ModPlatform::Fabric) {
auto overide = ModPlatform::getOverrideDeps();
auto over = std::find_if(overide.cbegin(), overide.cend(), [dep, providerName, isQuilt](auto o) {
auto over = std::find_if(overide.cbegin(), overide.cend(), [dep, providerName, isQuilt](const auto& o) {
return o.provider == providerName && dep.addonId == (isQuilt ? o.fabric : o.quilt);
});
if (over != overide.cend()) {
@ -207,8 +207,9 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
if (!pDep->version.addonId.isValid()) {
if (m_loaderType & ModPlatform::Quilt) { // falback for quilt
auto overide = ModPlatform::getOverrideDeps();
auto over = std::find_if(overide.cbegin(), overide.cend(),
[dep, provider](auto o) { return o.provider == provider.name && dep.addonId == o.quilt; });
auto over = std::find_if(overide.cbegin(), overide.cend(), [dep, provider](const auto& o) {
return o.provider == provider.name && dep.addonId == o.quilt;
});
if (over != overide.cend()) {
removePack(dep.addonId);
addTask(prepareDependencyTask({ over->fabric, dep.type }, provider.name, level));

View file

@ -391,7 +391,7 @@ QString PackInstallTask::getVersionForLoader(QString uid)
return m_version.loader.version;
}
QString PackInstallTask::detectLibrary(VersionLibrary library)
QString PackInstallTask::detectLibrary(const VersionLibrary& library)
{
// Try to detect what the library is
if (!library.server.isEmpty() && library.server.split("/").length() >= 3) {

View file

@ -105,7 +105,7 @@ class PackInstallTask : public InstanceTask {
private:
QString getDirForModType(ModType type, QString raw);
QString getVersionForLoader(QString uid);
QString detectLibrary(VersionLibrary library);
QString detectLibrary(const VersionLibrary& library);
bool createLibrariesComponent(QString instanceRoot, std::shared_ptr<PackProfile> profile);
bool createPackComponent(QString instanceRoot, std::shared_ptr<PackProfile> profile);

View file

@ -1,3 +1,4 @@
#pragma once
#include <QFuture>
#include <QJsonDocument>
#include <QJsonObject>