From 6674947a124c8bbd8bc4289a57f63e20d84c2637 Mon Sep 17 00:00:00 2001 From: Jez Higgins Date: Wed, 15 Apr 2020 23:05:47 +0100 Subject: [PATCH] Got rid of auto_ptr in the XSLT stylesheet compiler --- examples/XSLT/mangle.cpp | 2 +- include/XSLT/impl/xslt_stylesheet_compiler.hpp | 6 +++--- tests/XSLT/xslt_test.hpp | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/XSLT/mangle.cpp b/examples/XSLT/mangle.cpp index 9e99abb6..b3e8d6ec 100755 --- a/examples/XSLT/mangle.cpp +++ b/examples/XSLT/mangle.cpp @@ -25,7 +25,7 @@ int main(int argc, const char* argv[]) try { Arabica::SAX::InputSource source(argv[2]); - std::auto_ptr > stylesheet = compiler.compile(source); + std::unique_ptr > stylesheet = compiler.compile(source); if(stylesheet.get() == 0) { std::cerr << "Couldn't compile stylesheet: " << compiler.error() << std::endl; diff --git a/include/XSLT/impl/xslt_stylesheet_compiler.hpp b/include/XSLT/impl/xslt_stylesheet_compiler.hpp index d94064b6..9077f042 100644 --- a/include/XSLT/impl/xslt_stylesheet_compiler.hpp +++ b/include/XSLT/impl/xslt_stylesheet_compiler.hpp @@ -227,11 +227,11 @@ public: { } // ~StylesheetCompiler - std::auto_ptr > compile(InputSourceT& source) + std::unique_ptr > compile(InputSourceT& source) { error_ = ""; - std::auto_ptr > stylesheet(new CompiledStylesheet()); + auto stylesheet = std::make_unique>(); StylesheetParser parser; CompilationContext context(parser, *stylesheet.get()); @@ -252,7 +252,7 @@ public: stylesheet.reset(); } // catch - return std::auto_ptr >(stylesheet.release()); + return std::unique_ptr >(stylesheet.release()); } // compile const std::string& error() const diff --git a/tests/XSLT/xslt_test.hpp b/tests/XSLT/xslt_test.hpp index 9c810942..ee8799f9 100644 --- a/tests/XSLT/xslt_test.hpp +++ b/tests/XSLT/xslt_test.hpp @@ -177,7 +177,7 @@ protected: Arabica::XSLT::StylesheetCompiler compiler; Arabica::SAX::InputSource source(string_adaptor::construct(input_xslt_)); - std::auto_ptr > stylesheet = compiler.compile(source); + std::unique_ptr > stylesheet = compiler.compile(source); if(stylesheet.get() != 0) assertImplementation(false, "Expected " + input_xslt_ + " not to compile. But it did :o"); throw SkipException(reason_ + " : " + compiler.error()); @@ -209,7 +209,7 @@ protected: Arabica::XSLT::StylesheetCompiler compiler; Arabica::SAX::InputSource source(string_adaptor::construct(input_xslt_)); - std::auto_ptr > stylesheet = compiler.compile(source); + std::unique_ptr > stylesheet = compiler.compile(source); if(stylesheet.get() == 0) assertImplementation(false, "Failed to compile " + input_xslt_ + " : " + compiler.error()); @@ -255,7 +255,7 @@ protected: string_type input = string_adaptor::construct(input_xslt_); Arabica::SAX::InputSource source(input); - std::auto_ptr > stylesheet = compiler.compile(source); + std::unique_ptr > stylesheet = compiler.compile(source); if(stylesheet.get() == 0) return; @@ -301,7 +301,7 @@ protected: Arabica::XSLT::StylesheetCompiler compiler; Arabica::SAX::InputSource source(string_adaptor::construct(input_xslt_)); - std::auto_ptr > stylesheet = compiler.compile(source); + std::unique_ptr > stylesheet = compiler.compile(source); if(stylesheet.get() == 0) assertImplementation(false, "Failed to compile " + input_xslt_ + " : " + compiler.error()); @@ -397,7 +397,7 @@ protected: Arabica::XSLT::StylesheetCompiler compiler; Arabica::SAX::InputSource source(string_adaptor::construct(input_xslt_)); - std::auto_ptr > stylesheet = compiler.compile(source); + std::unique_ptr > stylesheet = compiler.compile(source); if(stylesheet.get() == 0) assertImplementation(false, "Failed to compile " + input_xslt_ + " : " + compiler.error()); @@ -498,7 +498,7 @@ protected: Arabica::XSLT::StylesheetCompiler compiler; Arabica::SAX::InputSource source(string_adaptor::construct(input_xslt_)); - std::auto_ptr > stylesheet = compiler.compile(source); + std::unique_ptr > stylesheet = compiler.compile(source); if(stylesheet.get() == 0) assertImplementation(false, "Failed to compile " + input_xslt_ + " : " + compiler.error());