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/02/06 02:35:58 UTC
[1/2] incubator-mynewt-larva git commit: Don't compile in floating
point support unless asked to.
Repository: incubator-mynewt-larva
Updated Branches:
refs/heads/master 08c56d919 -> 4d70cc0c7
Don't compile in floating point support unless asked to.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/bd15cc19
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/bd15cc19
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/bd15cc19
Branch: refs/heads/master
Commit: bd15cc191b9ce8640410fd6c33c6ecb1f1a7317f
Parents: 08c56d9
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Feb 5 17:31:36 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Feb 5 17:31:36 2016 -0800
----------------------------------------------------------------------
libs/json/src/json_decode.c | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/bd15cc19/libs/json/src/json_decode.c
----------------------------------------------------------------------
diff --git a/libs/json/src/json_decode.c b/libs/json/src/json_decode.c
index 640a52c..283cc16 100644
--- a/libs/json/src/json_decode.c
+++ b/libs/json/src/json_decode.c
@@ -429,8 +429,12 @@ json_internal_read_object(struct json_buffer *jb, const struct json_attr_t *attr
}
break;
case t_real: {
+#ifdef FLOAT_SUPPORT
double tmp = atof(valbuf);
memcpy(lptr, &tmp, sizeof(double));
+#else
+ return JSON_ERR_MISC;
+#endif
}
break;
case t_string:
@@ -586,6 +590,7 @@ json_read_array(struct json_buffer *jb, const struct json_array_t *arr)
}
break;
case t_real:
+#ifdef FLOAT_SUPPORT
n = jb->jb_readn(jb, valbuf, sizeof(valbuf)-1);
valbuf[n] = '\0';
@@ -598,6 +603,9 @@ json_read_array(struct json_buffer *jb, const struct json_array_t *arr)
c = jb->jb_read_next(jb);
}
}
+#else
+ return JSON_ERR_MISC;
+#endif
break;
case t_boolean:
n = jb->jb_readn(jb, valbuf, 5);
[2/2] incubator-mynewt-larva git commit: Don't use long long in
snprintf(). Neither newlib-nano nor baselibc support it.
Posted by ma...@apache.org.
Don't use long long in snprintf(). Neither newlib-nano nor baselibc
support it.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/4d70cc0c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/4d70cc0c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/4d70cc0c
Branch: refs/heads/master
Commit: 4d70cc0c70332a778324599e8bf71e5c57984370
Parents: bd15cc1
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Feb 5 17:33:50 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Feb 5 17:33:50 2016 -0800
----------------------------------------------------------------------
libs/json/src/json_encode.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/4d70cc0c/libs/json/src/json_encode.c
----------------------------------------------------------------------
diff --git a/libs/json/src/json_encode.c b/libs/json/src/json_encode.c
index efb68c8..663cc67 100644
--- a/libs/json/src/json_encode.c
+++ b/libs/json/src/json_encode.c
@@ -56,12 +56,13 @@ json_encode_value(struct json_encoder *encoder, struct json_value *jv)
encoder->je_write(encoder->je_arg, encoder->je_encode_buf, len);
break;
case JSON_VALUE_TYPE_UINT64:
- len = sprintf(encoder->je_encode_buf, "%llu", jv->jv_val.u);
+ len = sprintf(encoder->je_encode_buf, "%lu",
+ (unsigned long)jv->jv_val.u);
encoder->je_write(encoder->je_arg, encoder->je_encode_buf, len);
break;
case JSON_VALUE_TYPE_INT64:
- len = sprintf(encoder->je_encode_buf, "%lld",
- (int64_t) jv->jv_val.u);
+ len = sprintf(encoder->je_encode_buf, "%ld",
+ (long) jv->jv_val.u);
encoder->je_write(encoder->je_arg, encoder->je_encode_buf, len);
break;
case JSON_VALUE_TYPE_STRING: