@matheusbsbs / matheus-bagliano / commits / 492f70913e
Fork 0

Work around a regression in Windows 7, causing erase_in_line() to crash sometimes

The function FillConsoleOutputCharacterA() was pretty content in XP to take a NULL pointer if we did not want to store the number of written columns. In Windows 7, it crashes, but only when called from within Git Bash, not from within cmd.exe. Go figure. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jun 1, 2009 at 08:04 UTC 492f70913e11de19bc4cb197b1fe195c645b89c9
1 file changed +2 -1
compat/winansi.c
+2 -1
@@ -80,6 +80,7 @@ static void set_console_attr(void)
80 static void erase_in_line(void)
81 {
82 CONSOLE_SCREEN_BUFFER_INFO sbi;
83 + DWORD dummy; /* Needed for Windows 7 (or Vista) regression */
84
85 if (!console)
86 return;
@@ -87,7 +88,7 @@ static void erase_in_line(void)
88 GetConsoleScreenBufferInfo(console, &sbi);
89 FillConsoleOutputCharacterA(console, ' ',
90 sbi.dwSize.X - sbi.dwCursorPosition.X, sbi.dwCursorPosition,
90 - NULL);
91 + &dummy);
92 }
93
94