Browse Source

Make jshn use 64bit integers

Matthias Schiffer 10 years ago
parent
commit
c12508ef57
1 changed files with 40 additions and 0 deletions
  1. 40 0
      patches/openwrt/0008-libubox-jshn-increase-int-width-to-64bit.patch

+ 40 - 0
patches/openwrt/0008-libubox-jshn-increase-int-width-to-64bit.patch

@@ -0,0 +1,40 @@
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Thu, 13 Feb 2014 19:33:07 +0100
+Subject: libubox: jshn: increase int width to 64bit
+
+diff --git a/package/libubox/patches/001-jshn-increase-int-width-to-64bit.patch b/package/libubox/patches/001-jshn-increase-int-width-to-64bit.patch
+new file mode 100644
+index 0000000..0fc8977
+--- /dev/null
++++ b/package/libubox/patches/001-jshn-increase-int-width-to-64bit.patch
+@@ -0,0 +1,30 @@
++From e90344324b07aea040d818ec7eadb814570fa691 Mon Sep 17 00:00:00 2001
++Message-Id: <e90344324b07aea040d818ec7eadb814570fa691.1392316273.git.mschiffer@universe-factory.net>
++From: Matthias Schiffer <mschiffer@universe-factory.net>
++Date: Thu, 13 Feb 2014 19:30:06 +0100
++Subject: [PATCH] jshn: increase int width to 64bit
++
++---
++ jshn.c | 4 ++--
++ 1 file changed, 2 insertions(+), 2 deletions(-)
++
++--- a/jshn.c
+++++ b/jshn.c
++@@ -142,7 +142,7 @@ static int add_json_element(const char *
++ 		fprintf(stdout, "' %d;\n", json_object_get_boolean(obj));
++ 		break;
++ 	case json_type_int:
++-		fprintf(stdout, "' %d;\n", json_object_get_int(obj));
+++		fprintf(stdout, "' %lld;\n", (long long)json_object_get_int64(obj));
++ 		break;
++ 	case json_type_double:
++ 		fprintf(stdout, "' %lf;\n", json_object_get_double(obj));
++@@ -217,7 +217,7 @@ static void jshn_add_object_var(json_obj
++ 	} else if (!strcmp(type, "string")) {
++ 		new = json_object_new_string(var);
++ 	} else if (!strcmp(type, "int")) {
++-		new = json_object_new_int(atoi(var));
+++		new = json_object_new_int64(atoll(var));
++ 	} else if (!strcmp(type, "double")) {
++ 		new = json_object_new_double(strtod(var, NULL));
++ 	} else if (!strcmp(type, "boolean")) {