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 <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Karsten Blees
2011-10-06 17:40:56 +00:00
committed by Stepan Kasal
parent 08684f92ec
commit 3abcb04dd4

View File

@@ -2,6 +2,7 @@
* Copyright 2008 Peter Harris <git@peter.is-a-geek.org>
*/
#undef NOGDI
#include "../git-compat-util.h"
#include <malloc.h>
#include <wingdi.h>
@@ -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);