summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2017-12-21 08:11:54 -0800
committerPatrick Ohly <patrick.ohly@intel.com>2018-01-03 10:39:51 +0100
commit88619eb58cc9d4470d743e0c732e945da28a7eb2 (patch)
tree037dece46689cf0a4f5fbce889cdcfd018f8f9aa /src
parent52a34570373fc3d03e69456c2d4f460265bf9a22 (diff)
C++: replace auto_ptr with unique_ptr
auto_ptr has been deprecated for a while now. unique_ptr can be taken for granted now, so use that instead. GDBusMessage requires a custom deleter. Not sure how auto_ptr handled that before. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/backends/activesync/ActiveSyncSourceRegister.cpp2
-rw-r--r--src/backends/akonadi/akonadisyncsource.cpp24
-rw-r--r--src/backends/pbap/PbapSyncSource.cpp12
-rw-r--r--src/client-test-app.cpp2
-rw-r--r--src/dbus/server/pim/locale-factory-boost.cpp2
-rw-r--r--src/dbus/server/read-operations.cpp4
-rw-r--r--src/gdbus/gdbus-cxx-bridge.h2
-rw-r--r--src/gdbus/test/example.cpp4
-rw-r--r--src/gdbusxx/gdbus-cxx-bridge.cpp2
-rw-r--r--src/gdbusxx/gdbus-cxx-bridge.h53
-rw-r--r--src/syncevo/Cmdline.cpp6
-rw-r--r--src/syncevo/GLibSupport.h20
-rw-r--r--src/syncevo/LocalTransportAgent.cpp2
-rw-r--r--src/syncevo/SyncContext.cpp2
-rw-r--r--src/syncevo/SyncSource.cpp6
15 files changed, 75 insertions, 68 deletions
diff --git a/src/backends/activesync/ActiveSyncSourceRegister.cpp b/src/backends/activesync/ActiveSyncSourceRegister.cpp
index aab77ccc..2526e5cb 100644
--- a/src/backends/activesync/ActiveSyncSourceRegister.cpp
+++ b/src/backends/activesync/ActiveSyncSourceRegister.cpp
@@ -188,7 +188,7 @@ static TestingSyncSource *createEASSource(const ClientTestConfig::createsource_t
const std::string &clientID,
int source, bool isSourceA)
{
- std::auto_ptr<TestingSyncSource> res(create(client, clientID, source, isSourceA));
+ std::unique_ptr<TestingSyncSource> res(create(client, clientID, source, isSourceA));
// Mangle username: if the base username in the config is account
// "foo", then source B uses "foo_B", because otherwise it'll end
diff --git a/src/backends/akonadi/akonadisyncsource.cpp b/src/backends/akonadi/akonadisyncsource.cpp
index ac238769..ba82020f 100644
--- a/src/backends/akonadi/akonadisyncsource.cpp
+++ b/src/backends/akonadi/akonadisyncsource.cpp
@@ -56,7 +56,7 @@ using namespace Akonadi;
*
* To avoid double frees, we need to disable auto-deletion.
* This method does that. Use like this:
- * std::auto_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
+ * std::unique_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
*/
template<class J> J *DisableAutoDelete(J *job) { job->setAutoDelete(false); return job; }
@@ -80,7 +80,7 @@ bool AkonadiSyncSource::isEmpty()
}
//To Check if the respective collection is Empty, without actually loading the collections
- std::auto_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
+ std::unique_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
if (!statisticsJob->exec()) {
throwError(SE_HERE, "Error fetching the collection stats");
}
@@ -129,8 +129,8 @@ SyncSource::Databases AkonadiSyncSource::getDatabases()
// as the default one used by the source.
// res.push_back("Contacts", "some-KDE-specific-ID", isDefault);
- std::auto_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(Collection::root(),
- CollectionFetchJob::Recursive)));
+ std::unique_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(Collection::root(),
+ CollectionFetchJob::Recursive)));
fetchJob->fetchScope().setContentMimeTypes(m_mimeTypes);
@@ -193,8 +193,8 @@ void AkonadiSyncSource::open()
// Verify that the collection exists and ensure that
// m_collection.contentMimeTypes() returns valid information. The
// collection constructed so far only contains the collection ID.
- std::auto_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(m_collection,
- CollectionFetchJob::Base)));
+ std::unique_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(m_collection,
+ CollectionFetchJob::Base)));
if (!fetchJob->exec()) {
throwError(SE_HERE, StringPrintf("cannot fetch collection %s", id.c_str()));
}
@@ -228,7 +228,7 @@ void AkonadiSyncSource::listAllItems(SyncSourceRevisions::RevisionMap_t &revisio
}
// copy all local IDs and the corresponding revision
- std::auto_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(m_collection)));
+ std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(m_collection)));
if (!fetchJob->exec()) {
throwError(SE_HERE, "listing items");
}
@@ -260,7 +260,7 @@ TrackingSyncSource::InsertItemResult AkonadiSyncSource::insertItem(const std::st
if (luid.empty()) {
item.setMimeType(m_mimeTypes.front());
item.setPayloadFromData(QByteArray(data.c_str()));
- std::auto_ptr<ItemCreateJob> createJob(DisableAutoDelete(new ItemCreateJob(item, m_collection)));
+ std::unique_ptr<ItemCreateJob> createJob(DisableAutoDelete(new ItemCreateJob(item, m_collection)));
if (!createJob->exec()) {
throwError(SE_HERE, string("storing new item ") + luid);
return InsertItemResult("", "", ITEM_OKAY);
@@ -268,13 +268,13 @@ TrackingSyncSource::InsertItemResult AkonadiSyncSource::insertItem(const std::st
item = createJob->item();
} else {
Entity::Id syncItemId = QByteArray(luid.c_str()).toLongLong();
- std::auto_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
+ std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
if (!fetchJob->exec()) {
throwError(SE_HERE, string("checking item ") + luid);
}
item = fetchJob->items().first();
item.setPayloadFromData(QByteArray(data.c_str()));
- std::auto_ptr<ItemModifyJob> modifyJob(DisableAutoDelete(new ItemModifyJob(item)));
+ std::unique_ptr<ItemModifyJob> modifyJob(DisableAutoDelete(new ItemModifyJob(item)));
// TODO: SyncEvolution must pass the known revision that
// we are updating.
// TODO: check that the item has not been updated in the meantime
@@ -304,7 +304,7 @@ void AkonadiSyncSource::removeItem(const string &luid)
// Delete the item from our collection
// TODO: check that the revision is right (need revision from SyncEvolution)
- std::auto_ptr<ItemDeleteJob> deleteJob(DisableAutoDelete(new ItemDeleteJob(Item(syncItemId))));
+ std::unique_ptr<ItemDeleteJob> deleteJob(DisableAutoDelete(new ItemDeleteJob(Item(syncItemId))));
if (!deleteJob->exec()) {
throwError(SE_HERE, string("deleting item " ) + luid);
}
@@ -319,7 +319,7 @@ void AkonadiSyncSource::readItem(const std::string &luid, std::string &data, boo
Entity::Id syncItemId = QByteArray(luid.c_str()).toLongLong();
- std::auto_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
+ std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
fetchJob->fetchScope().fetchFullPayload();
if (fetchJob->exec()) {
if (fetchJob->items().empty()) {
diff --git a/src/backends/pbap/PbapSyncSource.cpp b/src/backends/pbap/PbapSyncSource.cpp
index dab5bf56..15317d1f 100644
--- a/src/backends/pbap/PbapSyncSource.cpp
+++ b/src/backends/pbap/PbapSyncSource.cpp
@@ -291,7 +291,7 @@ private:
PbapSyncSource &m_parent;
boost::weak_ptr<PbapSession> m_self;
- std::auto_ptr<GDBusCXX::DBusRemoteObject> m_client;
+ std::unique_ptr<GDBusCXX::DBusRemoteObject> m_client;
bool m_frozen;
enum {
OBEXD_OLD, // obexd < 0.47
@@ -333,14 +333,14 @@ private:
Transfers m_transfers;
std::string m_currentTransfer;
- std::auto_ptr<GDBusCXX::SignalWatch3<GDBusCXX::Path_t, std::string, std::string> >
+ std::unique_ptr<GDBusCXX::SignalWatch3<GDBusCXX::Path_t, std::string, std::string> >
m_errorSignal;
void errorCb(const GDBusCXX::Path_t &path, const std::string &error,
const std::string &msg);
// Bluez 5
typedef GDBusCXX::SignalWatch4<GDBusCXX::Path_t, std::string, Params, std::vector<std::string> > PropChangedSignal_t;
- std::auto_ptr<PropChangedSignal_t> m_propChangedSignal;
+ std::unique_ptr<PropChangedSignal_t> m_propChangedSignal;
void propChangedCb(const GDBusCXX::Path_t &path,
const std::string &interface,
const Params &changed,
@@ -348,13 +348,13 @@ private:
// new obexd API
typedef GDBusCXX::SignalWatch1<GDBusCXX::Path_t> CompleteSignal_t;
- std::auto_ptr<CompleteSignal_t> m_completeSignal;
+ std::unique_ptr<CompleteSignal_t> m_completeSignal;
void completeCb(const GDBusCXX::Path_t &path);
typedef GDBusCXX::SignalWatch3<GDBusCXX::Path_t, std::string, boost::variant<int64_t> > PropertyChangedSignal_t;
- std::auto_ptr<PropertyChangedSignal_t> m_propertyChangedSignal;
+ std::unique_ptr<PropertyChangedSignal_t> m_propertyChangedSignal;
void propertyChangedCb(const GDBusCXX::Path_t &path, const std::string &name, const boost::variant<int64_t> &value);
- std::auto_ptr<GDBusCXX::DBusRemoteObject> m_session;
+ std::unique_ptr<GDBusCXX::DBusRemoteObject> m_session;
};
PbapSession::PbapSession(PbapSyncSource &parent) :
diff --git a/src/client-test-app.cpp b/src/client-test-app.cpp
index b64a0734..ceea1f07 100644
--- a/src/client-test-app.cpp
+++ b/src/client-test-app.cpp
@@ -436,7 +436,7 @@ public:
private:
bool m_initialized;
string m_clientID;
- std::auto_ptr<TestEvolution> m_clientB;
+ std::unique_ptr<TestEvolution> m_clientB;
const TestRegistry &m_configs;
/** prefix, username, password to be used for local databases */
diff --git a/src/dbus/server/pim/locale-factory-boost.cpp b/src/dbus/server/pim/locale-factory-boost.cpp
index a04dd9ed..2a3e6905 100644
--- a/src/dbus/server/pim/locale-factory-boost.cpp
+++ b/src/dbus/server/pim/locale-factory-boost.cpp
@@ -65,7 +65,7 @@ static const boost::locale::collator_base::level_type DEFAULT_COLLATION_LEVEL =
class CompareBoost : public IndividualCompare, private boost::noncopyable {
std::locale m_locale;
const boost::locale::collator<char> &m_collator;
- std::auto_ptr<icu::Transliterator> m_trans;
+ std::unique_ptr<icu::Transliterator> m_trans;
public:
CompareBoost(const std::locale &locale);
diff --git a/src/dbus/server/read-operations.cpp b/src/dbus/server/read-operations.cpp
index 6bd57d97..65133908 100644
--- a/src/dbus/server/read-operations.cpp
+++ b/src/dbus/server/read-operations.cpp
@@ -295,7 +295,7 @@ void ReadOperations::checkSource(const std::string &sourceName)
try {
// this can already throw exceptions when the config is invalid
SyncSourceParams params(sourceName, config->getSyncSourceNodes(sourceName), config);
- auto_ptr<SyncSource> syncSource(SyncSource::createSource(params, false, config.get()));
+ unique_ptr<SyncSource> syncSource(SyncSource::createSource(params, false, config.get()));
if (syncSource.get()) {
syncSource->open();
@@ -318,7 +318,7 @@ void ReadOperations::getDatabases(const string &sourceName, SourceDatabases_t &d
SyncSourceParams params(sourceName, config->getSyncSourceNodes(sourceName), config);
const SourceRegistry &registry(SyncSource::getSourceRegistry());
BOOST_FOREACH(const RegisterSyncSource *sourceInfo, registry) {
- auto_ptr<SyncSource> source(sourceInfo->m_create(params));
+ unique_ptr<SyncSource> source(sourceInfo->m_create(params));
if (!source.get()) {
continue;
} else if (source->isInactive()) {
diff --git a/src/gdbus/gdbus-cxx-bridge.h b/src/gdbus/gdbus-cxx-bridge.h
index c3a0c910..82fbdf9f 100644
--- a/src/gdbus/gdbus-cxx-bridge.h
+++ b/src/gdbus/gdbus-cxx-bridge.h
@@ -1977,7 +1977,7 @@ class DBusResult : virtual public Result
virtual Watch *createWatch(const boost::function<void (void)> &callback)
{
- std::auto_ptr<Watch> watch(new Watch(m_conn, callback));
+ std::unique_ptr<Watch> watch(new Watch(m_conn, callback));
watch->activate(dbus_message_get_sender(m_msg.get()));
return watch.release();
}
diff --git a/src/gdbus/test/example.cpp b/src/gdbus/test/example.cpp
index 32e09f15..be155759 100644
--- a/src/gdbus/test/example.cpp
+++ b/src/gdbus/test/example.cpp
@@ -65,7 +65,7 @@ class Test {
static gboolean method_idle(gpointer data)
{
- std::auto_ptr<async> mydata(static_cast<async *>(data));
+ std::unique_ptr<async> mydata(static_cast<async *>(data));
std::cout << "replying to method_async" << std::endl;
mydata->m_result->done("Hello World, asynchronous and delayed");
return false;
@@ -269,7 +269,7 @@ int main(int argc, char *argv[])
exit(1);
}
- std::auto_ptr<DBusTest> test(new DBusTest(conn));
+ std::unique_ptr<DBusTest> test(new DBusTest(conn));
test->activate();
test->signal(42, "hello world", std::map<int32_t, int32_t>());
test->deactivate();
diff --git a/src/gdbusxx/gdbus-cxx-bridge.cpp b/src/gdbusxx/gdbus-cxx-bridge.cpp
index 238b52f0..a170b264 100644
--- a/src/gdbusxx/gdbus-cxx-bridge.cpp
+++ b/src/gdbusxx/gdbus-cxx-bridge.cpp
@@ -484,7 +484,7 @@ Watch::~Watch()
void getWatch(ExtractArgs &context,
boost::shared_ptr<Watch> &value)
{
- std::auto_ptr<Watch> watch(new Watch(context.m_conn));
+ std::unique_ptr<Watch> watch(new Watch(context.m_conn));
watch->activate((context.m_msg && *context.m_msg) ?
g_dbus_message_get_sender(*context.m_msg) :
context.m_sender);
diff --git a/src/gdbusxx/gdbus-cxx-bridge.h b/src/gdbusxx/gdbus-cxx-bridge.h
index 9eeefc9f..0656f77d 100644
--- a/src/gdbusxx/gdbus-cxx-bridge.h
+++ b/src/gdbusxx/gdbus-cxx-bridge.h
@@ -60,6 +60,7 @@
#include <stdint.h>
#include <gio/gio.h>
+#include <glib-object.h>
#include <map>
#include <list>
@@ -111,8 +112,14 @@ typedef GDBusMessage message_type;
typedef GVariantBuilder builder_type;
typedef GVariantIter reader_type;
+struct GDBusMessageUnref
+{
+ void operator () (GDBusMessage *ptr) const { g_object_unref(ptr); }
+};
+typedef std::unique_ptr<GDBusMessage, GDBusMessageUnref> GDBusMessageUnique;
+
/**
- * Simple auto_ptr for GVariant.
+ * Simple unique_ptr for GVariant.
*/
class GVariantCXX : boost::noncopyable
{
@@ -443,7 +450,7 @@ struct AppendArgs {
GDBusMessage *m_msg;
GVariantBuilder m_builder;
- AppendArgs(const std::auto_ptr<GDBusMessage> &msg) {
+ AppendArgs(const GDBusMessageUnique &msg) {
m_msg = msg.get();
if (!m_msg) {
throw std::runtime_error("NULL GDBusMessage reply");
@@ -2725,7 +2732,7 @@ class DBusResult : virtual public Result
virtual Watch *createWatch(const boost::function<void (void)> &callback)
{
- std::auto_ptr<Watch> watch(new Watch(m_conn, callback));
+ std::unique_ptr<Watch> watch(new Watch(m_conn, callback));
watch->activate(g_dbus_message_get_sender(m_msg.get()));
return watch.release();
}
@@ -3182,7 +3189,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5, A6, A7, A8, A9
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -3275,7 +3282,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4, A5, A6, A7, A8, A9)>
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -3366,7 +3373,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5, A6, A7, A8, A9
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -3455,7 +3462,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4, A5, A6, A7, A8)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -3543,7 +3550,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5, A6, A7, A8)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -3629,7 +3636,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4, A5, A6, A7)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -3713,7 +3720,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5, A6, A7)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -3796,7 +3803,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4, A5, A6)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -3878,7 +3885,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5, A6)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -3957,7 +3964,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4, A5)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -4034,7 +4041,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4, A5)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -4110,7 +4117,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3, A4)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -4182,7 +4189,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3, A4)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -4253,7 +4260,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2, A3)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -4322,7 +4329,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2, A3)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
typename dbus_traits<A3>::host_type a3;
@@ -4390,7 +4397,7 @@ struct MakeMethodEntry< boost::function<R (A1, A2)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -4456,7 +4463,7 @@ struct MakeMethodEntry< boost::function<void (A1, A2)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
typename dbus_traits<A2>::host_type a2;
@@ -4521,7 +4528,7 @@ struct MakeMethodEntry< boost::function<R (A1)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
typename dbus_traits<A1>::host_type a1;
@@ -4584,7 +4591,7 @@ struct MakeMethodEntry< boost::function<void (A1)> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<A1>::host_type a1;
try {
@@ -4643,7 +4650,7 @@ struct MakeMethodEntry< boost::function<R ()> >
GDBusMessage *msg, void *data)
{
try {
- std::auto_ptr<GDBusMessage> reply;
+ GDBusMessageUnique reply;
typename dbus_traits<R>::host_type r;
try {
diff --git a/src/syncevo/Cmdline.cpp b/src/syncevo/Cmdline.cpp
index c416cc22..f7b6d25e 100644
--- a/src/syncevo/Cmdline.cpp
+++ b/src/syncevo/Cmdline.cpp
@@ -810,7 +810,7 @@ bool Cmdline::run() {
if (!m_server.empty() || backend != sourceFilter.end()) {
// list for specific backend
params.m_name = sourceName;
- auto_ptr<SyncSource> source(SyncSource::createSource(params, false, NULL));
+ unique_ptr<SyncSource> source(SyncSource::createSource(params, false, NULL));
if (source.get() != NULL) {
if (!m_server.empty() && nodes) {
// ensure that we have passwords for this config
@@ -836,7 +836,7 @@ bool Cmdline::run() {
// don't have a source name, so let's fall
// back to the backend instead.
params.m_name = type.m_backend;
- auto_ptr<SyncSource> source(SyncSource::createSource(params, false));
+ unique_ptr<SyncSource> source(SyncSource::createSource(params, false));
(this->*operation)(source.get(), header);
} catch (...) {
SE_LOG_ERROR(NULL, "%s:\naccessing databases failed", header.c_str());
@@ -1250,7 +1250,7 @@ bool Cmdline::run() {
PasswordConfigProperty::CHECK_PASSWORD_RESOLVE_USERNAME,
boost::assign::list_of(source));
SyncSourceParams params(source, to->getSyncSourceNodes(source), to);
- auto_ptr<SyncSource> syncSource(SyncSource::createSource(params, false, to.get()));
+ unique_ptr<SyncSource> syncSource(SyncSource::createSource(params, false, to.get()));
if (syncSource.get() == NULL) {
disable = "no backend available";
} else {
diff --git a/src/syncevo/GLibSupport.h b/src/syncevo/GLibSupport.h
index 2c43678f..694d379b 100644
--- a/src/syncevo/GLibSupport.h
+++ b/src/syncevo/GLibSupport.h
@@ -731,7 +731,7 @@ template<class T, class F, F *finish, class A1, class A3, class A4, class A5> st
A5_t retval3 = boost::value_initialized<A5_t>();
T t = finish(reinterpret_cast<A1>(sourceObject),
result, &retval1, &retval2, &retval3);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, retval1, retval2, retval3);
} catch (...) {
// called from C, must not let exception escape
@@ -756,7 +756,7 @@ template<class T, class F, F *finish, class A1, class A3, class A4> struct GAsyn
A4_t retval2 = boost::value_initialized<A4_t>();
T t = finish(reinterpret_cast<A1>(sourceObject),
result, &retval1, &retval2, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, retval1, retval2, gerror);
} catch (...) {
// called from C, must not let exception escape
@@ -780,7 +780,7 @@ template<class T, class F, F *finish, class A1, class A3, class A4> struct GAsyn
A4_t retval2 = boost::value_initialized<A4_t>();
T t = finish(reinterpret_cast<A1>(sourceObject),
result, &retval1, &retval2);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, retval1, retval2);
} catch (...) {
// called from C, must not let exception escape
@@ -803,7 +803,7 @@ template<class T, class F, F *finish, class A1, class A3> struct GAsyncReady4<T,
A3_t retval = boost::value_initialized<A3_t>();
T t = finish(reinterpret_cast<A1>(sourceObject),
result, &retval, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, retval, gerror);
} catch (...) {
// called from C, must not let exception escape
@@ -823,7 +823,7 @@ template <class T, class F, F *finish, class A1> struct GAsyncReady3<T, F, finis
GErrorCXX gerror;
T t = finish(reinterpret_cast<A1>(sourceObject),
result, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, gerror);
} catch (...) {
// called from C, must not let exception escape
@@ -844,7 +844,7 @@ template<class F, F *finish, class A1> struct GAsyncReady3<void, F, finish, A1,
GErrorCXX gerror;
finish(reinterpret_cast<A1>(sourceObject),
result, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(gerror);
} catch (...) {
// called from C, must not let exception escape
@@ -864,7 +864,7 @@ template<class T, class F, F *finish, class A1> struct GAsyncReady2<T, F, finish
try {
T t = finish(reinterpret_cast<A1>(sourceObject),
result);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t);
} catch (...) {
// called from C, must not let exception escape
@@ -884,7 +884,7 @@ template<class T, class F, F *finish> struct GAsyncReady2<T, F, finish, GAsyncRe
try {
GErrorCXX gerror;
T t = finish(result, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(t, gerror);
} catch (...) {
// called from C, must not let exception escape
@@ -904,7 +904,7 @@ template<class F, F *finish, class A1> struct GAsyncReady2<void, F, finish, A1,
try {
finish(reinterpret_cast<A1>(sourceObject),
result);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)();
} catch (...) {
// called from C, must not let exception escape
@@ -924,7 +924,7 @@ template<class F, F *finish> struct GAsyncReady2<void, F, finish, GAsyncResult *
try {
GErrorCXX gerror;
finish(result, gerror);
- std::auto_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
+ std::unique_ptr<CXXFunctionCB_t> cb(static_cast<CXXFunctionCB_t *>(userData));
(*cb)(gerror);
} catch (...) {
// called from C, must not let exception escape
diff --git a/src/syncevo/LocalTransportAgent.cpp b/src/syncevo/LocalTransportAgent.cpp
index 1922e8f1..6c26254a 100644
--- a/src/syncevo/LocalTransportAgent.cpp
+++ b/src/syncevo/LocalTransportAgent.cpp
@@ -699,7 +699,7 @@ public:
class ChildLogger : public Logger
{
- std::auto_ptr<LogRedirect> m_parentLogger;
+ std::unique_ptr<LogRedirect> m_parentLogger;
boost::weak_ptr<LocalTransportChildImpl> m_child;
public:
diff --git a/src/syncevo/SyncContext.cpp b/src/syncevo/SyncContext.cpp
index 8f3232bb..c522d9f4 100644
--- a/src/syncevo/SyncContext.cpp
+++ b/src/syncevo/SyncContext.cpp
@@ -3970,7 +3970,7 @@ SyncMLStatus SyncContext::doSync()
sysync::STEPCMD_CLIENTSTART;
SharedSession session = m_engine.OpenSession(m_sessionID);
SharedBuffer sendBuffer;
- std::auto_ptr<SessionSentinel> sessionSentinel(new SessionSentinel(*this, session));
+ std::unique_ptr<SessionSentinel> sessionSentinel(new SessionSentinel(*this, session));
if (m_serverMode && !m_localSync) {
m_engine.WriteSyncMLBuffer(session,
diff --git a/src/syncevo/SyncSource.cpp b/src/syncevo/SyncSource.cpp
index 4373ab2c..75b2fbdd 100644
--- a/src/syncevo/SyncSource.cpp
+++ b/src/syncevo/SyncSource.cpp
@@ -465,15 +465,15 @@ SyncSource *SyncSource::createSource(const SyncSourceParams &params, bool error,
}
const SourceRegistry &registry(getSourceRegistry());
- auto_ptr<SyncSource> source;
+ unique_ptr<SyncSource> source;
BOOST_FOREACH(const RegisterSyncSource *sourceInfos, registry) {
- auto_ptr<SyncSource> nextSource(sourceInfos->m_create(params));
+ unique_ptr<SyncSource> nextSource(sourceInfos->m_create(params));
if (nextSource.get()) {
if (source.get()) {
Exception::throwError(SE_HERE, params.getDisplayName() + ": backend " + sourceType.m_backend +
" is ambiguous, avoid the alias and pick a specific backend instead directly");
}
- source = nextSource;
+ source = std::move(nextSource);
}
}
if (source.get()) {