[git] GPGME - branch, master, updated. gpgme-1.11.1-39-g618aa7f

by Andre Heinecke cvs at cvs.gnupg.org
Tue May 29 09:21:12 CEST 2018


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  618aa7f08db41911f25632d9fba23bca80908ebe (commit)
      from  77166851f165b1220dcf0116bb61f81e58e4512f (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 618aa7f08db41911f25632d9fba23bca80908ebe
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue May 29 09:16:22 2018 +0200

    cpp: Add gpgme_data_rewind to cpp API
    
    * lang/cpp/src/data.h, lang/cpp/src/data.cpp (Data::rewind): New.
    * lang/qt/tests/t-various.cpp (testDataRewind): Test it.
    
    --
    The advantage of this convieniance function in GPGME is that
    it avoids the messiness that are declarations with off_t.
    
    GnuPG-Bug-Id: T3996

diff --git a/NEWS b/NEWS
index e0adb35..848f4e9 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Noteworthy changes in version 1.11.2 (unreleased)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cpp: DecryptionResult::sessionKey    NEW.
  cpp: DecryptionResult::symkeyAlgo    NEW.
+ cpp: Data::rewind                    NEW.
 
 Noteworthy changes in version 1.11.1 (2018-04-20)
 -------------------------------------------------
diff --git a/lang/cpp/src/data.cpp b/lang/cpp/src/data.cpp
index 52b8da2..2782aa7 100644
--- a/lang/cpp/src/data.cpp
+++ b/lang/cpp/src/data.cpp
@@ -232,6 +232,11 @@ off_t GpgME::Data::seek(off_t offset, int whence)
     return gpgme_data_seek(d->data, offset, whence);
 }
 
+GpgME::Error GpgME::Data::rewind()
+{
+    return Error(gpgme_data_rewind(d->data));
+}
+
 std::vector<GpgME::Key> GpgME::Data::toKeys(Protocol proto) const
 {
     std::vector<GpgME::Key> ret;
diff --git a/lang/cpp/src/data.h b/lang/cpp/src/data.h
index 446f6fa..df8607e 100644
--- a/lang/cpp/src/data.h
+++ b/lang/cpp/src/data.h
@@ -110,6 +110,9 @@ public:
     ssize_t write(const void *buffer, size_t length);
     off_t seek(off_t offset, int whence);
 
+    /* Convenience function to do a seek (0, SEEK_SET).  */
+    Error rewind();
+
     /** Try to parse the data to a key object using the
      * Protocol proto. Returns an empty list on error.*/
     std::vector<Key> toKeys(const Protocol proto = Protocol::OpenPGP) const;
diff --git a/lang/qt/tests/t-various.cpp b/lang/qt/tests/t-various.cpp
index 7545628..76e6806 100644
--- a/lang/qt/tests/t-various.cpp
+++ b/lang/qt/tests/t-various.cpp
@@ -98,6 +98,25 @@ private Q_SLOTS:
         QVERIFY(key.primaryFingerprint() == QStringLiteral("7A0904B6950DA998020A1AD4BE41C0C3A5FF1F3C"));
     }
 
+    void testDataRewind()
+    {
+        if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.14") {
+            return;
+        }
+        QGpgME::QByteArrayDataProvider dp(aKey);
+        Data data(&dp);
+        char buf[20];
+        data.read(buf, 20);
+
+        auto keys = data.toKeys();
+        QVERIFY(keys.size() == 0);
+
+        data.rewind();
+
+        keys = data.toKeys();
+        QVERIFY(keys.size() == 1);
+    }
+
     void testQuickUid()
     {
         if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.13") {

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

Summary of changes:
 NEWS                        |  1 +
 lang/cpp/src/data.cpp       |  5 +++++
 lang/cpp/src/data.h         |  3 +++
 lang/qt/tests/t-various.cpp | 19 +++++++++++++++++++
 4 files changed, 28 insertions(+)


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




More information about the Gnupg-commits mailing list