From 7a720bfe087a5301e27a40ca8a3b687077541fa8 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 7 Sep 2018 13:48:35 +0200 Subject: [PATCH] Cygwin: console: store replacement char directly Rather than relying on an index variable, store the current replacement char and use that directly in WriteConsoleW. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_console.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index d53b53e98..ce6de6feb 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -1981,7 +1981,7 @@ static const wchar_t replacement_char[NUM_REPLACEMENT_CHARS] = }; /* nFont member is always 0 so we have to use the facename. */ static WCHAR cons_facename[LF_FACESIZE]; -static int rp_char_idx; +static WCHAR rp_char; static NO_COPY HDC cdc; static int CALLBACK @@ -2045,7 +2045,7 @@ check_font (HANDLE hdl) break; if (i == NUM_REPLACEMENT_CHARS) i = 0; - rp_char_idx = i; + rp_char = replacement_char[i]; /* Note that we copy the original name returned by GetCurrentConsoleFontEx, even if it was broken. This allows an early return, rather than to store @@ -2066,8 +2066,7 @@ fhandler_console::write_replacement_char () check_font (get_output_handle ()); DWORD done; - WriteConsoleW (get_output_handle (), &replacement_char[rp_char_idx], 1, - &done, 0); + WriteConsoleW (get_output_handle (), &rp_char, 1, &done, 0); } const unsigned char *