Fixed compilation warnings.

This commit is contained in:
Armin Novak 2020-08-10 12:04:02 +02:00
parent 226b072af8
commit 57b405ca26
8 changed files with 32 additions and 24 deletions

View File

@ -415,7 +415,7 @@ static void dvcman_free(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChan
*/
static UINT dvcman_init(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr)
{
size_t i;
int i;
DVCMAN* dvcman = (DVCMAN*)pChannelMgr;
UINT error = CHANNEL_RC_OK;
@ -483,7 +483,7 @@ static UINT dvcman_close_channel_iface(IWTSVirtualChannel* pChannel)
static UINT dvcman_create_channel(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr,
UINT32 ChannelId, const char* ChannelName)
{
size_t i;
int i;
BOOL bAccept;
DVCMAN_CHANNEL* channel;
DrdynvcClientContext* context;
@ -1606,7 +1606,7 @@ static UINT drdynvc_virtual_channel_event_terminated(drdynvcPlugin* drdynvc)
static UINT drdynvc_virtual_channel_event_attached(drdynvcPlugin* drdynvc)
{
UINT error = CHANNEL_RC_OK;
size_t i;
int i;
DVCMAN* dvcman;
if (!drdynvc)
@ -1638,7 +1638,7 @@ fail:
static UINT drdynvc_virtual_channel_event_detached(drdynvcPlugin* drdynvc)
{
UINT error = CHANNEL_RC_OK;
size_t i;
int i;
DVCMAN* dvcman;
if (!drdynvc)

View File

@ -454,11 +454,13 @@ static UINT urb_select_configuration(IUDEVICE* pdev, URBDRC_CHANNEL_CALLBACK* ca
if (MsConfig)
MsOutSize = MsConfig->MsOutSize;
if (MsOutSize > SIZE_MAX - 36)
return ERROR_INVALID_DATA;
if (MsOutSize > 0)
{
if ((size_t)MsOutSize > SIZE_MAX - 36)
return ERROR_INVALID_DATA;
out_size = 36 + MsOutSize;
}
else
out_size = 44;

View File

@ -799,7 +799,7 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT
if ((ret <= 0) || (ret <= 4) || (slen <= 4) || (locale != LIBUSB_DT_STRING) ||
(ret > UINT8_MAX))
{
char* msg = "SHORT_DESCRIPTOR";
const char* msg = "SHORT_DESCRIPTOR";
if (ret < 0)
msg = libusb_error_name(ret);
WLog_Print(urbdrc->log, WLOG_DEBUG,
@ -841,7 +841,8 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT
sprintf_s(deviceLocation, sizeof(deviceLocation),
"Port_#%04" PRIu8 ".Hub_#%04" PRIu8 "", device_address, bus_number);
len = strnlen(deviceLocation, MIN(sizeof(deviceLocation), inSize - 1));
len = strnlen(deviceLocation,
MIN(sizeof(deviceLocation), (inSize > 0) ? inSize - 1U : 0));
for (i = 0; i < len; i++)
text[i] = (WCHAR)deviceLocation[i];
text[len++] = '\0';

View File

@ -482,6 +482,8 @@ static BOOL planar_subsample_expand(const BYTE* plane, size_t planeLength, UINT3
{
size_t pos = 0;
UINT32 y;
WINPR_UNUSED(planeLength);
if (!plane || !deltaPlane)
return FALSE;
@ -1195,7 +1197,8 @@ BYTE* freerdp_bitmap_planar_delta_encode_plane(const BYTE* inPlane, UINT32 width
{
INT32 delta = *srcPtr - *prevLinePtr;
s2c = (delta >= 0) ? (char)delta : (char)(~((BYTE)(-delta)) + 1);
s2c = (s2c >= 0) ? ((UINT32)s2c << 1) : (char)(((UINT32)(~((BYTE)s2c) + 1) << 1) - 1);
s2c = (s2c >= 0) ? (char)((UINT32)s2c << 1)
: (char)(((UINT32)(~((BYTE)s2c) + 1) << 1) - 1);
*outPtr = (BYTE)s2c;
}
}

View File

@ -244,7 +244,10 @@ static const char* capabilities_enum_to_string(UINT32 capabilities)
static BOOL rdg_read_http_unicode_string(wStream* s, WCHAR** string, UINT16* lengthInBytes)
{
WCHAR* str;
union {
BYTE* b;
WCHAR* w;
} str;
UINT16 strLenBytes;
/* Read length of the string */
@ -253,7 +256,7 @@ static BOOL rdg_read_http_unicode_string(wStream* s, WCHAR** string, UINT16* len
Stream_Read_UINT16(s, strLenBytes);
/* Remember position of our string */
Stream_GetPointer(s, str);
Stream_GetPointer(s, str.b);
/* seek past the string - if this fails something is wrong */
if (!Stream_SafeSeek(s, strLenBytes))
@ -261,7 +264,7 @@ static BOOL rdg_read_http_unicode_string(wStream* s, WCHAR** string, UINT16* len
/* return the string data (if wanted) */
if (string)
*string = str;
*string = str.w;
if (lengthInBytes)
*lengthInBytes = strLenBytes;
@ -740,8 +743,6 @@ static BOOL rdg_process_tunnel_response_optional(rdpRdg* rdg, wStream* s, UINT16
if (fieldsPresent & HTTP_TUNNEL_RESPONSE_FIELD_SOH_REQ)
{
UINT16 certLen;
/* Seek over nonce (20 bytes) */
if (!Stream_SafeSeek(s, 20))
{

View File

@ -2618,10 +2618,11 @@ BOOL update_write_cache_glyph_v2_order(wStream* s, const CACHE_GLYPH_V2_ORDER* c
}
static BOOL update_decompress_brush(wStream* s, BYTE* output, size_t outSize, BYTE bpp)
{
INT32 x, y, k;
size_t x, k;
INT8 y;
BYTE byte = 0;
const BYTE* palette = Stream_Pointer(s) + 16;
const INT32 bytesPerPixel = ((bpp + 1) / 8);
const size_t bytesPerPixel = ((bpp + 1) / 8);
if (Stream_GetRemainingLength(s) < 16 + bytesPerPixel * 4)
return FALSE;

View File

@ -110,15 +110,15 @@ static int crypto_rsa_common(const BYTE* input, int length, UINT32 key_length, c
if (!input || (length < 0) || (exponent_size < 0) || !modulus || !exponent || !output)
return -1;
if (exponent_size > SIZE_MAX / 2)
if ((size_t)exponent_size > SIZE_MAX / 2)
return -1;
if (key_length >= SIZE_MAX / 2 - exponent_size)
return -1;
bufferSize = 2ULL * key_length + exponent_size;
if (length > bufferSize)
bufferSize = length;
if ((size_t)length > bufferSize)
bufferSize = (size_t)length;
input_reverse = (BYTE*)calloc(bufferSize, 1);
@ -163,7 +163,7 @@ static int crypto_rsa_common(const BYTE* input, int length, UINT32 key_length, c
goto fail;
crypto_reverse(output, output_length);
if (output_length < key_length)
if ((UINT32)output_length < key_length)
memset(output + output_length, 0, key_length - output_length);
fail:

View File

@ -127,7 +127,7 @@ static BOOL capture_plugin_session_end(proxyData* pdata)
wStream* s;
socket = capture_plugin_get_socket(pdata);
if (socket == -1)
if ((INT64)socket == -1LL)
return FALSE;
s = capture_plugin_packet_new(SESSION_END_PDU_BASE_SIZE, MESSAGE_TYPE_SESSION_END);
@ -191,7 +191,7 @@ static BOOL capture_plugin_client_end_paint(proxyData* pdata)
return TRUE;
socket = capture_plugin_get_socket(pdata);
if (socket == -1)
if ((INT64)socket == -1LL)
return FALSE;
if (!capture_plugin_send_frame(pc, socket, gdi->primary_buffer))
@ -211,7 +211,7 @@ static BOOL capture_plugin_client_post_connect(proxyData* pdata)
wStream* s;
socket = capture_plugin_init_socket();
if (socket == -1)
if ((INT64)socket == -1LL)
{
WLog_ERR(TAG, "failed to establish a connection");
return FALSE;