[git] GPGME - branch, master, updated. gpgme-1.6.0-106-g9b36ebf

by Andre Heinecke cvs at cvs.gnupg.org
Tue May 17 17:55:07 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  9b36ebf37a3b889c955ba68038bd5b3d9c5cde4e (commit)
      from  9f14a24076e7f93f7762d5d5383281eb593bfea9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9b36ebf37a3b889c955ba68038bd5b3d9c5cde4e
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue May 17 17:49:56 2016 +0200

    Qt / Cpp: Port auto_ptr to unique_ptr
    
    * lang/cpp/src/context.cpp,
    lang/cpp/src/context.h,
    lang/cpp/src/context_p.h (Context::createForEngine),
    (Context::edit, Context::startEditing),
    (Context::takeLastEditInteractor, Context::cardEdit),
    (Context::startCardEditing, Context::takeLastCardEditInteractor),
    (Context::assuanTransact, Context::startAssuanTransaction),
    (Context::takeLastAssuanTransaction): Port to unique_ptr.
    * lang/qt/src/qgpgmeadduseridjob.cpp,
    lang/qt/src/qgpgmechangeexpiryjob.cpp,
    lang/qt/src/qgpgmechangeownertrustjob.cpp,
    lang/qt/src/qgpgmechangepasswdjob.cpp,
    lang/qt/src/qgpgmesignkeyjob.cpp: Update accordingly.
    
    --
    This is another API break but as we already broke API with GpgME++
    and QGpgME from KDE Frameworks this is a good time to do this
    to avoid using a deprected C++ class in the API.

diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 93244b4..085b835 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -224,14 +224,14 @@ Context *Context::createForProtocol(Protocol proto)
     return new Context(ctx);
 }
 
-std::auto_ptr<Context> Context::createForEngine(Engine eng, Error *error)
+std::unique_ptr<Context> Context::createForEngine(Engine eng, Error *error)
 {
     gpgme_ctx_t ctx = 0;
     if (const gpgme_error_t err = gpgme_new(&ctx)) {
         if (error) {
             *error = Error(err);
         }
-        return std::auto_ptr<Context>();
+        return std::unique_ptr<Context>();
     }
 
     switch (eng) {
@@ -241,7 +241,7 @@ std::auto_ptr<Context> Context::createForEngine(Engine eng, Error *error)
             if (error) {
                 *error = Error(err);
             }
-            return std::auto_ptr<Context>();
+            return std::unique_ptr<Context>();
         }
         break;
     case G13Engine:
@@ -250,21 +250,21 @@ std::auto_ptr<Context> Context::createForEngine(Engine eng, Error *error)
             if (error) {
                 *error = Error(err);
             }
-            return std::auto_ptr<Context>();
+            return std::unique_ptr<Context>();
         }
         break;
     default:
         if (error) {
             *error = Error::fromCode(GPG_ERR_INV_ARG);
         }
-        return std::auto_ptr<Context>();
+        return std::unique_ptr<Context>();
     }
 
     if (error) {
         *error = Error();
     }
 
-    return std::auto_ptr<Context>(new Context(ctx));
+    return std::unique_ptr<Context>(new Context(ctx));
 }
 
 //
@@ -685,10 +685,10 @@ Error Context::startPasswd(const Key &key)
     return Error(d->lasterr = gpgme_op_passwd_start(d->ctx, key.impl(), 0U));
 }
 
