diff options
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 ) { |