From 8e79dfa6c0df4fc998f87e273b68c271711c8129 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Sun, 7 Apr 2013 22:07:42 +0300 Subject: [PATCH] Re: [PATCH] cli: mime node: fix compiler warning when building against gmime 2.4 --- ca/c6a6f4d3dcd20031a029b263d955f3f3995d6e | 132 ++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 ca/c6a6f4d3dcd20031a029b263d955f3f3995d6e diff --git a/ca/c6a6f4d3dcd20031a029b263d955f3f3995d6e b/ca/c6a6f4d3dcd20031a029b263d955f3f3995d6e new file mode 100644 index 000000000..ece9b89eb --- /dev/null +++ b/ca/c6a6f4d3dcd20031a029b263d955f3f3995d6e @@ -0,0 +1,132 @@ +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 A103E431FB6 + for ; Sun, 7 Apr 2013 12:07:44 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 nyh7CrEnrElR for ; + Sun, 7 Apr 2013 12:07:44 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id EA25F431FAE + for ; Sun, 7 Apr 2013 12:07:43 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 362D1100093; + Sun, 7 Apr 2013 22:07:43 +0300 (EEST) +From: Tomi Ollila +To: Jani Nikula , notmuch@notmuchmail.org, + Mark Walters +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.15.2+75~gd7fa7c4 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +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: Sun, 07 Apr 2013 19:07:44 -0000 + +On Sat, Apr 06 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. + +I can confirm this patch removes the compilation warning. I looked the +impmementation though the glasses which say gmime-2.4 support is going +to be deprecated in somewhat near future and I think it is good. + +Tomi + + +> --- +> 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 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2