[warnings] fix redundant casting

This commit is contained in:
akallabeth 2024-09-03 10:38:12 +02:00
parent 72ae7fb54f
commit f7fd817d1c
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
4 changed files with 12 additions and 15 deletions

View File

@ -1357,19 +1357,16 @@ BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file, const rdpSett
BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL unicode)
{
FILE* fp = NULL;
size_t size = 0;
char* buffer = NULL;
int status = 0;
WCHAR* unicodestr = NULL;
if (!file || !name)
return FALSE;
size = freerdp_client_write_rdp_file_buffer(file, NULL, 0);
const size_t size = freerdp_client_write_rdp_file_buffer(file, NULL, 0);
if (size == 0)
return FALSE;
buffer = (char*)calloc((size_t)(size + 1), sizeof(char));
char* buffer = calloc(size + 1ULL, sizeof(char));
if (freerdp_client_write_rdp_file_buffer(file, buffer, size + 1) != size)
{
@ -1378,7 +1375,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
return FALSE;
}
fp = winpr_fopen(name, "w+b");
FILE* fp = winpr_fopen(name, "w+b");
if (fp)
{

View File

@ -326,7 +326,10 @@ static int bitmap_cache_save_persistent(rdpBitmapCache* bitmapCache)
cacheEntry.key64 = bitmap->key64;
cacheEntry.width = bitmap->width;
cacheEntry.height = bitmap->height;
cacheEntry.size = (UINT32)(bitmap->width * bitmap->height * 4);
const UINT64 size = 4ULL * bitmap->width * bitmap->height;
if (size > UINT32_MAX)
continue;
cacheEntry.size = (UINT32)size;
cacheEntry.flags = 0;
cacheEntry.data = bitmap->data;

View File

@ -2011,9 +2011,9 @@ BOOL gcc_read_client_cluster_data(wStream* s, rdpMcs* mcs)
settings->RedirectSmartCards =
(settings->ClusterInfoFlags & REDIRECTED_SMARTCARD) ? TRUE : FALSE;
if (blockLength != 8)
if (blockLength > 8ULL)
{
if (Stream_GetRemainingLength(s) >= (size_t)(blockLength - 8))
if (Stream_GetRemainingLength(s) >= (blockLength - 8ULL))
{
/* The old Microsoft Mac RDP client can send a pad here */
Stream_Seek(s, (blockLength - 8));

View File

@ -91,9 +91,6 @@ static pstatus_t general_yCbCrToRGB_16s8u_P3AC4R_general(const INT16* const WINP
{
for (UINT32 x = 0; x < roi->width; x++)
{
INT64 R = 0;
INT64 G = 0;
INT64 B = 0;
const INT32 divisor = 16;
const INT32 Y = (INT32)((UINT32)((*pY++) + 4096) << divisor);
const INT32 Cb = (*pCb++);
@ -102,9 +99,9 @@ static pstatus_t general_yCbCrToRGB_16s8u_P3AC4R_general(const INT16* const WINP
const INT64 CrG = Cr * (INT64)(0.714401f * (1 << divisor)) * 1LL;
const INT64 CbG = Cb * (INT64)(0.343730f * (1 << divisor)) * 1LL;
const INT64 CbB = Cb * (INT64)(1.769905f * (1 << divisor)) * 1LL;
R = (INT64)((CrR + Y) >> (divisor + 5));
G = (INT64)((Y - CbG - CrG) >> (divisor + 5));
B = (INT64)((CbB + Y) >> (divisor + 5));
const INT64 R = (CrR + Y) >> (divisor + 5);
const INT64 G = (Y - CbG - CrG) >> (divisor + 5);
const INT64 B = (CbB + Y) >> (divisor + 5);
pRGB = writePixel(pRGB, formatSize, DstFormat, CLIP(R), CLIP(G), CLIP(B), 0);
}