Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit a203487

Browse files
kbleeskasal
authored andcommitted
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 <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent dec299f commit a203487

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compat/winansi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright 2008 Peter Harris <[email protected]>
33
*/
44

5+
#undef NOGDI
56
#include "../git-compat-util.h"
67
#include <malloc.h>
78
#include <wingdi.h>
@@ -29,6 +30,7 @@ static WORD attr;
2930
static int negative;
3031
static FILE *last_stream = NULL;
3132

33+
#ifdef __MINGW32__
3234
typedef struct _CONSOLE_FONT_INFOEX {
3335
ULONG cbSize;
3436
DWORD nFont;
@@ -37,6 +39,7 @@ typedef struct _CONSOLE_FONT_INFOEX {
3739
UINT FontWeight;
3840
WCHAR FaceName[LF_FACESIZE];
3941
} CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX;
42+
#endif
4043

4144
typedef BOOL (WINAPI *PGETCURRENTCONSOLEFONTEX)(HANDLE, BOOL,
4245
PCONSOLE_FONT_INFOEX);
@@ -60,8 +63,8 @@ static void check_truetype_font(void)
6063
truetype_font_checked = 1;
6164

6265
/* GetCurrentConsoleFontEx is available since Vista */
63-
pGetCurrentConsoleFontEx = GetProcAddress(GetModuleHandle("kernel32.dll"),
64-
"GetCurrentConsoleFontEx");
66+
pGetCurrentConsoleFontEx = (PGETCURRENTCONSOLEFONTEX) GetProcAddress(
67+
GetModuleHandle("kernel32.dll"), "GetCurrentConsoleFontEx");
6568
if (pGetCurrentConsoleFontEx) {
6669
CONSOLE_FONT_INFOEX cfi;
6770
cfi.cbSize = sizeof(cfi);

0 commit comments

Comments
 (0)