From bd7e2263ad88a472f68d2d012ade366f1598d376 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 28 Nov 2022 13:32:40 +0100 Subject: [PATCH] fixed const and type cast warnings --- client/Wayland/wlf_cliprdr.c | 2 +- client/X11/xf_window.c | 6 +++--- libfreerdp/core/info.c | 2 +- winpr/libwinpr/crt/string.c | 4 ++-- winpr/libwinpr/ncrypt/ncrypt_pkcs11.c | 4 ++-- winpr/libwinpr/sspi/sspi_winpr.c | 24 ++++++++++++------------ 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/client/Wayland/wlf_cliprdr.c b/client/Wayland/wlf_cliprdr.c index 7cf23ed1e..e2aea9661 100644 --- a/client/Wayland/wlf_cliprdr.c +++ b/client/Wayland/wlf_cliprdr.c @@ -673,7 +673,7 @@ wlf_cliprdr_server_format_data_request(CliprdrClientContext* context, else { size_t len = 0; - cdata = ConvertUtf8NToWCharAlloc(data, size, &len); + cdata = ConvertUtf8NToWCharAlloc((char*)data, size, &len); free(data); data = NULL; diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index 43cb5fcc7..475b425c4 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -1248,9 +1248,9 @@ UINT xf_AppUpdateWindowFromSurface(xfContext* xfc, gdiGfxSurface* surface) if (!appWindow->image) { WINPR_ASSERT(xfc->depth != 0); - appWindow->image = - XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0, surface->data, - surface->width, surface->height, xfc->scanline_pad, surface->scanline); + appWindow->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0, + (char*)surface->data, surface->width, surface->height, + xfc->scanline_pad, surface->scanline); if (!appWindow->image) { WLog_WARN(TAG, diff --git a/libfreerdp/core/info.c b/libfreerdp/core/info.c index c8b7044d5..b71f0b119 100644 --- a/libfreerdp/core/info.c +++ b/libfreerdp/core/info.c @@ -105,7 +105,7 @@ static BOOL rdp_read_info_null_string(UINT32 flags, wStream* s, size_t cbLen, CH } else { - const char* domain = Stream_Pointer(s); + const char* domain = (const char*)Stream_Pointer(s); if (!Stream_SafeSeek(s, cbLen)) return FALSE; diff --git a/winpr/libwinpr/crt/string.c b/winpr/libwinpr/crt/string.c index e868af4e5..d2b9a6c7d 100644 --- a/winpr/libwinpr/crt/string.c +++ b/winpr/libwinpr/crt/string.c @@ -175,13 +175,13 @@ WCHAR* _wcsstr(const WCHAR* str, const WCHAR* strSearch) WINPR_ASSERT(strSearch); if (strSearch[0] == '\0') - return str; + return (WCHAR*)str; const size_t searchLen = _wcslen(strSearch); while (*str) { if (_wcsncmp(str, strSearch, searchLen) == 0) - return str; + return (WCHAR*)str; str++; } return NULL; diff --git a/winpr/libwinpr/ncrypt/ncrypt_pkcs11.c b/winpr/libwinpr/ncrypt/ncrypt_pkcs11.c index 76a98f044..468f47fdd 100644 --- a/winpr/libwinpr/ncrypt/ncrypt_pkcs11.c +++ b/winpr/libwinpr/ncrypt/ncrypt_pkcs11.c @@ -812,8 +812,8 @@ static SECURITY_STATUS NCryptP11EnumKeys(NCRYPT_PROV_HANDLE hProvider, LPCWSTR p return NTE_NO_MORE_ITEMS; } -static SECURITY_STATUS get_piv_container_name(NCryptP11KeyHandle* key, BYTE* piv_tag, BYTE* output, - size_t output_len) +static SECURITY_STATUS get_piv_container_name(NCryptP11KeyHandle* key, const BYTE* piv_tag, + BYTE* output, size_t output_len) { CK_SLOT_INFO slot_info = { 0 }; CK_FUNCTION_LIST_PTR p11 = NULL; diff --git a/winpr/libwinpr/sspi/sspi_winpr.c b/winpr/libwinpr/sspi/sspi_winpr.c index c9cf2d40d..6e2bb01df 100644 --- a/winpr/libwinpr/sspi/sspi_winpr.c +++ b/winpr/libwinpr/sspi/sspi_winpr.c @@ -614,9 +614,9 @@ BOOL sspi_CopyAuthIdentityFieldsA(const SEC_WINNT_AUTH_IDENTITY_INFO* identity, char** pDomain, char** pPassword) { BOOL success = FALSE; - char* UserA = NULL; - char* DomainA = NULL; - char* PasswordA = NULL; + const char* UserA = NULL; + const char* DomainA = NULL; + const char* PasswordA = NULL; const WCHAR* UserW = NULL; const WCHAR* DomainW = NULL; const WCHAR* PasswordW = NULL; @@ -710,9 +710,9 @@ BOOL sspi_CopyAuthIdentityFieldsW(const SEC_WINNT_AUTH_IDENTITY_INFO* identity, const char* UserA = NULL; const char* DomainA = NULL; const char* PasswordA = NULL; - WCHAR* UserW = NULL; - WCHAR* DomainW = NULL; - WCHAR* PasswordW = NULL; + const WCHAR* UserW = NULL; + const WCHAR* DomainW = NULL; + const WCHAR* PasswordW = NULL; UINT32 UserLength = 0; UINT32 DomainLength = 0; UINT32 PasswordLength = 0; @@ -866,12 +866,12 @@ int sspi_CopyAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, { int status; UINT32 identityFlags; - char* UserA = NULL; - char* DomainA = NULL; - char* PasswordA = NULL; - WCHAR* UserW = NULL; - WCHAR* DomainW = NULL; - WCHAR* PasswordW = NULL; + const char* UserA = NULL; + const char* DomainA = NULL; + const char* PasswordA = NULL; + const WCHAR* UserW = NULL; + const WCHAR* DomainW = NULL; + const WCHAR* PasswordW = NULL; UINT32 UserLength = 0; UINT32 DomainLength = 0; UINT32 PasswordLength = 0;