cpp: Make GpgME::Data::toKeys really const
authorAndre Heinecke <aheinecke@gnupg.org>
Thu, 21 Feb 2019 12:04:54 +0000 (13:04 +0100)
committerAndre Heinecke <aheinecke@gnupg.org>
Thu, 21 Feb 2019 12:04:54 +0000 (13:04 +0100)
* lang/cpp/src/data.cpp (GpgME::Data::toKeys): Rewind afterards.

--
This fixes unexpected behavior that the seek pointer is changed
after calling the const toKeys.

lang/cpp/src/data.cpp

index 547ec76..7a93cbc 100644 (file)
@@ -256,6 +256,8 @@ std::vector<GpgME::Key> GpgME::Data::toKeys(Protocol proto) const
     while (!gpgme_op_keylist_next (ctx->impl()->ctx, &key)) {
         ret.push_back(GpgME::Key(key, false));
     }
+    gpgme_data_seek (d->data, 0, SEEK_SET);
+
     delete ctx;
     return ret;
 }