You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/05/17 18:57:57 UTC
[1/8] incubator-mynewt-core git commit: cbmem append was not
considering header length
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop 5df4dc1e0 -> afc0a74bc
cbmem append was not considering header length
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/edc9f73b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/edc9f73b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/edc9f73b
Branch: refs/heads/develop
Commit: edc9f73b02437d192fda81c387e9507e390bc346
Parents: 4d5aa14
Author: Vipul Rahane <vi...@runtime.io>
Authored: Wed May 4 13:55:30 2016 -0700
Committer: Vipul Rahane <vi...@runtime.io>
Committed: Mon May 16 13:58:53 2016 -0700
----------------------------------------------------------------------
libs/util/src/cbmem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/edc9f73b/libs/util/src/cbmem.c
----------------------------------------------------------------------
diff --git a/libs/util/src/cbmem.c b/libs/util/src/cbmem.c
index 27dc262..a0ac332 100644
--- a/libs/util/src/cbmem.c
+++ b/libs/util/src/cbmem.c
@@ -92,7 +92,7 @@ cbmem_append(struct cbmem *cbmem, void *data, uint16_t len)
} else {
dst = (struct cbmem_entry_hdr *) cbmem->c_buf;
}
- end = (uint8_t *) dst + len;
+ end = (uint8_t *) dst + len + sizeof(*dst);
/* If this item would take us past the end of this buffer, then adjust
* the item to the beginning of the buffer.
@@ -100,7 +100,7 @@ cbmem_append(struct cbmem *cbmem, void *data, uint16_t len)
if (end > cbmem->c_buf_end) {
cbmem->c_buf_cur_end = (uint8_t *) dst;
dst = (struct cbmem_entry_hdr *) cbmem->c_buf;
- end = (uint8_t *) dst + len;
+ end = (uint8_t *) dst + len + sizeof(*dst);
if ((uint8_t *) cbmem->c_entry_start >= cbmem->c_buf_cur_end) {
cbmem->c_entry_start = (struct cbmem_entry_hdr *) cbmem->c_buf;
}
[4/8] incubator-mynewt-core git commit: Fix json encoding
Posted by ma...@apache.org.
Fix json encoding
- Changing atoi to strtoull and strtoll as atoi return only 32 bit
values. strtoll and strtoull return 64bit values which we encode our
inetegers as.
- Changing a few other places where json encoding should use 64 bit
values instead of 32 bit.
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/ed16b3f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/ed16b3f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/ed16b3f2
Branch: refs/heads/develop
Commit: ed16b3f2e21809b68f45b10777cfb1331be0f697
Parents: 57e945d
Author: Vipul Rahane <vi...@runtime.io>
Authored: Mon Apr 25 17:33:21 2016 -0700
Committer: Vipul Rahane <vi...@runtime.io>
Committed: Mon May 16 14:16:53 2016 -0700
----------------------------------------------------------------------
libs/json/include/json/json.h | 8 ++++----
libs/json/src/json_decode.c | 20 +++++++++++---------
2 files changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ed16b3f2/libs/json/include/json/json.h
----------------------------------------------------------------------
diff --git a/libs/json/include/json/json.h b/libs/json/include/json/json.h
index 1b97d1b..8460126 100644
--- a/libs/json/include/json/json.h
+++ b/libs/json/include/json/json.h
@@ -128,8 +128,8 @@ typedef enum {
} json_type;
struct json_enum_t {
- char *name;
- int value;
+ char *name;
+ long long int value;
};
struct json_array_t {
@@ -146,10 +146,10 @@ struct json_array_t {
int storelen;
} strings;
struct {
- int *store;
+ long long int *store;
} integers;
struct {
- unsigned int *store;
+ long long unsigned int *store;
} uintegers;
struct {
double *store;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ed16b3f2/libs/json/src/json_decode.c
----------------------------------------------------------------------
diff --git a/libs/json/src/json_decode.c b/libs/json/src/json_decode.c
index 2dcde6f..0d81c0d 100644
--- a/libs/json/src/json_decode.c
+++ b/libs/json/src/json_decode.c
@@ -152,10 +152,10 @@ json_internal_read_object(struct json_buffer *jb, const struct json_attr_t *attr
if (lptr != NULL) {
switch (cursor->type) {
case t_integer:
- memcpy(lptr, &cursor->dflt.integer, sizeof(int));
+ memcpy(lptr, &cursor->dflt.integer, sizeof(long long int));
break;
case t_uinteger:
- memcpy(lptr, &cursor->dflt.uinteger, sizeof(unsigned int));
+ memcpy(lptr, &cursor->dflt.uinteger, sizeof(long long unsigned int));
break;
case t_real:
memcpy(lptr, &cursor->dflt.real, sizeof(double));
@@ -396,19 +396,21 @@ json_internal_read_object(struct json_buffer *jb, const struct json_attr_t *attr
}
return JSON_ERR_BADENUM;
foundit:
- (void)snprintf(valbuf, sizeof(valbuf), "%d", mp->value);
+ (void)snprintf(valbuf, sizeof(valbuf), "%lld", mp->value);
}
lptr = json_target_address(cursor, parent, offset);
if (lptr != NULL) {
switch (cursor->type) {
case t_integer: {
- int tmp = atoi(valbuf);
- memcpy(lptr, &tmp, sizeof(int));
+ long long int tmp =
+ (long long int)strtoll(valbuf, NULL, 10);
+ memcpy(lptr, &tmp, sizeof(long long int));
}
break;
case t_uinteger: {
- unsigned int tmp = (unsigned int)atoi(valbuf);
- memcpy(lptr, &tmp, sizeof(unsigned int));
+ long long unsigned int tmp =
+ (long long unsigned int)strtoull(valbuf, NULL, 10);
+ memcpy(lptr, &tmp, sizeof(long long unsigned int));
}
break;
case t_real: {
@@ -548,7 +550,7 @@ json_read_array(struct json_buffer *jb, const struct json_array_t *arr)
n = jb->jb_readn(jb, valbuf, sizeof(valbuf)-1);
valbuf[n] = '\0';
- arr->arr.integers.store[offset] = (int)strtol(valbuf, &ep, 0);
+ arr->arr.integers.store[offset] = (long long int)strtoll(valbuf, &ep, 0);
if (ep == valbuf) {
return JSON_ERR_BADNUM;
} else {
@@ -562,7 +564,7 @@ json_read_array(struct json_buffer *jb, const struct json_array_t *arr)
n = jb->jb_readn(jb, valbuf, sizeof(valbuf)-1);
valbuf[n] = '\0';
- arr->arr.uintegers.store[offset] = (unsigned int)strtoul(valbuf, &ep, 0);
+ arr->arr.uintegers.store[offset] = (long long unsigned int)strtoull(valbuf, &ep, 0);
if (ep == valbuf) {
return JSON_ERR_BADNUM;
} else {
[2/8] incubator-mynewt-core git commit: Fix cbmem crash
Posted by ma...@apache.org.
Fix cbmem crash
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/20820809
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/20820809
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/20820809
Branch: refs/heads/develop
Commit: 20820809069fbc4cbec5f9853b7ff123bb4ffa7c
Parents: edc9f73
Author: Vipul Rahane <vi...@runtime.io>
Authored: Thu Apr 28 19:10:17 2016 -0700
Committer: Vipul Rahane <vi...@runtime.io>
Committed: Mon May 16 14:02:28 2016 -0700
----------------------------------------------------------------------
libs/util/src/cbmem.c | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/20820809/libs/util/src/cbmem.c
----------------------------------------------------------------------
diff --git a/libs/util/src/cbmem.c b/libs/util/src/cbmem.c
index a0ac332..01988e5 100644
--- a/libs/util/src/cbmem.c
+++ b/libs/util/src/cbmem.c
@@ -166,6 +166,10 @@ cbmem_iter_next(struct cbmem *cbmem, struct cbmem_iter *iter)
}
} else {
hdr = iter->ci_cur;
+ if (!iter->ci_cur) {
+ goto err;
+ }
+
if (hdr == CBMEM_ENTRY_NEXT(iter->ci_end)) {
hdr = NULL;
} else {
@@ -173,6 +177,7 @@ cbmem_iter_next(struct cbmem *cbmem, struct cbmem_iter *iter)
}
}
+err:
return (hdr);
}
[5/8] incubator-mynewt-core git commit: Fixing json issues
Posted by ma...@apache.org.
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/develop
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] = {
[8/8] incubator-mynewt-core git commit: This closes #54. Merge branch
'mynewt-add' of https://github.com/vrahane/incubator-mynewt-core into develop
Posted by ma...@apache.org.
This closes #54.
Merge branch 'mynewt-add' of https://github.com/vrahane/incubator-mynewt-core into develop
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/afc0a74b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/afc0a74b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/afc0a74b
Branch: refs/heads/develop
Commit: afc0a74bc3e99c4a6acaab918fadf3375857ebdf
Parents: 2fb4707 e3e4e91
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue May 17 11:52:58 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue May 17 11:52:58 2016 -0700
----------------------------------------------------------------------
libs/imgmgr/src/imgmgr.c | 4 ++--
libs/imgmgr/src/imgmgr_fs.c | 6 +++---
libs/json/include/json/json.h | 16 ++++++++--------
libs/json/src/json_decode.c | 20 +++++++++++---------
libs/json/src/json_encode.c | 1 +
libs/json/src/test/test_json_simple.c | 4 ++--
libs/newtmgr/src/newtmgr.c | 2 +-
libs/util/src/cbmem.c | 11 ++++++++---
8 files changed, 36 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/afc0a74b/libs/json/include/json/json.h
----------------------------------------------------------------------
[6/8] incubator-mynewt-core git commit: Fix cbmem crash
Posted by ma...@apache.org.
Fix cbmem crash
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/e3e4e911
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e3e4e911
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e3e4e911
Branch: refs/heads/develop
Commit: e3e4e9117ff712d07fbcee3835e6b4ddeaf41f68
Parents: 19ccd68
Author: Vipul Rahane <vi...@runtime.io>
Authored: Mon May 16 14:47:32 2016 -0700
Committer: Vipul Rahane <vi...@runtime.io>
Committed: Mon May 16 14:47:32 2016 -0700
----------------------------------------------------------------------
libs/util/src/cbmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e3e4e911/libs/util/src/cbmem.c
----------------------------------------------------------------------
diff --git a/libs/util/src/cbmem.c b/libs/util/src/cbmem.c
index 01988e5..05051ae 100644
--- a/libs/util/src/cbmem.c
+++ b/libs/util/src/cbmem.c
@@ -160,7 +160,7 @@ cbmem_iter_next(struct cbmem *cbmem, struct cbmem_iter *iter)
hdr = iter->ci_cur;
iter->ci_cur = CBMEM_ENTRY_NEXT(iter->ci_cur);
- if ((uint8_t *) iter->ci_cur == cbmem->c_buf_cur_end) {
+ if ((uint8_t *) iter->ci_cur >= cbmem->c_buf_cur_end) {
iter->ci_cur = (struct cbmem_entry_hdr *) cbmem->c_buf;
iter->ci_start = (struct cbmem_entry_hdr *) cbmem->c_buf;
}
[3/8] incubator-mynewt-core git commit: Fixing json test
Posted by ma...@apache.org.
Fixing json test
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/57e945dc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/57e945dc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/57e945dc
Branch: refs/heads/develop
Commit: 57e945dc1b08d5d0f1f886e9e328abc0b25511d4
Parents: 2082080
Author: Vipul Rahane <vi...@runtime.io>
Authored: Tue Apr 26 11:36:02 2016 -0700
Committer: Vipul Rahane <vi...@runtime.io>
Committed: Mon May 16 14:05:34 2016 -0700
----------------------------------------------------------------------
libs/json/src/test/test_json_simple.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/57e945dc/libs/json/src/test/test_json_simple.c
----------------------------------------------------------------------
diff --git a/libs/json/src/test/test_json_simple.c b/libs/json/src/test/test_json_simple.c
index d1875a7..39d14b8 100644
--- a/libs/json/src/test/test_json_simple.c
+++ b/libs/json/src/test/test_json_simple.c
@@ -147,8 +147,8 @@ test_buf_init(struct test_jbuf *ptjb, char *string) {
/* now test the decode on a string */
TEST_CASE(test_json_simple_decode){
struct test_jbuf tjb;
- unsigned int uint_val;
- int int_val;
+ long long unsigned int uint_val;
+ long long int int_val;
bool bool_val;
char string1[16];
char string2[16];
[7/8] incubator-mynewt-core git commit: json;
Remove json_value_desc, not used anywhere.
Posted by ma...@apache.org.
json; Remove json_value_desc, not used anywhere.
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/2fb47079
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/2fb47079
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/2fb47079
Branch: refs/heads/develop
Commit: 2fb470790785d73037b4b80a9a77b0f320f78ce5
Parents: 5df4dc1
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue May 17 11:49:47 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue May 17 11:49:47 2016 -0700
----------------------------------------------------------------------
libs/json/include/json/json.h | 12 ------------
1 file changed, 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2fb47079/libs/json/include/json/json.h
----------------------------------------------------------------------
diff --git a/libs/json/include/json/json.h b/libs/json/include/json/json.h
index 1b97d1b..e82ccf8 100644
--- a/libs/json/include/json/json.h
+++ b/libs/json/include/json/json.h
@@ -35,18 +35,6 @@
#define JSON_VALUE_TYPE_OBJECT (5)
/**
- * For JSON decode, descriptions of the JSON values that
- * need to be parsed.
- */
-struct json_value_desc {
- char *jv_name;
- void *jv_ptr;
- uint16_t jv_len;
- uint8_t jv_type;
- uint8_t jv_matched;
-};
-
-/**
* For encode. The contents of a JSON value to encode.
*/
struct json_value {