anchao commented on code in PR #8996:
URL: https://github.com/apache/nuttx/pull/8996#discussion_r1163691685


##########
arch/sim/src/sim/win/sim_hostuart.c:
##########
@@ -94,12 +102,34 @@ int host_uart_puts(int fd, const char *buf, size_t size)
 
 int host_uart_gets(int fd, char *buf, size_t size)
 {
-  DWORD nread;
-  int ret;
+  INPUT_RECORD input[NUM_INPUT];
+  char *pos = buf;
+  DWORD ninput;
+  int i;
 
-  ret = ReadConsole(g_stdin_handle, buf, size, &nread, 0);
+  while (size > 0 && host_uart_checkin(fd))
+    {
+      ninput = size > NUM_INPUT ? NUM_INPUT : size;
+      if (ReadConsoleInput(g_stdin_handle,
+                           (void *)&input, ninput, &ninput) <= 0 ||

Review Comment:
   cast is necessary:
   
   ```
   D:\code\n5\incubator-nuttx\arch\sim\src\sim\win\sim_hostuart.c(113,50): 
warning C4047: “函数”:“PINPUT_RECORD”与“INPUT_RECORD (*)[16]”的间接级别不同 
[D:\code\n5\incubator-nuttx\vs2022\nuttx.vcxproj]                               
   
   D:\code\n5\incubator-nuttx\arch\sim\src\sim\win\sim_hostuart.c(113,44): 
warning C4024: “ReadConsoleInputA”: 形参和实参 2 的类型不同 
[D:\code\n5\incubator-nuttx\vs2022\nuttx.vcxproj]
   ```



##########
arch/sim/src/sim/win/sim_hostuart.c:
##########
@@ -36,6 +42,8 @@ static HANDLE g_stdout_handle;
  * Public Functions
  ****************************************************************************/
 
+bool host_uart_checkin(int fd);

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to