|
|
3dc890 |
From 07416268889f95e1495fb3d7b856de1c502870ba Mon Sep 17 00:00:00 2001
|
|
|
3dc890 |
From: Jaroslav Rohel <jrohel@redhat.com>
|
|
|
3dc890 |
Date: Wed, 21 Jul 2021 11:15:50 +0200
|
|
|
3dc890 |
Subject: [PATCH] covscan: remove unused vars, mark private func static, return values
|
|
|
3dc890 |
|
|
|
3dc890 |
The `begin` and `end` variables were not used
|
|
|
3dc890 |
in `ModulePackageContainer::updateFailSafeData`. Removed.
|
|
|
3dc890 |
|
|
|
3dc890 |
The `checksum` in "utils.cpp" is a private (static) function.
|
|
|
3dc890 |
|
|
|
3dc890 |
Added check of return value of `dnf_copy_recursive` function in unit test.
|
|
|
3dc890 |
|
|
|
3dc890 |
In the `install` in the "goal-py.cpp" file:
|
|
|
3dc890 |
Explicitly ignores the return values of `hy_goal_install` and
|
|
|
3dc890 |
`hy_goal_install_optional`. The functions always return zero.
|
|
|
3dc890 |
Explicitly ignores the return values of `hy_goal_install_selector` and
|
|
|
3dc890 |
`hy_goal_install_selector_optional`. The `error` argument is used instead.
|
|
|
3dc890 |
---
|
|
|
3dc890 |
libdnf/module/ModulePackageContainer.cpp | 2 --
|
|
|
3dc890 |
libdnf/utils/utils.cpp | 2 +-
|
|
|
3dc890 |
python/hawkey/goal-py.cpp | 8 ++++----
|
|
|
3dc890 |
tests/libdnf/module/ModulePackageContainerTest.cpp | 3 ++-
|
|
|
3dc890 |
4 files changed, 7 insertions(+), 8 deletions(-)
|
|
|
3dc890 |
|
|
|
3dc890 |
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
|
|
|
3dc890 |
index c0ad126..efab497 100644
|
|
|
3dc890 |
--- a/libdnf/module/ModulePackageContainer.cpp
|
|
|
3dc890 |
+++ b/libdnf/module/ModulePackageContainer.cpp
|
|
|
3dc890 |
@@ -1656,8 +1656,6 @@ void ModulePackageContainer::updateFailSafeData()
|
|
|
3dc890 |
if (pImpl->activatedModules) {
|
|
|
3dc890 |
std::vector<ModulePackage *> latest = pImpl->getLatestActiveEnabledModules();
|
|
|
3dc890 |
|
|
|
3dc890 |
- auto begin = fileNames.begin();
|
|
|
3dc890 |
- auto end = fileNames.end();
|
|
|
3dc890 |
if (g_mkdir_with_parents(pImpl->persistDir.c_str(), 0755) == -1) {
|
|
|
3dc890 |
const char * errTxt = strerror(errno);
|
|
|
3dc890 |
auto logger(Log::getLogger());
|
|
|
3dc890 |
diff --git a/libdnf/utils/utils.cpp b/libdnf/utils/utils.cpp
|
|
|
3dc890 |
index 450718d..15f5275 100644
|
|
|
3dc890 |
--- a/libdnf/utils/utils.cpp
|
|
|
3dc890 |
+++ b/libdnf/utils/utils.cpp
|
|
|
3dc890 |
@@ -301,7 +301,7 @@ void decompress(const char * inPath, const char * outPath, mode_t outMode, const
|
|
|
3dc890 |
fclose(inFile);
|
|
|
3dc890 |
}
|
|
|
3dc890 |
|
|
|
3dc890 |
-void checksum(const char * type, const char * inPath, const char * checksum_valid, bool * valid_out, gchar ** calculated_out)
|
|
|
3dc890 |
+static void checksum(const char * type, const char * inPath, const char * checksum_valid, bool * valid_out, gchar ** calculated_out)
|
|
|
3dc890 |
{
|
|
|
3dc890 |
GError * errP{nullptr};
|
|
|
3dc890 |
gboolean valid;
|
|
|
3dc890 |
diff --git a/python/hawkey/goal-py.cpp b/python/hawkey/goal-py.cpp
|
|
|
3dc890 |
index 2641a1d..5bbb959 100644
|
|
|
3dc890 |
--- a/python/hawkey/goal-py.cpp
|
|
|
3dc890 |
+++ b/python/hawkey/goal-py.cpp
|
|
|
3dc890 |
@@ -281,15 +281,15 @@ install(_GoalObject *self, PyObject *args, PyObject *kwds) try
|
|
|
3dc890 |
|
|
|
3dc890 |
if (flags & HY_WEAK_SOLV) {
|
|
|
3dc890 |
if (pkg) {
|
|
|
3dc890 |
- hy_goal_install_optional(self->goal, pkg);
|
|
|
3dc890 |
+ (void)hy_goal_install_optional(self->goal, pkg);
|
|
|
3dc890 |
} else {
|
|
|
3dc890 |
- hy_goal_install_selector_optional(self->goal, sltr, &error);
|
|
|
3dc890 |
+ (void)hy_goal_install_selector_optional(self->goal, sltr, &error);
|
|
|
3dc890 |
}
|
|
|
3dc890 |
} else {
|
|
|
3dc890 |
if (pkg) {
|
|
|
3dc890 |
- hy_goal_install(self->goal, pkg);
|
|
|
3dc890 |
+ (void)hy_goal_install(self->goal, pkg);
|
|
|
3dc890 |
} else {
|
|
|
3dc890 |
- hy_goal_install_selector(self->goal, sltr, &error);
|
|
|
3dc890 |
+ (void)hy_goal_install_selector(self->goal, sltr, &error);
|
|
|
3dc890 |
}
|
|
|
3dc890 |
}
|
|
|
3dc890 |
return op_error2exc(error);
|
|
|
3dc890 |
diff --git a/tests/libdnf/module/ModulePackageContainerTest.cpp b/tests/libdnf/module/ModulePackageContainerTest.cpp
|
|
|
3dc890 |
index b2cf170..6360a0c 100644
|
|
|
3dc890 |
--- a/tests/libdnf/module/ModulePackageContainerTest.cpp
|
|
|
3dc890 |
+++ b/tests/libdnf/module/ModulePackageContainerTest.cpp
|
|
|
3dc890 |
@@ -17,7 +17,8 @@ void ModulePackageContainerTest::setUp()
|
|
|
3dc890 |
char *retptr = mkdtemp(tmpdir);
|
|
|
3dc890 |
CPPUNIT_ASSERT(retptr);
|
|
|
3dc890 |
char * etc_target = g_strjoin(NULL, tmpdir, "/etc", NULL);
|
|
|
3dc890 |
- dnf_copy_recursive(TESTDATADIR "/modules/etc", etc_target, &error);
|
|
|
3dc890 |
+ auto ret = dnf_copy_recursive(TESTDATADIR "/modules/etc", etc_target, &error);
|
|
|
3dc890 |
+ g_assert_true(ret);
|
|
|
3dc890 |
g_assert_no_error(error);
|
|
|
3dc890 |
g_free(etc_target);
|
|
|
3dc890 |
|
|
|
3dc890 |
--
|
|
|
3dc890 |
libgit2 1.0.1
|
|
|
3dc890 |
|