You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by bt...@apache.org on 2020/12/29 23:42:40 UTC
[incubator-nuttx] branch master updated: libc/dumpvbuffer: update
the vector ptr correctly
This is an automated email from the ASF dual-hosted git repository.
btashton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new d7b004e libc/dumpvbuffer: update the vector ptr correctly
d7b004e is described below
commit d7b004e1798ac137d80fe620613f152707dd63d7
Author: chao.an <an...@xiaomi.com>
AuthorDate: Tue Dec 29 18:33:22 2020 +0800
libc/dumpvbuffer: update the vector ptr correctly
fix a bug that the vector pointer is not updated correctly.
Signed-off-by: chao.an <an...@xiaomi.com>
---
libs/libc/misc/lib_dumpvbuffer.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libs/libc/misc/lib_dumpvbuffer.c b/libs/libc/misc/lib_dumpvbuffer.c
index 1a32ff7..47b35d4 100644
--- a/libs/libc/misc/lib_dumpvbuffer.c
+++ b/libs/libc/misc/lib_dumpvbuffer.c
@@ -85,7 +85,6 @@ void lib_dumpvbuffer(FAR const char *msg, FAR const struct iovec *iov,
int iovcnt)
{
FAR const struct iovec *piov = iov;
- FAR const uint8_t *iov_buf;
unsigned int len = 0;
char line[_LINESIZE];
unsigned int nitems;
@@ -104,11 +103,12 @@ void lib_dumpvbuffer(FAR const char *msg, FAR const struct iovec *iov,
while (piov != &iov[iovcnt] && piov->iov_len)
{
- iov_buf = piov->iov_base;
ptr = line;
for (nitems = 0; nitems < _NITEMS; nitems++)
{
+ FAR const uint8_t *iov_buf = piov->iov_base;
+
*ptr++ = lib_nibble((iov_buf[len] >> 4) & 0xf);
*ptr++ = lib_nibble(iov_buf[len] & 0xf);
*ptr++ = ' ';
@@ -129,9 +129,9 @@ void lib_dumpvbuffer(FAR const char *msg, FAR const struct iovec *iov,
len = 0;
if (++piov == &iov[iovcnt])
{
- memset(ptr, ' ', (_NITEMS - nitems) * 3);
- memset(&line[_ASCIICHAR_OFFSET + nitems], ' ',
- _NITEMS - nitems);
+ memset(ptr, ' ', (_NITEMS - nitems - 1) * 3);
+ memset(&line[_ASCIICHAR_OFFSET + nitems + 1], ' ',
+ _NITEMS - nitems - 1);
break;
}
}