From: Jani Nikula Date: Sat, 6 Apr 2013 11:47:43 +0000 (+0300) Subject: [PATCH] cli: mime node: fix compiler warning when building against gmime 2.4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2ebe2aa962f3518f6d64b2cc3928fedc7375961d;p=notmuch-archives.git [PATCH] cli: mime node: fix compiler warning when building against gmime 2.4 --- diff --git a/f3/5fb3eb771f003d89b67caec449e7ad56942481 b/f3/5fb3eb771f003d89b67caec449e7ad56942481 new file mode 100644 index 000000000..1d25e5357 --- /dev/null +++ b/f3/5fb3eb771f003d89b67caec449e7ad56942481 @@ -0,0 +1,130 @@ +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 97DB4431FBC + for ; Sat, 6 Apr 2013 04:47:50 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 Vus2ohHqWxmX for ; + Sat, 6 Apr 2013 04:47:50 -0700 (PDT) +Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com + [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id DA8F7431FB6 + for ; Sat, 6 Apr 2013 04:47:49 -0700 (PDT) +Received: by mail-lb0-f181.google.com with SMTP id r11so4410260lbv.26 + for ; Sat, 06 Apr 2013 04:47:48 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=x-received:from:to:cc:subject:date:message-id:x-mailer:mime-version + :content-type:content-transfer-encoding:x-gm-message-state; + bh=uP/Nsy64/S8xQ5ZtgA+dcUPEo86F32KlNxSxrj83lLY=; + b=UCmePHYXMb0kZiw4M/vD8VbcybKZxWH3MzKCRJQp+QKpBgrhxnBMbB5/cxzLqwG+Kp + Zy/6u1zqFVaM1YxMHxvY1Q9L2fm5Prkzi3bKAobf4t+MTeCNMS0APr/52fzF46e1fd2F + BtW932YQrhHPlXh5deDu+hBo3QQsIX5/VI/uqOJ5y/VYLaYs5kZuTL7yW8IwzWEj290u + V/4VttO9Z0ZnaFWfV3vFdu8oIwPgg+y3pSW4AtB2j/gdj4EjjF/zNGwaOgoTzolhBlp7 + i+WzsofbeX7GSP+EnjOgCU3bUXTL4KD82cALaHEE/EveiVyPuTMizqpf/LwN0kWnuB3t + kNWQ== +X-Received: by 10.152.136.20 with SMTP id pw20mr8146019lab.16.1365248868362; + Sat, 06 Apr 2013 04:47:48 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi. + [80.223.81.27]) + by mx.google.com with ESMTPS id t17sm7367636lam.9.2013.04.06.04.47.46 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sat, 06 Apr 2013 04:47:47 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org, + Mark Walters +Subject: [PATCH] cli: mime node: fix compiler warning when building against + gmime 2.4 +Date: Sat, 6 Apr 2013 14:47:43 +0300 +Message-Id: <1365248863-17947-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 1.7.10.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +X-Gm-Message-State: + ALoCoQllaP9/uBSo3VKffBKbOWJtxL+agPZnuUpJqrsINzvZaML9VTwLw9riU1t7RpzyGvJW4Uvp +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: Sat, 06 Apr 2013 11:47:50 -0000 + +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 ‘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 +