From: Mark Walters Date: Fri, 12 Apr 2013 06:12:45 +0000 (+0100) Subject: Re: [PATCH] cli: mime node: fix compiler warning when building against gmime 2.4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=200b54b89b04c0c696d5f51c18f9054674544384;p=notmuch-archives.git Re: [PATCH] cli: mime node: fix compiler warning when building against gmime 2.4 --- diff --git a/b2/9cb650e2f863c28c808585e2f81b4fd904c018 b/b2/9cb650e2f863c28c808585e2f81b4fd904c018 new file mode 100644 index 000000000..2578acbd2 --- /dev/null +++ b/b2/9cb650e2f863c28c808585e2f81b4fd904c018 @@ -0,0 +1,144 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id B236F431FBC + for ; Thu, 11 Apr 2013 23:12:39 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id XsArnGFKpNZx for ; + Thu, 11 Apr 2013 23:12:35 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id DC977431FAE + for ; Thu, 11 Apr 2013 23:12:34 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1UQXDo-0007xv-59; Fri, 12 Apr 2013 07:12:28 +0100 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1UQXDn-0003rY-SU; Fri, 12 Apr 2013 07:12:28 +0100 +From: Mark Walters +To: Jani Nikula , notmuch@notmuchmail.org +Subject: Re: [PATCH] cli: mime node: fix compiler warning when building + against gmime 2.4 +In-Reply-To: <1365248863-17947-1-git-send-email-jani@nikula.org> +References: <1365248863-17947-1-git-send-email-jani@nikula.org> +User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Fri, 12 Apr 2013 07:12:45 +0100 +Message-ID: <87a9p4l1k2.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: dc4ba2a33ad66402fe82002e2247208c (of first 20000 bytes) +X-SpamAssassin-Score: -2.3 +X-SpamAssassin-SpamBar: -- +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -2.3 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) +X-QM-Scan-Virus: ClamAV says the message is clean +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 12 Apr 2013 06:12:40 -0000 + + +On Sat, 06 Apr 2013, Jani Nikula wrote: +> commit d487ef9e58bcd193118f19f771d5ef3984616be5 +> Author: Jani Nikula +> 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 =E2=80=98const=E2=80=99 q= +ualifier 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. + +This fixes the build warning and all tests pass. Thanks! + +Mark + +> --- +> 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) +>=20=20 +> /* 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 =3D talloc (node, GMimeSignatureValid= +ity *); +> if (proxy) { +> - *proxy =3D node->sig_validity; +> + *proxy =3D 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 =3D NULL; +> + GMimeSignatureValidity *sig_validity; +>=20=20 +> node->verify_attempted =3D TRUE; +> - node->sig_validity =3D g_mime_multipart_signed_verify +> + sig_validity =3D g_mime_multipart_signed_verify +> (GMIME_MULTIPART_SIGNED (part), cryptoctx, &err); +> - if (node->sig_validity) { +> - set_signature_validity_destructor (node); +> + node->sig_validity =3D 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"); +> --=20 +> 1.7.10.4