Преглед на файлове

[Fix] <components>:finsh/shell.c F: char rt_hw_console_getchar(void) (#10345)

[Fix] <components>:finsh/shell.c
When using char rt_hw_console_getchar(void),
some compilers may default to returning 255 instead of the expected -1,
causing the condition if(ch < 0) at F: shell.c L:519 to fail and enter an erroneous loop.

Solution: Use the signed char type return value as rt_hw_console_getchar

Signed-off-by: Yucai Liu <1486344514@qq.com>
ricky преди 5 месеца
родител
ревизия
9c5aeb75e2
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      components/finsh/shell.c

+ 1 - 1
components/finsh/shell.c

@@ -193,7 +193,7 @@ int finsh_getchar(void)
     return ch;
 #endif /* RT_USING_POSIX_STDIO */
 #else
-    extern char rt_hw_console_getchar(void);
+    extern signed char rt_hw_console_getchar(void);
     return rt_hw_console_getchar();
 #endif /* RT_USING_DEVICE */
 }