From 156561b0ade98b22df0e3ebc63682e54129c2cb4 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Mon, 28 Sep 2015 16:00:08 +0200 Subject: [PATCH] Fix pedantic warnings in mingw builds. Reviewed-by: Rich Salz --- crypto/cryptlib.c | 12 ++++-------- crypto/dso/dso_win32.c | 31 ++++++++++++++++++++----------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index 39d1e1ea84..f0aaae6893 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -117,10 +117,6 @@ #include "internal/cryptlib.h" #include -#if defined(OPENSSL_SYS_WIN32) -static double SSLeay_MSVC5_hack = 0.0; /* and for VC1.5 */ -#endif - #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ defined(__INTEL__) || \ defined(__x86_64) || defined(__x86_64__) || \ @@ -268,15 +264,15 @@ int OPENSSL_isservice(void) WCHAR *name; static union { void *p; - int (*f) (void); + FARPROC f; } _OPENSSL_isservice = { NULL }; if (_OPENSSL_isservice.p == NULL) { - HANDLE h = GetModuleHandle(NULL); - if (h != NULL) - _OPENSSL_isservice.p = GetProcAddress(h, "_OPENSSL_isservice"); + HANDLE mod = GetModuleHandle(NULL); + if (mod != NULL) + _OPENSSL_isservice.f = GetProcAddress(mod, "_OPENSSL_isservice"); if (_OPENSSL_isservice.p == NULL) _OPENSSL_isservice.p = (void *)-1; } diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c index c6fec6625a..8d2123ed08 100644 --- a/crypto/dso/dso_win32.c +++ b/crypto/dso/dso_win32.c @@ -224,7 +224,10 @@ static int win32_unload(DSO *dso) static void *win32_bind_var(DSO *dso, const char *symname) { HINSTANCE *ptr; - void *sym; + union { + void *p; + FARPROC f; + } sym; if ((dso == NULL) || (symname == NULL)) { DSOerr(DSO_F_WIN32_BIND_VAR, ERR_R_PASSED_NULL_PARAMETER); @@ -239,19 +242,22 @@ static void *win32_bind_var(DSO *dso, const char *symname) DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_NULL_HANDLE); return (NULL); } - sym = GetProcAddress(*ptr, symname); - if (sym == NULL) { + sym.f = GetProcAddress(*ptr, symname); + if (sym.p == NULL) { DSOerr(DSO_F_WIN32_BIND_VAR, DSO_R_SYM_FAILURE); ERR_add_error_data(3, "symname(", symname, ")"); return (NULL); } - return (sym); + return (sym.p); } static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname) { HINSTANCE *ptr; - void *sym; + union { + void *p; + FARPROC f; + } sym; if ((dso == NULL) || (symname == NULL)) { DSOerr(DSO_F_WIN32_BIND_FUNC, ERR_R_PASSED_NULL_PARAMETER); @@ -266,13 +272,13 @@ static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname) DSOerr(DSO_F_WIN32_BIND_FUNC, DSO_R_NULL_HANDLE); return (NULL); } - sym = GetProcAddress(*ptr, symname); - if (sym == NULL) { + sym.f = GetProcAddress(*ptr, symname); + if (sym.p == NULL) { DSOerr(DSO_F_WIN32_BIND_FUNC, DSO_R_SYM_FAILURE); ERR_add_error_data(3, "symname(", symname, ")"); return (NULL); } - return ((DSO_FUNC_TYPE)sym); + return ((DSO_FUNC_TYPE)sym.f); } struct file_st { @@ -704,7 +710,10 @@ static void *win32_globallookup(const char *name) CREATETOOLHELP32SNAPSHOT create_snap; CLOSETOOLHELP32SNAPSHOT close_snap; MODULE32 module_first, module_next; - FARPROC ret = NULL; + union { + void *p; + FARPROC f; + } ret = { NULL }; dll = LoadLibrary(TEXT(DLLNAME)); if (dll == NULL) { @@ -745,10 +754,10 @@ static void *win32_globallookup(const char *name) } do { - if ((ret = GetProcAddress(me32.hModule, name))) { + if ((ret.f = GetProcAddress(me32.hModule, name))) { (*close_snap) (hModuleSnap); FreeLibrary(dll); - return ret; + return ret.p; } } while ((*module_next) (hModuleSnap, &me32)); -- 2.40.0