Skip to content

Commit

Permalink
chore: fix some compiler warnings
Browse files Browse the repository at this point in the history
Signed-off-by: ComixHe <[email protected]>
  • Loading branch information
ComixHe committed Jan 10, 2025
1 parent 516aed5 commit 85caf44
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions apps/ll-dialog/src/permissionDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
#include <QTimer>

Check warning on line 15 in apps/ll-dialog/src/permissionDialog.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QTimer> not found. Please note: Cppcheck does not need standard library headers to get proper results.

PermissionDialog::PermissionDialog(
const linglong::api::types::v1::ApplicationPermissionsRequest &requires)
const linglong::api::types::v1::ApplicationPermissionsRequest &request)
: QWidget(nullptr)
{
// content
QStringList dirs;
std::transform(requires.xdgDirectories.cbegin(),
requires.xdgDirectories.cend(),
std::transform(request.xdgDirectories.cbegin(),
request.xdgDirectories.cend(),
std::back_inserter(dirs),
[](const linglong::api::types::v1::XdgDirectoryPermission &perm) {
return QString::fromStdString(perm.dirType);
Expand All @@ -31,7 +31,7 @@ PermissionDialog::PermissionDialog(
content->setWordWrap(true);
content->setMinimumSize(210, 90);
auto contentText =
QString{ _("Whether to allow %1 to access %2?") }.arg(QString::fromStdString(requires.appID),
QString{ _("Whether to allow %1 to access %2?") }.arg(QString::fromStdString(request.appID),
dirs.join(" "));
content->setText(contentText);

Expand Down
3 changes: 2 additions & 1 deletion apps/ll-dialog/src/permissionDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class PermissionDialog : public QWidget
{
Q_OBJECT
public:
explicit PermissionDialog(const linglong::api::types::v1::ApplicationPermissionsRequest &perms);
explicit PermissionDialog(
const linglong::api::types::v1::ApplicationPermissionsRequest &request);
~PermissionDialog() override = default;
};
4 changes: 2 additions & 2 deletions libs/linglong/src/linglong/cli/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2289,7 +2289,7 @@ int Cli::generateCache(const package::Reference &ref)
QString jobIDReply = "";
auto ret = connect(&this->pkgMan,
&api::dbus::v1::PackageManager::GenerateCacheFinished,
[this, &loop, &jobIDReply](const QString &jobID, bool success) {
[&loop, &jobIDReply](const QString &jobID, bool success) {
if (jobIDReply != jobID) {
return;
}
Expand Down Expand Up @@ -2423,7 +2423,7 @@ Cli::ensureCache(const package::Reference &ref,

void Cli::updateAM() noexcept
{
// NOTE: make sure AM refresh the cache of desktop
// NOTE: make sure AM refresh the cache of desktop
if ((QSysInfo::productType() == "Deepin" || QSysInfo::productType() == "deepin")
&& this->lastState == linglong::api::types::v1::State::Succeed) {
QDBusConnection conn = QDBusConnection::systemBus();
Expand Down
4 changes: 2 additions & 2 deletions libs/linglong/src/linglong/repo/repo_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ utils::error::Result<void> RepoCache::rebuildCache(const api::types::v1::RepoCon
// occurred, copy refs out
g_hash_table_foreach(
refsTable,
[](gpointer key, gpointer value, gpointer data) {
[](gpointer key, [[maybe_unused]] gpointer value, gpointer data) {
// key,value -> ref,checksum
auto *vec = static_cast<std::vector<std::string_view> *>(data);
vec->emplace_back(static_cast<const char *>(key));
Expand Down Expand Up @@ -133,7 +133,7 @@ utils::error::Result<void> RepoCache::rebuildCache(const api::types::v1::RepoCon
}

// FIXME: ll-cli may initialize repo, it can make states.json own by root
if (getuid() == 0) {
if (getuid() == 0) {
qWarning() << "Rebuild the cache by root, skip to write data to states.json";
return LINGLONG_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/linglong/src/linglong/runtime/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ utils::error::Result<void> Container::run(const ocppi::runtime::config::types::P
qDebug() << "run container in " << bundle.path();
// 禁用crun自己创建cgroup,便于AM识别和管理玲珑应用
opt.GlobalOption::extra.emplace_back("--cgroup-manager=disabled");
auto result = this->cli.run(ocppi::runtime::ContainerID(this->id.toStdString()),
auto result = this->cli.run(this->id.toStdString(),
std::filesystem::path(bundle.absolutePath().toStdString()),
opt);

Expand Down
2 changes: 1 addition & 1 deletion libs/utils/src/linglong/utils/serialize/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static QVariant decodeQDBusArgument(const QVariant &v)
complexType >> list;
QVariantList res;
res.reserve(list.size());
for (const auto &item : qAsConst(list)) {
for (const auto &item : std::as_const(list)) {
res << decodeQDBusArgument(item);
}
return res;
Expand Down

0 comments on commit 85caf44

Please sign in to comment.