From aa3abfc9852a4d4cfaa7f0042102eb56ed2e0daa Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 20 Apr 2009 21:43:11 +0200 Subject: [PATCH] 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 --- compat/winansi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compat/winansi.c b/compat/winansi.c index 44dc293ad3..4bee335f9e 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -80,6 +80,7 @@ static void set_console_attr(void) static void erase_in_line(void) { CONSOLE_SCREEN_BUFFER_INFO sbi; + long 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); }