diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-01-23 10:13:00 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-01-26 11:05:01 +0900 |
commit | 3b1e4bbb3df6a0de8aa0693038449c6f0359ce91 (patch) | |
tree | 068068e7b1b6202c635bd655e346f838d715373c /indexlib/create.cpp | |
parent | b0f8eef013163b2098c2bb07e93cb9b194338b80 (diff) | |
download | tdepim-3b1e4bbb3df6a0de8aa0693038449c6f0359ce91.tar.gz tdepim-3b1e4bbb3df6a0de8aa0693038449c6f0359ce91.zip |
Replace auto_ptr
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit d2f343cc239e1fa25c9581cf35bada96692c41db)
Diffstat (limited to 'indexlib/create.cpp')
-rw-r--r-- | indexlib/create.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/indexlib/create.cpp b/indexlib/create.cpp index e47d116a6..c64e21584 100644 --- a/indexlib/create.cpp +++ b/indexlib/create.cpp @@ -56,41 +56,41 @@ indexlib::index_type::type type_of( const char* basename ) { } } -std::auto_ptr<indexlib::index> indexlib::create( const char* basename, indexlib::index_type::type flags ) { +std::unique_ptr<indexlib::index> indexlib::create( const char* basename, indexlib::index_type::type flags ) { using namespace indexlib::version; - if ( type_of( basename ) != indexlib::index_type::none ) return std::auto_ptr<indexlib::index>( 0 ); + if ( type_of( basename ) != indexlib::index_type::none ) return std::unique_ptr<indexlib::index>(); try { if ( basename[ strlen( basename ) - 1 ] == '/' && !isdir( basename ) ) { - if ( !indexlib::detail::mkdir_trailing( basename ) ) return std::auto_ptr<indexlib::index>( 0 ); + if ( !indexlib::detail::mkdir_trailing( basename ) ) return std::unique_ptr<indexlib::index>(); } std::ofstream info( path_concat( basename, "info" ).c_str() ); info << marker << std::endl; info << "version " << major << '.' << minor << "\n"; if ( flags == index_type::quotes ) { info << "quotes" << std::endl; - return std::auto_ptr<indexlib::index>( new quotes( basename ) ); + return std::unique_ptr<indexlib::index>( new quotes( basename ) ); } if ( flags == index_type::ifile ) { info << "ifile" << std::endl; - return std::auto_ptr<indexlib::index>( new ifile( basename ) ); + return std::unique_ptr<indexlib::index>( new ifile( basename ) ); } } catch ( const std::exception& e ) { std::cerr << "index creation failed: " << e.what() << std::endl; } - return std::auto_ptr<indexlib::index>( 0 ); + return std::unique_ptr<indexlib::index>(); } -std::auto_ptr<indexlib::index> indexlib::open( const char* basename, unsigned flags ) { +std::unique_ptr<indexlib::index> indexlib::open( const char* basename, unsigned flags ) { using namespace indexlib; switch ( type_of( basename ) ) { - case index_type::ifile: return std::auto_ptr<indexlib::index>( new ifile( basename ) ); - case index_type::quotes: return std::auto_ptr<indexlib::index>( new quotes( basename ) ); + case index_type::ifile: return std::unique_ptr<indexlib::index>( new ifile( basename ) ); + case index_type::quotes: return std::unique_ptr<indexlib::index>( new quotes( basename ) ); case index_type::none: - if ( flags == open_flags::fail_if_nonexistant ) return std::auto_ptr<indexlib::index>(); + if ( flags == open_flags::fail_if_nonexistant ) return std::unique_ptr<indexlib::index>(); return create( basename, index_type::type( flags ) ); } logfile() << format( "%s:%s: Unexpected code reached!\n" ) % __FILE__ % __LINE__; - return std::auto_ptr<indexlib::index>( 0 ); + return std::unique_ptr<indexlib::index>(); } bool indexlib::exists( const char* basename ) { |