[PATCH] cli: mime node: fix compiler warning when building against gmime 2.4
authorJani Nikula <jani@nikula.org>
Sat, 6 Apr 2013 11:47:43 +0000 (14:47 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:54:16 +0000 (09:54 -0800)
f3/5fb3eb771f003d89b67caec449e7ad56942481 [new file with mode: 0644]

diff --git a/f3/5fb3eb771f003d89b67caec449e7ad56942481 b/f3/5fb3eb771f003d89b67caec449e7ad56942481
new file mode 100644 (file)
index 0000000..1d25e53
--- /dev/null
@@ -0,0 +1,130 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 97DB4431FBC\r
+       for <notmuch@notmuchmail.org>; Sat,  6 Apr 2013 04:47:50 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id Vus2ohHqWxmX for <notmuch@notmuchmail.org>;\r
+       Sat,  6 Apr 2013 04:47:50 -0700 (PDT)\r
+Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
+       [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id DA8F7431FB6\r
+       for <notmuch@notmuchmail.org>; Sat,  6 Apr 2013 04:47:49 -0700 (PDT)\r
+Received: by mail-lb0-f181.google.com with SMTP id r11so4410260lbv.26\r
+       for <notmuch@notmuchmail.org>; Sat, 06 Apr 2013 04:47:48 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=x-received:from:to:cc:subject:date:message-id:x-mailer:mime-version\r
+       :content-type:content-transfer-encoding:x-gm-message-state;\r
+       bh=uP/Nsy64/S8xQ5ZtgA+dcUPEo86F32KlNxSxrj83lLY=;\r
+       b=UCmePHYXMb0kZiw4M/vD8VbcybKZxWH3MzKCRJQp+QKpBgrhxnBMbB5/cxzLqwG+Kp\r
+       Zy/6u1zqFVaM1YxMHxvY1Q9L2fm5Prkzi3bKAobf4t+MTeCNMS0APr/52fzF46e1fd2F\r
+       BtW932YQrhHPlXh5deDu+hBo3QQsIX5/VI/uqOJ5y/VYLaYs5kZuTL7yW8IwzWEj290u\r
+       V/4VttO9Z0ZnaFWfV3vFdu8oIwPgg+y3pSW4AtB2j/gdj4EjjF/zNGwaOgoTzolhBlp7\r
+       i+WzsofbeX7GSP+EnjOgCU3bUXTL4KD82cALaHEE/EveiVyPuTMizqpf/LwN0kWnuB3t\r
+       kNWQ==\r
+X-Received: by 10.152.136.20 with SMTP id pw20mr8146019lab.16.1365248868362;\r
+       Sat, 06 Apr 2013 04:47:48 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id t17sm7367636lam.9.2013.04.06.04.47.46\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sat, 06 Apr 2013 04:47:47 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org,\r
+       Mark Walters <markwalters1009@gmail.com>\r
+Subject: [PATCH] cli: mime node: fix compiler warning when building against\r
+       gmime 2.4\r
+Date: Sat,  6 Apr 2013 14:47:43 +0300\r
+Message-Id: <1365248863-17947-1-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+X-Gm-Message-State:\r
+ ALoCoQllaP9/uBSo3VKffBKbOWJtxL+agPZnuUpJqrsINzvZaML9VTwLw9riU1t7RpzyGvJW4Uvp\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 06 Apr 2013 11:47:50 -0000\r
+\r
+commit d487ef9e58bcd193118f19f771d5ef3984616be5\r
+Author: Jani Nikula <jani@nikula.org>\r
+Date:   Sat Mar 30 15:53:16 2013 +0200\r
+\r
+    cli: mime node: abstract decryption and signature verification\r
+\r
+introduced a compiler warning, reported by Mark Walters, when building\r
+against gmime 2.4:\r
+\r
+mime-node.c:224:9: warning: assignment discards â€˜const’ qualifier from\r
+pointer target type [enabled by default]\r
+\r
+Pass the non-const signature validity to the destructor to fix this.\r
+\r
+---\r
+\r
+Not even compile tested as I don't have gmime 2.4 on any\r
+systems... Mark, please build and run the tests with this. Thanks.\r
+---\r
+ mime-node.c |   13 ++++++++-----\r
+ 1 file changed, 8 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/mime-node.c b/mime-node.c\r
+index 851f963..fd9e4a4 100644\r
+--- a/mime-node.c\r
++++ b/mime-node.c\r
+@@ -217,11 +217,12 @@ _signature_validity_free (GMimeSignatureValidity **proxy)\r
\r
+ /* Set up signature validity destructor (GMime 2.4) */\r
+ static void\r
+-set_signature_validity_destructor (mime_node_t *node)\r
++set_signature_validity_destructor (mime_node_t *node,\r
++                                 GMimeSignatureValidity *sig_validity)\r
+ {\r
+     GMimeSignatureValidity **proxy = talloc (node, GMimeSignatureValidity *);\r
+     if (proxy) {\r
+-      *proxy = node->sig_validity;\r
++      *proxy = sig_validity;\r
+       talloc_set_destructor (proxy, _signature_validity_free);\r
+     }\r
+ }\r
+@@ -232,12 +233,14 @@ node_verify (mime_node_t *node, GMimeObject *part,\r
+            notmuch_crypto_context_t *cryptoctx)\r
+ {\r
+     GError *err = NULL;\r
++    GMimeSignatureValidity *sig_validity;\r
\r
+     node->verify_attempted = TRUE;\r
+-    node->sig_validity = g_mime_multipart_signed_verify\r
++    sig_validity = g_mime_multipart_signed_verify\r
+       (GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);\r
+-    if (node->sig_validity) {\r
+-      set_signature_validity_destructor (node);\r
++    node->sig_validity = sig_validity;\r
++    if (sig_validity) {\r
++      set_signature_validity_destructor (node, sig_validity);\r
+     } else {\r
+       fprintf (stderr, "Failed to verify signed part: %s\n",\r
+                err ? err->message : "no error explanation given");\r
+-- \r
+1.7.10.4\r
+\r