[warnings] use WINPR_CAST_CONST_AWAY
on locations that require (ugly) const to non const casts usw WINPR_CAST_CONST_AWAY to do proper compiler specific casts to avoid warnings
This commit is contained in:
parent
0de5430578
commit
384cd284d8
@ -2590,7 +2590,8 @@ const char* freerdp_client_rdp_file_get_string_option(const rdpFile* file, const
|
||||
LPSTR* value = NULL;
|
||||
rdpFileLine* line = NULL;
|
||||
|
||||
if (freerdp_client_rdp_file_find_string_entry((rdpFile*)file, name, &value, &line))
|
||||
rdpFile* wfile = WINPR_CAST_CONST_PTR_AWAY(file, rdpFile*);
|
||||
if (freerdp_client_rdp_file_find_string_entry(wfile, name, &value, &line))
|
||||
{
|
||||
if (value && ~(size_t)(*value))
|
||||
return *value;
|
||||
@ -2611,7 +2612,8 @@ int freerdp_client_rdp_file_get_integer_option(const rdpFile* file, const char*
|
||||
DWORD* value = NULL;
|
||||
rdpFileLine* line = NULL;
|
||||
|
||||
if (freerdp_client_rdp_file_find_integer_entry((rdpFile*)file, name, &value, &line))
|
||||
rdpFile* wfile = WINPR_CAST_CONST_PTR_AWAY(file, rdpFile*);
|
||||
if (freerdp_client_rdp_file_find_integer_entry(wfile, name, &value, &line))
|
||||
{
|
||||
if (value && ~(*value))
|
||||
return *value;
|
||||
|
@ -860,7 +860,7 @@ BOOL freerdp_dsp_ffmpeg_decode(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
|
||||
av_init_packet(context->packet);
|
||||
#endif
|
||||
context->packet->data = (uint8_t*)data;
|
||||
context->packet->data = WINPR_CAST_CONST_PTR_AWAY(data, uint8_t*);
|
||||
|
||||
WINPR_ASSERT(length <= INT_MAX);
|
||||
context->packet->size = (int)length;
|
||||
|
@ -1385,7 +1385,14 @@ const RFX_TILE** rfx_message_get_tiles(const RFX_MESSAGE* WINPR_RESTRICT message
|
||||
WINPR_ASSERT(message);
|
||||
if (numTiles)
|
||||
*numTiles = message->numTiles;
|
||||
return (const RFX_TILE**)message->tiles;
|
||||
|
||||
union
|
||||
{
|
||||
RFX_TILE** pp;
|
||||
const RFX_TILE** ppc;
|
||||
} cnv;
|
||||
cnv.pp = message->tiles;
|
||||
return cnv.ppc;
|
||||
}
|
||||
|
||||
UINT16 rfx_message_get_tile_count(const RFX_MESSAGE* WINPR_RESTRICT message)
|
||||
|
@ -486,7 +486,7 @@ static BOOL createChildSessionTransport(HANDLE* pFile)
|
||||
}
|
||||
|
||||
const BYTE startOfPath[] = { '\\', 0, '\\', 0, '.', 0, '\\', 0 };
|
||||
if (_wcsncmp(pipePath, (WCHAR*)startOfPath, 4))
|
||||
if (_wcsncmp(pipePath, (const WCHAR*)startOfPath, 4))
|
||||
{
|
||||
/* when compiled under 32 bits, the path may miss "\\.\" at the beginning of the string
|
||||
* so add it if it's not there
|
||||
|
@ -901,7 +901,8 @@ TlsHandshakeResult freerdp_tls_connect_ex(rdpTls* tls, BIO* underlying, const SS
|
||||
return 0;
|
||||
|
||||
#if !defined(OPENSSL_NO_TLSEXT) && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
SSL_set_tlsext_host_name(tls->ssl, tls_get_server_name(tls));
|
||||
const char* str = tls_get_server_name(tls);
|
||||
SSL_set_tlsext_host_name(tls->ssl, WINPR_CAST_CONST_PTR_AWAY(str, void*));
|
||||
#endif
|
||||
|
||||
return freerdp_tls_handshake(tls);
|
||||
|
@ -639,7 +639,8 @@ static BYTE* x509_utils_get_pem(const X509* xcert, const STACK_OF(X509) * chain,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
status = PEM_write_bio_X509(bio, (X509*)xcert);
|
||||
X509* wcert = WINPR_CAST_CONST_PTR_AWAY(xcert, X509*);
|
||||
status = PEM_write_bio_X509(bio, wcert);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
|
@ -343,13 +343,13 @@ WCHAR* _wcsstr(const WCHAR* str, const WCHAR* strSearch)
|
||||
WINPR_ASSERT(strSearch);
|
||||
|
||||
if (strSearch[0] == '\0')
|
||||
return (WCHAR*)str;
|
||||
return WINPR_CAST_CONST_PTR_AWAY(str, WCHAR*);
|
||||
|
||||
const size_t searchLen = _wcslen(strSearch);
|
||||
while (*str)
|
||||
{
|
||||
if (_wcsncmp(str, strSearch, searchLen) == 0)
|
||||
return (WCHAR*)str;
|
||||
return WINPR_CAST_CONST_PTR_AWAY(str, WCHAR*);
|
||||
str++;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -242,14 +242,16 @@ BOOL WLog_Layout_GetMessagePrefix(wLog* log, wLogLayout* layout, wLogMessage* me
|
||||
&recurse }, /* day of week */
|
||||
{ ENTRY("%dy"), ENTRY("%u"), NULL, (void*)(size_t)localTime.wDay, NULL,
|
||||
&recurse }, /* day of year */
|
||||
{ ENTRY("%fl"), ENTRY("%s"), NULL, (void*)message->FileName, NULL, &recurse }, /* file */
|
||||
{ ENTRY("%fn"), ENTRY("%s"), NULL, (void*)message->FunctionName, NULL,
|
||||
&recurse }, /* function */
|
||||
{ ENTRY("%fl"), ENTRY("%s"), NULL, WINPR_CAST_CONST_PTR_AWAY(message->FileName, void*),
|
||||
NULL, &recurse }, /* file */
|
||||
{ ENTRY("%fn"), ENTRY("%s"), NULL, WINPR_CAST_CONST_PTR_AWAY(message->FunctionName, void*),
|
||||
NULL, &recurse }, /* function */
|
||||
{ ENTRY("%hr"), ENTRY("%02u"), NULL, (void*)(size_t)localTime.wHour, NULL,
|
||||
&recurse }, /* hours */
|
||||
{ ENTRY("%ln"), ENTRY("%" PRIuz), NULL, (void*)message->LineNumber, NULL,
|
||||
&recurse }, /* line number */
|
||||
{ ENTRY("%lv"), ENTRY("%s"), NULL, (void*)WLOG_LEVELS[message->Level], NULL,
|
||||
{ ENTRY("%lv"), ENTRY("%s"), NULL,
|
||||
WINPR_CAST_CONST_PTR_AWAY(WLOG_LEVELS[message->Level], void*), NULL,
|
||||
&recurse }, /* log level */
|
||||
{ ENTRY("%mi"), ENTRY("%02u"), NULL, (void*)(size_t)localTime.wMinute, NULL,
|
||||
&recurse }, /* minutes */
|
||||
|
Loading…
Reference in New Issue
Block a user