[git] GPGME - branch, master, updated. gpgme-1.6.0-303-ge20b0f0

by Werner Koch cvs at cvs.gnupg.org
Wed Aug 24 14:17:35 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  e20b0f0201543834f15c5d50cd3b2ece69a35d70 (commit)
      from  d2e40fb7adf667f3e2d2457ee4c646ea4d4d88b3 (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 e20b0f0201543834f15c5d50cd3b2ece69a35d70
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Aug 23 19:50:01 2016 +0200

    cpp: Get rid of AssuanResult due to its deprecation.
    
    * lang/cpp/src/assuanresult.cpp: Remove.
    * lang/cpp/src/assuanresult.h: Remove.
    * lang/cpp/src/Makefile.am: Remove these files.
    * lang/cpp/src/context.cpp: Remove header assuanresult.h
    (assuanTransact): Change return type to Error.  Use
    gpgme_op_assuan_transact_ext.
    (startAssuanTransaction): Change return type to Error.
    (assuanResult): Remove
    * lang/cpp/src/context.h (assuanResult): Adjust for changes.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am
index 188585a..e65a875 100644
--- a/lang/cpp/src/Makefile.am
+++ b/lang/cpp/src/Makefile.am
@@ -25,7 +25,7 @@ lib_LTLIBRARIES = libgpgmepp.la
 
 main_sources = \
     exception.cpp context.cpp key.cpp trustitem.cpp data.cpp callbacks.cpp \
-    eventloopinteractor.cpp editinteractor.cpp assuanresult.cpp \
+    eventloopinteractor.cpp editinteractor.cpp \
     keylistresult.cpp keygenerationresult.cpp importresult.cpp \
     decryptionresult.cpp verificationresult.cpp \
     signingresult.cpp encryptionresult.cpp \
@@ -36,7 +36,7 @@ main_sources = \
     vfsmountresult.cpp configuration.cpp tofuinfo.cpp
 
 gpgmepp_headers = \
-    assuanresult.h configuration.h context.h data.h decryptionresult.h \
+    configuration.h context.h data.h decryptionresult.h \
     defaultassuantransaction.h editinteractor.h encryptionresult.h \
     engineinfo.h error.h eventloopinteractor.h exception.h global.h \
     gpgadduserideditinteractor.h gpgagentgetinfoassuantransaction.h \
diff --git a/lang/cpp/src/assuanresult.cpp b/lang/cpp/src/assuanresult.cpp
deleted file mode 100644
index 3d6d0a3..0000000
--- a/lang/cpp/src/assuanresult.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-  assuanresult.cpp - wraps a gpgme assuan result
-  Copyright (C) 2009 Klarälvdalens Datakonsult AB
-
-  This file is part of GPGME++.
-
-  GPGME++ is free software; you can redistribute it and/or
-  modify it under the terms of the GNU Library General Public
-  License as published by the Free Software Foundation; either
-  version 2 of the License, or (at your option) any later version.
-
-  GPGME++ is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU Library General Public License for more details.
-
-  You should have received a copy of the GNU Library General Public License
-  along with GPGME++; see the file COPYING.LIB.  If not, write to the
-  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-  Boston, MA 02110-1301, USA.
-*/
-
-#include <assuanresult.h>
-#include "result_p.h"
-
-#include <gpgme.h>
-
-#include <istream>
-
-using namespace GpgME;
-
-class AssuanResult::Private
-{
-public:
-    explicit Private(const gpgme_assuan_result_t r)
-    {
-        if (!r) {
-            return;
-        }
-        error = r->err;
-    }
-
-    gpgme_error_t error;
-};
-
-AssuanResult::AssuanResult(gpgme_ctx_t ctx, int error)
-    : Result(error), d()
-{
-    init(ctx);
-}
-
-AssuanResult::AssuanResult(gpgme_ctx_t ctx, const Error &error)
-    : Result(error), d()
-{
-    init(ctx);
-}
-
-void AssuanResult::init(gpgme_ctx_t ctx)
-{
-    (void)ctx;
-    if (!ctx) {
-        return;
-    }
-    gpgme_assuan_result_t res = gpgme_op_assuan_result(ctx);
-    if (!res) {
-        return;
-    }
-    d.reset(new Private(res));
-}
-
-make_standard_stuff(AssuanResult)
-
-Error AssuanResult::assuanError() const
-{
-    if (d) {
-        return Error(d->error);
-    }
-    return Error();
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const AssuanResult &result)
-{
-    os << "GpgME::AssuanResult(";
-    if (!result.isNull()) {
-        os << "\n error:       " << result.error()
-           << "\n assuanError: " << result.assuanError()
-           << "\n";
-    }
-    return os << ')';
-}
diff --git a/lang/cpp/src/assuanresult.h b/lang/cpp/src/assuanresult.h
deleted file mode 100644
index e59b5ac..0000000
--- a/lang/cpp/src/assuanresult.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-  assuanresult.h - wraps a gpgme assuan result
-  Copyright (C) 2009 Klarälvdalens Datakonsult AB <info at kdab.com>
-  Author: Marc Mutz <marc at kdab.com>
-
-  This file is part of GPGME++.
-
-  GPGME++ is free software; you can redistribute it and/or
-  modify it under the terms of the GNU Library General Public
-  License as published by the Free Software Foundation; either
-  version 2 of the License, or (at your option) any later version.
-
-  GPGME++ is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU Library General Public License for more details.
-
-  You should have received a copy of the GNU Library General Public License
-  along with GPGME++; see the file COPYING.LIB.  If not, write to the
-  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-  Boston, MA 02110-1301, USA.
-*/
-
-#ifndef __GPGMEPP_ASSUANRESULT_H__
-#define __GPGMEPP_ASSUANRESULT_H__
-
-#include "gpgmefw.h"
-#include "result.h"
-#include "gpgmepp_export.h"
-
-#include <time.h>
-
-#include <vector>
-#include <iosfwd>
-#include <memory>
-
-namespace GpgME
-{
-
-class Error;
-
-class GPGMEPP_EXPORT AssuanResult : public Result
-{
-public:
-    AssuanResult();
-    AssuanResult(gpgme_ctx_t ctx, int error);
-    AssuanResult(gpgme_ctx_t ctx, const Error &error);
-    explicit AssuanResult(const Error &err);
-
-    const AssuanResult &operator=(AssuanResult other)
-    {
-        swap(other);
-        return *this;
-    }
-
-    void swap(AssuanResult &other)
-    {
-        Result::swap(other);
-        using std::swap;
-        swap(this->d, other.d);
-    }
-
-    bool isNull() const;
-
-    Error assuanError() const;
-
-    class Private;
-private:
-    void init(gpgme_ctx_t ctx);
-    std::shared_ptr<Private> d;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const AssuanResult &result);
-
-}
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(AssuanResult)
-
-#endif // __GPGMEPP_ASSUANRESULT_H__
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 11080cf..4e66d3b 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -23,7 +23,6 @@
 #include <context.h>
 #include <eventloopinteractor.h>
 #include <trustitem.h>
-#include <assuanresult.h>
 #include <keylistresult.h>
 #include <keygenerationresult.h>
 #include <importresult.h>
@@ -801,26 +800,36 @@ static gpgme_error_t assuan_transaction_status_callback(void *opaque, const char
     return t->status(status, a.c_str()).encodedError();
 }
 
-AssuanResult Context::assuanTransact(const char *command)
+Error Context::assuanTransact(const char *command)
 {
     return assuanTransact(command, std::unique_ptr<AssuanTransaction>(new DefaultAssuanTransaction));
 }
 
-AssuanResult Context::assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction)
+Error Context::assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction)
 {
+    gpgme_error_t err, operr;
+
     d->lastop = Private::AssuanTransact;
     d->lastAssuanTransaction = std::move(transaction);
     if (!d->lastAssuanTransaction.get()) {
-        return AssuanResult(Error(d->lasterr = make_error(GPG_ERR_INV_ARG)));
+        return Error(d->lasterr = make_error(GPG_ERR_INV_ARG));
     }
-    d->lasterr = gpgme_op_assuan_transact(d->ctx, command,
-                                          assuan_transaction_data_callback,
-                                          d->lastAssuanTransaction.get(),
-                                          assuan_transaction_inquire_callback,
-                                          d, // sic!
-                                          assuan_transaction_status_callback,
-                                          d->lastAssuanTransaction.get());
-    return AssuanResult(d->ctx, d->lasterr);
+    err = gpgme_op_assuan_transact_ext
+      (d->ctx,
+       command,
+       assuan_transaction_data_callback,
+       d->lastAssuanTransaction.get(),
+       assuan_transaction_inquire_callback,
+       d,
+       assuan_transaction_status_callback,
+       d->lastAssuanTransaction.get(),
+       &operr);
+
+    if (!err)
+      err = operr;
+    d->lasterr = err;
+
+    return Error(d->lasterr);
 }
 
 Error Context::startAssuanTransaction(const char *command)
