!23 Replace auto_ptr with unique_ptr

From: @cherry530 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
This commit is contained in:
openeuler-ci-bot 2024-10-08 02:22:16 +00:00 committed by Gitee
commit 5aae06d2e9
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 234 additions and 46 deletions

View File

@ -1,45 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Index of /pub/fedora/linux/releases/29/Everything/source/tree/Packages</title>
</head>
<body>
<h1>Index of /pub/fedora/linux/releases/29/Everything/source/tree/Packages</h1>
<pre><img src="/icons/blank.gif" alt="Icon "> <a href="?C=N;O=D">Name</a> <a href="?C=M;O=A">Last modified</a> <a href="?C=S;O=A">Size</a> <a href="?C=D;O=A">Description</a><hr><img src="/icons/back.gif" alt="[PARENTDIR]"> <a href="/pub/fedora/linux/releases/29/Everything/source/tree/">Parent Directory</a> -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="0/">0/</a> 2018-10-24 21:05 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="2/">2/</a> 2018-10-24 21:05 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="3/">3/</a> 2018-10-24 21:05 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="4/">4/</a> 2018-10-24 21:05 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="5/">5/</a> 2018-10-24 21:05 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="6/">6/</a> 2018-10-24 21:05 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="7/">7/</a> 2018-10-24 21:05 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="8/">8/</a> 2018-10-24 21:05 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="9/">9/</a> 2018-10-24 21:05 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="a/">a/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="b/">b/</a> 2018-10-24 22:01 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="c/">c/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="d/">d/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="e/">e/</a> 2018-10-24 22:01 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="f/">f/</a> 2018-10-24 22:01 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="g/">g/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="h/">h/</a> 2018-10-24 22:01 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="i/">i/</a> 2018-10-24 22:01 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="j/">j/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="k/">k/</a> 2018-10-24 21:20 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="l/">l/</a> 2018-10-24 22:01 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="m/">m/</a> 2018-10-24 22:01 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="n/">n/</a> 2018-10-24 22:01 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="o/">o/</a> 2018-10-24 21:51 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="p/">p/</a> 2018-10-24 22:01 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="q/">q/</a> 2018-10-24 22:01 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="r/">r/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="s/">s/</a> 2018-10-24 22:01 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="t/">t/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="u/">u/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="v/">v/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="w/">w/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="x/">x/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="y/">y/</a> 2018-10-24 21:30 -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="z/">z/</a> 2018-10-24 21:20 -
<hr></pre>
</body></html>

View File

@ -0,0 +1,227 @@
From af2d53b81d134b2ae05630a39292800673683bb4 Mon Sep 17 00:00:00 2001
From: cherry530 <707078654@qq.com>
Date: Mon, 30 Sep 2024 14:59:45 +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 b099b07..a26ca01 100644
--- a/atf-c++/check.cpp
+++ b/atf-c++/check.cpp
@@ -145,7 +145,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;
@@ -154,5 +154,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 f838efb..461eac0 100644
--- a/atf-c++/check.hpp
+++ b/atf-c++/check.hpp
@@ -75,7 +75,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:
//!
@@ -124,7 +124,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 a92511c..9417069 100644
--- a/atf-c++/check_test.cpp
+++ b/atf-c++/check_test.cpp
@@ -57,7 +57,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;
@@ -70,7 +70,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;
@@ -253,11 +253,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()));
@@ -277,7 +277,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());
@@ -285,7 +285,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());
@@ -293,7 +293,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());
@@ -326,12 +326,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);
@@ -377,7 +377,7 @@ ATF_TEST_CASE_BODY(exec_unknown)
argv.push_back(atf::config::get("atf_workdir") + "/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 a40f663..adad139 100644
--- a/atf-c++/detail/process_test.cpp
+++ b/atf-c++/detail/process_test.cpp
@@ -199,8 +199,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());
@@ -229,8 +229,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 4c8ca91..5e09904 100644
--- a/atf-c++/tests.hpp
+++ b/atf-c++/tests.hpp
@@ -77,7 +77,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 b08c020..071aa81 100644
--- a/atf-sh/atf-check.cpp
+++ b/atf-sh/atf-check.cpp
@@ -108,7 +108,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:
@@ -328,7 +328,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
@@ -344,7 +344,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);
@@ -806,7 +806,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.27.0

Binary file not shown.

View File

@ -1,12 +1,14 @@
Name: atf
Version: 0.20
Release: 13
Release: 14
License: BSD
Summary: Testing Framework for Automated
URL: http://code.google.com/p/kyua/wiki/ATF
Source0: https://github.com/jmmv/atf/releases/download/atf-0.20/atf-0.20.tar.gz
Source1: README
Patch0: Replace-auto_ptr-with-unique_ptr.patch
BuildRequires: gcc-c++
%description
@ -141,5 +143,9 @@ make check
%changelog
* Mon Sep 30 2024 xu_ping <707078654@qq.com> - 0.20-14
- Replace auto_ptr with unique_ptr
- Remove extra files
* Tue Dec 31 2019 duyeyu <duyeyu@huawei.com> - 0.20-13
- Package init