You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2019/01/04 13:36:24 UTC

[mynewt-core] branch master updated: sys/log: Fix endianess in CBOR pretty-printing

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new a919d22  sys/log: Fix endianess in CBOR pretty-printing
a919d22 is described below

commit a919d2223196bf49d735e36a1d708cbf1151c6c6
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Fri Jan 4 11:13:20 2019 +0100

    sys/log: Fix endianess in CBOR pretty-printing
---
 sys/log/full/src/log_shell.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sys/log/full/src/log_shell.c b/sys/log/full/src/log_shell.c
index b47e82f..40ffc3a 100644
--- a/sys/log/full/src/log_shell.c
+++ b/sys/log/full/src/log_shell.c
@@ -38,6 +38,7 @@
 #include "base64/hex.h"
 #if MYNEWT_VAL(LOG_VERSION) > 2
 #include "tinycbor/cbor.h"
+#include "tinycbor/compilersupport_p.h"
 #endif
 
 #if MYNEWT_VAL(LOG_VERSION) > 2
@@ -66,7 +67,7 @@ log_shell_cbor_reader_get16(struct cbor_decoder_reader *d, int offset)
 
     (void)log_read_body(cbr->log, cbr->dptr, &val, offset, sizeof(val));
 
-    return val;
+    return cbor_ntohs(val);
 }
 
 static uint32_t
@@ -77,7 +78,7 @@ log_shell_cbor_reader_get32(struct cbor_decoder_reader *d, int offset)
 
     (void)log_read_body(cbr->log, cbr->dptr, &val, offset, sizeof(val));
 
-    return val;
+    return cbor_ntohl(val);
 }
 
 static uint64_t
@@ -88,7 +89,7 @@ log_shell_cbor_reader_get64(struct cbor_decoder_reader *d, int offset)
 
     (void)log_read_body(cbr->log, cbr->dptr, &val, offset, sizeof(val));
 
-    return val;
+    return cbor_ntohll(val);
 }
 
 static uintptr_t