Projects
Mega:24.03:SP1:Everything
atf
_service:tar_scm:Replace-auto_ptr-with-unique_p...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:Replace-auto_ptr-with-unique_ptr.patch of Package atf
From 3c149a28d988654706b0dd7dc58900126be46f09 Mon Sep 17 00:00:00 2001 From: cherry530 <707078654@qq.com> Date: Sun, 29 Sep 2024 17:09:34 +0800 Subject: [PATCH] Replace auto_ptr with unique_ptr Signed-off-by: cherry530 <707078654@qq.com> --- atf-c++/check.cpp | 4 ++-- atf-c++/check.hpp | 4 ++-- atf-c++/check_test.cpp | 22 +++++++++++----------- atf-c++/detail/process_test.cpp | 8 ++++---- atf-c++/tests.hpp | 2 +- atf-sh/atf-check.cpp | 8 ++++---- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/atf-c++/check.cpp b/atf-c++/check.cpp index e4d7db4..5d85800 100644 --- a/atf-c++/check.cpp +++ b/atf-c++/check.cpp @@ -141,7 +141,7 @@ impl::build_cxx_o(const std::string& sfile, const std::string& ofile, return success; } -std::auto_ptr< impl::check_result > +std::unique_ptr< impl::check_result > impl::exec(const atf::process::argv_array& argva) { atf_check_result_t result; @@ -150,5 +150,5 @@ impl::exec(const atf::process::argv_array& argva) if (atf_is_error(err)) throw_atf_error(err); - return std::auto_ptr< impl::check_result >(new impl::check_result(&result)); + return std::unique_ptr< impl::check_result >(new impl::check_result(&result)); } diff --git a/atf-c++/check.hpp b/atf-c++/check.hpp index 0144ded..4d7f079 100644 --- a/atf-c++/check.hpp +++ b/atf-c++/check.hpp @@ -71,7 +71,7 @@ class check_result { check_result(const atf_check_result_t* result); friend check_result test_constructor(const char* const*); - friend std::auto_ptr< check_result > exec(const atf::process::argv_array&); + friend std::unique_ptr< check_result > exec(const atf::process::argv_array&); public: //! @@ -120,7 +120,7 @@ bool build_cpp(const std::string&, const std::string&, const atf::process::argv_array&); bool build_cxx_o(const std::string&, const std::string&, const atf::process::argv_array&); -std::auto_ptr< check_result > exec(const atf::process::argv_array&); +std::unique_ptr< check_result > exec(const atf::process::argv_array&); // Useful for testing only. check_result test_constructor(void); diff --git a/atf-c++/check_test.cpp b/atf-c++/check_test.cpp index 7baf3fa..ecb5a93 100644 --- a/atf-c++/check_test.cpp +++ b/atf-c++/check_test.cpp @@ -52,7 +52,7 @@ extern "C" { // ------------------------------------------------------------------------ static -std::auto_ptr< atf::check::check_result > +std::unique_ptr< atf::check::check_result > do_exec(const atf::tests::tc* tc, const char* helper_name) { std::vector< std::string > argv; @@ -65,7 +65,7 @@ do_exec(const atf::tests::tc* tc, const char* helper_name) } static -std::auto_ptr< atf::check::check_result > +std::unique_ptr< atf::check::check_result > do_exec(const atf::tests::tc* tc, const char* helper_name, const char *carg2) { std::vector< std::string > argv; @@ -248,11 +248,11 @@ ATF_TEST_CASE_HEAD(exec_cleanup) } ATF_TEST_CASE_BODY(exec_cleanup) { - std::auto_ptr< atf::fs::path > out; - std::auto_ptr< atf::fs::path > err; + std::unique_ptr< atf::fs::path > out; + std::unique_ptr< atf::fs::path > err; { - std::auto_ptr< atf::check::check_result > r = + std::unique_ptr< atf::check::check_result > r = do_exec(this, "exit-success"); out.reset(new atf::fs::path(r->stdout_path())); err.reset(new atf::fs::path(r->stderr_path())); @@ -272,7 +272,7 @@ ATF_TEST_CASE_HEAD(exec_exitstatus) ATF_TEST_CASE_BODY(exec_exitstatus) { { - std::auto_ptr< atf::check::check_result > r = + std::unique_ptr< atf::check::check_result > r = do_exec(this, "exit-success"); ATF_REQUIRE(r->exited()); ATF_REQUIRE(!r->signaled()); @@ -280,7 +280,7 @@ ATF_TEST_CASE_BODY(exec_exitstatus) } { - std::auto_ptr< atf::check::check_result > r = + std::unique_ptr< atf::check::check_result > r = do_exec(this, "exit-failure"); ATF_REQUIRE(r->exited()); ATF_REQUIRE(!r->signaled()); @@ -288,7 +288,7 @@ ATF_TEST_CASE_BODY(exec_exitstatus) } { - std::auto_ptr< atf::check::check_result > r = + std::unique_ptr< atf::check::check_result > r = do_exec(this, "exit-signal"); ATF_REQUIRE(!r->exited()); ATF_REQUIRE(r->signaled()); @@ -321,12 +321,12 @@ ATF_TEST_CASE_HEAD(exec_stdout_stderr) } ATF_TEST_CASE_BODY(exec_stdout_stderr) { - std::auto_ptr< atf::check::check_result > r1 = + std::unique_ptr< atf::check::check_result > r1 = do_exec(this, "stdout-stderr", "result1"); ATF_REQUIRE(r1->exited()); ATF_REQUIRE_EQ(r1->exitcode(), EXIT_SUCCESS); - std::auto_ptr< atf::check::check_result > r2 = + std::unique_ptr< atf::check::check_result > r2 = do_exec(this, "stdout-stderr", "result2"); ATF_REQUIRE(r2->exited()); ATF_REQUIRE_EQ(r2->exitcode(), EXIT_SUCCESS); @@ -372,7 +372,7 @@ ATF_TEST_CASE_BODY(exec_unknown) argv.push_back("/foo/bar/non-existent"); atf::process::argv_array argva(argv); - std::auto_ptr< atf::check::check_result > r = atf::check::exec(argva); + std::unique_ptr< atf::check::check_result > r = atf::check::exec(argva); ATF_REQUIRE(r->exited()); ATF_REQUIRE_EQ(r->exitcode(), 127); } diff --git a/atf-c++/detail/process_test.cpp b/atf-c++/detail/process_test.cpp index 0686d2a..97f9a08 100644 --- a/atf-c++/detail/process_test.cpp +++ b/atf-c++/detail/process_test.cpp @@ -196,8 +196,8 @@ ATF_TEST_CASE_BODY(argv_array_assign) const char* const carray1[] = { "arg1", NULL }; const char* const carray2[] = { "arg1", "arg2", NULL }; - std::auto_ptr< argv_array > argv1(new argv_array(carray1)); - std::auto_ptr< argv_array > argv2(new argv_array(carray2)); + std::unique_ptr< argv_array > argv1(new argv_array(carray1)); + std::unique_ptr< argv_array > argv2(new argv_array(carray2)); *argv2 = *argv1; ATF_REQUIRE_EQ(argv2->size(), argv1->size()); @@ -226,8 +226,8 @@ ATF_TEST_CASE_BODY(argv_array_copy) const char* const carray[] = { "arg0", NULL }; - std::auto_ptr< argv_array > argv1(new argv_array(carray)); - std::auto_ptr< argv_array > argv2(new argv_array(*argv1)); + std::unique_ptr< argv_array > argv1(new argv_array(carray)); + std::unique_ptr< argv_array > argv2(new argv_array(*argv1)); ATF_REQUIRE_EQ(argv2->size(), argv1->size()); ATF_REQUIRE(std::strcmp((*argv2)[0], (*argv1)[0]) == 0); diff --git a/atf-c++/tests.hpp b/atf-c++/tests.hpp index ce2fb1d..a03cc85 100644 --- a/atf-c++/tests.hpp +++ b/atf-c++/tests.hpp @@ -73,7 +73,7 @@ class tc { tc(const tc&); tc& operator=(const tc&); - std::auto_ptr< tc_impl > pimpl; + std::unique_ptr< tc_impl > pimpl; protected: virtual void head(void); diff --git a/atf-sh/atf-check.cpp b/atf-sh/atf-check.cpp index 866b7bb..c236652 100644 --- a/atf-sh/atf-check.cpp +++ b/atf-sh/atf-check.cpp @@ -103,7 +103,7 @@ struct output_check { }; class temp_file : public std::ostream { - std::auto_ptr< atf::fs::path > m_path; + std::unique_ptr< atf::fs::path > m_path; int m_fd; public: @@ -326,7 +326,7 @@ flatten_argv(char* const* argv) } static -std::auto_ptr< atf::check::check_result > +std::unique_ptr< atf::check::check_result > execute(const char* const* argv) { // TODO: This should go to stderr... but fixing it now may be hard as test @@ -342,7 +342,7 @@ execute(const char* const* argv) } static -std::auto_ptr< atf::check::check_result > +std::unique_ptr< atf::check::check_result > execute_with_shell(char* const* argv) { const std::string cmd = flatten_argv(argv); @@ -802,7 +802,7 @@ atf_check::main(void) int status = EXIT_FAILURE; - std::auto_ptr< atf::check::check_result > r = + std::unique_ptr< atf::check::check_result > r = m_xflag ? execute_with_shell(m_argv) : execute(m_argv); if (m_status_checks.empty()) -- 2.44.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2