From: ilho kim Date: Mon, 13 Feb 2023 02:25:54 +0000 (+0900) Subject: Fix static analysis issues X-Git-Tag: accepted/tizen/unified/20230310.062643~5 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fappfw%2Fpkgmgr-info.git;a=commitdiff_plain;h=790faabf17a2a072852cb3ea95d5be1d8e0ae0a6 Fix static analysis issues - Unchecked return value Change-Id: Ic59b1ee15622fd86f1bf4782e3df0191aa7fe0aa Signed-off-by: ilho kim --- diff --git a/test/unit_tests/test_cert_db_handlers.cc b/test/unit_tests/test_cert_db_handlers.cc index 8fc35ed..8b8c0fc 100644 --- a/test/unit_tests/test_cert_db_handlers.cc +++ b/test/unit_tests/test_cert_db_handlers.cc @@ -30,6 +30,7 @@ #include "server/pkgmgrinfo_internal.h" #define TEST_CERT_DB "test.pkgmgr_cert.db" +#define DB_VERSION_FILE "./pkg_db_version.txt" namespace psd = pkgmgr_server::database; @@ -86,12 +87,12 @@ class CertDBHandlerTest : public ::testing::Test { std::string journal_path(TEST_CERT_DB); journal_path += "-journal"; ASSERT_EQ(remove(journal_path.c_str()), 0); + ASSERT_EQ(remove(DB_VERSION_FILE), 0); } private: void MakeVersionFile() { - std::remove("./pkg_db_version.txt"); - std::ofstream ofs("./pkg_db_version.txt"); + std::ofstream ofs(DB_VERSION_FILE); ofs << "30005"; } diff --git a/test/unit_tests/test_parser_db_handlers.cc b/test/unit_tests/test_parser_db_handlers.cc index 30545bd..9310113 100644 --- a/test/unit_tests/test_parser_db_handlers.cc +++ b/test/unit_tests/test_parser_db_handlers.cc @@ -35,6 +35,7 @@ #include "server/pkgmgrinfo_internal.h" #define TEST_PARSER_DB "test.pkgmgr_parser.db" +#define DB_VERSION_FILE "./pkg_db_version.txt" namespace psd = pkgmgr_server::database; namespace pc = pkgmgr_common; @@ -119,12 +120,12 @@ class ParserDBHandlerTest : public TestFixture { std::string journal_path(TEST_PARSER_DB); journal_path += "-journal"; ASSERT_EQ(remove(journal_path.c_str()), 0); + ASSERT_EQ(remove(DB_VERSION_FILE), 0); } private: void MakeVersionFile() { - std::remove("./pkg_db_version.txt"); - std::ofstream ofs("./pkg_db_version.txt"); + std::ofstream ofs(DB_VERSION_FILE); ofs << "30005"; } diff --git a/test/unit_tests/test_query_db_handlers.cc b/test/unit_tests/test_query_db_handlers.cc index e081fab..ddeb14c 100644 --- a/test/unit_tests/test_query_db_handlers.cc +++ b/test/unit_tests/test_query_db_handlers.cc @@ -33,6 +33,7 @@ #include "server/pkgmgrinfo_internal.h" #define TEST_PARSER_DB "test.pkgmgr_parser.db" +#define DB_VERSION_FILE "./pkg_db_version.txt" namespace psd = pkgmgr_server::database; namespace pc = pkgmgr_common; @@ -99,12 +100,12 @@ class ParserDBHandlerTest : public TestFixture { std::string journal_path(TEST_PARSER_DB); journal_path += "-journal"; ASSERT_EQ(remove(journal_path.c_str()), 0); + ASSERT_EQ(remove(DB_VERSION_FILE), 0); } private: void MakeVersionFile() { - std::remove("./pkg_db_version.txt"); - std::ofstream ofs("./pkg_db_version.txt"); + std::ofstream ofs(DB_VERSION_FILE); ofs << "30005"; }