Code

Work around a regression in Windows 7, causing erase_in_line() to crash sometimes
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 1 Jun 2009 06:04:16 +0000 (08:04 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Jun 2009 07:08:54 +0000 (00:08 -0700)
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>
compat/winansi.c

index 44dc293ad314379d7835d9d96a5c3fd12ad2b27f..9217c24b43f7546815079d540304aa71821df926 100644 (file)
@@ -80,6 +80,7 @@ static void set_console_attr(void)
 static void erase_in_line(void)
 {
        CONSOLE_SCREEN_BUFFER_INFO sbi;
+       DWORD dummy; /* Needed for Windows 7 (or Vista) regression */
 
        if (!console)
                return;
@@ -87,7 +88,7 @@ static void erase_in_line(void)
        GetConsoleScreenBufferInfo(console, &sbi);
        FillConsoleOutputCharacterA(console, ' ',
                sbi.dwSize.X - sbi.dwCursorPosition.X, sbi.dwCursorPosition,
-               NULL);
+               &dummy);
 }