diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index f248e8cfc..9cd7c9fd4 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -1311,17 +1311,12 @@ static DWORD WINAPI xf_handle_pipe(void* arg) return 0; } - WINPR_PRAGMA_DIAG_PUSH - WINPR_PRAGMA_DIAG_IGNORED_QUALIFIERS - freerdp_add_signal_cleanup_handler(pipe, cleanup_pipe); - WINPR_PRAGMA_DIAG_POP + void* ctx = WINPR_CAST_CONST_PTR_AWAY(pipe, void*); + freerdp_add_signal_cleanup_handler(ctx, cleanup_pipe); xf_process_pipe(context, pipe); - WINPR_PRAGMA_DIAG_PUSH - WINPR_PRAGMA_DIAG_IGNORED_QUALIFIERS - freerdp_del_signal_cleanup_handler(pipe, cleanup_pipe); - WINPR_PRAGMA_DIAG_POP + freerdp_del_signal_cleanup_handler(ctx, cleanup_pipe); unlink(pipe); return 0; diff --git a/winpr/include/winpr/winpr.h b/winpr/include/winpr/winpr.h index 0f2558cc5..fc3da4125 100644 --- a/winpr/include/winpr/winpr.h +++ b/winpr/include/winpr/winpr.h @@ -137,6 +137,17 @@ WINPR_API const char* winpr_get_build_config(void); #define WINPR_UNUSED(x) (void)(x) #if defined(__GNUC__) || defined(__clang__) +#define WINPR_CAST_CONST_PTR_AWAY(ptr, dstType) \ + ({ \ + union \ + { \ + typeof(ptr) src; \ + dstType dst; \ + } cnv; \ + cnv.src = ptr; \ + cnv.dst; \ + }) + #define WINPR_FUNC_PTR_CAST(ptr, dstType) \ ({ \ union \ @@ -148,7 +159,8 @@ WINPR_API const char* winpr_get_build_config(void); cnv.dst; \ }) #else -#define WINPR_FUNC_PTR_CAST(ptr, dstType) (dstType)(uintptr_t) ptr +#define WINPR_CAST_CONST_PTR_AWAY(ptr, dstType) (dstType) ptr +#define WINPR_CONST_PTR_AWAY_CAST(ptr, dstType) (dstType)(uintptr_t) ptr #endif #endif /* WINPR_H */ diff --git a/winpr/libwinpr/crypto/hash.c b/winpr/libwinpr/crypto/hash.c index 9effce238..cc0874aa0 100644 --- a/winpr/libwinpr/crypto/hash.c +++ b/winpr/libwinpr/crypto/hash.c @@ -230,17 +230,14 @@ BOOL winpr_HMAC_Init(WINPR_HMAC_CTX* ctx, WINPR_MD_TYPE md, const void* key, siz #if defined(WITH_OPENSSL) #if OPENSSL_VERSION_NUMBER >= 0x30000000L - const char* hash = winpr_md_type_to_string(md); + char* hash = WINPR_CAST_CONST_PTR_AWAY(winpr_md_type_to_string(md), char*); if (!ctx->xhmac) return FALSE; - WINPR_PRAGMA_DIAG_PUSH - WINPR_PRAGMA_DIAG_IGNORED_QUALIFIERS const char* param_name = OSSL_MAC_PARAM_DIGEST; const OSSL_PARAM param[] = { OSSL_PARAM_construct_utf8_string(param_name, hash, 0), OSSL_PARAM_construct_end() }; - WINPR_PRAGMA_DIAG_POP if (EVP_MAC_init(ctx->xhmac, key, keylen, param) == 1) return TRUE;