]> sourceware.org Git - newlib-cygwin.git/commitdiff
cygwin: select: use UNICODE console functions
authorCorinna Vinschen <corinna@vinschen.de>
Mon, 31 Jul 2017 20:57:06 +0000 (22:57 +0200)
committerCorinna Vinschen <corinna@vinschen.de>
Mon, 31 Jul 2017 20:57:06 +0000 (22:57 +0200)
For historical reasons peek_console was calling the functions
PeekConsoleInputA and ReadConsoleInputA.  However, these functions are
not working correctly under at least codepage 65001 (UTF-8) on systems
prior to Windows 10.

Use PeekConsoleInputW and ReadConsoleInputW instead, which work
correctly under all systems and all codepages.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/select.cc

index 158de6af74eb28befe1095529390042d5abf4482..f5a993850408477a65d9ecda444785d0db1f35a8 100644 (file)
@@ -886,7 +886,7 @@ peek_console (select_record *me, bool)
   for (;;)
     if (fh->bg_check (SIGTTIN, true) <= bg_eof)
       return me->read_ready = true;
-    else if (!PeekConsoleInput (h, &irec, 1, &events_read) || !events_read)
+    else if (!PeekConsoleInputW (h, &irec, 1, &events_read) || !events_read)
       break;
     else
       {
@@ -918,7 +918,7 @@ peek_console (select_record *me, bool)
          }
 
        /* Read and discard the event */
-       ReadConsoleInput (h, &irec, 1, &events_read);
+       ReadConsoleInputW (h, &irec, 1, &events_read);
       }
 
   return me->write_ready;
This page took 0.036623 seconds and 5 git commands to generate.