From 7a398577ffb2e5586d08b80444606427cd20b743 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Thu, 24 May 2012 15:40:37 +1700 Subject: [PATCH] [PATCH v4 1/7] cli: use typedef to deal with gmime 2.4/2.6 incompatibility --- da/193d8d544165928b0ba19b5747fbac6158bcee | 129 ++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 da/193d8d544165928b0ba19b5747fbac6158bcee diff --git a/da/193d8d544165928b0ba19b5747fbac6158bcee b/da/193d8d544165928b0ba19b5747fbac6158bcee new file mode 100644 index 000000000..7d3ac5425 --- /dev/null +++ b/da/193d8d544165928b0ba19b5747fbac6158bcee @@ -0,0 +1,129 @@ +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 25F74431FAF + for ; Wed, 23 May 2012 15:40:51 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.3 +X-Spam-Level: +X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 + tests=[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 R8Na3iaDkc-G for ; + Wed, 23 May 2012 15:40:50 -0700 (PDT) +Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu + [131.215.239.19]) + by olra.theworths.org (Postfix) with ESMTP id 6A6E4431FBC + for ; Wed, 23 May 2012 15:40:50 -0700 (PDT) +Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1]) + by fire-doxen-postvirus (Postfix) with ESMTP id 1332A328043 + for ; Wed, 23 May 2012 15:40:48 -0700 (PDT) +X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new +Received: from finestructure.net (unknown [137.151.175.56]) + (Authenticated sender: jrollins) + by fire-doxen-submit (Postfix) with ESMTP id 45C4E32807F + for ; Wed, 23 May 2012 15:40:46 -0700 (PDT) +Received: by finestructure.net (Postfix, from userid 1000) + id F0629E3; Wed, 23 May 2012 15:40:45 -0700 (PDT) +From: Jameson Graef Rollins +To: Notmuch Mail +Subject: [PATCH v4 1/7] cli: use typedef to deal with gmime 2.4/2.6 + incompatibility +Date: Wed, 23 May 2012 15:40:37 -0700 +Message-Id: <1337812843-14986-2-git-send-email-jrollins@finestructure.net> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1337812843-14986-1-git-send-email-jrollins@finestructure.net> +References: <1337812843-14986-1-git-send-email-jrollins@finestructure.net> +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: Wed, 23 May 2012 22:40:51 -0000 + +gmime 2.4 defines GMimeCipherContext, while 2.6 defines +GMimeCryptoContext. We can use a typedef to cover this discrepancy +and remove a bunch of #ifdefs. +--- + mime-node.c | 8 -------- + notmuch-client.h | 10 ++-------- + 2 files changed, 2 insertions(+), 16 deletions(-) + +diff --git a/mime-node.c b/mime-node.c +index a95bdab..06fdb70 100644 +--- a/mime-node.c ++++ b/mime-node.c +@@ -33,11 +33,7 @@ typedef struct mime_node_context { + GMimeMessage *mime_message; + + /* Context provided by the caller. */ +-#ifdef GMIME_ATLEAST_26 + GMimeCryptoContext *cryptoctx; +-#else +- GMimeCipherContext *cryptoctx; +-#endif + notmuch_bool_t decrypt; + } mime_node_context_t; + +@@ -61,11 +57,7 @@ _mime_node_context_free (mime_node_context_t *res) + + notmuch_status_t + mime_node_open (const void *ctx, notmuch_message_t *message, +-#ifdef GMIME_ATLEAST_26 + GMimeCryptoContext *cryptoctx, +-#else +- GMimeCipherContext *cryptoctx, +-#endif + notmuch_bool_t decrypt, mime_node_t **root_out) + { + const char *filename = notmuch_message_get_filename (message); +diff --git a/notmuch-client.h b/notmuch-client.h +index 19b7f01..337409f 100644 +--- a/notmuch-client.h ++++ b/notmuch-client.h +@@ -36,6 +36,8 @@ + * these to check the version number. */ + #ifdef GMIME_MAJOR_VERSION + #define GMIME_ATLEAST_26 ++#else ++typedef GMimeCipherContext GMimeCryptoContext; + #endif + + #include "notmuch.h" +@@ -79,11 +81,7 @@ typedef struct notmuch_show_params { + notmuch_bool_t omit_excluded; + notmuch_bool_t raw; + int part; +-#ifdef GMIME_ATLEAST_26 + GMimeCryptoContext* cryptoctx; +-#else +- GMimeCipherContext* cryptoctx; +-#endif + notmuch_bool_t decrypt; + } notmuch_show_params_t; + +@@ -355,11 +353,7 @@ struct mime_node { + */ + notmuch_status_t + mime_node_open (const void *ctx, notmuch_message_t *message, +-#ifdef GMIME_ATLEAST_26 + GMimeCryptoContext *cryptoctx, +-#else +- GMimeCipherContext *cryptoctx, +-#endif + notmuch_bool_t decrypt, mime_node_t **node_out); + + /* Return a new MIME node for the requested child part of parent. +-- +1.7.10 + -- 2.26.2