diff --git a/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp b/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp index e89070f3..d5083b96 100644 --- a/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp +++ b/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp @@ -442,7 +442,7 @@ bool Kleo::ChiasmusBackend::checkForSMIME( TQString * reason ) const { bool Kleo::ChiasmusBackend::checkForChiasmus( TQString * reason ) const { // kills the protocol instance when we return false: - std::auto_ptr tmp( mProtocol ); + std::unique_ptr tmp( mProtocol ); mProtocol = 0; const CryptoConfigEntry * path = config()->entry( "Chiasmus", "General", "path" ); diff --git a/certmanager/lib/cryptplug.cpp b/certmanager/lib/cryptplug.cpp index 20747457..24ded795 100644 --- a/certmanager/lib/cryptplug.cpp +++ b/certmanager/lib/cryptplug.cpp @@ -696,8 +696,8 @@ GpgME::ImportResult CryptPlug::importCertificateFromMem( const char* data, size_ { using namespace GpgME; - std::auto_ptr context( Context::createForProtocol( mProtocol ) ); - if ( !context.get() ) + std::unique_ptr context( Context::createForProtocol( mProtocol ) ); + if ( !context ) return ImportResult(); Data keydata( data, length, false ); diff --git a/certmanager/lib/tests/test_jobs.cpp b/certmanager/lib/tests/test_jobs.cpp index ba26bfb5..661e07da 100644 --- a/certmanager/lib/tests/test_jobs.cpp +++ b/certmanager/lib/tests/test_jobs.cpp @@ -61,8 +61,8 @@ static void testSign() std::vector signingKeys; - std::auto_ptr listJob( proto->keyListJob( false, false, true ) ); // use validating keylisting - if ( listJob.get() ) { + std::unique_ptr listJob( proto->keyListJob( false, false, true ) ); // use validating keylisting + if ( listJob ) { // ##### Adjust this to your own identity listJob->exec( "faure@kde.org", true /*secret*/, signingKeys ); assert( !signingKeys.empty() ); diff --git a/indexlib/boost-compat/config/compiler/gcc.h b/indexlib/boost-compat/config/compiler/gcc.h index 2c5ad198..4be7f408 100644 --- a/indexlib/boost-compat/config/compiler/gcc.h +++ b/indexlib/boost-compat/config/compiler/gcc.h @@ -13,10 +13,6 @@ // GNU C++ compiler setup: -# if __GNUC__ == 2 && __GNUC_MINOR__ == 91 - // egcs 1.1 won't parse shared_ptr.h without this: -# define BOOST_NO_AUTO_PTR -# endif # if __GNUC__ == 2 && __GNUC_MINOR__ < 95 // // Prior to gcc 2.95 member templates only partly diff --git a/indexlib/boost-compat/config/stdlib/roguewave.h b/indexlib/boost-compat/config/stdlib/roguewave.h index ec3d881b..452b8421 100644 --- a/indexlib/boost-compat/config/stdlib/roguewave.h +++ b/indexlib/boost-compat/config/stdlib/roguewave.h @@ -73,7 +73,6 @@ // new-style iostreams, and no conformant std::allocator: // #if (BOOST_RWSTD_VER < 0x020000) -# define BOOST_NO_AUTO_PTR # define BOOST_NO_STRINGSTREAM # define BOOST_NO_STD_ALLOCATOR # define BOOST_NO_STD_LOCALE diff --git a/indexlib/boost-compat/scoped_ptr.h b/indexlib/boost-compat/scoped_ptr.h index 60078bf1..41d4f9b8 100644 --- a/indexlib/boost-compat/scoped_ptr.h +++ b/indexlib/boost-compat/scoped_ptr.h @@ -15,7 +15,7 @@ #include "checked_delete.h" -#include // for std::auto_ptr +#include #include namespace boost @@ -25,7 +25,7 @@ namespace boost // scoped_ptr mimics a built-in pointer except that it guarantees deletion // of the object pointed to, either on destruction of the scoped_ptr or via // an explicit reset(). scoped_ptr is a simple solution for simple needs; -// use shared_ptr or std::auto_ptr if your needs are more complex. +// use shared_ptr or std::unique_ptr if your needs are more complex. template class scoped_ptr // noncopyable { @@ -46,11 +46,6 @@ public: { } - - explicit scoped_ptr(std::auto_ptr p): ptr(p.release()) // never throws - { - } - ~scoped_ptr() // never throws { boost::checked_delete(ptr); diff --git a/indexlib/boost-compat/shared_ptr.h b/indexlib/boost-compat/shared_ptr.h index c236e3bd..a242c829 100644 --- a/indexlib/boost-compat/shared_ptr.h +++ b/indexlib/boost-compat/shared_ptr.h @@ -26,11 +26,11 @@ #include #include -#include // for std::auto_ptr -#include // for std::swap -#include // for std::less -#include // for std::bad_cast -#include // for std::basic_ostream +#include +#include +#include +#include +#include #ifdef BOOST_MSVC // moved here to work around VC++ compiler crash # pragma warning(push) @@ -191,18 +191,6 @@ public: } } -#ifndef BOOST_NO_AUTO_PTR - - template - explicit shared_ptr(std::auto_ptr & r): px(r.get()), pn() - { - Y * tmp = r.get(); - pn = detail::shared_count(r); - detail::sp_enable_shared_from_this( pn, tmp, tmp ); - } - -#endif - #if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) template @@ -213,17 +201,6 @@ public: return *this; } -#endif - -#ifndef BOOST_NO_AUTO_PTR - - template - shared_ptr & operator=(std::auto_ptr & r) - { - this_type(r).swap(*this); - return *this; - } - #endif void reset() // never throws in 1.30+ diff --git a/indexlib/compressed.cpp b/indexlib/compressed.cpp index a60c3f06..9c73c304 100644 --- a/indexlib/compressed.cpp +++ b/indexlib/compressed.cpp @@ -53,7 +53,7 @@ memory_manager* get_comp_p() { compressed_file::compressed_file( std::string base ): auxdata_( path_concat( base, "table" ) ), - data_( std::auto_ptr( new mmap_manager( path_concat( base, "data" ) ) ) ) + data_( std::unique_ptr( new mmap_manager( path_concat( base, "data" ) ) ) ) { if ( auxdata_.empty() ) auxdata_.push_back( 0 ); } diff --git a/indexlib/create.cpp b/indexlib/create.cpp index e47d116a..c64e2158 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::create( const char* basename, indexlib::index_type::type flags ) { +std::unique_ptr 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( 0 ); + if ( type_of( basename ) != indexlib::index_type::none ) return std::unique_ptr(); try { if ( basename[ strlen( basename ) - 1 ] == '/' && !isdir( basename ) ) { - if ( !indexlib::detail::mkdir_trailing( basename ) ) return std::auto_ptr( 0 ); + if ( !indexlib::detail::mkdir_trailing( basename ) ) return std::unique_ptr(); } 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( new quotes( basename ) ); + return std::unique_ptr( new quotes( basename ) ); } if ( flags == index_type::ifile ) { info << "ifile" << std::endl; - return std::auto_ptr( new ifile( basename ) ); + return std::unique_ptr( new ifile( basename ) ); } } catch ( const std::exception& e ) { std::cerr << "index creation failed: " << e.what() << std::endl; } - return std::auto_ptr( 0 ); + return std::unique_ptr(); } -std::auto_ptr indexlib::open( const char* basename, unsigned flags ) { +std::unique_ptr indexlib::open( const char* basename, unsigned flags ) { using namespace indexlib; switch ( type_of( basename ) ) { - case index_type::ifile: return std::auto_ptr( new ifile( basename ) ); - case index_type::quotes: return std::auto_ptr( new quotes( basename ) ); + case index_type::ifile: return std::unique_ptr( new ifile( basename ) ); + case index_type::quotes: return std::unique_ptr( new quotes( basename ) ); case index_type::none: - if ( flags == open_flags::fail_if_nonexistant ) return std::auto_ptr(); + if ( flags == open_flags::fail_if_nonexistant ) return std::unique_ptr(); return create( basename, index_type::type( flags ) ); } logfile() << format( "%s:%s: Unexpected code reached!\n" ) % __FILE__ % __LINE__; - return std::auto_ptr( 0 ); + return std::unique_ptr(); } bool indexlib::exists( const char* basename ) { diff --git a/indexlib/create.h b/indexlib/create.h index e865728e..18e9929b 100644 --- a/indexlib/create.h +++ b/indexlib/create.h @@ -57,14 +57,14 @@ namespace indexlib { * This will return something like "new quotes(basename)" but by using this, you do not need to include quotes.h * which needs boost headers also. */ - std::auto_ptr create( const char* basename, index_type::type flags = index_type::quotes ); + std::unique_ptr create( const char* basename, index_type::type flags = index_type::quotes ); namespace open_flags { enum type { none = 0, create_ifile = index_type::ifile, create_quotes = index_type::quotes, fail_if_nonexistant }; } - std::auto_ptr open( const char* basename, unsigned flags = open_flags::fail_if_nonexistant ); + std::unique_ptr open( const char* basename, unsigned flags = open_flags::fail_if_nonexistant ); /** * Removes the index. diff --git a/indexlib/ifile.cpp b/indexlib/ifile.cpp index 5709bb41..8ef5d2c6 100644 --- a/indexlib/ifile.cpp +++ b/indexlib/ifile.cpp @@ -83,10 +83,10 @@ void ifile::remove_doc( const char* doc ) { // TODO: remove from words_ too if that's the case } -std::auto_ptr ifile::everything() const { +std::unique_ptr ifile::everything() const { std::vector res( ndocs() ); for ( unsigned i = 0; i != ndocs(); ++i ) res[ i ] = i; - return std::auto_ptr( new indexlib::detail::simple_result( res ) ); + return std::unique_ptr( new indexlib::detail::simple_result( res ) ); } namespace { @@ -94,13 +94,13 @@ inline bool word_too_small( std::string str ) { return str.size() < 3; } } -std::auto_ptr ifile::search( const char* str ) const { +std::unique_ptr ifile::search( const char* str ) const { using namespace indexlib::detail; using indexlib::result; assert( str ); if ( !*str ) return everything(); std::vector words = break_clean( str ); - if ( words.empty() ) return std::auto_ptr( new empty_result ); + if ( words.empty() ) return std::unique_ptr( new empty_result ); words.erase( std::remove_if( words.begin(), words.end(), &word_too_small ), words.end() ); if ( words.empty() ) return everything(); std::set values = find_word( words[ 0 ] ); @@ -113,7 +113,7 @@ std::auto_ptr ifile::search( const char* str ) const { std::set_intersection( now.begin(), now.end(), values.begin(), values.end(), std::inserter( next, next.begin() ) ); next.swap( values ); } - std::auto_ptr r(new simple_result( std::vector( values.begin(), values.end() ) ) ); + std::unique_ptr r(new simple_result( std::vector( values.begin(), values.end() ) ) ); return r; } diff --git a/indexlib/ifile.h b/indexlib/ifile.h index 4cfcf585..3fcf772e 100644 --- a/indexlib/ifile.h +++ b/indexlib/ifile.h @@ -43,8 +43,10 @@ struct ifile : public indexlib::index { public: ifile( std::string ); + ifile(ifile const &) = delete; + ifile& operator=(ifile const &) = delete; virtual void add( const char* str, const char* doc ); - virtual std::auto_ptr search( const char* ) const; + virtual std::unique_ptr search( const char* ) const; virtual unsigned ndocs() const { return docnames_.size(); } virtual std::string lookup_docname( unsigned idx ) const { return docnames_.get( idx ); } @@ -56,7 +58,7 @@ struct ifile : public indexlib::index { private: std::set find_word( std::string ) const; std::vector break_clean( const char* ) const; - virtual std::auto_ptr everything() const; + virtual std::unique_ptr everything() const; static bool invalid_word( std::string ); bool is_stop_word( std::string ) const; @@ -67,7 +69,7 @@ struct ifile : public indexlib::index { stringset words_; stringset stopwords_; leafdatavector files_; - std::auto_ptr tokenizer_; + std::unique_ptr tokenizer_; }; #endif /* _IFILE_INCLUDE_GUARD_LPC_56465465798732 */ diff --git a/indexlib/index.h b/indexlib/index.h index b7c68375..5ffab2d4 100644 --- a/indexlib/index.h +++ b/indexlib/index.h @@ -61,7 +61,7 @@ struct result { * @return null if the type does not support this or the particular search string makes it impossible to * fulfill the search request. */ - virtual std::auto_ptr search( const char* ) = 0; + virtual std::unique_ptr search( const char* ) = 0; }; struct index { @@ -96,7 +96,7 @@ struct index { /** * Returns all documents matching \param pattern. */ - virtual std::auto_ptr search( const char* pattern ) const = 0; + virtual std::unique_ptr search( const char* pattern ) const = 0; /** * Returns the number of docs indexed. diff --git a/indexlib/leafdatavector.cpp b/indexlib/leafdatavector.cpp index 0dae6555..89b95ab9 100644 --- a/indexlib/leafdatavector.cpp +++ b/indexlib/leafdatavector.cpp @@ -45,7 +45,7 @@ typedef mmap_manager leafdatavector_manager; #endif leafdatavector::leafdatavector( std::string name ): - leafs_( std::auto_ptr( new leafdatavector_manager( path_concat( name, "leafs" ) ) ) ), + leafs_( std::unique_ptr( new leafdatavector_manager( path_concat( name, "leafs" ) ) ) ), table_( path_concat( name, "table" ) ) { } diff --git a/indexlib/main.cpp b/indexlib/main.cpp index b8685153..dcedbe1c 100644 --- a/indexlib/main.cpp +++ b/indexlib/main.cpp @@ -46,7 +46,7 @@ #include #include -typedef std::auto_ptr index_smart; +typedef std::unique_ptr index_smart; index_smart get_index( std::string name ) { return indexlib::open( name.c_str(), indexlib::open_flags::create_quotes ); @@ -92,8 +92,8 @@ int debug( int argc, char* argv[] ) { std::cout << "compressed_file:\n"; file.print( std::cout ); } else if ( type == "break_up" ) { - std::auto_ptr tok = get_tokenizer( "latin-1:european" ); - if ( !tok.get() ) { + std::unique_ptr tok = get_tokenizer( "latin-1:european" ); + if ( !tok ) { std::cerr << "Could not get tokenizer\n"; return 1; } diff --git a/indexlib/mempool.h b/indexlib/mempool.h index acf62494..08be8857 100644 --- a/indexlib/mempool.h +++ b/indexlib/mempool.h @@ -55,7 +55,9 @@ struct mempool /* : boost::noncopyable */ { typedef Traits traits_type; typedef typename traits_type::value_type data_type; typedef typename traits_type::pointer data_typeptr; - explicit mempool( std::auto_ptr source ); + explicit mempool( std::unique_ptr &&source ); + mempool(mempool const &) = delete; + mempool& operator=(mempool const &) = delete; /** * Returns a memory block of size \param s. @@ -151,7 +153,7 @@ struct mempool /* : boost::noncopyable */ { bool join( data_typeptr&, unsigned order ); void deallocate( data_typeptr, unsigned order ); - std::auto_ptr manager_; + std::unique_ptr manager_; memory_reference max_order_; }; diff --git a/indexlib/mempool.tcc b/indexlib/mempool.tcc index a130bffe..750209a2 100644 --- a/indexlib/mempool.tcc +++ b/indexlib/mempool.tcc @@ -33,8 +33,8 @@ */ template -mempool::mempool( std::auto_ptr source ): - manager_( source ), +mempool::mempool( std::unique_ptr &&source ): + manager_( std::move(source) ), max_order_( 0 ) { if ( !manager_->size() ) init_memory(); diff --git a/indexlib/quotes.cpp b/indexlib/quotes.cpp index e4c35db4..abf8915c 100644 --- a/indexlib/quotes.cpp +++ b/indexlib/quotes.cpp @@ -68,12 +68,12 @@ void quotes::remove_doc( const char* doc ) { impl_.remove_doc( doc ); } -std::auto_ptr quotes::search( const char* cstr ) const { +std::unique_ptr quotes::search( const char* cstr ) const { std::string str = cstr; if ( str[ 0 ] != '\"' ) return impl_.search( cstr ); str = cstr + 1; // cut " if ( str.size() && str[ str.size() - 1 ] == '\"' ) str.erase( str.size() - 1 ); - std::auto_ptr prev = impl_.search( str.c_str() ); + std::unique_ptr prev = impl_.search( str.c_str() ); if ( str.find( ' ' ) != std::string::npos ) { indexlib::Match m( str ); std::vector candidates = prev->list(); @@ -86,7 +86,7 @@ std::auto_ptr quotes::search( const char* cstr ) const { res.push_back( *first ); } } - return std::auto_ptr( new indexlib::detail::simple_result( res ) ); + return std::unique_ptr( new indexlib::detail::simple_result( res ) ); } else { return prev; } } diff --git a/indexlib/quotes.h b/indexlib/quotes.h index 7852d0dd..6604e9a9 100644 --- a/indexlib/quotes.h +++ b/indexlib/quotes.h @@ -42,7 +42,7 @@ struct quotes : public indexlib::index { quotes( std::string ); virtual void add( const char* str, const char* doc ); virtual void remove_doc( const char* doc ); - virtual std::auto_ptr search( const char* ) const; + virtual std::unique_ptr search( const char* ) const; virtual unsigned ndocs() const { return impl_.ndocs(); } virtual std::string lookup_docname( unsigned d ) const { return impl_.lookup_docname( d ); } diff --git a/indexlib/result.h b/indexlib/result.h index 4cad40d7..dd23f25d 100644 --- a/indexlib/result.h +++ b/indexlib/result.h @@ -42,7 +42,7 @@ struct simple_result : indexlib::result { simple_result( std::vector r ):res( r ) { } std::vector list() const { return res; } - std::auto_ptr search( const char* ) { return std::auto_ptr( 0 ); } + std::unique_ptr search( const char* ) { return std::unique_ptr(); } private: std::vector res; }; @@ -50,7 +50,7 @@ struct simple_result : indexlib::result { struct empty_result : indexlib::result { public: std::vector list() const { return std::vector(); } - std::auto_ptr search( const char* ) { return std::auto_ptr(); } + std::unique_ptr search( const char* ) { return std::unique_ptr(); } }; } //namespace detail } //namespace indexlib diff --git a/indexlib/tests/create-test.cpp b/indexlib/tests/create-test.cpp index beeb7d5f..da3c91ca 100644 --- a/indexlib/tests/create-test.cpp +++ b/indexlib/tests/create-test.cpp @@ -14,8 +14,8 @@ void cleanup() { void simple() { cleanup(); - std::auto_ptr ptr = indexlib::create( fname ); - BOOST_CHECK( ptr.get() ); + std::unique_ptr ptr = indexlib::create( fname ); + BOOST_CHECK( ptr ); } test_suite* get_suite() { diff --git a/indexlib/tests/mempool-test.cpp b/indexlib/tests/mempool-test.cpp index a0895243..1c9a4eb6 100644 --- a/indexlib/tests/mempool-test.cpp +++ b/indexlib/tests/mempool-test.cpp @@ -11,7 +11,7 @@ void cleanup() { void deallocate() { cleanup(); - mempool pool( std::auto_ptr( new mmap_manager( fname ) ) ); + mempool pool( std::unique_ptr( new mmap_manager( fname ) ) ); std::vector pointers; for ( int i = 0; i != 32; ++i ) { @@ -33,7 +33,7 @@ void deallocate() { void large() { cleanup(); - mempool pool( std::auto_ptr( new mmap_manager( fname ) ) ); + mempool pool( std::unique_ptr( new mmap_manager( fname ) ) ); pool.allocate( 4095 ); pool.allocate( 4097 ); diff --git a/indexlib/tests/tokenizer-test.cpp b/indexlib/tests/tokenizer-test.cpp index 372859d9..1354ddcd 100644 --- a/indexlib/tests/tokenizer-test.cpp +++ b/indexlib/tests/tokenizer-test.cpp @@ -9,8 +9,8 @@ using indexlib::detail::tokenizer; using indexlib::detail::get_tokenizer; void simple() { - std::auto_ptr tokenizer = get_tokenizer( "latin-1:european" ); - assert(tokenizer.get()); + std::unique_ptr tokenizer = get_tokenizer( "latin-1:european" ); + assert(tokenizer); std::vector tokens = tokenizer->string_to_words( "one ,as, ''#`:ThReE, בבאחי" ); std::vector expected; expected.push_back( "ONE" ); @@ -26,8 +26,8 @@ void simple() { } void with_newlines() { - std::auto_ptr tokenizer = get_tokenizer( "latin-1:european" ); - assert(tokenizer.get()); + std::unique_ptr tokenizer = get_tokenizer( "latin-1:european" ); + assert(tokenizer); std::vector tokens = tokenizer->string_to_words( "one\ntwo\nthree" ); std::vector expected; expected.push_back( "ONE" ); @@ -42,8 +42,8 @@ void with_newlines() { } void with_numbers() { - std::auto_ptr tokenizer = get_tokenizer( "latin-1:european" ); - assert(tokenizer.get()); + std::unique_ptr tokenizer = get_tokenizer( "latin-1:european" ); + assert(tokenizer); std::vector tokens = tokenizer->string_to_words( "one 012 123 four" ); std::vector expected; expected.push_back( "ONE" ); diff --git a/indexlib/tokenizer.cpp b/indexlib/tokenizer.cpp index b069c748..1c1243a7 100644 --- a/indexlib/tokenizer.cpp +++ b/indexlib/tokenizer.cpp @@ -294,7 +294,7 @@ class latin1_tokenizer : public indexlib::detail::tokenizer { } -std::auto_ptr indexlib::detail::get_tokenizer( std::string name ) { - if ( name == "latin-1:european" ) return std::auto_ptr( new latin1_tokenizer ); - return std::auto_ptr( 0 ); +std::unique_ptr indexlib::detail::get_tokenizer( std::string name ) { + if ( name == "latin-1:european" ) return std::unique_ptr( new latin1_tokenizer ); + return std::unique_ptr(); } diff --git a/indexlib/tokenizer.h b/indexlib/tokenizer.h index 2494f297..9916df66 100644 --- a/indexlib/tokenizer.h +++ b/indexlib/tokenizer.h @@ -20,7 +20,7 @@ class tokenizer { virtual std::vector do_string_to_words( const char* ) = 0; }; -std::auto_ptr get_tokenizer( std::string ); +std::unique_ptr get_tokenizer( std::string ); }} diff --git a/kmail/keyresolver.cpp b/kmail/keyresolver.cpp index fcd2f279..68187d2a 100644 --- a/kmail/keyresolver.cpp +++ b/kmail/keyresolver.cpp @@ -1701,8 +1701,8 @@ std::vector Kleo::KeyResolver::lookup( const TQStringList & patterns std::vector result; if ( mCryptoMessageFormats & (InlineOpenPGPFormat|OpenPGPMIMEFormat) ) if ( const Kleo::CryptoBackend::Protocol * p = Kleo::CryptoBackendFactory::instance()->openpgp() ) { - std::auto_ptr job( p->keyListJob( false, false, true ) ); // use validating keylisting - if ( job.get() ) { + std::unique_ptr job( p->keyListJob( false, false, true ) ); // use validating keylisting + if ( job ) { std::vector keys; job->exec( patterns, secret, keys ); result.insert( result.end(), keys.begin(), keys.end() ); @@ -1710,8 +1710,8 @@ std::vector Kleo::KeyResolver::lookup( const TQStringList & patterns } if ( mCryptoMessageFormats & (SMIMEFormat|SMIMEOpaqueFormat) ) if ( const Kleo::CryptoBackend::Protocol * p = Kleo::CryptoBackendFactory::instance()->smime() ) { - std::auto_ptr job( p->keyListJob( false, false, true ) ); // use validating keylisting - if ( job.get() ) { + std::unique_ptr job( p->keyListJob( false, false, true ) ); // use validating keylisting + if ( job ) { std::vector keys; job->exec( patterns, secret, keys ); result.insert( result.end(), keys.begin(), keys.end() ); diff --git a/kmail/kmcommands.cpp b/kmail/kmcommands.cpp index 26e62f7e..833144a8 100644 --- a/kmail/kmcommands.cpp +++ b/kmail/kmcommands.cpp @@ -3239,8 +3239,8 @@ void KMHandleAttachmentCommand::atmEncryptWithChiasmus() if ( !chiasmus ) return; - const STD_NAMESPACE_PREFIX auto_ptr listjob( chiasmus->specialJob( "x-obtain-keys", TQStringVariantMap() ) ); - if ( !listjob.get() ) { + const STD_NAMESPACE_PREFIX unique_ptr listjob( chiasmus->specialJob( "x-obtain-keys", TQStringVariantMap() ) ); + if ( !listjob ) { const TQString msg = i18n( "Chiasmus backend does not offer the " "\"x-obtain-keys\" function. Please report this bug." ); KMessageBox::error( parentWidget(), msg, i18n( "Chiasmus Backend Error" ) ); diff --git a/kmail/kmcomposewin.cpp b/kmail/kmcomposewin.cpp index 794aa67c..f83ac714 100644 --- a/kmail/kmcomposewin.cpp +++ b/kmail/kmcomposewin.cpp @@ -5310,8 +5310,8 @@ void KMComposeWin::slotEncryptChiasmusToggled( bool on ) { return; } - STD_NAMESPACE_PREFIX auto_ptr job( chiasmus->specialJob( "x-obtain-keys", TQStringVariantMap() ) ); - if ( !job.get() ) { + STD_NAMESPACE_PREFIX unique_ptr job( chiasmus->specialJob( "x-obtain-keys", TQStringVariantMap() ) ); + if ( !job ) { const TQString msg = i18n( "Chiasmus backend does not offer the " "\"x-obtain-keys\" function. Please report this bug." ); KMessageBox::error( this, msg, i18n( "Chiasmus Backend Error" ) ); diff --git a/kmail/messagecomposer.cpp b/kmail/messagecomposer.cpp index c98289e0..1cc0cd33 100644 --- a/kmail/messagecomposer.cpp +++ b/kmail/messagecomposer.cpp @@ -552,8 +552,8 @@ bool MessageComposer::encryptWithChiasmus( const Kleo::CryptoBackend::Protocol * const TQByteArray& body, TQByteArray& resultData ) { - std::auto_ptr job( chiasmus->specialJob( "x-encrypt", TQStringVariantMap() ) ); - if ( !job.get() ) { + std::unique_ptr job( chiasmus->specialJob( "x-encrypt", TQStringVariantMap() ) ); + if ( !job ) { const TQString msg = i18n( "Chiasmus backend does not offer the " "\"x-encrypt\" function. Please report this bug." ); KMessageBox::error( mComposeWin, msg, i18n( "Chiasmus Backend Error" ) ); @@ -2162,10 +2162,10 @@ void MessageComposer::pgpSignedMsg( const TQByteArray& cText, Kleo::CryptoMessag = isSMIME( format ) ? cpf->smime() : cpf->openpgp() ; assert( proto ); /// hmmm.....? - std::auto_ptr job( proto->signJob( armor( format ), + std::unique_ptr job( proto->signJob( armor( format ), textMode( format ) ) ); - if ( !job.get() ) { + if ( !job ) { KMessageBox::sorry( mComposeWin, i18n("This message could not be signed, " "since the chosen backend does not seem to support " @@ -2218,9 +2218,9 @@ Kpgp::Result MessageComposer::pgpEncryptedMsg( TQByteArray & encryptedBody, = isSMIME( format ) ? cpf->smime() : cpf->openpgp() ; assert( proto ); // hmmmm....? - std::auto_ptr job( proto->encryptJob( armor( format ), + std::unique_ptr job( proto->encryptJob( armor( format ), textMode( format ) ) ); - if ( !job.get() ) { + if ( !job ) { KMessageBox::sorry( mComposeWin, i18n("This message could not be encrypted, " "since the chosen backend does not seem to support " @@ -2266,9 +2266,9 @@ Kpgp::Result MessageComposer::pgpSignedAndEncryptedMsg( TQByteArray & encryptedB = isSMIME( format ) ? cpf->smime() : cpf->openpgp() ; assert( proto ); // hmmmm....? - std::auto_ptr job( proto->signEncryptJob( armor( format ), + std::unique_ptr job( proto->signEncryptJob( armor( format ), textMode( format ) ) ); - if ( !job.get() ) { + if ( !job ) { KMessageBox::sorry( mComposeWin, i18n("This message could not be signed and encrypted, " "since the chosen backend does not seem to support " diff --git a/kmail/objecttreeparser.cpp b/kmail/objecttreeparser.cpp index 39b7ac00..3d0593cc 100644 --- a/kmail/objecttreeparser.cpp +++ b/kmail/objecttreeparser.cpp @@ -1652,7 +1652,7 @@ namespace KMail { const TQByteArray certData = node->msgPart().bodyDecodedBinary(); - const STD_NAMESPACE_PREFIX auto_ptr import( smimeCrypto->importJob() ); + const STD_NAMESPACE_PREFIX unique_ptr import( smimeCrypto->importJob() ); const GpgME::ImportResult res = import->exec( certData ); if ( res.error() ) { htmlWriter()->queue( i18n( "Sorry, certificate could not be imported.
" @@ -1853,8 +1853,8 @@ bool ObjectTreeParser::decryptChiasmus( const TQByteArray& data, TQByteArray& bo if ( !chiasmus ) return false; - const STD_NAMESPACE_PREFIX auto_ptr listjob( chiasmus->specialJob( "x-obtain-keys", TQStringVariantMap() ) ); - if ( !listjob.get() ) { + const STD_NAMESPACE_PREFIX unique_ptr listjob( chiasmus->specialJob( "x-obtain-keys", TQStringVariantMap() ) ); + if ( !listjob ) { errorText = i18n( "Chiasmus backend does not offer the " "\"x-obtain-keys\" function. Please report this bug." ); return false; @@ -1892,8 +1892,8 @@ bool ObjectTreeParser::decryptChiasmus( const TQByteArray& data, TQByteArray& bo GlobalSettings::setChiasmusDecryptionKey( selectorDlg.key() ); assert( !GlobalSettings::chiasmusDecryptionKey().isEmpty() ); - const STD_NAMESPACE_PREFIX auto_ptr job( chiasmus->specialJob( "x-decrypt", TQStringVariantMap() ) ); - if ( !job.get() ) { + const STD_NAMESPACE_PREFIX unique_ptr job( chiasmus->specialJob( "x-decrypt", TQStringVariantMap() ) ); + if ( !job ) { errorText = i18n( "Chiasmus backend does not offer the " "\"x-decrypt\" function. Please report this bug." ); return false; diff --git a/libksieve/parser/lexer.cpp b/libksieve/parser/lexer.cpp index 4b0ebf4f..0213f7d7 100644 --- a/libksieve/parser/lexer.cpp +++ b/libksieve/parser/lexer.cpp @@ -42,7 +42,7 @@ #include #include -#include // std::auto_ptr +#include #include #include // isdigit @@ -618,8 +618,8 @@ namespace KSieve { const TQTextCodec * const codec = TQTextCodec::codecForMib( 106 ); // UTF-8 assert( codec ); - const std::auto_ptr dec( codec->makeDecoder() ); - assert( dec.get() ); + const std::unique_ptr dec( codec->makeDecoder() ); + assert( dec ); while ( !atEnd() ) switch ( *mState.cursor ) {