summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2024-01-23 10:13:00 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2024-01-23 10:13:00 +0900
commitd2f343cc239e1fa25c9581cf35bada96692c41db (patch)
tree52a60c0c804e42a990ffb27ca69c54d7467ea814
parent3b3f9ec8f31978030c17309fae48335bea5c1587 (diff)
downloadtdepim-d2f343cc239e1fa25c9581cf35bada96692c41db.tar.gz
tdepim-d2f343cc239e1fa25c9581cf35bada96692c41db.zip
Replace auto_ptr
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r--certmanager/lib/backends/chiasmus/chiasmusbackend.cpp2
-rw-r--r--certmanager/lib/cryptplug.cpp4
-rw-r--r--certmanager/lib/tests/test_jobs.cpp4
-rw-r--r--indexlib/boost-compat/config/compiler/gcc.h4
-rw-r--r--indexlib/boost-compat/config/stdlib/roguewave.h1
-rw-r--r--indexlib/boost-compat/scoped_ptr.h9
-rw-r--r--indexlib/boost-compat/shared_ptr.h33
-rw-r--r--indexlib/compressed.cpp2
-rw-r--r--indexlib/create.cpp22
-rw-r--r--indexlib/create.h4
-rw-r--r--indexlib/ifile.cpp10
-rw-r--r--indexlib/ifile.h8
-rw-r--r--indexlib/index.h4
-rw-r--r--indexlib/leafdatavector.cpp2
-rw-r--r--indexlib/main.cpp6
-rw-r--r--indexlib/mempool.h6
-rw-r--r--indexlib/mempool.tcc4
-rw-r--r--indexlib/quotes.cpp6
-rw-r--r--indexlib/quotes.h2
-rw-r--r--indexlib/result.h4
-rw-r--r--indexlib/tests/create-test.cpp4
-rw-r--r--indexlib/tests/mempool-test.cpp4
-rw-r--r--indexlib/tests/tokenizer-test.cpp12
-rw-r--r--indexlib/tokenizer.cpp6
-rw-r--r--indexlib/tokenizer.h2
-rw-r--r--kmail/keyresolver.cpp8
-rw-r--r--kmail/kmcommands.cpp4
-rw-r--r--kmail/kmcomposewin.cpp4
-rw-r--r--kmail/messagecomposer.cpp16
-rw-r--r--kmail/objecttreeparser.cpp10
-rw-r--r--libksieve/parser/lexer.cpp6
31 files changed, 92 insertions, 121 deletions
diff --git a/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp b/certmanager/lib/backends/chiasmus/chiasmusbackend.cpp
index e89070f39..d5083b96e 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<Protocol> tmp( mProtocol );
+ std::unique_ptr<Protocol> 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 20747457a..24ded7959 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( Context::createForProtocol( mProtocol ) );
- if ( !context.get() )
+ std::unique_ptr<Context> 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 ba26bfb58..661e07dae 100644
--- a/certmanager/lib/tests/test_jobs.cpp
+++ b/certmanager/lib/tests/test_jobs.cpp
@@ -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() );
diff --git a/indexlib/boost-compat/config/compiler/gcc.h b/indexlib/boost-compat/config/compiler/gcc.h
index 2c5ad1981..4be7f408e 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 ec3d881b5..452b8421f 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 60078bf1a..41d4f9b8e 100644
--- a/indexlib/boost-compat/scoped_ptr.h
+++ b/indexlib/boost-compat/scoped_ptr.h
@@ -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);
diff --git a/indexlib/boost-compat/shared_ptr.h b/indexlib/boost-compat/shared_ptr.h
index c236e3bd7..a242c8299 100644
--- a/indexlib/boost-compat/shared_ptr.h
+++ b/indexlib/boost-compat/shared_ptr.h
@@ -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>
@@ -215,17 +203,6 @@ public:
#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+
{
this_type().swap(*this);
diff --git a/indexlib/compressed.cpp b/indexlib/compressed.cpp
index a60c3f06e..9c73c304c 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<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 );
}
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 ) {
diff --git a/indexlib/create.h b/indexlib/create.h
index e865728e8..18e9929b3 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<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.
diff --git a/indexlib/ifile.cpp b/indexlib/ifile.cpp
index 5709bb418..8ef5d2c6b 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<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;
}
diff --git a/indexlib/ifile.h b/indexlib/ifile.h
index 4cfcf5853..3fcf772e0 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<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 */
diff --git a/indexlib/index.h b/indexlib/index.h
index b7c683755..5ffab2d4e 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<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.
diff --git a/indexlib/leafdatavector.cpp b/indexlib/leafdatavector.cpp
index 0dae65555..89b95ab96 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<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" ) )
{
}
diff --git a/indexlib/main.cpp b/indexlib/main.cpp
index b86851537..dcedbe1ce 100644
--- a/indexlib/main.cpp
+++ b/indexlib/main.cpp
@@ -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;
}
diff --git a/indexlib/mempool.h b/indexlib/mempool.h
index acf624948..08be88578 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<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_;
};
diff --git a/indexlib/mempool.tcc b/indexlib/mempool.tcc
index a130bffee..750209a22 100644
--- a/indexlib/mempool.tcc
+++ b/indexlib/mempool.tcc
@@ -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();
diff --git a/indexlib/quotes.cpp b/indexlib/quotes.cpp
index e4c35db43..abf8915cd 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<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; }
}
diff --git a/indexlib/quotes.h b/indexlib/quotes.h
index 7852d0ddf..6604e9a98 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<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 ); }
diff --git a/indexlib/result.h b/indexlib/result.h
index 4cad40d74..dd23f25d2 100644
--- a/indexlib/result.h
+++ b/indexlib/result.h
@@ -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
diff --git a/indexlib/tests/create-test.cpp b/indexlib/tests/create-test.cpp
index beeb7d5f9..da3c91ca5 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<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() {
diff --git a/indexlib/tests/mempool-test.cpp b/indexlib/tests/mempool-test.cpp
index a0895243c..1c9a4eb61 100644
--- a/indexlib/tests/mempool-test.cpp
+++ b/indexlib/tests/mempool-test.cpp
@@ -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 );
diff --git a/indexlib/tests/tokenizer-test.cpp b/indexlib/tests/tokenizer-test.cpp
index 372859d90..1354ddcd6 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> 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" );
diff --git a/indexlib/tokenizer.cpp b/indexlib/tokenizer.cpp
index b069c7482..1c1243a7f 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::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>();
}
diff --git a/indexlib/tokenizer.h b/indexlib/tokenizer.h
index 2494f2973..9916df66a 100644
--- a/indexlib/tokenizer.h
+++ b/indexlib/tokenizer.h
@@ -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 );
}}
diff --git a/kmail/keyresolver.cpp b/kmail/keyresolver.cpp
index fcd2f2792..68187d2a2 100644
--- a/kmail/keyresolver.cpp
+++ b/kmail/keyresolver.cpp
@@ -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() );
diff --git a/kmail/kmcommands.cpp b/kmail/kmcommands.cpp
index 26e62f7ed..833144a86 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<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" ) );
diff --git a/kmail/kmcomposewin.cpp b/kmail/kmcomposewin.cpp
index 794aa67c8..f83ac714f 100644
--- a/kmail/kmcomposewin.cpp
+++ b/kmail/kmcomposewin.cpp
@@ -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" ) );
diff --git a/kmail/messagecomposer.cpp b/kmail/messagecomposer.cpp
index c98289e0c..1cc0cd33f 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<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 "
diff --git a/kmail/objecttreeparser.cpp b/kmail/objecttreeparser.cpp
index 39b7ac001..3d0593cc3 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<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;
diff --git a/libksieve/parser/lexer.cpp b/libksieve/parser/lexer.cpp
index 4b0ebf4f1..0213f7d7f 100644
--- a/libksieve/parser/lexer.cpp
+++ b/libksieve/parser/lexer.cpp
@@ -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 ) {