Merge branch 'js/gcc-8-and-9'
Code clean-up for new compilers. * js/gcc-8-and-9: config: avoid calling `labs()` on too-large data type winansi: simplify loading the GetCurrentConsoleFontEx() function kwset: allow building with GCC 8 poll (mingw): allow compiling with GCC 8 and DEVELOPER=1
This commit is contained in:
commit
7785f9ba03
@ -149,7 +149,7 @@ win32_compute_revents (HANDLE h, int *p_sought)
|
|||||||
case FILE_TYPE_PIPE:
|
case FILE_TYPE_PIPE:
|
||||||
if (!once_only)
|
if (!once_only)
|
||||||
{
|
{
|
||||||
NtQueryInformationFile = (PNtQueryInformationFile)
|
NtQueryInformationFile = (PNtQueryInformationFile)(void (*)(void))
|
||||||
GetProcAddress (GetModuleHandle ("ntdll.dll"),
|
GetProcAddress (GetModuleHandle ("ntdll.dll"),
|
||||||
"NtQueryInformationFile");
|
"NtQueryInformationFile");
|
||||||
once_only = TRUE;
|
once_only = TRUE;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <wingdi.h>
|
#include <wingdi.h>
|
||||||
#include <winreg.h>
|
#include <winreg.h>
|
||||||
#include "win32.h"
|
#include "win32.h"
|
||||||
|
#include "win32/lazyload.h"
|
||||||
|
|
||||||
static int fd_is_interactive[3] = { 0, 0, 0 };
|
static int fd_is_interactive[3] = { 0, 0, 0 };
|
||||||
#define FD_CONSOLE 0x1
|
#define FD_CONSOLE 0x1
|
||||||
@ -41,26 +42,21 @@ typedef struct _CONSOLE_FONT_INFOEX {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef BOOL (WINAPI *PGETCURRENTCONSOLEFONTEX)(HANDLE, BOOL,
|
|
||||||
PCONSOLE_FONT_INFOEX);
|
|
||||||
|
|
||||||
static void warn_if_raster_font(void)
|
static void warn_if_raster_font(void)
|
||||||
{
|
{
|
||||||
DWORD fontFamily = 0;
|
DWORD fontFamily = 0;
|
||||||
PGETCURRENTCONSOLEFONTEX pGetCurrentConsoleFontEx;
|
DECLARE_PROC_ADDR(kernel32.dll, BOOL, GetCurrentConsoleFontEx,
|
||||||
|
HANDLE, BOOL, PCONSOLE_FONT_INFOEX);
|
||||||
|
|
||||||
/* don't bother if output was ascii only */
|
/* don't bother if output was ascii only */
|
||||||
if (!non_ascii_used)
|
if (!non_ascii_used)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* GetCurrentConsoleFontEx is available since Vista */
|
/* GetCurrentConsoleFontEx is available since Vista */
|
||||||
pGetCurrentConsoleFontEx = (PGETCURRENTCONSOLEFONTEX) GetProcAddress(
|
if (INIT_PROC_ADDR(GetCurrentConsoleFontEx)) {
|
||||||
GetModuleHandle("kernel32.dll"),
|
|
||||||
"GetCurrentConsoleFontEx");
|
|
||||||
if (pGetCurrentConsoleFontEx) {
|
|
||||||
CONSOLE_FONT_INFOEX cfi;
|
CONSOLE_FONT_INFOEX cfi;
|
||||||
cfi.cbSize = sizeof(cfi);
|
cfi.cbSize = sizeof(cfi);
|
||||||
if (pGetCurrentConsoleFontEx(console, 0, &cfi))
|
if (GetCurrentConsoleFontEx(console, 0, &cfi))
|
||||||
fontFamily = cfi.FontFamily;
|
fontFamily = cfi.FontFamily;
|
||||||
} else {
|
} else {
|
||||||
/* pre-Vista: check default console font in registry */
|
/* pre-Vista: check default console font in registry */
|
||||||
|
4
config.c
4
config.c
@ -896,9 +896,9 @@ static int git_parse_signed(const char *value, intmax_t *ret, intmax_t max)
|
|||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uval = labs(val);
|
uval = val < 0 ? -val : val;
|
||||||
uval *= factor;
|
uval *= factor;
|
||||||
if (uval > max || labs(val) > uval) {
|
if (uval > max || (val < 0 ? -val : val) > uval) {
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
8
kwset.c
8
kwset.c
@ -38,7 +38,13 @@
|
|||||||
#include "compat/obstack.h"
|
#include "compat/obstack.h"
|
||||||
|
|
||||||
#define NCHAR (UCHAR_MAX + 1)
|
#define NCHAR (UCHAR_MAX + 1)
|
||||||
#define obstack_chunk_alloc xmalloc
|
/* adapter for `xmalloc()`, which takes `size_t`, not `long` */
|
||||||
|
static void *obstack_chunk_alloc(long size)
|
||||||
|
{
|
||||||
|
if (size < 0)
|
||||||
|
BUG("Cannot allocate a negative amount: %ld", size);
|
||||||
|
return xmalloc(size);
|
||||||
|
}
|
||||||
#define obstack_chunk_free free
|
#define obstack_chunk_free free
|
||||||
|
|
||||||
#define U(c) ((unsigned char) (c))
|
#define U(c) ((unsigned char) (c))
|
||||||
|
Loading…
Reference in New Issue
Block a user