public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: console: store replacement char directly
@ 2018-09-07 11:50 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2018-09-07 11:50 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7a720bfe087a5301e27a40ca8a3b687077541fa8

commit 7a720bfe087a5301e27a40ca8a3b687077541fa8
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Sep 7 13:48:35 2018 +0200

    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 <corinna@vinschen.de>

Diff:
---
 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 d53b53e..ce6de6f 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 *


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-09-07 11:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-07 11:50 [newlib-cygwin] Cygwin: console: store replacement char directly Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).