@@ -830,27 +839,26 @@ Error Context::startAssuanTransaction(const char *command)
 
 Error Context::startAssuanTransaction(const char *command, std::unique_ptr<AssuanTransaction> transaction)
 {
+    gpgme_error_t err;
+
     d->lastop = Private::AssuanTransact;
     d->lastAssuanTransaction = std::move(transaction);
     if (!d->lastAssuanTransaction.get()) {
         return Error(d->lasterr = make_error(GPG_ERR_INV_ARG));
     }
-    return Error(d->lasterr = gpgme_op_assuan_transact_start(d->ctx, command,
-                              assuan_transaction_data_callback,
-                              d->lastAssuanTransaction.get(),
-                              assuan_transaction_inquire_callback,
-                              d, // sic!
-                              assuan_transaction_status_callback,
-                              d->lastAssuanTransaction.get()));
-}
+    err = gpgme_op_assuan_transact_start
+      (d->ctx,
+       command,
+       assuan_transaction_data_callback,
+       d->lastAssuanTransaction.get(),
+       assuan_transaction_inquire_callback,
+       d,
+       assuan_transaction_status_callback,
+       d->lastAssuanTransaction.get());
 
-AssuanResult Context::assuanResult() const
-{
-    if (d->lastop & Private::AssuanTransact) {
-        return AssuanResult(d->ctx, d->lasterr);
-    } else {
-        return AssuanResult();
-    }
+    d->lasterr = err;
+
+    return Error(d->lasterr);
 }
 
 AssuanTransaction *Context::lastAssuanTransaction() const
diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h
index 29eba91..6518d4c 100644
--- a/lang/cpp/src/context.h
+++ b/lang/cpp/src/context.h
@@ -46,7 +46,6 @@ class EventLoopInteractor;
 class EditInteractor;
 class AssuanTransaction;
 
-class AssuanResult;
 class KeyListResult;
 class KeyGenerationResult;
 class ImportResult;
@@ -240,11 +239,10 @@ public:
     // Assuan Transactions
     //
 
-    AssuanResult assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction);
-    AssuanResult assuanTransact(const char *command);
+    GpgME::Error assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction);
+    GpgME::Error assuanTransact(const char *command);
     GpgME::Error startAssuanTransaction(const char *command, std::unique_ptr<AssuanTransaction> transaction);
     GpgME::Error startAssuanTransaction(const char *command);
-    AssuanResult assuanResult() const;
 
     AssuanTransaction *lastAssuanTransaction() const;
     std::unique_ptr<AssuanTransaction> takeLastAssuanTransaction();
diff --git a/lang/cpp/src/vfsmountresult.h b/lang/cpp/src/vfsmountresult.h
index abdd655..b46eeb1 100644
--- a/lang/cpp/src/vfsmountresult.h
+++ b/lang/cpp/src/vfsmountresult.h
@@ -73,4 +73,4 @@ GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const VfsMountResult &
 
 GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(VfsMountResult)
 
-#endif // __GPGMEPP_ASSUANRESULT_H__
+#endif // __GPGMEPP_VFSMOUNTRESULT_H__

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

Summary of changes:
 lang/cpp/src/Makefile.am      |  4 +-
 lang/cpp/src/assuanresult.cpp | 90 -------------------------------------------
 lang/cpp/src/assuanresult.h   | 79 -------------------------------------
 lang/cpp/src/context.cpp      | 62 ++++++++++++++++-------------
 lang/cpp/src/context.h        |  6 +--
 lang/cpp/src/vfsmountresult.h |  2 +-
 6 files changed, 40 insertions(+), 203 deletions(-)
 delete mode 100644 lang/cpp/src/assuanresult.cpp
 delete mode 100644 lang/cpp/src/assuanresult.h


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




More information about the Gnupg-commits mailing list