summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2019-05-16 09:38:08 +0800
committerGitHub <[email protected]>2019-05-16 09:38:08 +0800
commit4539172f5c97306a322ac1768c5c8eb4f878ea3c (patch)
treec6ed31f70123415e96da63973a8184e96eaad824 /components
parent361754e0375b3ef61438ff2d0ec96e330b5a4147 (diff)
parent415d12220b44e735fe3422cb81edc98714742aa2 (diff)
Merge pull request #2687 from armink/fix_ulog
[components][ulog] Fix the log length error when using multiple non-c…
Diffstat (limited to 'components')
-rw-r--r--components/utilities/ulog/ulog.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/utilities/ulog/ulog.c b/components/utilities/ulog/ulog.c
index 87d0932506..36d5ac275f 100644
--- a/components/utilities/ulog/ulog.c
+++ b/components/utilities/ulog/ulog.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2019, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -403,15 +403,15 @@ void ulog_output_to_all_backend(rt_uint32_t level, const char *tag, rt_bool_t is
else
{
/* recalculate the log start address and log size when backend not supported color */
- rt_size_t color_info_len = rt_strlen(color_output_info[level]);
+ rt_size_t color_info_len = rt_strlen(color_output_info[level]), output_size = size;
if (color_info_len)
{
rt_size_t color_hdr_len = rt_strlen(CSI_START) + color_info_len;
log += color_hdr_len;
- size -= (color_hdr_len + (sizeof(CSI_END) - 1));
+ output_size -= (color_hdr_len + (sizeof(CSI_END) - 1));
}
- backend->output(backend, level, tag, is_raw, log, size);
+ backend->output(backend, level, tag, is_raw, log, output_size);
}
#endif /* !defined(ULOG_USING_COLOR) || defined(ULOG_USING_SYSLOG) */
}