[PATCH v5 1/7] cli: use new typedef to deal with gmime 2.4/2.6 context incompatibility
authorJameson Graef Rollins <jrollins@finestructure.net>
Sat, 26 May 2012 18:45:40 +0000 (11:45 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:27 +0000 (09:47 -0800)
1e/db21a6dd2a43365c0ee0f4ccf0e25491dcff9d [new file with mode: 0644]

diff --git a/1e/db21a6dd2a43365c0ee0f4ccf0e25491dcff9d b/1e/db21a6dd2a43365c0ee0f4ccf0e25491dcff9d
new file mode 100644 (file)
index 0000000..ea3193e
--- /dev/null
@@ -0,0 +1,134 @@
+Return-Path: <jrollins@finestructure.net>\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 D6033429E25\r
+       for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:55 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] 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 Oj6B33FDQs17 for <notmuch@notmuchmail.org>;\r
+       Sat, 26 May 2012 11:45:55 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       by olra.theworths.org (Postfix) with ESMTP id 16FFB431FBC\r
+       for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:55 -0700 (PDT)\r
+Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by fire-doxen-postvirus (Postfix) with ESMTP id 990CB328017\r
+       for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:54 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
+Received: from finestructure.net (unknown [76.89.192.57])\r
+       (Authenticated sender: jrollins)\r
+       by fire-doxen-submit (Postfix) with ESMTP id CD7AB2E50CDC\r
+       for <notmuch@notmuchmail.org>; Sat, 26 May 2012 11:45:51 -0700 (PDT)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+       id 66242188; Sat, 26 May 2012 11:45:51 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v5 1/7] cli: use new typedef to deal with gmime 2.4/2.6\r
+       context incompatibility\r
+Date: Sat, 26 May 2012 11:45:40 -0700\r
+Message-Id: <1338057946-29209-2-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1338057946-29209-1-git-send-email-jrollins@finestructure.net>\r
+References: <1338057946-29209-1-git-send-email-jrollins@finestructure.net>\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, 26 May 2012 18:45:56 -0000\r
+\r
+gmime 2.4 defines GMimeCipherContext, while 2.6 defines\r
+GMimeCryptoContext.  typedef them both to notmuch_crypto_context_t to\r
+cover this discrepancy and remove a bunch of #ifdefs.\r
+---\r
+ mime-node.c      |   12 ++----------\r
+ notmuch-client.h |   15 +++++----------\r
+ 2 files changed, 7 insertions(+), 20 deletions(-)\r
+\r
+diff --git a/mime-node.c b/mime-node.c\r
+index a95bdab..a5645e5 100644\r
+--- a/mime-node.c\r
++++ b/mime-node.c\r
+@@ -33,11 +33,7 @@ typedef struct mime_node_context {\r
+     GMimeMessage *mime_message;\r
+ \r
+     /* Context provided by the caller. */\r
+-#ifdef GMIME_ATLEAST_26\r
+-    GMimeCryptoContext *cryptoctx;\r
+-#else\r
+-    GMimeCipherContext *cryptoctx;\r
+-#endif\r
++    notmuch_crypto_context_t *cryptoctx;\r
+     notmuch_bool_t decrypt;\r
+ } mime_node_context_t;\r
+ \r
+@@ -61,11 +57,7 @@ _mime_node_context_free (mime_node_context_t *res)\r
+ \r
+ notmuch_status_t\r
+ mime_node_open (const void *ctx, notmuch_message_t *message,\r
+-#ifdef GMIME_ATLEAST_26\r
+-              GMimeCryptoContext *cryptoctx,\r
+-#else\r
+-              GMimeCipherContext *cryptoctx,\r
+-#endif\r
++              notmuch_crypto_context_t *cryptoctx,\r
+               notmuch_bool_t decrypt, mime_node_t **root_out)\r
+ {\r
+     const char *filename = notmuch_message_get_filename (message);\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index 19b7f01..d377b04 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -36,6 +36,9 @@\r
+  * these to check the version number. */\r
+ #ifdef GMIME_MAJOR_VERSION\r
+ #define GMIME_ATLEAST_26\r
++typedef GMimeCryptoContext notmuch_crypto_context_t;\r
++#else\r
++typedef GMimeCipherContext notmuch_crypto_context_t;\r
+ #endif\r
+ \r
+ #include "notmuch.h"\r
+@@ -79,11 +82,7 @@ typedef struct notmuch_show_params {\r
+     notmuch_bool_t omit_excluded;\r
+     notmuch_bool_t raw;\r
+     int part;\r
+-#ifdef GMIME_ATLEAST_26\r
+-    GMimeCryptoContext* cryptoctx;\r
+-#else\r
+-    GMimeCipherContext* cryptoctx;\r
+-#endif\r
++    notmuch_crypto_context_t* cryptoctx;\r
+     notmuch_bool_t decrypt;\r
+ } notmuch_show_params_t;\r
+ \r
+@@ -355,11 +354,7 @@ struct mime_node {\r
+  */\r
+ notmuch_status_t\r
+ mime_node_open (const void *ctx, notmuch_message_t *message,\r
+-#ifdef GMIME_ATLEAST_26\r
+-              GMimeCryptoContext *cryptoctx,\r
+-#else\r
+-              GMimeCipherContext *cryptoctx,\r
+-#endif\r
++              notmuch_crypto_context_t *cryptoctx,\r
+               notmuch_bool_t decrypt, mime_node_t **node_out);\r
+ \r
+ /* Return a new MIME node for the requested child part of parent.\r
+-- \r
+1.7.10\r
+\r