mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
cli: mime node: fix compiler warning when building against gmime 2.4
commit d487ef9e58
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.
This commit is contained in:
parent
566e8f1eba
commit
d2c881867e
1 changed files with 8 additions and 5 deletions
13
mime-node.c
13
mime-node.c
|
@ -217,11 +217,12 @@ _signature_validity_free (GMimeSignatureValidity **proxy)
|
||||||
|
|
||||||
/* Set up signature validity destructor (GMime 2.4) */
|
/* Set up signature validity destructor (GMime 2.4) */
|
||||||
static void
|
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 *);
|
GMimeSignatureValidity **proxy = talloc (node, GMimeSignatureValidity *);
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
*proxy = node->sig_validity;
|
*proxy = sig_validity;
|
||||||
talloc_set_destructor (proxy, _signature_validity_free);
|
talloc_set_destructor (proxy, _signature_validity_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,12 +233,14 @@ node_verify (mime_node_t *node, GMimeObject *part,
|
||||||
notmuch_crypto_context_t *cryptoctx)
|
notmuch_crypto_context_t *cryptoctx)
|
||||||
{
|
{
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
|
GMimeSignatureValidity *sig_validity;
|
||||||
|
|
||||||
node->verify_attempted = TRUE;
|
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);
|
(GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);
|
||||||
if (node->sig_validity) {
|
node->sig_validity = sig_validity;
|
||||||
set_signature_validity_destructor (node);
|
if (sig_validity) {
|
||||||
|
set_signature_validity_destructor (node, sig_validity);
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr, "Failed to verify signed part: %s\n",
|
fprintf (stderr, "Failed to verify signed part: %s\n",
|
||||||
err ? err->message : "no error explanation given");
|
err ? err->message : "no error explanation given");
|
||||||
|
|
Loading…
Reference in a new issue