From bbae4bb0e839d83d8b2d1bff0bc9a06aca25e0be Mon Sep 17 00:00:00 2001 From: Bill-Gray Date: Sat, 15 Apr 2023 20:26:14 -0400 Subject: [PATCH] GetProcAddress() returns a FARPROC, which is a very generic function pointer. Casting it is unnecessary (except when looking at the return value, I think) and can generate warnings and errors. My thanks to Arnold Tremblay and Chuck Haatvedt for testing this out on other forks of Windows. --- curses.h | 2 +- wingui/pdcscrn.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/curses.h b/curses.h index eac37650..a409f64b 100644 --- a/curses.h +++ b/curses.h @@ -42,7 +42,7 @@ Defined by this header: #define PDC_VER_CHANGE 6 #define PDC_VER_YEAR 2023 #define PDC_VER_MONTH 04 -#define PDC_VER_DAY 12 +#define PDC_VER_DAY 15 #define PDC_STRINGIZE( x) #x #define PDC_stringize( x) PDC_STRINGIZE( x) diff --git a/wingui/pdcscrn.c b/wingui/pdcscrn.c index 2ccb8d10..a5b6d523 100644 --- a/wingui/pdcscrn.c +++ b/wingui/pdcscrn.c @@ -1215,9 +1215,8 @@ an exact number of rows/columns results in cascading resize attempts. So we check on initialization to see if we're in Wine; if we are, resizes are skipped. */ -typedef const char *(CDECL *wine_version_func)(void); -static wine_version_func wine_version; +static FARPROC wine_version; static void HandleSize( const WPARAM wParam, const LPARAM lParam) { @@ -2221,13 +2220,13 @@ int PDC_scr_open(void) PDC_LOG(("PDC_scr_open() - called\n")); if( hntdll) - wine_version = (wine_version_func)GetProcAddress(hntdll, "wine_get_version"); + wine_version = GetProcAddress(hntdll, "wine_get_version"); if ( shcoredll) { - typedef HRESULT(STDAPICALLTYPE *set_process_dpi_awareness_t)(int); - static set_process_dpi_awareness_t set_process_dpi_awareness_func; static int ADJUST_DPI_PER_MONITOR = 2; - set_process_dpi_awareness_func = (set_process_dpi_awareness_t)GetProcAddress(shcoredll, "SetProcessDpiAwareness"); + FARPROC set_process_dpi_awareness_func = + GetProcAddress(shcoredll, "SetProcessDpiAwareness"); + if ( set_process_dpi_awareness_func) { set_process_dpi_awareness_func(ADJUST_DPI_PER_MONITOR); }