[PATCH] show: don't use hex literals in JSON output

2012-01-22 Thread David Bremner
On Sun, 22 Jan 2012 01:20:57 +0100, Thomas Jost  
wrote:
> JSON does not support hex literals (0x..) so numbers must be formatted
> as %d instead of %x.

pushed, 

d


[PATCH] show: don't use hex literals in JSON output

2012-01-22 Thread Thomas Jost
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



Re: [PATCH] show: don't use hex literals in JSON output

2012-01-22 Thread David Bremner
On Sun, 22 Jan 2012 01:20:57 +0100, Thomas Jost schno...@schnouki.net wrote:
 JSON does not support hex literals (0x..) so numbers must be formatted
 as %d instead of %x.

pushed, 

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] show: don't use hex literals in JSON output

2012-01-21 Thread Thomas Jost
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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch