Replace auto_ptr

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/107/head
Michele Calgaro 10 months ago
parent 3b3f9ec8f3
commit d2f343cc23
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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<Protocol> tmp( mProtocol );
std::unique_ptr<Protocol> tmp( mProtocol );
mProtocol = 0;
const CryptoConfigEntry * path = config()->entry( "Chiasmus", "General", "path" );

@ -696,8 +696,8 @@ GpgME::ImportResult CryptPlug::importCertificateFromMem( const char* data, size_
{
using namespace GpgME;
std::auto_ptr<Context> context( Context::createForProtocol( mProtocol ) );
if ( !context.get() )
std::unique_ptr<Context> context( Context::createForProtocol( mProtocol ) );
if ( !context )
return ImportResult();
Data keydata( data, length, false );

@ -61,8 +61,8 @@ static void testSign()
std::vector<GpgME::Key> signingKeys;
std::auto_ptr<Kleo::KeyListJob> listJob( proto->keyListJob( false, false, true ) ); // use validating keylisting
if ( listJob.get() ) {
std::unique_ptr<Kleo::KeyListJob> 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() );

@ -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

@ -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

@ -15,7 +15,7 @@
#include "checked_delete.h"
#include <memory> // for std::auto_ptr
#include <memory>
#include <assert.h>
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 T> class scoped_ptr // noncopyable
{
@ -46,11 +46,6 @@ public:
{
}
explicit scoped_ptr(std::auto_ptr<T> p): ptr(p.release()) // never throws
{
}
~scoped_ptr() // never throws
{
boost::checked_delete(ptr);

@ -26,11 +26,11 @@
#include <boost/detail/shared_count.hpp>
#include <boost/detail/workaround.hpp>
#include <memory> // for std::auto_ptr
#include <algorithm> // for std::swap
#include <functional> // for std::less
#include <typeinfo> // for std::bad_cast
#include <iosfwd> // for std::basic_ostream
#include <memory>
#include <algorithm>
#include <functional>
#include <typeinfo>
#include <iosfwd>
#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<class Y>
explicit shared_ptr(std::auto_ptr<Y> & 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<class Y>
@ -213,17 +201,6 @@ public:
return *this;
}
#endif
#ifndef BOOST_NO_AUTO_PTR
template<class Y>
shared_ptr & operator=(std::auto_ptr<Y> & r)
{
this_type(r).swap(*this);
return *this;
}
#endif
void reset() // never throws in 1.30+

@ -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<memory_manager>( new mmap_manager( path_concat( base, "data" ) ) ) )
data_( std::unique_ptr<memory_manager>( new mmap_manager( path_concat( base, "data" ) ) ) )
{
if ( auxdata_.empty() ) auxdata_.push_back( 0 );
}

@ -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 ) {

@ -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<index> create( const char* basename, index_type::type flags = index_type::quotes );
std::unique_ptr<index> 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<index> open( const char* basename, unsigned flags = open_flags::fail_if_nonexistant );
std::unique_ptr<index> open( const char* basename, unsigned flags = open_flags::fail_if_nonexistant );
/**
* Removes the index.

@ -83,10 +83,10 @@ void ifile::remove_doc( const char* doc ) {
// TODO: remove from words_ too if that's the case
}
std::auto_ptr<indexlib::result> ifile::everything() const {
std::unique_ptr<indexlib::result> ifile::everything() const {
std::vector<unsigned> res( ndocs() );
for ( unsigned i = 0; i != ndocs(); ++i ) res[ i ] = i;
return std::auto_ptr<indexlib::result>( new indexlib::detail::simple_result( res ) );
return std::unique_ptr<indexlib::result>( 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<indexlib::result> ifile::search( const char* str ) const {
std::unique_ptr<indexlib::result> ifile::search( const char* str ) const {
using namespace indexlib::detail;
using indexlib::result;
assert( str );
if ( !*str ) return everything();
std::vector<std::string> words = break_clean( str );
if ( words.empty() ) return std::auto_ptr<result>( new empty_result );
if ( words.empty() ) return std::unique_ptr<result>( new empty_result );
words.erase( std::remove_if( words.begin(), words.end(), &word_too_small ), words.end() );
if ( words.empty() ) return everything();
std::set<unsigned> values = find_word( words[ 0 ] );
@ -113,7 +113,7 @@ std::auto_ptr<indexlib::result> 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<result> r(new simple_result( std::vector<unsigned>( values.begin(), values.end() ) ) );
std::unique_ptr<result> r(new simple_result( std::vector<unsigned>( values.begin(), values.end() ) ) );
return r;
}

@ -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<indexlib::result> search( const char* ) const;
virtual std::unique_ptr<indexlib::result> 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<unsigned> find_word( std::string ) const;
std::vector<std::string> break_clean( const char* ) const;
virtual std::auto_ptr<indexlib::result> everything() const;
virtual std::unique_ptr<indexlib::result> 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<indexlib::detail::tokenizer> tokenizer_;
std::unique_ptr<indexlib::detail::tokenizer> tokenizer_;
};
#endif /* _IFILE_INCLUDE_GUARD_LPC_56465465798732 */

@ -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<result> search( const char* ) = 0;
virtual std::unique_ptr<result> search( const char* ) = 0;
};
struct index {
@ -96,7 +96,7 @@ struct index {
/**
* Returns all documents matching \param pattern.
*/
virtual std::auto_ptr<result> search( const char* pattern ) const = 0;
virtual std::unique_ptr<result> search( const char* pattern ) const = 0;
/**
* Returns the number of docs indexed.

@ -45,7 +45,7 @@ typedef mmap_manager leafdatavector_manager;
#endif
leafdatavector::leafdatavector( std::string name ):
leafs_( std::auto_ptr<memory_manager>( new leafdatavector_manager( path_concat( name, "leafs" ) ) ) ),
leafs_( std::unique_ptr<memory_manager>( new leafdatavector_manager( path_concat( name, "leafs" ) ) ) ),
table_( path_concat( name, "table" ) )
{
}

@ -46,7 +46,7 @@
#include <memory>
#include <string.h>
typedef std::auto_ptr<indexlib::index> index_smart;
typedef std::unique_ptr<indexlib::index> 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<tokenizer> tok = get_tokenizer( "latin-1:european" );
if ( !tok.get() ) {
std::unique_ptr<tokenizer> tok = get_tokenizer( "latin-1:european" );
if ( !tok ) {
std::cerr << "Could not get tokenizer\n";
return 1;
}

@ -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<memory_manager> source );
explicit mempool( std::unique_ptr<memory_manager> &&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<memory_manager> manager_;
std::unique_ptr<memory_manager> manager_;
memory_reference<uint32_t> max_order_;
};

@ -33,8 +33,8 @@
*/
template <typename Traits>
mempool<Traits>::mempool( std::auto_ptr<memory_manager> source ):
manager_( source ),
mempool<Traits>::mempool( std::unique_ptr<memory_manager> &&source ):
manager_( std::move(source) ),
max_order_( 0 )
{
if ( !manager_->size() ) init_memory();

@ -68,12 +68,12 @@ void quotes::remove_doc( const char* doc ) {
impl_.remove_doc( doc );
}
std::auto_ptr<indexlib::result> quotes::search( const char* cstr ) const {
std::unique_ptr<indexlib::result> 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<indexlib::result> prev = impl_.search( str.c_str() );
std::unique_ptr<indexlib::result> prev = impl_.search( str.c_str() );
if ( str.find( ' ' ) != std::string::npos ) {
indexlib::Match m( str );
std::vector<unsigned> candidates = prev->list();
@ -86,7 +86,7 @@ std::auto_ptr<indexlib::result> quotes::search( const char* cstr ) const {
res.push_back( *first );
}
}
return std::auto_ptr<indexlib::result>( new indexlib::detail::simple_result( res ) );
return std::unique_ptr<indexlib::result>( new indexlib::detail::simple_result( res ) );
} else { return prev; }
}

@ -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<indexlib::result> search( const char* ) const;
virtual std::unique_ptr<indexlib::result> search( const char* ) const;
virtual unsigned ndocs() const { return impl_.ndocs(); }
virtual std::string lookup_docname( unsigned d ) const { return impl_.lookup_docname( d ); }

@ -42,7 +42,7 @@ struct simple_result : indexlib::result {
simple_result( std::vector<unsigned> r ):res( r ) { }
std::vector<unsigned> list() const { return res; }
std::auto_ptr<result> search( const char* ) { return std::auto_ptr<result>( 0 ); }
std::unique_ptr<result> search( const char* ) { return std::unique_ptr<result>(); }
private:
std::vector<unsigned> res;
};
@ -50,7 +50,7 @@ struct simple_result : indexlib::result {
struct empty_result : indexlib::result {
public:
std::vector<unsigned> list() const { return std::vector<unsigned>(); }
std::auto_ptr<result> search( const char* ) { return std::auto_ptr<result>(); }
std::unique_ptr<result> search( const char* ) { return std::unique_ptr<result>(); }
};
} //namespace detail
} //namespace indexlib

@ -14,8 +14,8 @@ void cleanup() {
void simple() {
cleanup();
std::auto_ptr<indexlib::index> ptr = indexlib::create( fname );
BOOST_CHECK( ptr.get() );
std::unique_ptr<indexlib::index> ptr = indexlib::create( fname );
BOOST_CHECK( ptr );
}
test_suite* get_suite() {

@ -11,7 +11,7 @@ void cleanup() {
void deallocate() {
cleanup();
mempool<leaf_data_pool_traits> pool( std::auto_ptr<memory_manager>( new mmap_manager( fname ) ) );
mempool<leaf_data_pool_traits> pool( std::unique_ptr<memory_manager>( new mmap_manager( fname ) ) );
std::vector<leafdataptr> pointers;
for ( int i = 0; i != 32; ++i ) {
@ -33,7 +33,7 @@ void deallocate() {
void large() {
cleanup();
mempool<leaf_data_pool_traits> pool( std::auto_ptr<memory_manager>( new mmap_manager( fname ) ) );
mempool<leaf_data_pool_traits> pool( std::unique_ptr<memory_manager>( new mmap_manager( fname ) ) );
pool.allocate( 4095 );
pool.allocate( 4097 );

@ -9,8 +9,8 @@ using indexlib::detail::tokenizer;
using indexlib::detail::get_tokenizer;
void simple() {
std::auto_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
assert(tokenizer.get());
std::unique_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
assert(tokenizer);
std::vector<std::string> tokens = tokenizer->string_to_words( "one ,as, ''#`:ThReE, ááàçé" );
std::vector<std::string> expected;
expected.push_back( "ONE" );
@ -26,8 +26,8 @@ void simple() {
}
void with_newlines() {
std::auto_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
assert(tokenizer.get());
std::unique_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
assert(tokenizer);
std::vector<std::string> tokens = tokenizer->string_to_words( "one\ntwo\nthree" );
std::vector<std::string> expected;
expected.push_back( "ONE" );
@ -42,8 +42,8 @@ void with_newlines() {
}
void with_numbers() {
std::auto_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
assert(tokenizer.get());
std::unique_ptr<tokenizer> tokenizer = get_tokenizer( "latin-1:european" );
assert(tokenizer);
std::vector<std::string> tokens = tokenizer->string_to_words( "one 012 123 four" );
std::vector<std::string> expected;
expected.push_back( "ONE" );

@ -294,7 +294,7 @@ class latin1_tokenizer : public indexlib::detail::tokenizer {
}
std::auto_ptr<indexlib::detail::tokenizer> indexlib::detail::get_tokenizer( std::string name ) {
if ( name == "latin-1:european" ) return std::auto_ptr<indexlib::detail::tokenizer>( new latin1_tokenizer );
return std::auto_ptr<indexlib::detail::tokenizer>( 0 );
std::unique_ptr<indexlib::detail::tokenizer> indexlib::detail::get_tokenizer( std::string name ) {
if ( name == "latin-1:european" ) return std::unique_ptr<indexlib::detail::tokenizer>( new latin1_tokenizer );
return std::unique_ptr<indexlib::detail::tokenizer>();
}

@ -20,7 +20,7 @@ class tokenizer {
virtual std::vector<std::string> do_string_to_words( const char* ) = 0;
};
std::auto_ptr<tokenizer> get_tokenizer( std::string );
std::unique_ptr<tokenizer> get_tokenizer( std::string );
}}

@ -1701,8 +1701,8 @@ std::vector<GpgME::Key> Kleo::KeyResolver::lookup( const TQStringList & patterns
std::vector<GpgME::Key> result;
if ( mCryptoMessageFormats & (InlineOpenPGPFormat|OpenPGPMIMEFormat) )
if ( const Kleo::CryptoBackend::Protocol * p = Kleo::CryptoBackendFactory::instance()->openpgp() ) {
std::auto_ptr<Kleo::KeyListJob> job( p->keyListJob( false, false, true ) ); // use validating keylisting
if ( job.get() ) {
std::unique_ptr<Kleo::KeyListJob> job( p->keyListJob( false, false, true ) ); // use validating keylisting
if ( job ) {
std::vector<GpgME::Key> keys;
job->exec( patterns, secret, keys );
result.insert( result.end(), keys.begin(), keys.end() );
@ -1710,8 +1710,8 @@ std::vector<GpgME::Key> Kleo::KeyResolver::lookup( const TQStringList & patterns
}
if ( mCryptoMessageFormats & (SMIMEFormat|SMIMEOpaqueFormat) )
if ( const Kleo::CryptoBackend::Protocol * p = Kleo::CryptoBackendFactory::instance()->smime() ) {
std::auto_ptr<Kleo::KeyListJob> job( p->keyListJob( false, false, true ) ); // use validating keylisting
if ( job.get() ) {
std::unique_ptr<Kleo::KeyListJob> job( p->keyListJob( false, false, true ) ); // use validating keylisting
if ( job ) {
std::vector<GpgME::Key> keys;
job->exec( patterns, secret, keys );
result.insert( result.end(), keys.begin(), keys.end() );

@ -3239,8 +3239,8 @@ void KMHandleAttachmentCommand::atmEncryptWithChiasmus()
if ( !chiasmus )
return;
const STD_NAMESPACE_PREFIX auto_ptr<Kleo::SpecialJob> listjob( chiasmus->specialJob( "x-obtain-keys", TQStringVariantMap() ) );
if ( !listjob.get() ) {
const STD_NAMESPACE_PREFIX unique_ptr<Kleo::SpecialJob> 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" ) );

@ -5310,8 +5310,8 @@ void KMComposeWin::slotEncryptChiasmusToggled( bool on ) {
return;
}
STD_NAMESPACE_PREFIX auto_ptr<Kleo::SpecialJob> job( chiasmus->specialJob( "x-obtain-keys", TQStringVariantMap() ) );
if ( !job.get() ) {
STD_NAMESPACE_PREFIX unique_ptr<Kleo::SpecialJob> 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" ) );

@ -552,8 +552,8 @@ bool MessageComposer::encryptWithChiasmus( const Kleo::CryptoBackend::Protocol *
const TQByteArray& body,
TQByteArray& resultData )
{
std::auto_ptr<Kleo::SpecialJob> job( chiasmus->specialJob( "x-encrypt", TQStringVariantMap() ) );
if ( !job.get() ) {
std::unique_ptr<Kleo::SpecialJob> 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<Kleo::SignJob> job( proto->signJob( armor( format ),
std::unique_ptr<Kleo::SignJob> 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<Kleo::EncryptJob> job( proto->encryptJob( armor( format ),
std::unique_ptr<Kleo::EncryptJob> 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<Kleo::SignEncryptJob> job( proto->signEncryptJob( armor( format ),
std::unique_ptr<Kleo::SignEncryptJob> 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 "

@ -1652,7 +1652,7 @@ namespace KMail {
const TQByteArray certData = node->msgPart().bodyDecodedBinary();
const STD_NAMESPACE_PREFIX auto_ptr<Kleo::ImportJob> import( smimeCrypto->importJob() );
const STD_NAMESPACE_PREFIX unique_ptr<Kleo::ImportJob> import( smimeCrypto->importJob() );
const GpgME::ImportResult res = import->exec( certData );
if ( res.error() ) {
htmlWriter()->queue( i18n( "Sorry, certificate could not be imported.<br>"
@ -1853,8 +1853,8 @@ bool ObjectTreeParser::decryptChiasmus( const TQByteArray& data, TQByteArray& bo
if ( !chiasmus )
return false;
const STD_NAMESPACE_PREFIX auto_ptr<Kleo::SpecialJob> listjob( chiasmus->specialJob( "x-obtain-keys", TQStringVariantMap() ) );
if ( !listjob.get() ) {
const STD_NAMESPACE_PREFIX unique_ptr<Kleo::SpecialJob> 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<Kleo::SpecialJob> job( chiasmus->specialJob( "x-decrypt", TQStringVariantMap() ) );
if ( !job.get() ) {
const STD_NAMESPACE_PREFIX unique_ptr<Kleo::SpecialJob> 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;

@ -42,7 +42,7 @@
#include <tqstringlist.h>
#include <tqtextcodec.h>
#include <memory> // std::auto_ptr
#include <memory>
#include <assert.h>
#include <ctype.h> // isdigit
@ -618,8 +618,8 @@ namespace KSieve {
const TQTextCodec * const codec = TQTextCodec::codecForMib( 106 ); // UTF-8
assert( codec );
const std::auto_ptr<TQTextDecoder> dec( codec->makeDecoder() );
assert( dec.get() );
const std::unique_ptr<TQTextDecoder> dec( codec->makeDecoder() );
assert( dec );
while ( !atEnd() )
switch ( *mState.cursor ) {

Loading…
Cancel
Save