--- /dev/null
+Return-Path: <bremner@tethera.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 41E65431E64\r
+ for <notmuch@notmuchmail.org>; Sun, 24 Nov 2013 13:30:07 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 KY+z0XJKcq96 for <notmuch@notmuchmail.org>;\r
+ Sun, 24 Nov 2013 13:30:01 -0800 (PST)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id E236D431FAE\r
+ for <notmuch@notmuchmail.org>; Sun, 24 Nov 2013 13:30:01 -0800 (PST)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1VkhFd-0000YU-6U; Sun, 24 Nov 2013 17:29:57 -0400\r
+Received: (nullmailer pid 24664 invoked by uid 1000); Sun, 24 Nov 2013\r
+ 21:29:53 -0000\r
+From: david@tethera.net\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] lib: fix byte order test in libsha1.c\r
+Date: Sun, 24 Nov 2013 17:29:42 -0400\r
+Message-Id: <1385328583-24602-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.8.4.2\r
+In-Reply-To: <m2ob593g55.fsf@guru.guru-group.fi>\r
+References: <m2ob593g55.fsf@guru.guru-group.fi>\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: Sun, 24 Nov 2013 21:30:07 -0000\r
+\r
+From: David Bremner <david@tethera.net>\r
+\r
+Previously PLATFORM_BYTE_ORDER and IS_LITTLE_ENDIAN were not defined,\r
+so the little endian code was always compiled in.\r
+\r
+This will have the effect that the "SHA1s" on big endian architectures\r
+will change (i.e. become actual sha1s). So someone re-indexing their\r
+database could conceivable lose tags on messages without a message-id\r
+header.\r
+---\r
+ lib/libsha1.c | 14 ++++++++++----\r
+ 1 file changed, 10 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/lib/libsha1.c b/lib/libsha1.c\r
+index 5d16f6a..794854b 100644\r
+--- a/lib/libsha1.c\r
++++ b/lib/libsha1.c\r
+@@ -49,11 +49,17 @@ extern "C"\r
+ \r
+ #define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00))\r
+ \r
+-#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)\r
+-#define bsw_32(p,n) \\r
+- { int _i = (n); while(_i--) ((uint32_t*)p)[_i] = bswap_32(((uint32_t*)p)[_i]); }\r
++#ifdef __BYTE_ORDER__\r
++# if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)\r
++# define bsw_32(p,n) \\r
++ { int _i = (n); while(_i--) ((uint32_t*)p)[_i] = bswap_32(((uint32_t*)p)[_i]); }\r
++# elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)\r
++# define bsw_32(p,n)\r
++# else\r
++# error "unknown byte order"\r
++# endif\r
+ #else\r
+-#define bsw_32(p,n)\r
++# error "macro __BYTE_ORDER__ is not defined"\r
+ #endif\r
+ \r
+ #define SHA1_MASK (SHA1_BLOCK_SIZE - 1)\r
+-- \r
+1.8.4.2\r
+\r