-Error Context::edit(const Key &key, std::auto_ptr<EditInteractor> func, Data &data)
+Error Context::edit(const Key &key, std::unique_ptr<EditInteractor> func, Data &data)
 {
     d->lastop = Private::Edit;
-    d->lastEditInteractor = func;
+    d->lastEditInteractor = std::move(func);
     Data::Private *const dp = data.impl();
     return Error(d->lasterr = gpgme_op_edit(d->ctx, key.impl(),
                                             d->lastEditInteractor.get() ? edit_interactor_callback : 0,
@@ -696,10 +696,10 @@ Error Context::edit(const Key &key, std::auto_ptr<EditInteractor> func, Data &da
                                             dp ? dp->data : 0));
 }
 
-Error Context::startEditing(const Key &key, std::auto_ptr<EditInteractor> func, Data &data)
+Error Context::startEditing(const Key &key, std::unique_ptr<EditInteractor> func, Data &data)
 {
     d->lastop = Private::Edit;
-    d->lastEditInteractor = func;
+    d->lastEditInteractor = std::move(func);
     Data::Private *const dp = data.impl();
     return Error(d->lasterr = gpgme_op_edit_start(d->ctx, key.impl(),
                               d->lastEditInteractor.get() ? edit_interactor_callback : 0,
@@ -712,15 +712,15 @@ EditInteractor *Context::lastEditInteractor() const
     return d->lastEditInteractor.get();
 }
 
-std::auto_ptr<EditInteractor> Context::takeLastEditInteractor()
+std::unique_ptr<EditInteractor> Context::takeLastEditInteractor()
 {
-    return d->lastEditInteractor;
+    return std::move(d->lastEditInteractor);
 }
 
-Error Context::cardEdit(const Key &key, std::auto_ptr<EditInteractor> func, Data &data)
+Error Context::cardEdit(const Key &key, std::unique_ptr<EditInteractor> func, Data &data)
 {
     d->lastop = Private::CardEdit;
-    d->lastCardEditInteractor = func;
+    d->lastCardEditInteractor = std::move(func);
     Data::Private *const dp = data.impl();
     return Error(d->lasterr = gpgme_op_card_edit(d->ctx, key.impl(),
                               d->lastCardEditInteractor.get() ? edit_interactor_callback : 0,
@@ -728,10 +728,10 @@ Error Context::cardEdit(const Key &key, std::auto_ptr<EditInteractor> func, Data
                               dp ? dp->data : 0));
 }
 
-Error Context::startCardEditing(const Key &key, std::auto_ptr<EditInteractor> func, Data &data)
+Error Context::startCardEditing(const Key &key, std::unique_ptr<EditInteractor> func, Data &data)
 {
     d->lastop = Private::CardEdit;
-    d->lastCardEditInteractor = func;
+    d->lastCardEditInteractor = std::move(func);
     Data::Private *const dp = data.impl();
     return Error(d->lasterr = gpgme_op_card_edit_start(d->ctx, key.impl(),
                               d->lastCardEditInteractor.get() ? edit_interactor_callback : 0,
@@ -744,9 +744,9 @@ EditInteractor *Context::lastCardEditInteractor() const
     return d->lastCardEditInteractor.get();
 }
 
-std::auto_ptr<EditInteractor> Context::takeLastCardEditInteractor()
+std::unique_ptr<EditInteractor> Context::takeLastCardEditInteractor()
 {
-    return d->lastCardEditInteractor;
+    return std::move(d->lastCardEditInteractor);
 }
 
 Error Context::startTrustItemListing(const char *pattern, int maxLevel)
@@ -803,13 +803,13 @@ static gpgme_error_t assuan_transaction_status_callback(void *opaque, const char
 
 AssuanResult Context::assuanTransact(const char *command)
 {
-    return assuanTransact(command, std::auto_ptr<AssuanTransaction>(new DefaultAssuanTransaction));
+    return assuanTransact(command, std::unique_ptr<AssuanTransaction>(new DefaultAssuanTransaction));
 }
 
-AssuanResult Context::assuanTransact(const char *command, std::auto_ptr<AssuanTransaction> transaction)
+AssuanResult Context::assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction)
 {
     d->lastop = Private::AssuanTransact;
-    d->lastAssuanTransaction = transaction;
+    d->lastAssuanTransaction = std::move(transaction);
     if (!d->lastAssuanTransaction.get()) {
         return AssuanResult(Error(d->lasterr = make_error(GPG_ERR_INV_ARG)));
     }
@@ -825,13 +825,13 @@ AssuanResult Context::assuanTransact(const char *command, std::auto_ptr<AssuanTr
 
 Error Context::startAssuanTransaction(const char *command)
 {
-    return startAssuanTransaction(command, std::auto_ptr<AssuanTransaction>(new DefaultAssuanTransaction));
+    return startAssuanTransaction(command, std::unique_ptr<AssuanTransaction>(new DefaultAssuanTransaction));
 }
 
-Error Context::startAssuanTransaction(const char *command, std::auto_ptr<AssuanTransaction> transaction)
+Error Context::startAssuanTransaction(const char *command, std::unique_ptr<AssuanTransaction> transaction)
 {
     d->lastop = Private::AssuanTransact;
-    d->lastAssuanTransaction = transaction;
+    d->lastAssuanTransaction = std::move(transaction);
     if (!d->lastAssuanTransaction.get()) {
         return Error(d->lasterr = make_error(GPG_ERR_INV_ARG));
     }
@@ -858,9 +858,9 @@ AssuanTransaction *Context::lastAssuanTransaction() const
     return d->lastAssuanTransaction.get();
 }
 
-std::auto_ptr<AssuanTransaction> Context::takeLastAssuanTransaction()
+std::unique_ptr<AssuanTransaction> Context::takeLastAssuanTransaction()
 {
-    return d->lastAssuanTransaction;
+    return std::move(d->lastAssuanTransaction);
 }
 
 DecryptionResult Context::decrypt(const Data &cipherText, Data &plainText)
diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h
index ee4f847..a8112d6 100644
--- a/lang/cpp/src/context.h
+++ b/lang/cpp/src/context.h
@@ -69,7 +69,7 @@ public:
     //
 
     static Context *createForProtocol(Protocol proto);
-    static std::auto_ptr<Context> createForEngine(Engine engine, Error *err = 0);
+    static std::unique_ptr<Context> createForEngine(Engine engine, Error *err = 0);
     virtual ~Context();
 
     //
@@ -188,21 +188,21 @@ public:
     // Key Editing
     //
 
-    GpgME::Error edit(const Key &key, std::auto_ptr<EditInteractor> function, Data &out);
-    GpgME::Error startEditing(const Key &key, std::auto_ptr<EditInteractor> function, Data &out);
+    GpgME::Error edit(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
+    GpgME::Error startEditing(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
 
     EditInteractor *lastEditInteractor() const;
-    std::auto_ptr<EditInteractor> takeLastEditInteractor();
+    std::unique_ptr<EditInteractor> takeLastEditInteractor();
 
     //
     // SmartCard Editing
     //
 
-    GpgME::Error cardEdit(const Key &key, std::auto_ptr<EditInteractor> function, Data &out);
-    GpgME::Error startCardEditing(const Key &key, std::auto_ptr<EditInteractor> function, Data &out);
+    GpgME::Error cardEdit(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
+    GpgME::Error startCardEditing(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
 
     EditInteractor *lastCardEditInteractor() const;
-    std::auto_ptr<EditInteractor> takeLastCardEditInteractor();
+    std::unique_ptr<EditInteractor> takeLastCardEditInteractor();
 
     //
     // Trust Item Management
@@ -216,14 +216,14 @@ public:
     // Assuan Transactions
     //
 
-    AssuanResult assuanTransact(const char *command, std::auto_ptr<AssuanTransaction> transaction);
+    AssuanResult assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction);
     AssuanResult assuanTransact(const char *command);
-    GpgME::Error startAssuanTransaction(const char *command, std::auto_ptr<AssuanTransaction> transaction);
+    GpgME::Error startAssuanTransaction(const char *command, std::unique_ptr<AssuanTransaction> transaction);
     GpgME::Error startAssuanTransaction(const char *command);
     AssuanResult assuanResult() const;
 
     AssuanTransaction *lastAssuanTransaction() const;
-    std::auto_ptr<AssuanTransaction> takeLastAssuanTransaction();
+    std::unique_ptr<AssuanTransaction> takeLastAssuanTransaction();
 
     //
     //
diff --git a/lang/cpp/src/context_p.h b/lang/cpp/src/context_p.h
index 2991123..be34783 100644
--- a/lang/cpp/src/context_p.h
+++ b/lang/cpp/src/context_p.h
@@ -75,8 +75,8 @@ public:
     Operation lastop;
     gpgme_error_t lasterr;
     Data lastAssuanInquireData;
-    std::auto_ptr<AssuanTransaction> lastAssuanTransaction;
-    std::auto_ptr<EditInteractor> lastEditInteractor, lastCardEditInteractor;
+    std::unique_ptr<AssuanTransaction> lastAssuanTransaction;
+    std::unique_ptr<EditInteractor> lastEditInteractor, lastCardEditInteractor;
 };
 
 } // namespace GpgME
diff --git a/lang/qt/src/qgpgmeadduseridjob.cpp b/lang/qt/src/qgpgmeadduseridjob.cpp
index aa873f4..eb3bfab 100644
--- a/lang/qt/src/qgpgmeadduseridjob.cpp
+++ b/lang/qt/src/qgpgmeadduseridjob.cpp
@@ -57,18 +57,16 @@ QGpgMEAddUserIDJob::~QGpgMEAddUserIDJob() {}
 static QGpgMEAddUserIDJob::result_type add_user_id(Context *ctx, const Key &key, const QString &name, const QString &email, const QString &comment)
 {
 
-    std::auto_ptr<GpgAddUserIDEditInteractor> gau(new GpgAddUserIDEditInteractor);
+    GpgAddUserIDEditInteractor *gau = new GpgAddUserIDEditInteractor;
 
     gau->setNameUtf8(name.toUtf8().constData());
     gau->setEmailUtf8(email.toUtf8().constData());
     gau->setCommentUtf8(comment.toUtf8().constData());
 
-    std::auto_ptr<EditInteractor> ei(gau);
-
     QGpgME::QByteArrayDataProvider dp;
     Data data(&dp);
     assert(!data.isNull());
-    const Error err = ctx->edit(key, ei, data);
+    const Error err = ctx->edit(key, std::unique_ptr<EditInteractor> (gau), data);
     Error ae;
     const QString log = _detail::audit_log_as_html(ctx, ae);
     return std::make_tuple(err, log, ae);
diff --git a/lang/qt/src/qgpgmechangeexpiryjob.cpp b/lang/qt/src/qgpgmechangeexpiryjob.cpp
index e0c6c4d..43ceee3 100644
--- a/lang/qt/src/qgpgmechangeexpiryjob.cpp
+++ b/lang/qt/src/qgpgmechangeexpiryjob.cpp
@@ -59,15 +59,14 @@ QGpgMEChangeExpiryJob::~QGpgMEChangeExpiryJob() {}
 
 static QGpgMEChangeExpiryJob::result_type change_expiry(Context *ctx, const Key &key, const QDateTime &expiry)
 {
-    std::auto_ptr<EditInteractor>
-    ei(expiry.isValid()
+    EditInteractor *ei = expiry.isValid()
        ? new GpgSetExpiryTimeEditInteractor(expiry.date().toString(Qt::ISODate).toStdString())
-       : new GpgSetExpiryTimeEditInteractor());
+       : new GpgSetExpiryTimeEditInteractor();
 
     QGpgME::QByteArrayDataProvider dp;
     Data data(&dp);
     assert(!data.isNull());
-    const Error err = ctx->edit(key, ei, data);
+    const Error err = ctx->edit(key, std::unique_ptr<EditInteractor> (ei), data);
     Error ae;
     const QString log = _detail::audit_log_as_html(ctx, ae);
     return std::make_tuple(err, log, ae);
diff --git a/lang/qt/src/qgpgmechangeownertrustjob.cpp b/lang/qt/src/qgpgmechangeownertrustjob.cpp
index 2f055f1..55131d9 100644
--- a/lang/qt/src/qgpgmechangeownertrustjob.cpp
+++ b/lang/qt/src/qgpgmechangeownertrustjob.cpp
@@ -56,14 +56,13 @@ QGpgMEChangeOwnerTrustJob::~QGpgMEChangeOwnerTrustJob() {}
 
 static QGpgMEChangeOwnerTrustJob::result_type change_ownertrust(Context *ctx, const Key &key, Key::OwnerTrust trust)
 {
-    std::auto_ptr<EditInteractor>
-    ei(new GpgSetOwnerTrustEditInteractor(trust));
+    EditInteractor *ei = new GpgSetOwnerTrustEditInteractor(trust);
 
     QGpgME::QByteArrayDataProvider dp;
     Data data(&dp);
     assert(!data.isNull());
 
-    const Error err = ctx->edit(key, ei, data);
+    const Error err = ctx->edit(key, std::unique_ptr<EditInteractor>(ei), data);
     Error ae;
     const QString log = _detail::audit_log_as_html(ctx, ae);
     return std::make_tuple(err, log, ae);
diff --git a/lang/qt/src/qgpgmechangepasswdjob.cpp b/lang/qt/src/qgpgmechangepasswdjob.cpp
index 675eee6..0aec927 100644
--- a/lang/qt/src/qgpgmechangepasswdjob.cpp
+++ b/lang/qt/src/qgpgmechangepasswdjob.cpp
@@ -56,7 +56,7 @@ QGpgMEChangePasswdJob::~QGpgMEChangePasswdJob() {}
 static QGpgMEChangePasswdJob::result_type change_passwd(Context *ctx, const Key &key)
 {
 #if 0 // in case we want to fall back to edit interactor for gpg...
-    std::auto_ptr<EditInteractor> ei(new GpgChangePasswdEditInteractor);
+    std::unique_ptr<EditInteractor> ei(new GpgChangePasswdEditInteractor);
 
     QGpgME::QByteArrayDataProvider dp;
     Data data(&dp);
diff --git a/lang/qt/src/qgpgmesignkeyjob.cpp b/lang/qt/src/qgpgmesignkeyjob.cpp
index 9a12f61..e6c1478 100644
--- a/lang/qt/src/qgpgmesignkeyjob.cpp
+++ b/lang/qt/src/qgpgmesignkeyjob.cpp
@@ -64,18 +64,16 @@ static QGpgMESignKeyJob::result_type sign_key(Context *ctx, const Key &key, cons
     QGpgME::QByteArrayDataProvider dp;
     Data data(&dp);
 
-    std::auto_ptr<GpgSignKeyEditInteractor> skei(new GpgSignKeyEditInteractor);
+    GpgSignKeyEditInteractor *skei(new GpgSignKeyEditInteractor);
     skei->setUserIDsToSign(uids);
     skei->setCheckLevel(checkLevel);
     skei->setSigningOptions(opts);
 
-    std::auto_ptr<EditInteractor> ei(skei);
-
     if (!signer.isNull())
         if (const Error err = ctx->addSigningKey(signer)) {
             return std::make_tuple(err, QString(), Error());
         }
-    const Error err = ctx->edit(key, ei, data);
+    const Error err = ctx->edit(key, std::unique_ptr<EditInteractor> (skei), data);
     Error ae;
     const QString log = _detail::audit_log_as_html(ctx, ae);
     return std::make_tuple(err, log, ae);

-----------------------------------------------------------------------

Summary of changes:
 lang/cpp/src/context.cpp                  | 52 +++++++++++++++----------------
 lang/cpp/src/context.h                    | 20 ++++++------
 lang/cpp/src/context_p.h                  |  4 +--
 lang/qt/src/qgpgmeadduseridjob.cpp        |  6 ++--
 lang/qt/src/qgpgmechangeexpiryjob.cpp     |  7 ++---
 lang/qt/src/qgpgmechangeownertrustjob.cpp |  5 ++-
 lang/qt/src/qgpgmechangepasswdjob.cpp     |  2 +-
 lang/qt/src/qgpgmesignkeyjob.cpp          |  6 ++--
 8 files changed, 48 insertions(+), 54 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list