From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org, Mark Walters <markwalters1009@gmail.com>
Subject: [PATCH] cli: mime node: fix compiler warning when building against gmime 2.4
Date: Sat, 6 Apr 2013 14:47:43 +0300 [thread overview]
Message-ID: <1365248863-17947-1-git-send-email-jani@nikula.org> (raw)
commit d487ef9e58bcd193118f19f771d5ef3984616be5
Author: Jani Nikula <jani@nikula.org>
Date: Sat Mar 30 15:53:16 2013 +0200
cli: mime node: abstract decryption and signature verification
introduced a compiler warning, reported by Mark Walters, when building
against gmime 2.4:
mime-node.c:224:9: warning: assignment discards ‘const’ qualifier from
pointer target type [enabled by default]
Pass the non-const signature validity to the destructor to fix this.
---
Not even compile tested as I don't have gmime 2.4 on any
systems... Mark, please build and run the tests with this. Thanks.
---
mime-node.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/mime-node.c b/mime-node.c
index 851f963..fd9e4a4 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -217,11 +217,12 @@ _signature_validity_free (GMimeSignatureValidity **proxy)
/* Set up signature validity destructor (GMime 2.4) */
static void
-set_signature_validity_destructor (mime_node_t *node)
+set_signature_validity_destructor (mime_node_t *node,
+ GMimeSignatureValidity *sig_validity)
{
GMimeSignatureValidity **proxy = talloc (node, GMimeSignatureValidity *);
if (proxy) {
- *proxy = node->sig_validity;
+ *proxy = sig_validity;
talloc_set_destructor (proxy, _signature_validity_free);
}
}
@@ -232,12 +233,14 @@ node_verify (mime_node_t *node, GMimeObject *part,
notmuch_crypto_context_t *cryptoctx)
{
GError *err = NULL;
+ GMimeSignatureValidity *sig_validity;
node->verify_attempted = TRUE;
- node->sig_validity = g_mime_multipart_signed_verify
+ sig_validity = g_mime_multipart_signed_verify
(GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);
- if (node->sig_validity) {
- set_signature_validity_destructor (node);
+ node->sig_validity = sig_validity;
+ if (sig_validity) {
+ set_signature_validity_destructor (node, sig_validity);
} else {
fprintf (stderr, "Failed to verify signed part: %s\n",
err ? err->message : "no error explanation given");
--
1.7.10.4
next reply other threads:[~2013-04-06 11:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-06 11:47 Jani Nikula [this message]
2013-04-07 19:07 ` [PATCH] cli: mime node: fix compiler warning when building against gmime 2.4 Tomi Ollila
2013-04-12 6:12 ` Mark Walters
2013-04-14 23:00 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1365248863-17947-1-git-send-email-jani@nikula.org \
--to=jani@nikula.org \
--cc=markwalters1009@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).