diff --git a/channels/cliprdr/client/cliprdr_format.c b/channels/cliprdr/client/cliprdr_format.c index e01cb656d..087635054 100644 --- a/channels/cliprdr/client/cliprdr_format.c +++ b/channels/cliprdr/client/cliprdr_format.c @@ -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; diff --git a/channels/cliprdr/client/cliprdr_main.c b/channels/cliprdr/client/cliprdr_main.c index 99a1b7b1f..950a7be7b 100644 --- a/channels/cliprdr/client/cliprdr_main.c +++ b/channels/cliprdr/client/cliprdr_main.c @@ -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; diff --git a/channels/drdynvc/client/drdynvc_main.c b/channels/drdynvc/client/drdynvc_main.c index 17492542b..fb3665d8d 100644 --- a/channels/drdynvc/client/drdynvc_main.c +++ b/channels/drdynvc/client/drdynvc_main.c @@ -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; diff --git a/channels/drdynvc/client/dvcman.c b/channels/drdynvc/client/dvcman.c index 954247d02..fae74d81b 100644 --- a/channels/drdynvc/client/dvcman.c +++ b/channels/drdynvc/client/dvcman.c @@ -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)); diff --git a/channels/rdpei/client/rdpei_main.c b/channels/rdpei/client/rdpei_main.c index d2030051e..6f174ee68 100644 --- a/channels/rdpei/client/rdpei_main.c +++ b/channels/rdpei/client/rdpei_main.c @@ -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; diff --git a/channels/rdpsnd/client/winmm/rdpsnd_winmm.c b/channels/rdpsnd/client/winmm/rdpsnd_winmm.c index b19f114ba..7c1e47cd0 100644 --- a/channels/rdpsnd/client/winmm/rdpsnd_winmm.c +++ b/channels/rdpsnd/client/winmm/rdpsnd_winmm.c @@ -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; diff --git a/channels/smartcard/ChannelOptions.cmake b/channels/smartcard/ChannelOptions.cmake index ad8cc40fc..130516d34 100644 --- a/channels/smartcard/ChannelOptions.cmake +++ b/channels/smartcard/ChannelOptions.cmake @@ -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}) - diff --git a/channels/smartcard/client/CMakeLists.txt b/channels/smartcard/client/CMakeLists.txt index 859ea9b67..9c927a9ed 100644 --- a/channels/smartcard/client/CMakeLists.txt +++ b/channels/smartcard/client/CMakeLists.txt @@ -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) diff --git a/channels/smartcard/client/smartcard_main.h b/channels/smartcard/client/smartcard_main.h index 320292be2..1ab4f7aeb 100644 --- a/channels/smartcard/client/smartcard_main.h +++ b/channels/smartcard/client/smartcard_main.h @@ -21,8 +21,6 @@ #ifndef FREERDP_CHANNEL_SMARTCARD_CLIENT_MAIN_H #define FREERDP_CHANNEL_SMARTCARD_CLIENT_MAIN_H -#include - #include #include #include diff --git a/channels/smartcard/client/smartcard_operations.c b/channels/smartcard/client/smartcard_operations.c index 5481c2714..acb5a85b2 100644 --- a/channels/smartcard/client/smartcard_operations.c +++ b/channels/smartcard/client/smartcard_operations.c @@ -23,12 +23,15 @@ #include "config.h" #endif -#include #include #include #include -#include +#include +#ifdef _WIN32 +#include +#else +#include #define BOOL PCSC_BOOL #include #include @@ -50,6 +53,7 @@ #define SCARD_CTL_CODE(code) (0x42000000 + (code)) #endif #undef BOOL +#endif #include #include diff --git a/libfreerdp/cache/palette.c b/libfreerdp/cache/palette.c index a8561bb8d..3436a686d 100644 --- a/libfreerdp/cache/palette.c +++ b/libfreerdp/cache/palette.c @@ -104,7 +104,7 @@ void palette_cache_free(rdpPaletteCache* paletteCache) { if (paletteCache) { - int i; + UINT32 i; for (i = 0; i< paletteCache->maxEntries; i++) { diff --git a/libfreerdp/codec/mppc_dec.c b/libfreerdp/codec/mppc_dec.c index 76238768a..2bb2de819 100644 --- a/libfreerdp/codec/mppc_dec.c +++ b/libfreerdp/codec/mppc_dec.c @@ -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"); diff --git a/libfreerdp/codec/rfx.c b/libfreerdp/codec/rfx.c index f8e736d88..efa447086 100644 --- a/libfreerdp/codec/rfx.c +++ b/libfreerdp/codec/rfx.c @@ -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) diff --git a/libfreerdp/common/settings.c b/libfreerdp/common/settings.c index ef4493f4e..f2b501a0a 100644 --- a/libfreerdp/common/settings.c +++ b/libfreerdp/common/settings.c @@ -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++) { diff --git a/libfreerdp/core/capabilities.c b/libfreerdp/core/capabilities.c index 39bdd66d1..7cac73486 100644 --- a/libfreerdp/core/capabilities.c +++ b/libfreerdp/core/capabilities.c @@ -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 */ diff --git a/libfreerdp/core/certificate.c b/libfreerdp/core/certificate.c index 6a28ab3b2..e679cfbee 100644 --- a/libfreerdp/core/certificate.c +++ b/libfreerdp/core/certificate.c @@ -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); diff --git a/libfreerdp/core/channel.c b/libfreerdp/core/channel.c index e9b14c27f..8abbd50f1 100644 --- a/libfreerdp/core/channel.c +++ b/libfreerdp/core/channel.c @@ -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; diff --git a/libfreerdp/core/connection.c b/libfreerdp/core/connection.c index bf2bae764..78abb88c3 100644 --- a/libfreerdp/core/connection.c +++ b/libfreerdp/core/connection.c @@ -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; diff --git a/libfreerdp/core/gateway/rpc.c b/libfreerdp/core/gateway/rpc.c index 5a3760f35..4df8c0da8 100644 --- a/libfreerdp/core/gateway/rpc.c +++ b/libfreerdp/core/gateway/rpc.c @@ -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; diff --git a/libfreerdp/core/gateway/rpc_bind.c b/libfreerdp/core/gateway/rpc_bind.c index 108d7ff14..72a254381 100644 --- a/libfreerdp/core/gateway/rpc_bind.c +++ b/libfreerdp/core/gateway/rpc_bind.c @@ -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; diff --git a/libfreerdp/core/gcc.c b/libfreerdp/core/gcc.c index 4c7dd4376..b6d4e2f1f 100644 --- a/libfreerdp/core/gcc.c +++ b/libfreerdp/core/gcc.c @@ -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)); diff --git a/libfreerdp/core/info.c b/libfreerdp/core/info.c index 671840152..7ccc7eff7 100644 --- a/libfreerdp/core/info.c +++ b/libfreerdp/core/info.c @@ -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) diff --git a/libfreerdp/core/input.c b/libfreerdp/core/input.c index c9ce3773d..e3d1d6158 100644 --- a/libfreerdp/core/input.c +++ b/libfreerdp/core/input.c @@ -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++) diff --git a/libfreerdp/core/listener.c b/libfreerdp/core/listener.c index e275ad404..e37c4c89f 100644 --- a/libfreerdp/core/listener.c +++ b/libfreerdp/core/listener.c @@ -27,6 +27,7 @@ #include #include +#include #ifndef _WIN32 #include @@ -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; } diff --git a/libfreerdp/core/mcs.c b/libfreerdp/core/mcs.c index 1fd38d86e..906c0db2a 100644 --- a/libfreerdp/core/mcs.c +++ b/libfreerdp/core/mcs.c @@ -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)) diff --git a/libfreerdp/core/message.c b/libfreerdp/core/message.c index 5d6083f22..10e2bd637 100644 --- a/libfreerdp/core/message.c +++ b/libfreerdp/core/message.c @@ -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++) diff --git a/libfreerdp/core/nla.c b/libfreerdp/core/nla.c index 301590acb..d106d2471 100644 --- a/libfreerdp/core/nla.c +++ b/libfreerdp/core/nla.c @@ -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; diff --git a/libfreerdp/core/orders.c b/libfreerdp/core/orders.c index 5836da631..b48ba1a39 100644 --- a/libfreerdp/core/orders.c +++ b/libfreerdp/core/orders.c @@ -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; diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c index a874ff183..4ed0ccbcc 100644 --- a/libfreerdp/core/rdp.c +++ b/libfreerdp/core/rdp.c @@ -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; diff --git a/libfreerdp/core/redirection.c b/libfreerdp/core/redirection.c index 6dbdd9e6b..d7f7e9ec0 100644 --- a/libfreerdp/core/redirection.c +++ b/libfreerdp/core/redirection.c @@ -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); diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index fb59a73a9..07db3ab77 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -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)); diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c index 97e5fa789..374e8f5da 100644 --- a/libfreerdp/core/update.c +++ b/libfreerdp/core/update.c @@ -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); diff --git a/libfreerdp/crypto/ber.c b/libfreerdp/crypto/ber.c index 38d98f411..74ce23190 100644 --- a/libfreerdp/crypto/ber.c +++ b/libfreerdp/crypto/ber.c @@ -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) diff --git a/libfreerdp/crypto/per.c b/libfreerdp/crypto/per.c index ab6a409ad..788266860 100644 --- a/libfreerdp/crypto/per.c +++ b/libfreerdp/crypto/per.c @@ -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); diff --git a/libfreerdp/crypto/tls.c b/libfreerdp/crypto/tls.c index 4fe93ee94..e72022eb3 100644 --- a/libfreerdp/crypto/tls.c +++ b/libfreerdp/crypto/tls.c @@ -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; } diff --git a/libfreerdp/utils/stopwatch.c b/libfreerdp/utils/stopwatch.c index fb1c5c161..a45ee9a73 100644 --- a/libfreerdp/utils/stopwatch.c +++ b/libfreerdp/utils/stopwatch.c @@ -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; } diff --git a/winpr/libwinpr/utils/collections/HashTable.c b/winpr/libwinpr/utils/collections/HashTable.c index 0b5636073..0d4eaf985 100644 --- a/winpr/libwinpr/utils/collections/HashTable.c +++ b/winpr/libwinpr/utils/collections/HashTable.c @@ -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; diff --git a/winpr/libwinpr/utils/collections/Reference.c b/winpr/libwinpr/utils/collections/Reference.c index c2df4773f..b12c121c2 100644 --- a/winpr/libwinpr/utils/collections/Reference.c +++ b/winpr/libwinpr/utils/collections/Reference.c @@ -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; diff --git a/winpr/libwinpr/utils/trio/triostr.c b/winpr/libwinpr/utils/trio/triostr.c index 5721b7cb0..c471b4a1d 100644 --- a/winpr/libwinpr/utils/trio/triostr.c +++ b/winpr/libwinpr/utils/trio/triostr.c @@ -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 diff --git a/winpr/libwinpr/utils/wlog/PacketMessage.c b/winpr/libwinpr/utils/wlog/PacketMessage.c index f8919f888..ad6472841 100644 --- a/winpr/libwinpr/utils/wlog/PacketMessage.c +++ b/winpr/libwinpr/utils/wlog/PacketMessage.c @@ -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; diff --git a/winpr/libwinpr/utils/wlog/wlog.c b/winpr/libwinpr/utils/wlog/wlog.c index 6df27a5ea..74b8639d0 100644 --- a/winpr/libwinpr/utils/wlog/wlog.c +++ b/winpr/libwinpr/utils/wlog/wlog.c @@ -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;