diff --git a/client/Windows/CMakeLists.txt b/client/Windows/CMakeLists.txt index 6dd194157..4b05882d5 100644 --- a/client/Windows/CMakeLists.txt +++ b/client/Windows/CMakeLists.txt @@ -1,9 +1,7 @@ # FreeRDP: A Remote Desktop Protocol Client # FreeRDP Windows cmake build script # -# Copyright 2011 O.S. Systems Software Ltda. -# Copyright 2011 Otavio Salvador -# Copyright 2011 Marc-Andre Moreau +# Copyright 2012 Marc-Andre Moreau # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -36,9 +34,9 @@ set(FREERDP_CLIENT_WINDOWS_SRCS add_executable(wfreerdp WIN32 ${FREERDP_CLIENT_WINDOWS_SRCS}) if(WITH_MONOLITHIC_BUILD) - set(FREERDP_CLIENT_WINDOWS_LIBS ${FREERDP_CLIENT_X11_LIBS} freerdp) + set(FREERDP_CLIENT_WINDOWS_LIBS ${FREERDP_CLIENT_WINDOWS_LIBS} freerdp) else() - set(FREERDP_CLIENT_WINDOWS_LIBS ${FREERDP_CLIENT_X11_LIBS} + set(FREERDP_CLIENT_WINDOWS_LIBS ${FREERDP_CLIENT_WINDOWS_LIBS} freerdp-core freerdp-gdi freerdp-codec @@ -46,5 +44,5 @@ else() freerdp-utils) endif() -target_link_libraries(wfreerdp ${FREERDP_CLIENT_X11_LIBS}) +target_link_libraries(wfreerdp ${FREERDP_CLIENT_WINDOWS_LIBS}) install(TARGETS wfreerdp DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/client/Windows/wf_graphics.c b/client/Windows/wf_graphics.c index 2920c6b0e..17d0b85c5 100644 --- a/client/Windows/wf_graphics.c +++ b/client/Windows/wf_graphics.c @@ -161,7 +161,7 @@ void wf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap) } void wf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, - uint8* data, int width, int height, int bpp, int length, boolean compressed) + uint8* data, int width, int height, int bpp, int length, boolean compressed, int codec_id) { uint16 size; diff --git a/libfreerdp/channels/wtsvc.c b/libfreerdp/channels/wtsvc.c index 2e4720feb..2fb9f3626 100644 --- a/libfreerdp/channels/wtsvc.c +++ b/libfreerdp/channels/wtsvc.c @@ -162,7 +162,7 @@ static void wts_read_drdynvc_data_first(rdpPeerChannel* channel, STREAM* s, int return; stream_set_pos(channel->receive_data, 0); - stream_check_size(channel->receive_data, channel->dvc_total_length); + stream_check_size(channel->receive_data, (int) channel->dvc_total_length); stream_write(channel->receive_data, stream_get_tail(s), length); } @@ -177,7 +177,7 @@ static void wts_read_drdynvc_data(rdpPeerChannel* channel, STREAM* s, uint32 len return; } stream_write(channel->receive_data, stream_get_tail(s), length); - if (stream_get_length(channel->receive_data) >= channel->dvc_total_length) + if (stream_get_length(channel->receive_data) >= (int) channel->dvc_total_length) { wts_queue_receive_data(channel, stream_get_head(channel->receive_data), channel->dvc_total_length); channel->dvc_total_length = 0; @@ -303,7 +303,7 @@ static void wts_write_drdynvc_create_request(STREAM *s, uint32 ChannelId, const wts_write_drdynvc_header(s, CREATE_REQUEST_PDU, ChannelId); len = strlen(ChannelName) + 1; - stream_check_size(s, len); + stream_check_size(s, (int) len); stream_write(s, ChannelName, len); } diff --git a/libfreerdp/core/capabilities.c b/libfreerdp/core/capabilities.c index 5ea363662..7c5ed657c 100644 --- a/libfreerdp/core/capabilities.c +++ b/libfreerdp/core/capabilities.c @@ -1675,10 +1675,12 @@ void rdp_write_bitmap_cache_v3_codec_id_capability_set(STREAM* s, rdpSettings* s void rdp_write_frame_acknowledge_capability_set(STREAM* s, rdpSettings* settings) { uint8* header; + uint32 frame_acknowledge; header = rdp_capability_set_start(s); - stream_write_uint32(s, settings->frame_acknowledge); /* (4 bytes) */ + frame_acknowledge = settings->frame_acknowledge; + stream_write_uint32(s, frame_acknowledge); /* (4 bytes) */ rdp_capability_set_finish(s, header, CAPSET_TYPE_FRAME_ACKNOWLEDGE); } diff --git a/libfreerdp/locale/timezone.c b/libfreerdp/locale/timezone.c index bf303db66..0508fb5c1 100644 --- a/libfreerdp/locale/timezone.c +++ b/libfreerdp/locale/timezone.c @@ -1652,7 +1652,6 @@ TIME_ZONE_RULE_ENTRY* freerdp_get_current_time_zone_rule(TIME_ZONE_RULE_ENTRY* r void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) { time_t t; - sint32 sbias; TIME_ZONE_ENTRY* tz; struct tm* local_time; @@ -1661,15 +1660,9 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) #ifdef HAVE_TM_GMTOFF if (local_time->tm_gmtoff >= 0) - { - sbias = local_time->tm_gmtoff / 60; - clientTimeZone->bias = (uint32) sbias; - } + clientTimeZone->bias = (uint32) (local_time->tm_gmtoff / 60); else - { - sbias = local_time->tm_gmtoff / 60; - clientTimeZone->bias = (uint32) (1440 + sbias); - } + clientTimeZone->bias = (uint32) (1440 + (sint32) (local_time->tm_gmtoff / 60)); #elif sun if (local_time->tm_isdst > 0) clientTimeZone->bias = (uint32) (altzone / 3600); diff --git a/server/channels/audin.c b/server/channels/audin.c index 9703d4963..3f51f0a2b 100644 --- a/server/channels/audin.c +++ b/server/channels/audin.c @@ -303,16 +303,20 @@ static void* audin_server_thread_func(void* arg) while (ready) { freerdp_thread_wait(thread); + if (freerdp_thread_is_stopped(thread)) break; stream_set_pos(s, 0); + if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s), stream_get_size(s), &bytes_returned) == false) { if (bytes_returned == 0) break; - stream_check_size(s, bytes_returned); + + stream_check_size(s, (int) bytes_returned); + if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s), stream_get_size(s), &bytes_returned) == false) break; diff --git a/server/channels/rdpsnd.c b/server/channels/rdpsnd.c index 48b9bb096..61a080a20 100644 --- a/server/channels/rdpsnd.c +++ b/server/channels/rdpsnd.c @@ -125,6 +125,7 @@ static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s) if (rdpsnd->context.num_client_formats > 0) { rdpsnd->context.client_formats = xzalloc(rdpsnd->context.num_client_formats * sizeof(rdpsndFormat)); + for (i = 0; i < rdpsnd->context.num_client_formats; i++) { if (stream_get_left(s) < 18) @@ -141,6 +142,7 @@ static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s) stream_read_uint16(s, rdpsnd->context.client_formats[i].nBlockAlign); stream_read_uint16(s, rdpsnd->context.client_formats[i].wBitsPerSample); stream_read_uint16(s, rdpsnd->context.client_formats[i].cbSize); + if (rdpsnd->context.client_formats[i].cbSize > 0) { stream_seek(s, rdpsnd->context.client_formats[i].cbSize); @@ -151,8 +153,6 @@ static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s) return true; } - - static void* rdpsnd_server_thread_func(void* arg) { void* fd; @@ -178,16 +178,20 @@ static void* rdpsnd_server_thread_func(void* arg) while (1) { freerdp_thread_wait(thread); + if (freerdp_thread_is_stopped(thread)) break; stream_set_pos(s, 0); + if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s), stream_get_size(s), &bytes_returned) == false) { if (bytes_returned == 0) break; - stream_check_size(s, bytes_returned); + + stream_check_size(s, (int) bytes_returned); + if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s), stream_get_size(s), &bytes_returned) == false) break; @@ -196,10 +200,12 @@ static void* rdpsnd_server_thread_func(void* arg) stream_read_uint8(s, msgType); stream_seek_uint8(s); /* bPad */ stream_read_uint16(s, BodySize); - if (BodySize + 4 > bytes_returned) + + if (BodySize + 4 > (int) bytes_returned) continue; - switch (msgType) { + switch (msgType) + { case SNDC_FORMATS: if (rdpsnd_server_recv_formats(rdpsnd, s)) { @@ -222,6 +228,7 @@ static boolean rdpsnd_server_initialize(rdpsnd_server_context* context) rdpsnd_server* rdpsnd = (rdpsnd_server*) context; rdpsnd->rdpsnd_channel = WTSVirtualChannelOpenEx(context->vcm, "rdpsnd", 0); + if (rdpsnd->rdpsnd_channel != NULL) { rdpsnd->rdpsnd_pdu = stream_new(4096); @@ -254,6 +261,7 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie context->selected_client_format = client_format_index; format = &context->client_formats[client_format_index]; + if (format->wFormatTag == 0x11) { bs = (format->nBlockAlign - 4 * format->nChannels) * 4; @@ -268,6 +276,7 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie { rdpsnd->out_frames = 0x4000 / rdpsnd->src_bytes_per_frame; } + if (format->nSamplesPerSec != context->src_format.nSamplesPerSec) { rdpsnd->out_frames = (rdpsnd->out_frames * context->src_format.nSamplesPerSec + format->nSamplesPerSec - 100) / format->nSamplesPerSec; @@ -275,6 +284,7 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie rdpsnd->out_pending_frames = 0; out_buffer_size = rdpsnd->out_frames * rdpsnd->src_bytes_per_frame; + if (rdpsnd->out_buffer_size < out_buffer_size) { rdpsnd->out_buffer = xrealloc(rdpsnd->out_buffer, out_buffer_size);