summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVipul Rahane <vipul@runtime.io>2016-05-16 14:38:33 -0700
committerVipul Rahane <vipul@runtime.io>2016-05-16 14:38:33 -0700
commit19ccd6894302982f39cd40b87b41753c9023de2c (patch)
tree4ddb6dd0d3c66dc8c52bf21d796782eaac4bd854
parented16b3f2e21809b68f45b10777cfb1331be0f697 (diff)
Fixing json issues
- Changing json_attr to handle uint64/int64 while decoding - Changing imgmgr and imgmgr_fs to have uint64/int64 attributes
-rw-r--r--libs/imgmgr/src/imgmgr.c4
-rw-r--r--libs/imgmgr/src/imgmgr_fs.c6
-rw-r--r--libs/json/include/json/json.h8
-rw-r--r--libs/json/src/json_encode.c1
-rw-r--r--libs/newtmgr/src/newtmgr.c2
5 files changed, 11 insertions, 10 deletions
diff --git a/libs/imgmgr/src/imgmgr.c b/libs/imgmgr/src/imgmgr.c
index ef42cd55..eb192a0c 100644
--- a/libs/imgmgr/src/imgmgr.c
+++ b/libs/imgmgr/src/imgmgr.c
@@ -150,8 +150,8 @@ static int
imgr_upload(struct nmgr_jbuf *njb)
{
char img_data[BASE64_ENCODE_SIZE(IMGMGR_NMGR_MAX_MSG)];
- unsigned int off = UINT_MAX;
- unsigned int size = UINT_MAX;
+ long long unsigned int off = UINT_MAX;
+ long long unsigned int size = UINT_MAX;
const struct json_attr_t off_attr[4] = {
[0] = {
.attribute = "off",
diff --git a/libs/imgmgr/src/imgmgr_fs.c b/libs/imgmgr/src/imgmgr_fs.c
index bbf8d944..ab33c54a 100644
--- a/libs/imgmgr/src/imgmgr_fs.c
+++ b/libs/imgmgr/src/imgmgr_fs.c
@@ -38,7 +38,7 @@
int
imgr_file_download(struct nmgr_jbuf *njb)
{
- unsigned int off;
+ long long unsigned int off;
char tmp_str[IMGMGR_NMGR_MAX_NAME + 1];
char img_data[BASE64_ENCODE_SIZE(IMGMGR_NMGR_MAX_MSG)];
const struct json_attr_t dload_attr[3] = {
@@ -109,8 +109,8 @@ imgr_file_upload(struct nmgr_jbuf *njb)
{
char img_data[BASE64_ENCODE_SIZE(IMGMGR_NMGR_MAX_MSG)];
char file_name[IMGMGR_NMGR_MAX_NAME + 1];
- unsigned int off = UINT_MAX;
- unsigned int size = UINT_MAX;
+ long long unsigned int off = UINT_MAX;
+ long long unsigned int size = UINT_MAX;
const struct json_attr_t off_attr[5] = {
[0] = {
.attribute = "off",
diff --git a/libs/json/include/json/json.h b/libs/json/include/json/json.h
index 84601260..5e2b037e 100644
--- a/libs/json/include/json/json.h
+++ b/libs/json/include/json/json.h
@@ -166,8 +166,8 @@ struct json_attr_t {
char *attribute;
json_type type;
union {
- int *integer;
- unsigned int *uinteger;
+ long long int *integer;
+ long long unsigned int *uinteger;
double *real;
char *string;
bool *boolean;
@@ -176,8 +176,8 @@ struct json_attr_t {
size_t offset;
} addr;
union {
- int integer;
- unsigned int uinteger;
+ long long int integer;
+ long long unsigned int uinteger;
double real;
bool boolean;
char character;
diff --git a/libs/json/src/json_encode.c b/libs/json/src/json_encode.c
index cddca31d..8512a666 100644
--- a/libs/json/src/json_encode.c
+++ b/libs/json/src/json_encode.c
@@ -241,6 +241,7 @@ err:
int
json_encode_array_finish(struct json_encoder *encoder)
{
+ encoder->je_wr_commas = 1;
JSON_ENCODE_ARRAY_END(encoder);
return (0);
diff --git a/libs/newtmgr/src/newtmgr.c b/libs/newtmgr/src/newtmgr.c
index 624ab586..c3bc6141 100644
--- a/libs/newtmgr/src/newtmgr.c
+++ b/libs/newtmgr/src/newtmgr.c
@@ -89,7 +89,7 @@ err:
static int
nmgr_def_console_echo(struct nmgr_jbuf *njb)
{
- int echo_on = 1;
+ long long int echo_on = 1;
int rc;
struct json_attr_t attrs[3] = {
[0] = {