summaryrefslogtreecommitdiff
diff options
authorYangfl <mmyangfl@gmail.com>2020-07-06 13:05:05 +0800
committergit-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com>2020-07-10 22:36:30 +0000
commit6e5d463eabb3fb8bff20439f794fdc7c8ef62a35 (patch)
treebbf6015c30828652ce701413c21cb42b2c36b2a4
parent33b1dd8201483eb3a630877b40c4c0109fb0d0e0 (diff)
Imported using git-ubuntu import.
Notes
Notes: * Pick upstream commits * Bump debhelper compat to 13 * Bump Standards-Version to 4.5.0 * Add upstream metadata * Add autopkgtest
-rw-r--r--debian/changelog10
-rw-r--r--debian/compat1
-rw-r--r--debian/control5
-rw-r--r--debian/gbp.conf4
-rw-r--r--debian/gitlab-ci.yml3
-rw-r--r--debian/libjsonparser-dev.install1
-rw-r--r--debian/libjsonparser1.1.symbols1
-rw-r--r--debian/patches/Install-pc-file-to-libdir.patch29
-rw-r--r--debian/patches/Respect-LDFLAGS-CPPFLAGS-and-add-missing-lm.patch32
-rw-r--r--debian/patches/add-missing-lm.patch13
-rw-r--r--debian/patches/series23
-rw-r--r--debian/patches/upstream/0001-improve-pkgconfig-module-close-37.patch69
-rw-r--r--debian/patches/upstream/0002-Prevent-zero-byte-allocations.patch26
-rw-r--r--debian/patches/upstream/0003-Change-to-mboelstra-s-method-of-preventing-zero-byte.patch47
-rw-r--r--debian/patches/upstream/0004-Update-AUTHORS-closes-46.patch22
-rw-r--r--debian/patches/upstream/0005-Update-README.md.patch25
-rw-r--r--debian/patches/upstream/0006-Assign-a-name-to-the-json_object_entry-struct-to-sim.patch40
-rw-r--r--debian/patches/upstream/0007-Move-json_object_entry-out-of-json_value-and-turn-it.patch72
-rw-r--r--debian/patches/upstream/0008-Create-test_json.c.patch168
-rw-r--r--debian/patches/upstream/0009-Updated-compile-command-line-in-test_json.c.patch25
-rw-r--r--debian/patches/upstream/0010-Moved-test_json-in-directory-examples.patch109
-rw-r--r--debian/patches/upstream/0012-make-test.py-compliant-to-python3-add-.gitignore.patch92
-rw-r--r--debian/patches/upstream/0013-make-test_json-compile-without-warnings-on-64-Bit-pl.patch36
-rw-r--r--debian/patches/upstream/0014-add-instructions-how-to-compile-example-test_json-fo.patch31
-rw-r--r--debian/patches/upstream/0015-Fix-52-based-on-suggestions-from-kcm1700.patch111
-rw-r--r--debian/patches/upstream/0016-Remove-stdint.h-dependency-use-json_int_t-instead-of.patch43
-rw-r--r--debian/patches/upstream/0017-Fix-Travis-CI-error-dynamically-determine-int-max.patch50
-rw-r--r--debian/patches/upstream/0018-Regenerate-configure-so-make-install-won-t-complain-.patch421
-rw-r--r--debian/patches/upstream/0019-Fix-buffer-overrun-in-truncated-unicode-escape-seque.patch35
-rw-r--r--debian/patches/upstream/0020-Update-AUTHORS.patch22
-rw-r--r--debian/patches/vlc/0001-json-fix-fall-through-warnings.patch32
-rwxr-xr-xdebian/rules2
-rw-r--r--debian/tests/control2
-rwxr-xr-xdebian/tests/unittest.sh17
-rw-r--r--debian/upstream/metadata4
35 files changed, 1605 insertions, 18 deletions
diff --git a/debian/changelog b/debian/changelog
index 4234bbc..e651538 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+libjsonparser (1.1.0-2) unstable; urgency=medium
+
+ * Pick upstream commits
+ * Bump debhelper compat to 13
+ * Bump Standards-Version to 4.5.0
+ * Add upstream metadata
+ * Add autopkgtest
+
+ -- Yangfl <mmyangfl@gmail.com> Mon, 06 Jul 2020 13:05:05 +0800
+
libjsonparser (1.1.0-1) unstable; urgency=medium
* Initial release (Closes: #909106)
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index b4de394..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-11
diff --git a/debian/control b/debian/control
index 3a95a0d..973efe8 100644
--- a/debian/control
+++ b/debian/control
@@ -2,8 +2,9 @@ Source: libjsonparser
Section: libs
Priority: optional
Maintainer: Yangfl <mmyangfl@gmail.com>
-Build-Depends: debhelper (>=11~)
-Standards-Version: 4.2.1
+Build-Depends: debhelper-compat (= 13)
+Rules-Requires-Root: no
+Standards-Version: 4.5.0
Homepage: https://github.com/udp/json-parser
Vcs-Git: https://salsa.debian.org/yangfl-guest/json-parser.git
Vcs-Browser: https://salsa.debian.org/yangfl-guest/json-parser
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..45052a1
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,4 @@
+[DEFAULT]
+upstream-branch = upstream
+debian-branch = master
+pristine-tar = True
diff --git a/debian/gitlab-ci.yml b/debian/gitlab-ci.yml
new file mode 100644
index 0000000..0c22dc4
--- /dev/null
+++ b/debian/gitlab-ci.yml
@@ -0,0 +1,3 @@
+include:
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
diff --git a/debian/libjsonparser-dev.install b/debian/libjsonparser-dev.install
index 459fdf2..970d9a2 100644
--- a/debian/libjsonparser-dev.install
+++ b/debian/libjsonparser-dev.install
@@ -1,3 +1,4 @@
usr/include/json-parser/*.h
usr/lib/*/libjsonparser.so
usr/lib/*/libjsonparser.a
+usr/lib/*/pkgconfig/json-parser.pc
diff --git a/debian/libjsonparser1.1.symbols b/debian/libjsonparser1.1.symbols
index d065c25..142fb61 100644
--- a/debian/libjsonparser1.1.symbols
+++ b/debian/libjsonparser1.1.symbols
@@ -1,4 +1,5 @@
libjsonparser.so.1.1 libjsonparser1.1 #MINVER#
+* Build-Depends-Package: libjsonparser-dev
json_parse@Base 1.1.0
json_parse_ex@Base 1.1.0
json_value_free@Base 1.1.0
diff --git a/debian/patches/Install-pc-file-to-libdir.patch b/debian/patches/Install-pc-file-to-libdir.patch
new file mode 100644
index 0000000..7ce9bab
--- /dev/null
+++ b/debian/patches/Install-pc-file-to-libdir.patch
@@ -0,0 +1,29 @@
+From e841a0437802ac3073dc7e8108b88a29438025de Mon Sep 17 00:00:00 2001
+From: yangfl <yangfl@users.noreply.github.com>
+Date: Tue, 21 Apr 2020 12:16:38 +0800
+Subject: [PATCH] Install pc file to libdir
+
+---
+ Makefile.in | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index e6e6341..e67cbef 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -41,9 +41,9 @@ clean:
+ rm -f libjsonparser.$(SO_EXT) libjsonparser.a json.o
+
+ install-shared: libjsonparser.$(SO_EXT)
+- @echo Installing pkgconfig module: $(datadir)/pkgconfig/json-parser.pc
+- @install -d $(datadir)/pkgconfig/ || true
+- @install -m 0644 json-parser.pc $(datadir)/pkgconfig/json-parser.pc
++ @echo Installing pkgconfig module: $(libdir)/pkgconfig/json-parser.pc
++ @install -d $(libdir)/pkgconfig/ || true
++ @install -m 0644 json-parser.pc $(libdir)/pkgconfig/json-parser.pc
+ @echo Installing shared library: $(libdir)/libjsonparser.$(SO_EXT)
+ @install -d $(libdir) || true
+ @install -m 0755 libjsonparser.$(SO_EXT) $(libdir)/$(REAL_NAME)
+--
+2.26.1
+
diff --git a/debian/patches/Respect-LDFLAGS-CPPFLAGS-and-add-missing-lm.patch b/debian/patches/Respect-LDFLAGS-CPPFLAGS-and-add-missing-lm.patch
new file mode 100644
index 0000000..f6bad96
--- /dev/null
+++ b/debian/patches/Respect-LDFLAGS-CPPFLAGS-and-add-missing-lm.patch
@@ -0,0 +1,32 @@
+From d6f0a153b9ba959316a1cf9ca78efa5235dfd02c Mon Sep 17 00:00:00 2001
+From: yangfl <yangfl@users.noreply.github.com>
+Date: Tue, 21 Apr 2020 12:09:35 +0800
+Subject: [PATCH 23/23] Respect LDFLAGS, CPPFLAGS and add missing -lm
+
+---
+ Makefile.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 68e0b33..e6e6341 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -29,13 +29,13 @@ libjsonparser.a: $(OBJS)
+ $(AR) rcs libjsonparser.a json.o
+
+ libjsonparser.so: $(OBJS)
+- $(CC) -shared -Wl,-soname,$(SO_NAME) -o libjsonparser.so $^
++ $(CC) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o libjsonparser.so $^ -lm
+
+ libjsonparser.dylib: $(OBJS)
+ $(CC) -dynamiclib json.o -o libjsonparser.dylib
+
+ %.o: %.c
+- $(CC) $(CFLAGS) -c $^
++ $(CC) $(CPPFLAGS) $(CFLAGS) -c $^
+
+ clean:
+ rm -f libjsonparser.$(SO_EXT) libjsonparser.a json.o
+--
+2.26.1
+
diff --git a/debian/patches/add-missing-lm.patch b/debian/patches/add-missing-lm.patch
deleted file mode 100644
index c79008b..0000000
--- a/debian/patches/add-missing-lm.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/Makefile.in b/Makefile.in
-index 85e9e38..b6c0259 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -28,7 +28,7 @@ libjsonparser.a: $(OBJS)
- $(AR) rcs libjsonparser.a json.o
-
- libjsonparser.so: $(OBJS)
-- $(CC) -shared -Wl,-soname,$(SO_NAME) -o libjsonparser.so $^
-+ $(CC) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o libjsonparser.so $^ -lm
-
- libjsonparser.dylib: $(OBJS)
- $(CC) -dynamiclib json.o -o libjsonparser.dylib
diff --git a/debian/patches/series b/debian/patches/series
index 8f7afee..0e56a04 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,22 @@
-add-missing-lm.patch
+upstream/0001-improve-pkgconfig-module-close-37.patch
+upstream/0002-Prevent-zero-byte-allocations.patch
+upstream/0003-Change-to-mboelstra-s-method-of-preventing-zero-byte.patch
+upstream/0004-Update-AUTHORS-closes-46.patch
+upstream/0005-Update-README.md.patch
+upstream/0006-Assign-a-name-to-the-json_object_entry-struct-to-sim.patch
+upstream/0007-Move-json_object_entry-out-of-json_value-and-turn-it.patch
+upstream/0008-Create-test_json.c.patch
+upstream/0009-Updated-compile-command-line-in-test_json.c.patch
+upstream/0010-Moved-test_json-in-directory-examples.patch
+upstream/0012-make-test.py-compliant-to-python3-add-.gitignore.patch
+upstream/0013-make-test_json-compile-without-warnings-on-64-Bit-pl.patch
+upstream/0014-add-instructions-how-to-compile-example-test_json-fo.patch
+upstream/0015-Fix-52-based-on-suggestions-from-kcm1700.patch
+upstream/0016-Remove-stdint.h-dependency-use-json_int_t-instead-of.patch
+upstream/0017-Fix-Travis-CI-error-dynamically-determine-int-max.patch
+upstream/0018-Regenerate-configure-so-make-install-won-t-complain-.patch
+upstream/0019-Fix-buffer-overrun-in-truncated-unicode-escape-seque.patch
+upstream/0020-Update-AUTHORS.patch
+vlc/0001-json-fix-fall-through-warnings.patch
+Install-pc-file-to-libdir.patch
+Respect-LDFLAGS-CPPFLAGS-and-add-missing-lm.patch
diff --git a/debian/patches/upstream/0001-improve-pkgconfig-module-close-37.patch b/debian/patches/upstream/0001-improve-pkgconfig-module-close-37.patch
new file mode 100644
index 0000000..718b345
--- /dev/null
+++ b/debian/patches/upstream/0001-improve-pkgconfig-module-close-37.patch
@@ -0,0 +1,69 @@
+From ef2e7454cae8dab485ec4cbce85134a7b7bd7ecd Mon Sep 17 00:00:00 2001
+From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
+Date: Wed, 14 May 2014 14:58:27 +0400
+Subject: [PATCH 01/20] improve pkgconfig module (close #37)
+
+Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
+---
+ Makefile.in | 4 ++++
+ configure.ac | 4 +++-
+ json-parser.pc.in | 10 ++++++++++
+ 3 files changed, 17 insertions(+), 1 deletion(-)
+ create mode 100644 json-parser.pc.in
+
+diff --git a/Makefile.in b/Makefile.in
+index 85e9e38..68e0b33 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -4,6 +4,7 @@ prefix = @prefix@
+
+ includedir = $(DESTDIR)@includedir@
+ libdir = $(DESTDIR)@libdir@
++datadir = $(DESTDIR)@datadir@
+
+ AR = @AR@
+ CC = @CC@
+@@ -40,6 +41,9 @@ clean:
+ rm -f libjsonparser.$(SO_EXT) libjsonparser.a json.o
+
+ install-shared: libjsonparser.$(SO_EXT)
++ @echo Installing pkgconfig module: $(datadir)/pkgconfig/json-parser.pc
++ @install -d $(datadir)/pkgconfig/ || true
++ @install -m 0644 json-parser.pc $(datadir)/pkgconfig/json-parser.pc
+ @echo Installing shared library: $(libdir)/libjsonparser.$(SO_EXT)
+ @install -d $(libdir) || true
+ @install -m 0755 libjsonparser.$(SO_EXT) $(libdir)/$(REAL_NAME)
+diff --git a/configure.ac b/configure.ac
+index 8e73fc3..2111634 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -22,7 +22,9 @@ fi
+
+ AC_SUBST(VERSION_MAJOR, $VERSION_MAJOR)
+
+-AC_CONFIG_FILES([Makefile])
++AC_CONFIG_FILES([
++ Makefile
++ json-parser.pc])
+
+ AC_OUTPUT
+
+diff --git a/json-parser.pc.in b/json-parser.pc.in
+new file mode 100644
+index 0000000..fc743c4
+--- /dev/null
++++ b/json-parser.pc.in
+@@ -0,0 +1,10 @@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@
++
++Name: json-parser
++Description: Very low footprint JSON parser written in portable ANSI C
++Version: @VERSION_MAJOR@
++Libs: -L${libdir} -ljsonparser
++Cflags: -I${includedir}/json-parser
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0002-Prevent-zero-byte-allocations.patch b/debian/patches/upstream/0002-Prevent-zero-byte-allocations.patch
new file mode 100644
index 0000000..6815024
--- /dev/null
+++ b/debian/patches/upstream/0002-Prevent-zero-byte-allocations.patch
@@ -0,0 +1,26 @@
+From 63be13a8b185d2bc0c7b3b2bb7ca1a9a9f0bb0c4 Mon Sep 17 00:00:00 2001
+From: James McLaughlin <james@clickteam.com>
+Date: Mon, 30 Jun 2014 17:24:09 +0100
+Subject: [PATCH 02/20] Prevent zero-byte allocations
+
+---
+ json.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/json.c b/json.c
+index 4fb225e..43439e7 100644
+--- a/json.c
++++ b/json.c
+@@ -87,6 +87,9 @@ static void default_free (void * ptr, void * user_data)
+
+ static void * json_alloc (json_state * state, unsigned long size, int zero)
+ {
++ if (size == 0)
++ size = 1;
++
+ if ((state->ulong_max - state->used_memory) < size)
+ return 0;
+
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0003-Change-to-mboelstra-s-method-of-preventing-zero-byte.patch b/debian/patches/upstream/0003-Change-to-mboelstra-s-method-of-preventing-zero-byte.patch
new file mode 100644
index 0000000..53e39c4
--- /dev/null
+++ b/debian/patches/upstream/0003-Change-to-mboelstra-s-method-of-preventing-zero-byte.patch
@@ -0,0 +1,47 @@
+From 8c4b18f9e2ed91a2edfb3db3e66d459a13aaa2cd Mon Sep 17 00:00:00 2001
+From: James McLaughlin <james@clickteam.com>
+Date: Mon, 30 Jun 2014 17:29:37 +0100
+Subject: [PATCH 03/20] Change to @mboelstra's method of preventing zero byte
+ allocations
+
+---
+ json.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/json.c b/json.c
+index 43439e7..fa784f4 100644
+--- a/json.c
++++ b/json.c
+@@ -87,9 +87,6 @@ static void default_free (void * ptr, void * user_data)
+
+ static void * json_alloc (json_state * state, unsigned long size, int zero)
+ {
+- if (size == 0)
+- size = 1;
+-
+ if ((state->ulong_max - state->used_memory) < size)
+ return 0;
+
+@@ -121,6 +118,9 @@ static int new_value (json_state * state,
+ {
+ case json_array:
+
++ if (value->u.array.length == 0)
++ break;
++
+ if (! (value->u.array.values = (json_value **) json_alloc
+ (state, value->u.array.length * sizeof (json_value *), 0)) )
+ {
+@@ -132,6 +132,9 @@ static int new_value (json_state * state,
+
+ case json_object:
+
++ if (value->u.object.length == 0)
++ break;
++
+ values_size = sizeof (*value->u.object.values) * value->u.object.length;
+
+ if (! ((*(void **) &value->u.object.values) = json_alloc
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0004-Update-AUTHORS-closes-46.patch b/debian/patches/upstream/0004-Update-AUTHORS-closes-46.patch
new file mode 100644
index 0000000..381c8d9
--- /dev/null
+++ b/debian/patches/upstream/0004-Update-AUTHORS-closes-46.patch
@@ -0,0 +1,22 @@
+From a93e866dee8435e8f3b85a0ca2ba048079624d8b Mon Sep 17 00:00:00 2001
+From: James McLaughlin <james@clickteam.com>
+Date: Mon, 30 Jun 2014 17:33:16 +0100
+Subject: [PATCH 04/20] Update AUTHORS (closes #46)
+
+---
+ AUTHORS | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/AUTHORS b/AUTHORS
+index a375bb7..6a5c799 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -16,4 +16,5 @@ Patrick Donnelly
+ Wilmer van der Gaast
+ Jin Wei
+ François Cartegnie
++Matthijs Boelstra
+
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0005-Update-README.md.patch b/debian/patches/upstream/0005-Update-README.md.patch
new file mode 100644
index 0000000..a67355c
--- /dev/null
+++ b/debian/patches/upstream/0005-Update-README.md.patch
@@ -0,0 +1,25 @@
+From 40f05034017166695a41b5933647ee6d6db13cd0 Mon Sep 17 00:00:00 2001
+From: James McLaughlin <james@clickteam.com>
+Date: Thu, 14 Aug 2014 19:47:56 +0100
+Subject: [PATCH 05/20] Update README.md
+
+---
+ README.md | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/README.md b/README.md
+index b1f7565..e0b70b6 100644
+--- a/README.md
++++ b/README.md
+@@ -6,6 +6,8 @@ Very low footprint JSON parser written in portable ANSI C.
+
+ [![Build Status](https://secure.travis-ci.org/udp/json-parser.png)](http://travis-ci.org/udp/json-parser)
+
++_Want to serialize? Check out [json-builder](https://github.com/udp/json-builder)!_
++
+ Installing
+ ----------
+
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0006-Assign-a-name-to-the-json_object_entry-struct-to-sim.patch b/debian/patches/upstream/0006-Assign-a-name-to-the-json_object_entry-struct-to-sim.patch
new file mode 100644
index 0000000..b8a563a
--- /dev/null
+++ b/debian/patches/upstream/0006-Assign-a-name-to-the-json_object_entry-struct-to-sim.patch
@@ -0,0 +1,40 @@
+From 05f2c346d155db8b5b658ec45a51b9ffa2972dbf Mon Sep 17 00:00:00 2001
+From: James McLaughlin <james@clickteam.com>
+Date: Fri, 15 Aug 2014 16:10:15 +0100
+Subject: [PATCH 06/20] Assign a name to the json_object_entry struct to
+ simplify json-builder code
+
+---
+ json.c | 2 +-
+ json.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/json.c b/json.c
+index fa784f4..7eb972b 100644
+--- a/json.c
++++ b/json.c
+@@ -137,7 +137,7 @@ static int new_value (json_state * state,
+
+ values_size = sizeof (*value->u.object.values) * value->u.object.length;
+
+- if (! ((*(void **) &value->u.object.values) = json_alloc
++ if (! (value->u.object.values = (struct json_object_entry *) json_alloc
+ (state, values_size + ((unsigned long) value->u.object.values), 0)) )
+ {
+ return 0;
+diff --git a/json.h b/json.h
+index d565d87..86a9b27 100644
+--- a/json.h
++++ b/json.h
+@@ -112,7 +112,7 @@ typedef struct _json_value
+ {
+ unsigned int length;
+
+- struct
++ struct json_object_entry
+ {
+ json_char * name;
+ unsigned int name_length;
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0007-Move-json_object_entry-out-of-json_value-and-turn-it.patch b/debian/patches/upstream/0007-Move-json_object_entry-out-of-json_value-and-turn-it.patch
new file mode 100644
index 0000000..2a8f0c7
--- /dev/null
+++ b/debian/patches/upstream/0007-Move-json_object_entry-out-of-json_value-and-turn-it.patch
@@ -0,0 +1,72 @@
+From c967d4d86788c50352e8ea4d67c64808a49c6650 Mon Sep 17 00:00:00 2001
+From: James McLaughlin <james@clickteam.com>
+Date: Sat, 16 Aug 2014 12:26:19 +0100
+Subject: [PATCH 07/20] Move json_object_entry out of json_value and turn it
+ into a typedef to allow compiling as C++ again
+
+---
+ json.c | 2 +-
+ json.h | 20 +++++++++++---------
+ 2 files changed, 12 insertions(+), 10 deletions(-)
+
+diff --git a/json.c b/json.c
+index 7eb972b..6012bad 100644
+--- a/json.c
++++ b/json.c
+@@ -137,7 +137,7 @@ static int new_value (json_state * state,
+
+ values_size = sizeof (*value->u.object.values) * value->u.object.length;
+
+- if (! (value->u.object.values = (struct json_object_entry *) json_alloc
++ if (! (value->u.object.values = (json_object_entry *) json_alloc
+ (state, values_size + ((unsigned long) value->u.object.values), 0)) )
+ {
+ return 0;
+diff --git a/json.h b/json.h
+index 86a9b27..f6549ec 100644
+--- a/json.h
++++ b/json.h
+@@ -88,6 +88,15 @@ typedef enum
+ } json_type;
+
+ extern const struct _json_value json_value_none;
++
++typedef struct _json_object_entry
++{
++ json_char * name;
++ unsigned int name_length;
++
++ struct _json_value * value;
++
++} json_object_entry;
+
+ typedef struct _json_value
+ {
+@@ -112,14 +121,7 @@ typedef struct _json_value
+ {
+ unsigned int length;
+
+- struct json_object_entry
+- {
+- json_char * name;
+- unsigned int name_length;
+-
+- struct _json_value * value;
+-
+- } * values;
++ json_object_entry * values;
+
+ #if defined(__cplusplus) && __cplusplus >= 201103L
+ decltype(values) begin () const
+@@ -252,7 +254,7 @@ typedef struct _json_value
+ #endif
+
+ } json_value;
+-
++
+ json_value * json_parse (const json_char * json,
+ size_t length);
+
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0008-Create-test_json.c.patch b/debian/patches/upstream/0008-Create-test_json.c.patch
new file mode 100644
index 0000000..5f0b241
--- /dev/null
+++ b/debian/patches/upstream/0008-Create-test_json.c.patch
@@ -0,0 +1,168 @@
+From 752d852df838b4554730a3ad066da7f1c566d675 Mon Sep 17 00:00:00 2001
+From: pasqumirk <mirko.pasqualetti@gmail.com>
+Date: Tue, 26 Aug 2014 12:35:21 +0200
+Subject: [PATCH 08/20] Create test_json.c
+
+Test file for json.c
+---
+ tests/test_json.c | 148 ++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 148 insertions(+)
+ create mode 100644 tests/test_json.c
+
+diff --git a/tests/test_json.c b/tests/test_json.c
+new file mode 100644
+index 0000000..d8fc957
+--- /dev/null
++++ b/tests/test_json.c
+@@ -0,0 +1,148 @@
++#include <stdio.h>
++#include <stdlib.h>
++#include <sys/stat.h>
++
++#include "json.h"
++
++/*
++ * Test for json.c
++ *
++ * Compile with
++ * gcc -o test_json -g test_json.c json.c -lm
++ *
++ * USAGE: ./test_json <json_file>
++ */
++
++static void print_depth_shift(int depth)
++{
++ int j;
++ for (j=0; j < depth; j++) {
++ printf(" ");
++ }
++}
++
++static void process_value(json_value* value, int depth);
++
++static void process_object(json_value* value, int depth)
++{
++ int length, x;
++ if (value == NULL) {
++ return;
++ }
++ length = value->u.object.length;
++ for (x = 0; x < length; x++) {
++ print_depth_shift(depth);
++ printf("object[%d].name = %s\n", x, value->u.object.values[x].name);
++ process_value(value->u.object.values[x].value, depth+1);
++ }
++}
++
++static void process_array(json_value* value, int depth)
++{
++ int length, x;
++ if (value == NULL) {
++ return;
++ }
++ length = value->u.array.length;
++ printf("array\n");
++ for (x = 0; x < length; x++) {
++ process_value(value->u.array.values[x], depth);
++ }
++}
++
++static void process_value(json_value* value, int depth)
++{
++ int j;
++ if (value == NULL) {
++ return;
++ }
++ if (value->type != json_object) {
++ print_depth_shift(depth);
++ }
++ switch (value->type) {
++ case json_none:
++ printf("none\n");
++ break;
++ case json_object:
++ process_object(value, depth+1);
++ break;
++ case json_array:
++ process_array(value, depth+1);
++ break;
++ case json_integer:
++ printf("int: %d\n", value->u.integer);
++ break;
++ case json_double:
++ printf("double: %f\n", value->u.dbl);
++ break;
++ case json_string:
++ printf("string: %s\n", value->u.string.ptr);
++ break;
++ case json_boolean:
++ printf("bool: %d\n", value->u.boolean);
++ break;
++ }
++}
++
++void main(int argc, char** argv)
++{
++ char* filename;
++ FILE *fp;
++ struct stat filestatus;
++ int file_size;
++ char* file_contents;
++ json_char* json;
++ json_value* value;
++
++ if (argc != 2) {
++ fprintf(stderr, "%s <file_json>\n", argv[0]);
++ exit(1);
++ }
++ filename = argv[1];
++
++ if ( stat(filename, &filestatus) != 0) {
++ fprintf(stderr, "File %s not found\n", filename);
++ exit(1);
++ }
++ file_size = filestatus.st_size;
++ file_contents = (char*)malloc(filestatus.st_size);
++ if ( file_contents == NULL) {
++ fprintf(stderr, "Memory error: unable to allocate %d bytes\n", file_size);
++ exit(1);
++ }
++
++ fp = fopen(filename, "rt");
++ if (fp == NULL) {
++ fprintf(stderr, "Unable to open %s\n", filename);
++ fclose(fp);
++ free(file_contents);
++ exit(1);
++ }
++ if ( fread(file_contents, file_size, 1, fp) != 1 ) {
++ fprintf(stderr, "Unable t read content of %s\n", filename);
++ fclose(fp);
++ free(file_contents);
++ exit(1);
++ }
++ fclose(fp);
++
++ printf("%s\n", file_contents);
++
++ printf("--------------------------------\n\n");
++
++ json = (json_char*)file_contents;
++
++ value = json_parse(json,file_size);
++
++ if (value == NULL) {
++ fprintf(stderr, "Unable to parse data\n");
++ free(file_contents);
++ exit(1);
++ }
++
++ process_value(value, 0);
++
++ json_value_free(value);
++ free(file_contents);
++ exit(0);
++}
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0009-Updated-compile-command-line-in-test_json.c.patch b/debian/patches/upstream/0009-Updated-compile-command-line-in-test_json.c.patch
new file mode 100644
index 0000000..eec8312
--- /dev/null
+++ b/debian/patches/upstream/0009-Updated-compile-command-line-in-test_json.c.patch
@@ -0,0 +1,25 @@
+From df18b3649c007f0015c6bf73f97407c4a2c9f91d Mon Sep 17 00:00:00 2001
+From: Mirko Pasqualetti <m.pasqualetti@engineonline.it>
+Date: Tue, 26 Aug 2014 12:43:03 +0200
+Subject: [PATCH 09/20] Updated compile command line in test_json.c
+
+---
+ tests/test_json.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/test_json.c b/tests/test_json.c
+index d8fc957..7996fec 100644
+--- a/tests/test_json.c
++++ b/tests/test_json.c
+@@ -8,7 +8,7 @@
+ * Test for json.c
+ *
+ * Compile with
+- * gcc -o test_json -g test_json.c json.c -lm
++ * gcc -o test_json -I.. test_json.c ../json.c -lm
+ *
+ * USAGE: ./test_json <json_file>
+ */
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0010-Moved-test_json-in-directory-examples.patch b/debian/patches/upstream/0010-Moved-test_json-in-directory-examples.patch
new file mode 100644
index 0000000..50f67fe
--- /dev/null
+++ b/debian/patches/upstream/0010-Moved-test_json-in-directory-examples.patch
@@ -0,0 +1,109 @@
+From 746414c142243289fdaf0500015d7a7221b16121 Mon Sep 17 00:00:00 2001
+From: Mirko Pasqualetti <m.pasqualetti@engineonline.it>
+Date: Thu, 2 Jul 2015 15:35:55 +0200
+Subject: [PATCH 10/20] Moved test_json in directory examples
+
+---
+ {tests => examples}/test_json.c | 43 ++++++++++++++++++++++++++------
+ 2 files changed, 36 insertions(+), 7 deletions(-)
+ create mode 100755 examples/test_json
+ rename {tests => examples}/test_json.c (70%)
+
+diff --git a/tests/test_json.c b/examples/test_json.c
+similarity index 70%
+rename from tests/test_json.c
+rename to examples/test_json.c
+index 7996fec..936bd88 100644
+--- a/tests/test_json.c
++++ b/examples/test_json.c
+@@ -1,3 +1,32 @@
++/* vim: set et ts=4
++ *
++ * Copyright (C) 2015 Mirko Pasqualetti All rights reserved.
++ * https://github.com/udp/json-parser
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ *
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ *
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <sys/stat.h>
+@@ -84,7 +113,7 @@ static void process_value(json_value* value, int depth)
+ }
+ }
+
+-void main(int argc, char** argv)
++int main(int argc, char** argv)
+ {
+ char* filename;
+ FILE *fp;
+@@ -96,19 +125,19 @@ void main(int argc, char** argv)
+
+ if (argc != 2) {
+ fprintf(stderr, "%s <file_json>\n", argv[0]);
+- exit(1);
++ return 1;
+ }
+ filename = argv[1];
+
+ if ( stat(filename, &filestatus) != 0) {
+ fprintf(stderr, "File %s not found\n", filename);
+- exit(1);
++ return 1;
+ }
+ file_size = filestatus.st_size;
+ file_contents = (char*)malloc(filestatus.st_size);
+ if ( file_contents == NULL) {
+ fprintf(stderr, "Memory error: unable to allocate %d bytes\n", file_size);
+- exit(1);
++ return 1;
+ }
+
+ fp = fopen(filename, "rt");
+@@ -116,13 +145,13 @@ void main(int argc, char** argv)
+ fprintf(stderr, "Unable to open %s\n", filename);
+ fclose(fp);
+ free(file_contents);
+- exit(1);
++ return 1;
+ }
+ if ( fread(file_contents, file_size, 1, fp) != 1 ) {
+ fprintf(stderr, "Unable t read content of %s\n", filename);
+ fclose(fp);
+ free(file_contents);
+- exit(1);
++ return 1;
+ }
+ fclose(fp);
+
+@@ -144,5 +173,5 @@ void main(int argc, char** argv)
+
+ json_value_free(value);
+ free(file_contents);
+- exit(0);
++ return 0;
+ }
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0012-make-test.py-compliant-to-python3-add-.gitignore.patch b/debian/patches/upstream/0012-make-test.py-compliant-to-python3-add-.gitignore.patch
new file mode 100644
index 0000000..6147ad1
--- /dev/null
+++ b/debian/patches/upstream/0012-make-test.py-compliant-to-python3-add-.gitignore.patch
@@ -0,0 +1,92 @@
+From a350027f9faa3a2da842b128c479e4bd78e7a6ea Mon Sep 17 00:00:00 2001
+From: Hannes Gredler <hannes@rtbrick.com>
+Date: Sat, 26 Sep 2015 06:46:35 +0000
+Subject: [PATCH 12/20] make test.py compliant to python3, add .gitignore
+
+---
+ .gitignore | 6 ++++++
+ tests/test.py | 20 ++++++++++----------
+ 2 files changed, 16 insertions(+), 10 deletions(-)
+ create mode 100644 .gitignore
+
+diff --git a/.gitignore b/.gitignore
+new file mode 100644
+index 0000000..f07dfa0
+--- /dev/null
++++ b/.gitignore
+@@ -0,0 +1,6 @@
++Makefile
++config.log
++config.status
++json.o
++libjsonparser.a
++libjsonparser.so
+diff --git a/tests/test.py b/tests/test.py
+index 5d6218b..338dcbc 100755
+--- a/tests/test.py
++++ b/tests/test.py
+@@ -16,7 +16,7 @@ for i, test in enumerate(
+ try:
+ jsonparser.decode(test)
+ except jsonparser.JSONException as error:
+- print 'valid/%d : Failed with error: %s' % (i, error)
++ print ('valid/%d : Failed with error: %s' % (i, error))
+ continue
+
+ py_decoded = json.loads(test)
+@@ -25,13 +25,13 @@ for i, test in enumerate(
+ try:
+ reencoded = jsonparser.decode(py_reencoded)
+ except jsonparser.JSONException as error:
+- print 'valid/%d : Failed on re-encoded version with error: %s' % (i, error)
++ print ('valid/%d : Failed on re-encoded version with error: %s' % (i, error))
+ continue
+
+ if reencoded != py_decoded:
+- print 'valid/%d : %s:\n\n%s\n\nbecame\n\n%s\n' % (i, failed, test, reencoded)
++ print ('valid/%d : %s:\n\n%s\n\nbecame\n\n%s\n' % (i, failed, test, reencoded))
+ else:
+- print 'valid/%d : %s' % (i, passed)
++ print ('valid/%d : %s' % (i, passed))
+
+ for i, test in enumerate(
+ map(lambda file: open(file).read(), sorted(glob.glob('invalid*.json')))):
+@@ -39,10 +39,10 @@ for i, test in enumerate(
+ try:
+ jsonparser.decode(test)
+ except jsonparser.JSONException as error:
+- print 'invalid/%d : %s: %s' % (i, passed, error)
++ print ('invalid/%d : %s: %s' % (i, passed, error))
+ continue
+
+- print 'invalid/%d : %s (parsing succeeded and shouldn\'t have)' % (i, failed)
++ print ('invalid/%d : %s (parsing succeeded and shouldn\'t have)' % (i, failed))
+
+
+ # Extension tests
+@@ -52,9 +52,9 @@ for i, test in enumerate(
+
+ try:
+ decoded = jsonparser.decode(test)
+- print 'ext-valid/%d : %s: %s' % (i, passed, json.dumps(decoded))
++ print ('ext-valid/%d : %s: %s' % (i, passed, json.dumps(decoded)))
+ except jsonparser.JSONException as error:
+- print 'ext-valid/%d : Failed with error: %s' % (i, error)
++ print ('ext-valid/%d : Failed with error: %s' % (i, error))
+ continue
+
+ for i, test in enumerate(
+@@ -63,8 +63,8 @@ for i, test in enumerate(
+ try:
+ jsonparser.decode(test)
+ except jsonparser.JSONException as error:
+- print 'ext-invalid/%d : %s: %s' % (i, passed, error)
++ print ('ext-invalid/%d : %s: %s' % (i, passed, error))
+ continue
+
+- print 'ext-invalid/%d : %s (parsing succeeded and shouldn\'t have)' % (i, failed)
++ print ('ext-invalid/%d : %s (parsing succeeded and shouldn\'t have)' % (i, failed))
+
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0013-make-test_json-compile-without-warnings-on-64-Bit-pl.patch b/debian/patches/upstream/0013-make-test_json-compile-without-warnings-on-64-Bit-pl.patch
new file mode 100644
index 0000000..9a45ea6
--- /dev/null
+++ b/debian/patches/upstream/0013-make-test_json-compile-without-warnings-on-64-Bit-pl.patch
@@ -0,0 +1,36 @@
+From 183c5824433c83af1d5f947c823d822365adbae0 Mon Sep 17 00:00:00 2001
+From: Hannes Gredler <hannes@rtbrick.com>
+Date: Sat, 26 Sep 2015 12:41:41 +0000
+Subject: [PATCH 13/20] make test_json compile without warnings on 64-Bit
+ platforms
+
+---
+ .gitignore | 1 +
+ examples/test_json.c | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/.gitignore b/.gitignore
+index f07dfa0..8352bae 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -4,3 +4,4 @@ config.status
+ json.o
+ libjsonparser.a
+ libjsonparser.so
++test_json
+diff --git a/examples/test_json.c b/examples/test_json.c
+index 936bd88..7306a8b 100644
+--- a/examples/test_json.c
++++ b/examples/test_json.c
+@@ -99,7 +99,7 @@ static void process_value(json_value* value, int depth)
+ process_array(value, depth+1);
+ break;
+ case json_integer:
+- printf("int: %d\n", value->u.integer);
++ printf("int: %10" PRId64 "\n", value->u.integer);
+ break;
+ case json_double:
+ printf("double: %f\n", value->u.dbl);
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0014-add-instructions-how-to-compile-example-test_json-fo.patch b/debian/patches/upstream/0014-add-instructions-how-to-compile-example-test_json-fo.patch
new file mode 100644
index 0000000..acc1718
--- /dev/null
+++ b/debian/patches/upstream/0014-add-instructions-how-to-compile-example-test_json-fo.patch
@@ -0,0 +1,31 @@
+From 555f3cad2a132625eee143fe6bf755c696410754 Mon Sep 17 00:00:00 2001
+From: Hannes Gredler <hannes@rtbrick.com>
+Date: Sat, 26 Sep 2015 12:47:15 +0000
+Subject: [PATCH 14/20] add instructions how to compile example test_json for
+ dynamic linking
+
+---
+ examples/test_json.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/examples/test_json.c b/examples/test_json.c
+index 7306a8b..796f8e7 100644
+--- a/examples/test_json.c
++++ b/examples/test_json.c
+@@ -36,9 +36,12 @@
+ /*
+ * Test for json.c
+ *
+- * Compile with
++ * Compile (static linking) with
+ * gcc -o test_json -I.. test_json.c ../json.c -lm
+ *
++ * Compile (dynamic linking) with
++ * gcc -o test_json -I.. test_json.c -lm -ljsonparser
++ *
+ * USAGE: ./test_json <json_file>
+ */
+
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0015-Fix-52-based-on-suggestions-from-kcm1700.patch b/debian/patches/upstream/0015-Fix-52-based-on-suggestions-from-kcm1700.patch
new file mode 100644
index 0000000..ab11349
--- /dev/null
+++ b/debian/patches/upstream/0015-Fix-52-based-on-suggestions-from-kcm1700.patch
@@ -0,0 +1,111 @@
+From 51ac0646d6eab79e526ee7eb5a6d0dbbb3bad79f Mon Sep 17 00:00:00 2001
+From: Richard Selneck <blakpilar@gmail.com>
+Date: Sat, 20 Feb 2016 14:58:37 -0500
+Subject: [PATCH 15/20] Fix #52 based on suggestions from @kcm1700
+
+---
+ json.c | 35 +++++++++++++++++++++++++++--------
+ 1 file changed, 27 insertions(+), 8 deletions(-)
+
+diff --git a/json.c b/json.c
+index 6012bad..e1913fc 100644
+--- a/json.c
++++ b/json.c
+@@ -41,6 +41,7 @@ const struct _json_value json_value_none;
+ #include <string.h>
+ #include <ctype.h>
+ #include <math.h>
++#include <stdint.h>
+
+ typedef unsigned int json_uchar;
+
+@@ -60,6 +61,11 @@ static unsigned char hex_value (json_char c)
+ }
+ }
+
++static int would_overflow (long long value, json_char b)
++{
++ return ( ( INT64_MAX - ( b - '0' ) ) / 10 ) < value;
++}
++
+ typedef struct
+ {
+ unsigned long used_memory;
+@@ -216,7 +222,8 @@ static const long
+ flag_num_e_got_sign = 1 << 11,
+ flag_num_e_negative = 1 << 12,
+ flag_line_comment = 1 << 13,
+- flag_block_comment = 1 << 14;
++ flag_block_comment = 1 << 14,
++ flag_num_got_decimal = 1 << 15;
+
+ json_value * json_parse_ex (json_settings * settings,
+ const json_char * json,
+@@ -227,9 +234,9 @@ json_value * json_parse_ex (json_settings * settings,
+ const json_char * end;
+ json_value * top, * root, * alloc = 0;
+ json_state state = { 0 };
+- long flags;
+- long num_digits = 0, num_e = 0;
+- json_int_t num_fraction = 0;
++ long flags = 0;
++ double num_digits = 0, num_e = 0;
++ double num_fraction = 0;
+
+ /* Skip UTF-8 BOM
+ */
+@@ -756,11 +763,23 @@ json_value * json_parse_ex (json_settings * settings,
+ continue;
+ }
+
++ if (would_overflow(top->u.integer, b))
++ { -- num_digits;
++ -- state.ptr;
++ top->type = json_double;
++ top->u.dbl = (double)top->u.integer;
++ continue;
++ }
++
+ top->u.integer = (top->u.integer * 10) + (b - '0');
+ continue;
+ }
+
+- num_fraction = (num_fraction * 10) + (b - '0');
++ if (flags & flag_num_got_decimal)
++ num_fraction = (num_fraction * 10) + (b - '0');
++ else
++ top->u.dbl = (top->u.dbl * 10) + (b - '0');
++
+ continue;
+ }
+
+@@ -786,6 +805,7 @@ json_value * json_parse_ex (json_settings * settings,
+ top->type = json_double;
+ top->u.dbl = (double) top->u.integer;
+
++ flags |= flag_num_got_decimal;
+ num_digits = 0;
+ continue;
+ }
+@@ -799,7 +819,7 @@ json_value * json_parse_ex (json_settings * settings,
+ goto e_failed;
+ }
+
+- top->u.dbl += ((double) num_fraction) / (pow (10.0, (double) num_digits));
++ top->u.dbl += num_fraction / pow (10.0, num_digits);
+ }
+
+ if (b == 'e' || b == 'E')
+@@ -825,8 +845,7 @@ json_value * json_parse_ex (json_settings * settings,
+ goto e_failed;
+ }
+
+- top->u.dbl *= pow (10.0, (double)
+- (flags & flag_num_e_negative ? - num_e : num_e));
++ top->u.dbl *= pow (10.0, (flags & flag_num_e_negative ? - num_e : num_e));
+ }
+
+ if (flags & flag_num_negative)
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0016-Remove-stdint.h-dependency-use-json_int_t-instead-of.patch b/debian/patches/upstream/0016-Remove-stdint.h-dependency-use-json_int_t-instead-of.patch
new file mode 100644
index 0000000..98a8c01
--- /dev/null
+++ b/debian/patches/upstream/0016-Remove-stdint.h-dependency-use-json_int_t-instead-of.patch
@@ -0,0 +1,43 @@
+From 71ae36907a58ade3adcf9a6debc7eb22d8df55e5 Mon Sep 17 00:00:00 2001
+From: Richard Selneck <blakpilar@gmail.com>
+Date: Sat, 20 Feb 2016 15:32:19 -0500
+Subject: [PATCH 16/20] Remove stdint.h dependency, use json_int_t instead of
+ long long
+
+---
+ json.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/json.c b/json.c
+index e1913fc..acf1230 100644
+--- a/json.c
++++ b/json.c
+@@ -41,10 +41,12 @@ const struct _json_value json_value_none;
+ #include <string.h>
+ #include <ctype.h>
+ #include <math.h>
+-#include <stdint.h>
+
+ typedef unsigned int json_uchar;
+
++// Adapted from http://stackoverflow.com/a/31902428
++static const json_int_t JSON_INT_MAX = (((unsigned json_int_t)0 - (unsigned json_int_t)1) / (unsigned json_int_t)2);
++
+ static unsigned char hex_value (json_char c)
+ {
+ if (isdigit(c))
+@@ -61,9 +63,9 @@ static unsigned char hex_value (json_char c)
+ }
+ }
+
+-static int would_overflow (long long value, json_char b)
++static int would_overflow (json_int_t value, json_char b)
+ {
+- return ( ( INT64_MAX - ( b - '0' ) ) / 10 ) < value;
++ return ((JSON_INT_MAX - (b - '0')) / 10 ) < value;
+ }
+
+ typedef struct
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0017-Fix-Travis-CI-error-dynamically-determine-int-max.patch b/debian/patches/upstream/0017-Fix-Travis-CI-error-dynamically-determine-int-max.patch
new file mode 100644
index 0000000..2dd14bd
--- /dev/null
+++ b/debian/patches/upstream/0017-Fix-Travis-CI-error-dynamically-determine-int-max.patch
@@ -0,0 +1,50 @@
+From fcfa74885dc324a2b49ad0aee96b59de8b09ab40 Mon Sep 17 00:00:00 2001
+From: Richard Selneck <blakpilar@gmail.com>
+Date: Sun, 21 Feb 2016 11:32:58 -0500
+Subject: [PATCH 17/20] Fix Travis CI error, dynamically determine int max
+
+---
+ json.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/json.c b/json.c
+index acf1230..414f18e 100644
+--- a/json.c
++++ b/json.c
+@@ -33,6 +33,7 @@
+ #ifndef _CRT_SECURE_NO_WARNINGS
+ #define _CRT_SECURE_NO_WARNINGS
+ #endif
++ #include <stdint.h>
+ #endif
+
+ const struct _json_value json_value_none;
+@@ -44,8 +45,14 @@ const struct _json_value json_value_none;
+
+ typedef unsigned int json_uchar;
+
+-// Adapted from http://stackoverflow.com/a/31902428
+-static const json_int_t JSON_INT_MAX = (((unsigned json_int_t)0 - (unsigned json_int_t)1) / (unsigned json_int_t)2);
++/* There has to be a better way to do this */
++static const json_int_t JSON_INT_MAX = sizeof(json_int_t) == 1
++ ? INT8_MAX
++ : (sizeof(json_int_t) == 2
++ ? INT16_MAX
++ : (sizeof(json_int_t) == 4
++ ? INT32_MAX
++ : INT64_MAX));
+
+ static unsigned char hex_value (json_char c)
+ {
+@@ -65,7 +72,7 @@ static unsigned char hex_value (json_char c)
+
+ static int would_overflow (json_int_t value, json_char b)
+ {
+- return ((JSON_INT_MAX - (b - '0')) / 10 ) < value;
++ return ((JSON_INT_MAX - (b - '0')) / 10 ) < value;
+ }
+
+ typedef struct
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0018-Regenerate-configure-so-make-install-won-t-complain-.patch b/debian/patches/upstream/0018-Regenerate-configure-so-make-install-won-t-complain-.patch
new file mode 100644
index 0000000..1cd8404
--- /dev/null
+++ b/debian/patches/upstream/0018-Regenerate-configure-so-make-install-won-t-complain-.patch
@@ -0,0 +1,421 @@
+From 13b18047fa2b7ca1af2e3c6ac2586a9d9258e1d2 Mon Sep 17 00:00:00 2001
+From: Lewis Liu <rhinoceromirinda@gmail.com>
+Date: Tue, 11 Oct 2016 23:03:38 +0800
+Subject: [PATCH 18/20] Regenerate "configure" so make install won't complain
+ about missing "json-parser.pc" file.
+
+---
+ configure | 192 ++++++++++++++++++++++++++----------------------------
+ 1 file changed, 94 insertions(+), 98 deletions(-)
+
+diff --git a/configure b/configure
+index 5529ffe..ae24674 100755
+--- a/configure
++++ b/configure
+@@ -1,9 +1,11 @@
+ #! /bin/sh
+ # Guess values for system-dependent variables and create Makefiles.
+-# Generated by GNU Autoconf 2.69 for libjsonparser 1.1.0.
++# Generated by GNU Autoconf 2.68 for libjsonparser 1.1.0.
+ #
+ #
+-# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
++# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
++# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
++# Foundation, Inc.
+ #
+ #
+ # This configure script is free software; the Free Software Foundation
+@@ -132,31 +134,6 @@ export LANGUAGE
+ # CDPATH.
+ (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+-# Use a proper internal environment variable to ensure we don't fall
+- # into an infinite loop, continuously re-executing ourselves.
+- if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+- _as_can_reexec=no; export _as_can_reexec;
+- # We cannot yet assume a decent shell, so we have to provide a
+-# neutralization value for shells without unset; and this also
+-# works around shells that cannot unset nonexistent variables.
+-# Preserve -v and -x to the replacement shell.
+-BASH_ENV=/dev/null
+-ENV=/dev/null
+-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+-case $- in # ((((
+- *v*x* | *x*v* ) as_opts=-vx ;;
+- *v* ) as_opts=-v ;;
+- *x* ) as_opts=-x ;;
+- * ) as_opts= ;;
+-esac
+-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+-# Admittedly, this is quite paranoid, since all the known shells bail
+-# out after a failed `exec'.
+-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+-as_fn_exit 255
+- fi
+- # We don't want this to propagate to other subprocesses.
+- { _as_can_reexec=; unset _as_can_reexec;}
+ if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+@@ -190,8 +167,7 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+ else
+ exitcode=1; echo positional parameters were not saved.
+ fi
+-test x\$exitcode = x0 || exit 1
+-test -x / || exit 1"
++test x\$exitcode = x0 || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+@@ -235,25 +211,21 @@ IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+- export CONFIG_SHELL
+- # We cannot yet assume a decent shell, so we have to provide a
+-# neutralization value for shells without unset; and this also
+-# works around shells that cannot unset nonexistent variables.
+-# Preserve -v and -x to the replacement shell.
+-BASH_ENV=/dev/null
+-ENV=/dev/null
+-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+-case $- in # ((((
+- *v*x* | *x*v* ) as_opts=-vx ;;
+- *v* ) as_opts=-v ;;
+- *x* ) as_opts=-x ;;
+- * ) as_opts= ;;
+-esac
+-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+-# Admittedly, this is quite paranoid, since all the known shells bail
+-# out after a failed `exec'.
+-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+-exit 255
++ # We cannot yet assume a decent shell, so we have to provide a
++ # neutralization value for shells without unset; and this also
++ # works around shells that cannot unset nonexistent variables.
++ # Preserve -v and -x to the replacement shell.
++ BASH_ENV=/dev/null
++ ENV=/dev/null
++ (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
++ export CONFIG_SHELL
++ case $- in # ((((
++ *v*x* | *x*v* ) as_opts=-vx ;;
++ *v* ) as_opts=-v ;;
++ *x* ) as_opts=-x ;;
++ * ) as_opts= ;;
++ esac
++ exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+ fi
+
+ if test x$as_have_required = xno; then :
+@@ -355,14 +327,6 @@ $as_echo X"$as_dir" |
+
+
+ } # as_fn_mkdir_p
+-
+-# as_fn_executable_p FILE
+-# -----------------------
+-# Test if FILE is an executable regular file.
+-as_fn_executable_p ()
+-{
+- test -f "$1" && test -x "$1"
+-} # as_fn_executable_p
+ # as_fn_append VAR VALUE
+ # ----------------------
+ # Append the text in VALUE to the end of the definition contained in VAR. Take
+@@ -484,10 +448,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+- # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+- # already done that, so ensure we don't try to do so again and fall
+- # in an infinite loop. This has already happened in practice.
+- _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+@@ -522,16 +482,16 @@ if (echo >conf$$.file) 2>/dev/null; then
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+- # In both cases, we have to default to `cp -pR'.
++ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+- as_ln_s='cp -pR'
++ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+- as_ln_s='cp -pR'
++ as_ln_s='cp -p'
+ fi
+ else
+- as_ln_s='cp -pR'
++ as_ln_s='cp -p'
+ fi
+ rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+ rmdir conf$$.dir 2>/dev/null
+@@ -543,8 +503,28 @@ else
+ as_mkdir_p=false
+ fi
+
+-as_test_x='test -x'
+-as_executable_p=as_fn_executable_p
++if test -x / >/dev/null 2>&1; then
++ as_test_x='test -x'
++else
++ if ls -dL / >/dev/null 2>&1; then
++ as_ls_L_option=L
++ else
++ as_ls_L_option=
++ fi
++ as_test_x='
++ eval sh -c '\''
++ if test -d "$1"; then
++ test -d "$1/.";
++ else
++ case $1 in #(
++ -*)set "./$1";;
++ esac;
++ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
++ ???[sx]*):;;*)false;;esac;fi
++ '\'' sh
++ '
++fi
++as_executable_p=$as_test_x
+
+ # Sed expression to map a string onto a valid CPP name.
+ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+@@ -1098,6 +1078,8 @@ target=$target_alias
+ if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
++ $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
++ If a cross compiler is detected then cross compile mode will be used" >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+@@ -1331,9 +1313,9 @@ test -n "$ac_init_help" && exit $ac_status
+ if $ac_init_version; then
+ cat <<\_ACEOF
+ libjsonparser configure 1.1.0
+-generated by GNU Autoconf 2.69
++generated by GNU Autoconf 2.68
+
+-Copyright (C) 2012 Free Software Foundation, Inc.
++Copyright (C) 2010 Free Software Foundation, Inc.
+ This configure script is free software; the Free Software Foundation
+ gives unlimited permission to copy, distribute and modify it.
+ _ACEOF
+@@ -1386,7 +1368,7 @@ This file contains any messages produced by compilers while
+ running configure, to aid debugging if configure makes a mistake.
+
+ It was created by libjsonparser $as_me 1.1.0, which was
+-generated by GNU Autoconf 2.69. Invocation command line was
++generated by GNU Autoconf 2.68. Invocation command line was
+
+ $ $0 $@
+
+@@ -1733,7 +1715,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
+ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+-VERSION_MAJOR="1.0"
++VERSION_MAJOR="1.1"
+
+
+
+@@ -1759,7 +1741,7 @@ do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+@@ -1799,7 +1781,7 @@ do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+@@ -1852,7 +1834,7 @@ do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+@@ -1893,7 +1875,7 @@ do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+@@ -1951,7 +1933,7 @@ do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+@@ -1995,7 +1977,7 @@ do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+@@ -2441,7 +2423,8 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+ #include <stdarg.h>
+ #include <stdio.h>
+-struct stat;
++#include <sys/types.h>
++#include <sys/stat.h>
+ /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+ struct buf { int x; };
+ FILE * (*rcsopen) (struct buf *, struct stat *, int);
+@@ -2543,7 +2526,7 @@ do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+@@ -2583,7 +2566,7 @@ do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+@@ -2635,7 +2618,7 @@ fi
+ VERSION_MAJOR=$VERSION_MAJOR
+
+
+-ac_config_files="$ac_config_files Makefile"
++ac_config_files="$ac_config_files Makefile json-parser.pc"
+
+
+ cat >confcache <<\_ACEOF
+@@ -3081,16 +3064,16 @@ if (echo >conf$$.file) 2>/dev/null; then
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+- # In both cases, we have to default to `cp -pR'.
++ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+- as_ln_s='cp -pR'
++ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+- as_ln_s='cp -pR'
++ as_ln_s='cp -p'
+ fi
+ else
+- as_ln_s='cp -pR'
++ as_ln_s='cp -p'
+ fi
+ rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+ rmdir conf$$.dir 2>/dev/null
+@@ -3150,16 +3133,28 @@ else
+ as_mkdir_p=false
+ fi
+
+-
+-# as_fn_executable_p FILE
+-# -----------------------
+-# Test if FILE is an executable regular file.
+-as_fn_executable_p ()
+-{
+- test -f "$1" && test -x "$1"
+-} # as_fn_executable_p
+-as_test_x='test -x'
+-as_executable_p=as_fn_executable_p
++if test -x / >/dev/null 2>&1; then
++ as_test_x='test -x'
++else
++ if ls -dL / >/dev/null 2>&1; then
++ as_ls_L_option=L
++ else
++ as_ls_L_option=
++ fi
++ as_test_x='
++ eval sh -c '\''
++ if test -d "$1"; then
++ test -d "$1/.";
++ else
++ case $1 in #(
++ -*)set "./$1";;
++ esac;
++ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
++ ???[sx]*):;;*)false;;esac;fi
++ '\'' sh
++ '
++fi
++as_executable_p=$as_test_x
+
+ # Sed expression to map a string onto a valid CPP name.
+ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+@@ -3181,7 +3176,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ # values after options handling.
+ ac_log="
+ This file was extended by libjsonparser $as_me 1.1.0, which was
+-generated by GNU Autoconf 2.69. Invocation command line was
++generated by GNU Autoconf 2.68. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+@@ -3234,10 +3229,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ ac_cs_version="\\
+ libjsonparser config.status 1.1.0
+-configured by $0, generated by GNU Autoconf 2.69,
++configured by $0, generated by GNU Autoconf 2.68,
+ with options \\"\$ac_cs_config\\"
+
+-Copyright (C) 2012 Free Software Foundation, Inc.
++Copyright (C) 2010 Free Software Foundation, Inc.
+ This config.status script is free software; the Free Software Foundation
+ gives unlimited permission to copy, distribute and modify it."
+
+@@ -3314,7 +3309,7 @@ fi
+ _ACEOF
+ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ if \$ac_cs_recheck; then
+- set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
++ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+@@ -3344,6 +3339,7 @@ for ac_config_target in $ac_config_targets
+ do
+ case $ac_config_target in
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
++ "json-parser.pc") CONFIG_FILES="$CONFIG_FILES json-parser.pc" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0019-Fix-buffer-overrun-in-truncated-unicode-escape-seque.patch b/debian/patches/upstream/0019-Fix-buffer-overrun-in-truncated-unicode-escape-seque.patch
new file mode 100644
index 0000000..e0ba0ed
--- /dev/null
+++ b/debian/patches/upstream/0019-Fix-buffer-overrun-in-truncated-unicode-escape-seque.patch
@@ -0,0 +1,35 @@
+From b42439a2927a879f40698e4861e727c4265c13e6 Mon Sep 17 00:00:00 2001
+From: James Alastair McLaughlin <james@clickteam.com>
+Date: Thu, 22 Feb 2018 17:25:40 +0000
+Subject: [PATCH 19/20] Fix buffer overrun in truncated unicode escape
+ sequences
+
+---
+ json.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/json.c b/json.c
+index 6012bad..c44b84e 100644
+--- a/json.c
++++ b/json.c
+@@ -297,7 +297,7 @@ json_value * json_parse_ex (json_settings * settings,
+ case 't': string_add ('\t'); break;
+ case 'u':
+
+- if (end - state.ptr < 4 ||
++ if (end - state.ptr <= 4 ||
+ (uc_b1 = hex_value (*++ state.ptr)) == 0xFF ||
+ (uc_b2 = hex_value (*++ state.ptr)) == 0xFF ||
+ (uc_b3 = hex_value (*++ state.ptr)) == 0xFF ||
+@@ -314,7 +314,7 @@ json_value * json_parse_ex (json_settings * settings,
+ if ((uchar & 0xF800) == 0xD800) {
+ json_uchar uchar2;
+
+- if (end - state.ptr < 6 || (*++ state.ptr) != '\\' || (*++ state.ptr) != 'u' ||
++ if (end - state.ptr <= 6 || (*++ state.ptr) != '\\' || (*++ state.ptr) != 'u' ||
+ (uc_b1 = hex_value (*++ state.ptr)) == 0xFF ||
+ (uc_b2 = hex_value (*++ state.ptr)) == 0xFF ||
+ (uc_b3 = hex_value (*++ state.ptr)) == 0xFF ||
+--
+2.26.1
+
diff --git a/debian/patches/upstream/0020-Update-AUTHORS.patch b/debian/patches/upstream/0020-Update-AUTHORS.patch
new file mode 100644
index 0000000..5c1fd68
--- /dev/null
+++ b/debian/patches/upstream/0020-Update-AUTHORS.patch
@@ -0,0 +1,22 @@
+From e6426aefb6ded8dcc549d847e2a453aea5dd04a6 Mon Sep 17 00:00:00 2001
+From: James Alastair McLaughlin <james@mclgh.net>
+Date: Tue, 9 Jul 2019 23:44:08 +0100
+Subject: [PATCH 20/20] Update AUTHORS
+
+---
+ AUTHORS | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/AUTHORS b/AUTHORS
+index 6a5c799..17da278 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -17,4 +17,5 @@ Wilmer van der Gaast
+ Jin Wei
+ François Cartegnie
+ Matthijs Boelstra
++Richard Selneck
+
+--
+2.26.1
+
diff --git a/debian/patches/vlc/0001-json-fix-fall-through-warnings.patch b/debian/patches/vlc/0001-json-fix-fall-through-warnings.patch
new file mode 100644
index 0000000..e828559
--- /dev/null
+++ b/debian/patches/vlc/0001-json-fix-fall-through-warnings.patch
@@ -0,0 +1,32 @@
+From 1208307f6f3c4c7b6f58a71bdfe75c71977221e6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
+Date: Fri, 7 Jul 2017 21:02:14 +0300
+Subject: [PATCH 1/2] json: fix fall through warnings
+
+---
+ json.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/json.c b/json.c
+index eb0d5f7..415cf24 100644
+--- a/json.c
++++ b/json.c
+@@ -208,6 +208,7 @@ static int new_value (json_state * state,
+
+ #define whitespace \
+ case '\n': ++ state.cur_line; state.cur_col = 0; \
++ /* fall through */ \
+ case ' ': case '\t': case '\r'
+
+ #define string_add(b) \
+@@ -739,6 +740,7 @@ json_value * json_parse_ex (json_settings * settings,
+ break;
+ }
+
++ /* fall through */
+ default:
+ sprintf (error, "%d:%d: Unexpected `%c` in object", line_and_col, b);
+ goto e_failed;
+--
+2.26.1
+
diff --git a/debian/rules b/debian/rules
index dd110d3..6b5e485 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,7 +5,7 @@
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
-export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+export DEB_LDFLAGS_MAINT_APPEND =
%:
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..e13af1b
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: unittest.sh
+Depends: @builddeps@, libjsonparser-dev
diff --git a/debian/tests/unittest.sh b/debian/tests/unittest.sh
new file mode 100755
index 0000000..e01019c
--- /dev/null
+++ b/debian/tests/unittest.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -e
+
+cd tests
+gcc -o test_json -I.. ../examples/test_json.c -lm -ljsonparser
+for i in invalid-*.json; do
+ if ./test_json $i > /dev/null 2>&1 ; then
+ exit 1
+ fi
+done
+for i in valid-*.json; do
+ if ! ./test_json $i > /dev/null 2>&1 ; then
+ exit 1
+ fi
+done
+rm test_json
+exit 0
diff --git a/debian/upstream/metadata b/debian/upstream/metadata
new file mode 100644
index 0000000..aebd3c8
--- /dev/null
+++ b/debian/upstream/metadata
@@ -0,0 +1,4 @@
+Bug-Database: https://github.com/udp/json-parser/issues
+Bug-Submit: https://github.com/udp/json-parser/issues/new
+Repository: https://github.com/udp/json-parser.git
+Repository-Browse: https://github.com/udp/json-parser