You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/05/17 20:51:59 UTC

[36/50] [abbrv] incubator-mynewt-core git commit: Fixing json issues

Fixing json issues

- Changing json_attr to handle uint64/int64 while decoding
- Changing imgmgr and imgmgr_fs to have uint64/int64 attributes


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/19ccd689
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/19ccd689
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/19ccd689

Branch: refs/heads/master
Commit: 19ccd6894302982f39cd40b87b41753c9023de2c
Parents: ed16b3f
Author: Vipul Rahane <vi...@runtime.io>
Authored: Mon May 16 14:38:33 2016 -0700
Committer: Vipul Rahane <vi...@runtime.io>
Committed: Mon May 16 14:38:33 2016 -0700

----------------------------------------------------------------------
 libs/imgmgr/src/imgmgr.c      | 4 ++--
 libs/imgmgr/src/imgmgr_fs.c   | 6 +++---
 libs/json/include/json/json.h | 8 ++++----
 libs/json/src/json_encode.c   | 1 +
 libs/newtmgr/src/newtmgr.c    | 2 +-
 5 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/19ccd689/libs/imgmgr/src/imgmgr.c
----------------------------------------------------------------------
diff --git a/libs/imgmgr/src/imgmgr.c b/libs/imgmgr/src/imgmgr.c
index ef42cd5..eb192a0 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",

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/19ccd689/libs/imgmgr/src/imgmgr_fs.c
----------------------------------------------------------------------
diff --git a/libs/imgmgr/src/imgmgr_fs.c b/libs/imgmgr/src/imgmgr_fs.c
index bbf8d94..ab33c54 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",

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/19ccd689/libs/json/include/json/json.h
----------------------------------------------------------------------
diff --git a/libs/json/include/json/json.h b/libs/json/include/json/json.h
index 8460126..5e2b037 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;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/19ccd689/libs/json/src/json_encode.c
----------------------------------------------------------------------
diff --git a/libs/json/src/json_encode.c b/libs/json/src/json_encode.c
index cddca31..8512a66 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);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/19ccd689/libs/newtmgr/src/newtmgr.c
----------------------------------------------------------------------
diff --git a/libs/newtmgr/src/newtmgr.c b/libs/newtmgr/src/newtmgr.c
index 624ab58..c3bc614 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] = {