all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against unsigned variables. Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This commit is contained in:
parent
caebf204c6
commit
24d71431e9
559 changed files with 2331 additions and 2328 deletions
|
@ -63,7 +63,7 @@ static void shell_tdata_dump(const struct k_thread *thread, void *user_data)
|
|||
size);
|
||||
|
||||
/* Calculate the real size reserved for the stack */
|
||||
pcnt = ((size - unused) * 100) / size;
|
||||
pcnt = ((size - unused) * 100U) / size;
|
||||
|
||||
tname = k_thread_name_get((struct k_thread *)thread);
|
||||
|
||||
|
@ -104,7 +104,7 @@ static void shell_stack_dump(const struct k_thread *thread, void *user_data)
|
|||
size);
|
||||
|
||||
/* Calculate the real size reserved for the stack */
|
||||
pcnt = ((size - unused) * 100) / size;
|
||||
pcnt = ((size - unused) * 100U) / size;
|
||||
|
||||
shell_fprintf((const struct shell *)user_data, SHELL_NORMAL,
|
||||
"0x%08X %-10s (real size %u):\tunused %u\tusage %u / %u (%u %%)\n",
|
||||
|
|
|
@ -109,7 +109,7 @@ static void tab_item_print(const struct shell *shell, const char *option,
|
|||
- shell_strlen(tab)) / longest_option;
|
||||
diff = longest_option - shell_strlen(option);
|
||||
|
||||
if (shell->ctx->vt100_ctx.printed_cmd++ % columns == 0) {
|
||||
if (shell->ctx->vt100_ctx.printed_cmd++ % columns == 0U) {
|
||||
shell_internal_fprintf(shell, SHELL_OPTION, "\n%s%s", tab,
|
||||
option);
|
||||
} else {
|
||||
|
@ -280,7 +280,7 @@ static bool tab_prepare(const struct shell *shell,
|
|||
u16_t compl_space = completion_space_get(shell);
|
||||
size_t search_argc;
|
||||
|
||||
if (compl_space == 0) {
|
||||
if (compl_space == 0U) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -837,7 +837,7 @@ static bool process_nl(const struct shell *shell, u8_t data)
|
|||
return false;
|
||||
}
|
||||
|
||||
if ((flag_last_nl_get(shell) == 0) ||
|
||||
if ((flag_last_nl_get(shell) == 0U) ||
|
||||
(data == flag_last_nl_get(shell))) {
|
||||
flag_last_nl_set(shell, data);
|
||||
return true;
|
||||
|
@ -1298,8 +1298,8 @@ void shell_process(const struct shell *shell)
|
|||
|
||||
union shell_internal internal;
|
||||
|
||||
internal.value = 0;
|
||||
internal.flags.processing = 1;
|
||||
internal.value = 0U;
|
||||
internal.flags.processing = 1U;
|
||||
|
||||
(void)atomic_or((atomic_t *)&shell->ctx->internal.value,
|
||||
internal.value);
|
||||
|
@ -1318,7 +1318,7 @@ void shell_process(const struct shell *shell)
|
|||
}
|
||||
|
||||
internal.value = 0xFFFFFFFF;
|
||||
internal.flags.processing = 0;
|
||||
internal.flags.processing = 0U;
|
||||
(void)atomic_and((atomic_t *)&shell->ctx->internal.value,
|
||||
internal.value);
|
||||
}
|
||||
|
|
|
@ -97,10 +97,10 @@ static int cursor_position_get(const struct shell *shell, u16_t *x, u16_t *y)
|
|||
/* Index start position in the buffer where 'y'
|
||||
* is stored.
|
||||
*/
|
||||
buff_idx = 2;
|
||||
buff_idx = 2U;
|
||||
|
||||
while (shell->ctx->temp_buff[buff_idx] != ';') {
|
||||
*y = *y * 10 +
|
||||
*y = *y * 10U +
|
||||
(shell->ctx->temp_buff[buff_idx++] -
|
||||
'0');
|
||||
if (buff_idx >=
|
||||
|
@ -115,7 +115,7 @@ static int cursor_position_get(const struct shell *shell, u16_t *x, u16_t *y)
|
|||
|
||||
while (shell->ctx->temp_buff[buff_idx]
|
||||
!= '\0') {
|
||||
*x = *x * 10 +
|
||||
*x = *x * 10U +
|
||||
(shell->ctx->temp_buff[buff_idx++] -
|
||||
'0');
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ void shell_help_subcmd_print(const struct shell *shell)
|
|||
{
|
||||
const struct shell_static_entry *entry = NULL;
|
||||
struct shell_static_entry static_entry;
|
||||
u16_t longest_syntax = 0;
|
||||
u16_t longest_syntax = 0U;
|
||||
size_t cmd_idx = 0;
|
||||
|
||||
/* Checking if there are any subcommands available. */
|
||||
|
|
|
@ -19,14 +19,14 @@ bool shell_history_get(struct shell_history *history, bool up,
|
|||
sys_dnode_t *l_item; /* list item */
|
||||
|
||||
if (sys_dlist_is_empty(&history->list)) {
|
||||
*len = 0;
|
||||
*len = 0U;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!up) { /* button down */
|
||||
if (history->current == NULL) {
|
||||
/* Not in history mode. It is started by up button. */
|
||||
*len = 0;
|
||||
*len = 0U;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ bool shell_history_get(struct shell_history *history, bool up,
|
|||
return true;
|
||||
}
|
||||
|
||||
*len = 0;
|
||||
*len = 0U;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,14 +31,14 @@ void shell_op_cursor_horiz_move(const struct shell *shell, s32_t delta)
|
|||
static inline bool full_line_cmd(const struct shell *shell)
|
||||
{
|
||||
return ((shell->ctx->cmd_buff_len + shell_strlen(shell->ctx->prompt))
|
||||
% shell->ctx->vt100_ctx.cons.terminal_wid == 0);
|
||||
% shell->ctx->vt100_ctx.cons.terminal_wid == 0U);
|
||||
}
|
||||
|
||||
/* Function returns true if cursor is at beginning of an empty line. */
|
||||
bool shell_cursor_in_empty_line(const struct shell *shell)
|
||||
{
|
||||
return ((shell->ctx->cmd_buff_pos + shell_strlen(shell->ctx->prompt))
|
||||
% shell->ctx->vt100_ctx.cons.terminal_wid == 0);
|
||||
% shell->ctx->vt100_ctx.cons.terminal_wid == 0U);
|
||||
}
|
||||
|
||||
void shell_op_cond_next_line(const struct shell *shell)
|
||||
|
@ -101,12 +101,12 @@ void shell_op_cursor_move(const struct shell *shell, s16_t val)
|
|||
static u16_t shift_calc(const char *str, u16_t pos, u16_t len, s16_t sign)
|
||||
{
|
||||
bool found = false;
|
||||
u16_t ret = 0;
|
||||
u16_t ret = 0U;
|
||||
u16_t idx;
|
||||
|
||||
while (1) {
|
||||
idx = pos + ret * sign;
|
||||
if (((idx == 0) && (sign < 0)) ||
|
||||
if (((idx == 0U) && (sign < 0)) ||
|
||||
((idx == len) && (sign > 0))) {
|
||||
break;
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ void shell_op_char_delete(const struct shell *shell)
|
|||
u16_t diff = shell->ctx->cmd_buff_len - shell->ctx->cmd_buff_pos;
|
||||
char *str = &shell->ctx->cmd_buff[shell->ctx->cmd_buff_pos];
|
||||
|
||||
if (diff == 0) {
|
||||
if (diff == 0U) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ static void timer_handler(struct k_timer *timer)
|
|||
const struct shell_uart *sh_uart = k_timer_user_data_get(timer);
|
||||
|
||||
while (uart_poll_in(sh_uart->ctrl_blk->dev, &c) == 0) {
|
||||
if (ring_buf_put(sh_uart->rx_ringbuf, &c, 1) == 0) {
|
||||
if (ring_buf_put(sh_uart->rx_ringbuf, &c, 1) == 0U) {
|
||||
/* ring buffer full. */
|
||||
LOG_WRN("RX ring buffer full.");
|
||||
}
|
||||
|
|
|
@ -347,9 +347,9 @@ static void buffer_trim(char *buff, u16_t *buff_len)
|
|||
return;
|
||||
}
|
||||
|
||||
while (isspace((int) buff[*buff_len - 1])) {
|
||||
*buff_len -= 1;
|
||||
if (*buff_len == 0) {
|
||||
while (isspace((int) buff[*buff_len - 1U])) {
|
||||
*buff_len -= 1U;
|
||||
if (*buff_len == 0U) {
|
||||
buff[0] = '\0';
|
||||
return;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ static void buffer_trim(char *buff, u16_t *buff_len)
|
|||
|
||||
/* Removing counted whitespace characters. */
|
||||
if (--i > 0) {
|
||||
memmove(buff, buff + i, (*buff_len + 1) - i); /* +1 for '\0' */
|
||||
memmove(buff, buff + i, (*buff_len + 1U) - i); /* +1 for '\0' */
|
||||
*buff_len = *buff_len - i;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue