From 898e732e5269380a435c1121f31f449c7b159b4d Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Fri, 11 May 2018 11:42:26 +1100 Subject: [PATCH] Filesystem/Boost: made use of std::make_unique (cherry-picked from commit 32111ae5e9f05cd2e8ce708eed574ce0560c299e) --- src/filesystem_boost.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/filesystem_boost.cpp b/src/filesystem_boost.cpp index e8a5e6207fba..9ee70185614f 100644 --- a/src/filesystem_boost.cpp +++ b/src/filesystem_boost.cpp @@ -889,8 +889,7 @@ filesystem::scoped_istream istream_file(const std::string& fname, bool treat_fai return s; } - return filesystem::scoped_istream( - new boost::iostreams::stream(fd, 4096, 0)); + return std::make_unique>(fd, 4096, 0); } catch(const std::exception&) { if(treat_failure_as_error) { ERR_FS << "Could not open '" << fname << "' for reading.\n"; @@ -908,8 +907,7 @@ filesystem::scoped_ostream ostream_file(const std::string& fname, bool create_di #if 1 try { boost::iostreams::file_descriptor_sink fd(bfs::path(fname), std::ios_base::binary); - return filesystem::scoped_ostream( - new boost::iostreams::stream(fd, 4096, 0)); + return std::make_unique>(fd, 4096, 0); } catch(BOOST_IOSTREAMS_FAILURE& e) { // If this operation failed because the parent directory didn't exist, create the parent directory and // retry.