wfreerdp: fix most build warnings

This commit is contained in:
Marc-André Moreau 2014-02-10 22:12:13 -05:00
parent 39e64c5808
commit cdcd290c44
41 changed files with 108 additions and 98 deletions

View File

@ -217,7 +217,7 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 data
if (context->custom)
{
int index;
UINT32 index;
int formatNameLength;
CLIPRDR_FORMAT* formats;
CLIPRDR_FORMAT_LIST formatList;

View File

@ -362,8 +362,8 @@ int cliprdr_client_capabilities(CliprdrClientContext* context, CLIPRDR_CAPABILIT
int cliprdr_client_format_list(CliprdrClientContext* context, CLIPRDR_FORMAT_LIST* formatList)
{
int index;
wStream* s;
UINT32 index;
int length = 0;
int formatNameSize;
CLIPRDR_FORMAT* format;

View File

@ -356,7 +356,7 @@ static void drdynvc_process_receive(rdpSvcPlugin* plugin, wStream* s)
static void drdynvc_process_connect(rdpSvcPlugin* plugin)
{
int index;
UINT32 index;
ADDIN_ARGV* args;
rdpSettings* settings;
drdynvcPlugin* drdynvc = (drdynvcPlugin*)plugin;

View File

@ -469,7 +469,7 @@ int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, UINT32 C
Stream_Write(channel->dvc_data, data, data_size);
if (Stream_GetPosition(channel->dvc_data) >= Stream_Capacity(channel->dvc_data))
if (((size_t) Stream_GetPosition(channel->dvc_data)) >= Stream_Capacity(channel->dvc_data))
{
error = channel->channel_callback->OnDataReceived(channel->channel_callback,
Stream_Capacity(channel->dvc_data), Stream_Buffer(channel->dvc_data));

View File

@ -252,7 +252,7 @@ void rdpei_print_contact_flags(UINT32 contactFlags)
int rdpei_write_touch_frame(wStream* s, RDPINPUT_TOUCH_FRAME* frame)
{
int index;
UINT32 index;
int rectSize = 2;
RDPINPUT_CONTACT_DATA* contact;

View File

@ -95,7 +95,6 @@ static void rdpsnd_winmm_set_format(rdpsndDevicePlugin* device, AUDIO_FORMAT* fo
static void CALLBACK rdpsnd_winmm_callback_function(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
{
MMRESULT mmResult;
RDPSND_WAVE* wave;
LPWAVEHDR lpWaveHdr;
rdpsndWinmmPlugin* winmm = (rdpsndWinmmPlugin*) dwInstance;

View File

@ -15,4 +15,3 @@ define_channel_options(NAME "smartcard" TYPE "device"
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -40,6 +40,10 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${PCSC_LIBRARIES})
if(WIN32)
list(APPEND ${MODULE_PREFIX}_LIBS winscard)
endif()
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_ADDIN_PATH} EXPORT FreeRDPTargets)

View File

@ -21,8 +21,6 @@
#ifndef FREERDP_CHANNEL_SMARTCARD_CLIENT_MAIN_H
#define FREERDP_CHANNEL_SMARTCARD_CLIENT_MAIN_H
#include <inttypes.h>
#include <freerdp/utils/list.h>
#include <freerdp/utils/debug.h>
#include <freerdp/channels/rdpdr.h>

View File

@ -23,12 +23,15 @@
#include "config.h"
#endif
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <assert.h>
#ifdef _WIN32
#include <winscard.h>
#else
#include <strings.h>
#define BOOL PCSC_BOOL
#include <PCSC/pcsclite.h>
#include <PCSC/winscard.h>
@ -50,6 +53,7 @@
#define SCARD_CTL_CODE(code) (0x42000000 + (code))
#endif
#undef BOOL
#endif
#include <winpr/crt.h>
#include <winpr/print.h>

View File

@ -104,7 +104,7 @@ void palette_cache_free(rdpPaletteCache* paletteCache)
{
if (paletteCache)
{
int i;
UINT32 i;
for (i = 0; i< paletteCache->maxEntries; i++)
{

View File

@ -172,18 +172,18 @@ int decompress_rdp(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UIN
int decompress_rdp_4(struct rdp_mppc_dec* dec, BYTE* cbuf, int len, int ctype, UINT32* roff, UINT32* rlen)
{
BYTE* history_buf; /* uncompressed data goes here */
BYTE* history_ptr; /* points to next free slot in history_buf */
UINT32 d32; /* we process 4 compressed bytes at a time */
UINT16 copy_offset; /* location to copy data from */
UINT16 lom; /* length of match */
BYTE* src_ptr; /* used while copying compressed data */
BYTE* cptr; /* points to next byte in cbuf */
BYTE cur_byte; /* last byte fetched from cbuf */
unsigned int bits_left; /* bits left in d34 for processing */
unsigned int cur_bits_left; /* bits left in cur_byte for processing */
int tmp;
UINT32 i32;
BYTE* history_buf; /* uncompressed data goes here */
BYTE* history_ptr; /* points to next free slot in history_buf */
UINT32 d32; /* we process 4 compressed bytes at a time */
UINT16 copy_offset; /* location to copy data from */
UINT16 lom; /* length of match */
BYTE* src_ptr; /* used while copying compressed data */
BYTE* cptr; /* points to next byte in cbuf */
BYTE cur_byte; /* last byte fetched from cbuf */
unsigned int bits_left; /* bits left in d34 for processing */
unsigned int cur_bits_left; /* bits left in cur_byte for processing */
int tmp;
UINT32 i32;
fprintf(stderr, "decompress_rdp_4:\n");

View File

@ -453,7 +453,7 @@ static BOOL rfx_process_message_codec_versions(RFX_CONTEXT* context, wStream* s)
return FALSE;
}
if (Stream_GetRemainingLength(s) < 2 * numCodecs)
if (Stream_GetRemainingLength(s) < (size_t) (2 * numCodecs))
{
DEBUG_WARN("RfxCodecVersion packet too small for numCodecs=%d", numCodecs);
return FALSE;
@ -490,7 +490,7 @@ static BOOL rfx_process_message_channels(RFX_CONTEXT* context, wStream* s)
return TRUE;
}
if (Stream_GetRemainingLength(s) < numChannels * 5)
if (Stream_GetRemainingLength(s) < (size_t) (numChannels * 5))
{
DEBUG_WARN("RfxMessageChannels packet too small for numChannels=%d", numChannels);
return FALSE;
@ -604,7 +604,7 @@ static BOOL rfx_process_message_region(RFX_CONTEXT* context, RFX_MESSAGE* messag
return TRUE;
}
if (Stream_GetRemainingLength(s) < 8 * message->numRects)
if (Stream_GetRemainingLength(s) < (size_t) (8 * message->numRects))
{
DEBUG_WARN("RfxMessageRegion packet too small for num_rects=%d", message->numRects);
return FALSE;
@ -703,7 +703,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
quants = context->quants;
/* quantVals */
if (Stream_GetRemainingLength(s) < context->numQuant * 5)
if (Stream_GetRemainingLength(s) < (size_t) (context->numQuant * 5))
{
DEBUG_WARN("RfxMessageTileSet packet too small for num_quants=%d", context->numQuant);
return FALSE;
@ -1313,7 +1313,7 @@ RFX_MESSAGE* rfx_split_message(RFX_CONTEXT* context, RFX_MESSAGE* message, int*
{
tileDataSize = rfx_tile_length(message->tiles[i]);
if ((messages[j].tilesDataSize + tileDataSize) > maxDataSize)
if ((messages[j].tilesDataSize + tileDataSize) > ((UINT32) maxDataSize))
j++;
if (!messages[j].numTiles)

View File

@ -147,7 +147,7 @@ void freerdp_device_collection_add(rdpSettings* settings, RDPDR_DEVICE* device)
RDPDR_DEVICE* freerdp_device_collection_find(rdpSettings* settings, const char* name)
{
int index;
UINT32 index;
RDPDR_DEVICE* device;
for (index = 0; index < settings->DeviceCount; index++)
@ -234,7 +234,7 @@ RDPDR_DEVICE* freerdp_device_clone(RDPDR_DEVICE* device)
void freerdp_device_collection_free(rdpSettings* settings)
{
int index;
UINT32 index;
RDPDR_DEVICE* device;
for (index = 0; index < settings->DeviceCount; index++)
@ -288,7 +288,7 @@ void freerdp_static_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* ch
ADDIN_ARGV* freerdp_static_channel_collection_find(rdpSettings* settings, const char* name)
{
int index;
UINT32 index;
ADDIN_ARGV* channel;
for (index = 0; index < settings->StaticChannelCount; index++)
@ -322,7 +322,8 @@ ADDIN_ARGV* freerdp_static_channel_clone(ADDIN_ARGV* channel)
void freerdp_static_channel_collection_free(rdpSettings* settings)
{
int i, j;
int j;
UINT32 i;
for (i = 0; i < settings->StaticChannelCount; i++)
{
@ -354,7 +355,7 @@ void freerdp_dynamic_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* c
ADDIN_ARGV* freerdp_dynamic_channel_collection_find(rdpSettings* settings, const char* name)
{
int index;
UINT32 index;
ADDIN_ARGV* channel;
for (index = 0; index < settings->DynamicChannelCount; index++)
@ -388,7 +389,7 @@ ADDIN_ARGV* freerdp_dynamic_channel_clone(ADDIN_ARGV* channel)
void freerdp_dynamic_channel_collection_free(rdpSettings* settings)
{
int index;
UINT32 index;
for (index = 0; index < settings->DynamicChannelCount; index++)
{

View File

@ -2977,7 +2977,7 @@ BOOL rdp_print_capability_sets(wStream* s, UINT16 numberCapabilities, BOOL recei
em = bm + length;
if (Stream_GetRemainingLength(s) < length - 4)
if (Stream_GetRemainingLength(s) < (size_t) (length - 4))
{
fprintf(stderr, "error processing stream\n");
return FALSE;
@ -3176,7 +3176,7 @@ BOOL rdp_read_capability_sets(wStream* s, rdpSettings* settings, UINT16 numberCa
em = bm + length;
if (Stream_GetRemainingLength(s) < length - 4)
if (Stream_GetRemainingLength(s) < ((size_t) length - 4))
{
fprintf(stderr, "error processing stream\n");
return FALSE;
@ -3555,7 +3555,7 @@ BOOL rdp_recv_confirm_active(rdpRdp* rdp, wStream* s)
Stream_Read_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */
Stream_Read_UINT16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */
if (Stream_GetRemainingLength(s) < lengthSourceDescriptor + 4)
if (((int) Stream_GetRemainingLength(s)) < lengthSourceDescriptor + 4)
return FALSE;
Stream_Seek(s, lengthSourceDescriptor); /* sourceDescriptor */

View File

@ -248,7 +248,7 @@ BOOL certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info)
error++;
if (Stream_GetRemainingLength(s) < modulus_length)
if (((int) Stream_GetRemainingLength(s)) < modulus_length)
goto error1;
info->ModulusLength = modulus_length;
@ -261,7 +261,7 @@ BOOL certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info)
error++;
if (Stream_GetRemainingLength(s) < exponent_length || exponent_length > 4)
if ((((int) Stream_GetRemainingLength(s)) < exponent_length) || (exponent_length > 4))
goto error2;
Stream_Read(s, &info->exponent[4 - exponent_length], exponent_length);

View File

@ -35,9 +35,10 @@
BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channel_id, BYTE* data, int size)
{
DWORD i;
int left;
wStream* s;
UINT32 flags;
int i, left;
int chunk_size;
rdpChannel* channel = NULL;

View File

@ -338,7 +338,7 @@ BOOL rdp_client_redirect(rdpRdp* rdp)
BOOL rdp_client_reconnect(rdpRdp* rdp)
{
int i;
UINT32 i;
transport_disconnect(rdp->transport);
@ -557,7 +557,7 @@ BOOL rdp_client_connect_mcs_attach_user_confirm(rdpRdp* rdp, wStream* s)
BOOL rdp_client_connect_mcs_channel_join_confirm(rdpRdp* rdp, wStream* s)
{
int i;
UINT32 i;
UINT16 channel_id;
BOOL all_joined = TRUE;
@ -922,7 +922,7 @@ BOOL rdp_server_accept_nego(rdpRdp* rdp, wStream* s)
BOOL rdp_server_accept_mcs_connect_initial(rdpRdp* rdp, wStream* s)
{
int i;
UINT32 i;
if (!mcs_recv_connect_initial(rdp->mcs, s))
return FALSE;
@ -969,7 +969,7 @@ BOOL rdp_server_accept_mcs_attach_user_request(rdpRdp* rdp, wStream* s)
BOOL rdp_server_accept_mcs_channel_join_request(rdpRdp* rdp, wStream* s)
{
int i;
UINT32 i;
UINT16 channel_id;
BOOL all_joined = TRUE;

View File

@ -379,7 +379,7 @@ int rpc_write(rdpRpc* rpc, BYTE* data, int length, UINT16 opnum)
request_pdu->ptype = PTYPE_REQUEST;
request_pdu->pfc_flags = PFC_FIRST_FRAG | PFC_LAST_FRAG;
request_pdu->auth_length = ntlm->ContextSizes.cbMaxSignature;
request_pdu->auth_length = (UINT16) ntlm->ContextSizes.cbMaxSignature;
request_pdu->call_id = rpc->CallId++;
request_pdu->alloc_hint = length;
request_pdu->p_cont_id = 0x0000;

View File

@ -142,7 +142,7 @@ int rpc_send_bind_pdu(rdpRpc* rpc)
rpc_pdu_header_init(rpc, (rpcconn_hdr_t*) bind_pdu);
bind_pdu->auth_length = rpc->ntlm->outputBuffer[0].cbBuffer;
bind_pdu->auth_length = (UINT16) rpc->ntlm->outputBuffer[0].cbBuffer;
bind_pdu->auth_verifier.auth_value = rpc->ntlm->outputBuffer[0].pvBuffer;
bind_pdu->ptype = PTYPE_BIND;
@ -291,7 +291,7 @@ int rpc_send_rpc_auth_3_pdu(rdpRpc* rpc)
rpc_pdu_header_init(rpc, (rpcconn_hdr_t*) auth_3_pdu);
auth_3_pdu->auth_length = rpc->ntlm->outputBuffer[0].cbBuffer;
auth_3_pdu->auth_length = (UINT16) rpc->ntlm->outputBuffer[0].cbBuffer;
auth_3_pdu->auth_verifier.auth_value = rpc->ntlm->outputBuffer[0].pvBuffer;
auth_3_pdu->ptype = PTYPE_RPC_AUTH_3;

View File

@ -328,7 +328,7 @@ BOOL gcc_read_client_data_blocks(wStream* s, rdpSettings* settings, int length)
if (!gcc_read_user_data_header(s, &type, &blockLength))
return FALSE;
if (Stream_GetRemainingLength(s) < (blockLength - 4))
if (Stream_GetRemainingLength(s) < (size_t) (blockLength - 4))
return FALSE;
switch (type)
@ -520,7 +520,7 @@ BOOL gcc_read_user_data_header(wStream* s, UINT16* type, UINT16* length)
Stream_Read_UINT16(s, *type); /* type */
Stream_Read_UINT16(s, *length); /* length */
if (Stream_GetRemainingLength(s) < *length - 4)
if (Stream_GetRemainingLength(s) < (size_t) (*length - 4))
return FALSE;
return TRUE;
@ -1175,14 +1175,16 @@ void gcc_write_server_security_data(wStream* s, rdpSettings* settings)
BOOL gcc_read_client_network_data(wStream* s, rdpSettings* settings, UINT16 blockLength)
{
int i;
UINT32 i;
if (blockLength < 4)
return FALSE;
Stream_Read_UINT32(s, settings->ChannelCount); /* channelCount */
if (blockLength < 4 + settings->ChannelCount * 12)
return FALSE;
if (settings->ChannelCount > 16)
return FALSE;
@ -1207,7 +1209,7 @@ BOOL gcc_read_client_network_data(wStream* s, rdpSettings* settings, UINT16 bloc
void gcc_write_client_network_data(wStream* s, rdpSettings* settings)
{
int i;
UINT32 i;
UINT16 length;
if (settings->ChannelCount > 0)
@ -1252,7 +1254,7 @@ BOOL gcc_read_server_network_data(wStream* s, rdpSettings* settings)
channelsToTreat = settings->ChannelCount;
}
if (Stream_GetRemainingLength(s) < channelCount * 2)
if (Stream_GetRemainingLength(s) < (size_t) channelCount * 2)
return FALSE;
for (i = 0; i < channelsToTreat; i++)
@ -1269,7 +1271,7 @@ BOOL gcc_read_server_network_data(wStream* s, rdpSettings* settings)
void gcc_write_server_network_data(wStream* s, rdpSettings* settings)
{
int i;
UINT32 i;
gcc_write_user_data_header(s, SC_NET, 8 + settings->ChannelCount * 2 + (settings->ChannelCount % 2 == 1 ? 2 : 0));

View File

@ -314,7 +314,7 @@ BOOL rdp_read_info_packet(wStream* s, rdpSettings* settings)
Stream_Read_UINT16(s, cbAlternateShell); /* cbAlternateShell */
Stream_Read_UINT16(s, cbWorkingDir); /* cbWorkingDir */
if (Stream_GetRemainingLength(s) < cbDomain + 2)
if (Stream_GetRemainingLength(s) < (size_t) (cbDomain + 2))
return FALSE;
if (cbDomain > 0)
@ -324,7 +324,7 @@ BOOL rdp_read_info_packet(wStream* s, rdpSettings* settings)
}
Stream_Seek(s, 2);
if (Stream_GetRemainingLength(s) < cbUserName + 2)
if (Stream_GetRemainingLength(s) < (size_t) (cbUserName + 2))
return FALSE;
if (cbUserName > 0)
@ -334,7 +334,7 @@ BOOL rdp_read_info_packet(wStream* s, rdpSettings* settings)
}
Stream_Seek(s, 2);
if (Stream_GetRemainingLength(s) < cbPassword + 2)
if (Stream_GetRemainingLength(s) < (size_t) (cbPassword + 2))
return FALSE;
if (cbPassword > 0)
@ -344,7 +344,7 @@ BOOL rdp_read_info_packet(wStream* s, rdpSettings* settings)
}
Stream_Seek(s, 2);
if (Stream_GetRemainingLength(s) < cbAlternateShell + 2)
if (Stream_GetRemainingLength(s) < (size_t) (cbAlternateShell + 2))
return FALSE;
if (cbAlternateShell > 0)
@ -354,7 +354,7 @@ BOOL rdp_read_info_packet(wStream* s, rdpSettings* settings)
}
Stream_Seek(s, 2);
if (Stream_GetRemainingLength(s) < cbWorkingDir + 2)
if (Stream_GetRemainingLength(s) < (size_t) (cbWorkingDir + 2))
return FALSE;
if (cbWorkingDir > 0)

View File

@ -400,7 +400,7 @@ BOOL input_recv(rdpInput* input, wStream* s)
Stream_Seek(s, 2); /* pad2Octets (2 bytes) */
/* Each input event uses 6 exactly bytes. */
if (Stream_GetRemainingLength(s) < 6 * numberEvents)
if (Stream_GetRemainingLength(s) < (size_t) (6 * numberEvents))
return FALSE;
for (i = 0; i < numberEvents; i++)

View File

@ -27,6 +27,7 @@
#include <fcntl.h>
#include <winpr/crt.h>
#include <winpr/windows.h>
#ifndef _WIN32
#include <netdb.h>
@ -45,7 +46,7 @@
#ifdef _WIN32
#if _WIN32_WINNT < 0x0600
static const char *inet_ntop(int af, const void* src, char* dst, socklen_t cnt)
static const char* inet_ntop(int af, const void* src, char* dst, size_t cnt)
{
if (af == AF_INET)
{
@ -64,7 +65,7 @@ static const char *inet_ntop(int af, const void* src, char* dst, socklen_t cnt)
memset(&in, 0, sizeof(in));
in.sin6_family = AF_INET6;
memcpy(&in.sin6_addr, src, sizeof(struct in_addr6));
getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in6), dst, cnt, NULL, 0, NI_NUMERICHOST);
getnameinfo((struct sockaddr*) &in, sizeof(struct sockaddr_in6), dst, cnt, NULL, 0, NI_NUMERICHOST);
return dst;
}

View File

@ -342,12 +342,12 @@ BOOL mcs_recv_connect_initial(rdpMcs* mcs, wStream* s)
return FALSE;
/* callingDomainSelector (OCTET_STRING) */
if (!ber_read_octet_string_tag(s, &length) || Stream_GetRemainingLength(s) < length)
if (!ber_read_octet_string_tag(s, &length) || ((int) Stream_GetRemainingLength(s)) < length)
return FALSE;
Stream_Seek(s, length);
/* calledDomainSelector (OCTET_STRING) */
if (!ber_read_octet_string_tag(s, &length) || Stream_GetRemainingLength(s) < length)
if (!ber_read_octet_string_tag(s, &length) || ((int) Stream_GetRemainingLength(s)) < length)
return FALSE;
Stream_Seek(s, length);
@ -367,7 +367,7 @@ BOOL mcs_recv_connect_initial(rdpMcs* mcs, wStream* s)
if (!mcs_read_domain_parameters(s, &mcs->maximumParameters))
return FALSE;
if (!ber_read_octet_string_tag(s, &length) || Stream_GetRemainingLength(s) < length)
if (!ber_read_octet_string_tag(s, &length) || ((int) Stream_GetRemainingLength(s)) < length)
return FALSE;
if (!gcc_read_conference_create_request(s, mcs->transport->settings))

View File

@ -77,7 +77,7 @@ static void update_message_DesktopResize(rdpContext* context)
static void update_message_BitmapUpdate(rdpContext* context, BITMAP_UPDATE* bitmap)
{
int index;
UINT32 index;
BITMAP_UPDATE* wParam;
wParam = (BITMAP_UPDATE*) malloc(sizeof(BITMAP_UPDATE));
@ -998,7 +998,7 @@ static int update_message_free_update_class(wMessage* msg, int type)
case Update_BitmapUpdate:
{
int index;
UINT32 index;
BITMAP_UPDATE* wParam = (BITMAP_UPDATE*) msg->wParam;
for (index = 0; index < wParam->number; index++)

View File

@ -1244,7 +1244,7 @@ int credssp_recv(rdpCredssp* credssp)
!ber_read_sequence_tag(s, &length) || /* NegoDataItem */
!ber_read_contextual_tag(s, 0, &length, TRUE) || /* [0] negoToken */
!ber_read_octet_string_tag(s, &length) || /* OCTET STRING */
Stream_GetRemainingLength(s) < length)
((int) Stream_GetRemainingLength(s)) < length)
{
Stream_Free(s, TRUE);
return -1;
@ -1257,8 +1257,8 @@ int credssp_recv(rdpCredssp* credssp)
/* [2] authInfo (OCTET STRING) */
if (ber_read_contextual_tag(s, 2, &length, TRUE) != FALSE)
{
if(!ber_read_octet_string_tag(s, &length) || /* OCTET STRING */
Stream_GetRemainingLength(s) < length)
if (!ber_read_octet_string_tag(s, &length) || /* OCTET STRING */
((int) Stream_GetRemainingLength(s)) < length)
{
Stream_Free(s, TRUE);
return -1;
@ -1271,8 +1271,8 @@ int credssp_recv(rdpCredssp* credssp)
/* [3] pubKeyAuth (OCTET STRING) */
if (ber_read_contextual_tag(s, 3, &length, TRUE) != FALSE)
{
if(!ber_read_octet_string_tag(s, &length) || /* OCTET STRING */
Stream_GetRemainingLength(s) < length)
if (!ber_read_octet_string_tag(s, &length) || /* OCTET STRING */
((int) Stream_GetRemainingLength(s)) < length)
{
Stream_Free(s, TRUE);
return -1;

View File

@ -651,7 +651,7 @@ static INLINE BOOL update_read_delta_rects(wStream* s, DELTA_RECT* rectangles, i
int i;
BYTE flags = 0;
BYTE* zeroBits;
int zeroBitsSize;
UINT32 zeroBitsSize;
if (number > 45)
number = 45;
@ -711,7 +711,7 @@ static INLINE BOOL update_read_delta_points(wStream* s, DELTA_POINT* points, int
int i;
BYTE flags = 0;
BYTE* zeroBits;
int zeroBitsSize;
UINT32 zeroBitsSize;
zeroBitsSize = ((number + 3) / 4);
@ -2464,7 +2464,7 @@ BOOL update_read_cache_brush_order(wStream* s, CACHE_BRUSH_ORDER* cache_brush, U
else
{
/* uncompressed brush */
int scanline = (cache_brush->bpp / 8) * 8;
UINT32 scanline = (cache_brush->bpp / 8) * 8;
if (Stream_GetRemainingLength(s) < scanline * 8)
return FALSE;

View File

@ -109,7 +109,7 @@ BOOL rdp_read_share_control_header(wStream* s, UINT16* length, UINT16* type, UIN
/* Share Control Header */
Stream_Read_UINT16(s, *length); /* totalLength */
if (*length - 2 > Stream_GetRemainingLength(s))
if (((size_t) *length - 2) > Stream_GetRemainingLength(s))
return FALSE;
Stream_Read_UINT16(s, *type); /* pduType */
@ -279,7 +279,7 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
return FALSE;
}
if (*length - 8 > Stream_GetRemainingLength(s))
if ((size_t) (*length - 8) > Stream_GetRemainingLength(s))
return FALSE;
if (MCSPDU == DomainMCSPDU_DisconnectProviderUltimatum)
@ -648,7 +648,7 @@ BOOL rdp_recv_server_status_info_pdu(rdpRdp* rdp, wStream* s)
BOOL rdp_recv_monitor_layout_pdu(rdpRdp* rdp, wStream* s)
{
int index;
UINT32 index;
UINT32 monitorCount;
MONITOR_DEF* monitor;
MONITOR_DEF* monitorDefArray;
@ -682,7 +682,7 @@ BOOL rdp_recv_monitor_layout_pdu(rdpRdp* rdp, wStream* s)
BOOL rdp_write_monitor_layout_pdu(wStream* s, UINT32 monitorCount, MONITOR_DEF* monitorDefArray)
{
int index;
UINT32 index;
MONITOR_DEF* monitor;
Stream_EnsureRemainingCapacity(s, 4 + (monitorCount * 20));
@ -722,7 +722,7 @@ int rdp_recv_data_pdu(rdpRdp* rdp, wStream* s)
if (compressed_type & PACKET_COMPRESSED)
{
if (Stream_GetRemainingLength(s) < compressed_len - 18)
if (Stream_GetRemainingLength(s) < (size_t) (compressed_len - 18))
{
fprintf(stderr, "decompress_rdp: not enough bytes for compressed_len=%d\n", compressed_len);
return -1;

View File

@ -152,7 +152,7 @@ int rdp_redirection_apply_settings(rdpRdp* rdp)
if (settings->RedirectionFlags & LB_TARGET_NET_ADDRESSES)
{
int i;
UINT32 i;
freerdp_target_net_addresses_free(settings);

View File

@ -426,7 +426,7 @@ rdpSettings* freerdp_settings_new(DWORD flags)
rdpSettings* freerdp_settings_clone(rdpSettings* settings)
{
int index;
UINT32 index;
rdpSettings* _settings;
_settings = (rdpSettings*) malloc(sizeof(rdpSettings));

View File

@ -1460,7 +1460,7 @@ BOOL update_read_refresh_rect(rdpUpdate* update, wStream* s)
Stream_Read_UINT8(s, numberOfAreas);
Stream_Seek(s, 3); /* pad3Octects */
if (Stream_GetRemainingLength(s) < numberOfAreas * 4 * 2)
if (Stream_GetRemainingLength(s) < ((size_t) numberOfAreas * 4 * 2))
return FALSE;
areas = (RECTANGLE_16*) malloc(sizeof(RECTANGLE_16) * numberOfAreas);

View File

@ -369,7 +369,7 @@ BOOL ber_read_integer(wStream* s, UINT32* value)
if (!ber_read_universal_tag(s, BER_TAG_INTEGER, FALSE) ||
!ber_read_length(s, &length) ||
Stream_GetRemainingLength(s) < length)
((int) Stream_GetRemainingLength(s)) < length)
return FALSE;
if (value == NULL)

View File

@ -160,7 +160,7 @@ void per_write_number_of_sets(wStream* s, BYTE number)
BOOL per_read_padding(wStream* s, int length)
{
if (Stream_GetRemainingLength(s) < length)
if (((int) Stream_GetRemainingLength(s)) < length)
return FALSE;
Stream_Seek(s, length);
@ -399,7 +399,7 @@ BOOL per_read_octet_string(wStream* s, BYTE* oct_str, int length, int min)
if (mlength + min != length)
return FALSE;
if (Stream_GetRemainingLength(s) < length)
if (((int) Stream_GetRemainingLength(s)) < length)
return FALSE;
a_oct_str = Stream_Pointer(s);
@ -453,7 +453,7 @@ BOOL per_read_numeric_string(wStream* s, int min)
length = (mlength + min + 1) / 2;
if (Stream_GetRemainingLength(s) < length)
if (((int) Stream_GetRemainingLength(s)) < length)
return FALSE;
Stream_Seek(s, length);

View File

@ -594,10 +594,11 @@ BOOL tls_match_hostname(char *pattern, int pattern_length, char *hostname)
return TRUE;
}
if (pattern_length > 2 && pattern[0] == '*' && pattern[1] == '.' && strlen(hostname) >= pattern_length)
if ((pattern_length > 2) && (pattern[0] == '*') && (pattern[1] == '.') && (((int) strlen(hostname)) >= pattern_length))
{
char *check_hostname = &hostname[ strlen(hostname) - pattern_length+1 ];
if (memcmp((void*) check_hostname, (void*) &pattern[1], pattern_length - 1) == 0 )
char* check_hostname = &hostname[strlen(hostname) - pattern_length + 1];
if (memcmp((void*) check_hostname, (void*) &pattern[1], pattern_length - 1) == 0)
{
return TRUE;
}

View File

@ -92,7 +92,7 @@ double stopwatch_get_elapsed_time_in_seconds(STOPWATCH* stopwatch)
void stopwatch_get_elapsed_time_in_useconds(STOPWATCH* stopwatch, UINT32* sec, UINT32* usec)
{
*sec = stopwatch->elapsed / 1000000;
*usec = stopwatch->elapsed % 1000000;
*sec = (UINT32) stopwatch->elapsed / 1000000;
*usec = (UINT32) stopwatch->elapsed % 1000000;
}

View File

@ -50,7 +50,7 @@ static int isProbablePrime(long oddNumber)
static long calculateIdealNumOfBuckets(wHashTable* table)
{
long idealNumOfBuckets = table->numOfElements / table->idealRatio;
long idealNumOfBuckets = table->numOfElements / ((long) table->idealRatio);
if (idealNumOfBuckets < 5)
idealNumOfBuckets = 5;

View File

@ -36,7 +36,7 @@
wReference* ReferenceTable_FindEntry(wReferenceTable* referenceTable, void* ptr)
{
int index = 0;
UINT32 index = 0;
BOOL found = FALSE;
wReference* reference = NULL;
@ -53,7 +53,7 @@ wReference* ReferenceTable_FindEntry(wReferenceTable* referenceTable, void* ptr)
wReference* ReferenceTable_GetFreeEntry(wReferenceTable* referenceTable)
{
int index = 0;
UINT32 index = 0;
BOOL found = FALSE;
wReference* reference = NULL;

View File

@ -103,7 +103,7 @@
# if defined(TRIO_PLATFORM_WINCE)
# define strcasecmp(x,y) _stricmp(x,y)
# else
# define strcasecmp(x,y) strcmpi(x,y)
# define strcasecmp(x,y) _stricmp(x,y)
# endif
#endif

View File

@ -370,7 +370,7 @@ int WLog_PacketMessage_Write(wPcap* pcap, void* data, DWORD length, DWORD flags)
ipv4.Version = 4;
ipv4.InternetHeaderLength = 5;
ipv4.TypeOfService = 0;
ipv4.TotalLength = length + 20 + 20;
ipv4.TotalLength = (UINT16) (length + 20 + 20);
ipv4.Identification = 0;
ipv4.InternetProtocolFlags = 0x02;
ipv4.FragmentOffset = 0;

View File

@ -403,7 +403,7 @@ int WLog_AddChild(wLog* parent, wLog* child)
wLog* WLog_FindChild(LPCSTR name)
{
int index;
DWORD index;
wLog* root;
wLog* child = NULL;
BOOL found = FALSE;