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 575B4429E40 for ; Sat, 21 Jan 2012 16:21:12 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] 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 NQsWF3Hk1U2L for ; Sat, 21 Jan 2012 16:21:11 -0800 (PST) Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222]) by olra.theworths.org (Postfix) with ESMTP id A4888431FAF for ; Sat, 21 Jan 2012 16:21:11 -0800 (PST) Received: from odin.local (nancy.schnouki.net [78.238.0.45]) by ks3536.kimsufi.com (Postfix) with ESMTPSA id F03076C000A; Sun, 22 Jan 2012 01:20:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net; s=key-schnouki; t=1327191638; bh=r8aR65PGjaE3fHwxICZRLch+ZTcFP6mh8RhTlQe8URQ=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=W/XTXNGoA6gDqVcaZhf0ELR+sWTX2Q5A6hCWbMx4LRTJOVzPMu+KPp6/Tsd9wh0ff +edWaT/XG8u4fIy1G3zTEjCOKDeDl7wfeMG7qOwPfnqUgjVGwj31HEsVwp6OdYC9Ut QT5nguPZL8pZ59cneV6MOUyfXUH4vde9mr4i+rbc= From: Thomas Jost To: notmuch@notmuchmail.org Subject: [PATCH] show: don't use hex literals in JSON output Date: Sun, 22 Jan 2012 01:20:57 +0100 Message-Id: <1327191657-13095-1-git-send-email-schnouki@schnouki.net> X-Mailer: git-send-email 1.7.8.4 In-Reply-To: <87ipk6wlvv.fsf@convex-new.cs.unb.ca> References: <87ipk6wlvv.fsf@convex-new.cs.unb.ca> 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: Sun, 22 Jan 2012 00:21:12 -0000 JSON does not support hex literals (0x..) so numbers must be formatted as %d instead of %x. Currently, the possible values for the gmime error code are 1 (expired signature), 2 (no public key), 4 (expired key) and 8 (revoked key). The other possible value is 16 (unsupported algorithm) but obviously it is much more rare. If this happens, the current code will add '"errors": 10'. This is valid JSON (it looks like a decimal number) but it is incorrect (should be 16, not 10). Since this is just an issue in the JSON encoder, no changes are needed on the Emacs side (or in other UIs using the JSON output). --- notmuch-show.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index 43ee211..7b40568 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -728,7 +728,7 @@ format_part_sigstatus_json (const GMimeSignatureValidity* validity) printf (", \"keyid\": %s", json_quote_str (ctx_quote, signer->keyid)); } if (signer->errors != GMIME_SIGNER_ERROR_NONE) { - printf (", \"errors\": %x", signer->errors); + printf (", \"errors\": %d", signer->errors); } printf ("}"); -- 1.7.8.4