jshn: read and write 64-bit integers
authorChristian Beier <dontmind@freeshell.org>
Sat, 21 Oct 2017 23:42:29 +0000 (01:42 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sun, 7 Jan 2018 15:02:02 +0000 (16:02 +0100)
commit6abafba0c4d38d109c7563d9c09b51d627002cb6
tree412945d67d1fed9b2e6c9cc3ecfaf395d5a0bf69
parentcfc75c5e8ceca80dd9ca28eec3ddfdfa19bb8be2
jshn: read and write 64-bit integers

This allows for reading in and writing out bigger JSON Numbers.

Following test script (that fails to print correct values _without_ this
commit) verifies the functionality (tested on x86-64 as well as on ar71xx):

---snip---
# assumes you built jshn and sourced jshn.sh
echo testing reading-in JSON
SHELL_BIGNUM=12147483647
json_init
json_load "{ \"bignum\": $SHELL_BIGNUM }"
json_get_var BIGNUM bignum
echo jshn bignum: $BIGNUM
echo shll bignum: $SHELL_BIGNUM
echo testing writing-out JSON
json_init
json_add_int bigint $SHELL_BIGNUM
json_dump
--snap---

Signed-off-by: Christian Beier <dontmind@freeshell.org>
(cherry picked from commit 729f47fd5279f902986457682f8f166c324eafb5)
jshn.c