From 09119bdfc5ae694589e011c9bb9554e82a6f72b5 Mon Sep 17 00:00:00 2001 From: Karsten Blees Date: Thu, 6 Oct 2011 17:40:56 +0000 Subject: [PATCH] MSVC: fix winansi.c compile errors Some constants (such as LF_FACESIZE) are undefined with -DNOGDI (set in the Makefile), and CONSOLE_FONT_INFOEX is available in MSVC, but not in MinGW. Cast FARPROC to PGETCURRENTCONSOLEFONTEX to suppress MSVC compiler warning. Signed-off-by: Karsten Blees Signed-off-by: Johannes Schindelin --- compat/winansi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compat/winansi.c b/compat/winansi.c index ab38ed95ab..bec6713b74 100644 --- a/compat/winansi.c +++ b/compat/winansi.c @@ -2,6 +2,7 @@ * Copyright 2008 Peter Harris */ +#undef NOGDI #include "../git-compat-util.h" #include #include @@ -29,6 +30,7 @@ static WORD attr; static int negative; static FILE *last_stream = NULL; +#ifdef __MINGW32__ typedef struct _CONSOLE_FONT_INFOEX { ULONG cbSize; DWORD nFont; @@ -37,6 +39,7 @@ typedef struct _CONSOLE_FONT_INFOEX { UINT FontWeight; WCHAR FaceName[LF_FACESIZE]; } CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX; +#endif typedef BOOL (WINAPI *PGETCURRENTCONSOLEFONTEX)(HANDLE, BOOL, PCONSOLE_FONT_INFOEX); @@ -60,8 +63,8 @@ static void check_truetype_font(void) truetype_font_checked = 1; /* GetCurrentConsoleFontEx is available since Vista */ - pGetCurrentConsoleFontEx = GetProcAddress(GetModuleHandle("kernel32.dll"), - "GetCurrentConsoleFontEx"); + pGetCurrentConsoleFontEx = (PGETCURRENTCONSOLEFONTEX) GetProcAddress( + GetModuleHandle("kernel32.dll"), "GetCurrentConsoleFontEx"); if (pGetCurrentConsoleFontEx) { CONSOLE_FONT_INFOEX cfi; cfi.cbSize = sizeof(cfi); -- 2.11.4.GIT