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-23 10:13:00 +0900 |
commit | d2f343cc239e1fa25c9581cf35bada96692c41db (patch) | |
tree | 52a60c0c804e42a990ffb27ca69c54d7467ea814 /indexlib/create.cpp | |
parent | 3b3f9ec8f31978030c17309fae48335bea5c1587 (diff) | |
download | tdepim-d2f343cc239e1fa25c9581cf35bada96692c41db.tar.gz tdepim-d2f343cc239e1fa25c9581cf35bada96692c41db.zip |
Replace auto_ptr
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
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 ) { |