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 2017/04/19 21:36:46 UTC
incubator-mynewt-core git commit: fs/fcb;
fix a bug when storing variable of 127 bytes in length.
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/master 43e3f7235 -> 31d00cb0a
fs/fcb; fix a bug when storing variable of 127 bytes in 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/31d00cb0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/31d00cb0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/31d00cb0
Branch: refs/heads/master
Commit: 31d00cb0a86368ce2c2f25a0c4ade94fc1680e76
Parents: 43e3f72
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Apr 19 14:35:19 2017 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Apr 19 14:35:19 2017 -0700
----------------------------------------------------------------------
fs/fcb/src/fcb.c | 2 +-
fs/fcb/test/src/testcases/fcb_test_len.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31d00cb0/fs/fcb/src/fcb.c
----------------------------------------------------------------------
diff --git a/fs/fcb/src/fcb.c b/fs/fcb/src/fcb.c
index 30c76b5..ea106ad 100644
--- a/fs/fcb/src/fcb.c
+++ b/fs/fcb/src/fcb.c
@@ -127,7 +127,7 @@ fcb_is_empty(struct fcb *fcb)
int
fcb_put_len(uint8_t *buf, uint16_t len)
{
- if (len < CHAR_MAX) {
+ if (len < 0x80) {
buf[0] = len;
return 1;
} else if (len < FCB_MAX_LEN) {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/31d00cb0/fs/fcb/test/src/testcases/fcb_test_len.c
----------------------------------------------------------------------
diff --git a/fs/fcb/test/src/testcases/fcb_test_len.c b/fs/fcb/test/src/testcases/fcb_test_len.c
index 9aa036f..a2851cb 100644
--- a/fs/fcb/test/src/testcases/fcb_test_len.c
+++ b/fs/fcb/test/src/testcases/fcb_test_len.c
@@ -24,13 +24,14 @@ TEST_CASE(fcb_test_len)
uint16_t len;
uint16_t len2;
int rc;
+ int rc2;
for (len = 0; len < FCB_MAX_LEN; len++) {
rc = fcb_put_len(buf, len);
TEST_ASSERT(rc == 1 || rc == 2);
- rc = fcb_get_len(buf, &len2);
- TEST_ASSERT(rc == 1 || rc == 2);
+ rc2 = fcb_get_len(buf, &len2);
+ TEST_ASSERT(rc2 == rc);
TEST_ASSERT(len == len2);
}