wfreerdp: fix compilation warnings on Windows

This commit is contained in:
Marc-André Moreau 2012-08-14 18:39:07 -04:00
parent 910f9ffed6
commit f1fa98c997
7 changed files with 33 additions and 26 deletions

View File

@ -1,9 +1,7 @@
# FreeRDP: A Remote Desktop Protocol Client # FreeRDP: A Remote Desktop Protocol Client
# FreeRDP Windows cmake build script # FreeRDP Windows cmake build script
# #
# Copyright 2011 O.S. Systems Software Ltda. # Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with 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}) add_executable(wfreerdp WIN32 ${FREERDP_CLIENT_WINDOWS_SRCS})
if(WITH_MONOLITHIC_BUILD) 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() else()
set(FREERDP_CLIENT_WINDOWS_LIBS ${FREERDP_CLIENT_X11_LIBS} set(FREERDP_CLIENT_WINDOWS_LIBS ${FREERDP_CLIENT_WINDOWS_LIBS}
freerdp-core freerdp-core
freerdp-gdi freerdp-gdi
freerdp-codec freerdp-codec
@ -46,5 +44,5 @@ else()
freerdp-utils) freerdp-utils)
endif() endif()
target_link_libraries(wfreerdp ${FREERDP_CLIENT_X11_LIBS}) target_link_libraries(wfreerdp ${FREERDP_CLIENT_WINDOWS_LIBS})
install(TARGETS wfreerdp DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS wfreerdp DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@ -161,7 +161,7 @@ void wf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
} }
void wf_Bitmap_Decompress(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; uint16 size;

View File

@ -162,7 +162,7 @@ static void wts_read_drdynvc_data_first(rdpPeerChannel* channel, STREAM* s, int
return; return;
stream_set_pos(channel->receive_data, 0); 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); 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; return;
} }
stream_write(channel->receive_data, stream_get_tail(s), length); 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); wts_queue_receive_data(channel, stream_get_head(channel->receive_data), channel->dvc_total_length);
channel->dvc_total_length = 0; 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); wts_write_drdynvc_header(s, CREATE_REQUEST_PDU, ChannelId);
len = strlen(ChannelName) + 1; len = strlen(ChannelName) + 1;
stream_check_size(s, len); stream_check_size(s, (int) len);
stream_write(s, ChannelName, len); stream_write(s, ChannelName, len);
} }

View File

@ -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) void rdp_write_frame_acknowledge_capability_set(STREAM* s, rdpSettings* settings)
{ {
uint8* header; uint8* header;
uint32 frame_acknowledge;
header = rdp_capability_set_start(s); 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); rdp_capability_set_finish(s, header, CAPSET_TYPE_FRAME_ACKNOWLEDGE);
} }

View File

@ -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) void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone)
{ {
time_t t; time_t t;
sint32 sbias;
TIME_ZONE_ENTRY* tz; TIME_ZONE_ENTRY* tz;
struct tm* local_time; struct tm* local_time;
@ -1661,15 +1660,9 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone)
#ifdef HAVE_TM_GMTOFF #ifdef HAVE_TM_GMTOFF
if (local_time->tm_gmtoff >= 0) if (local_time->tm_gmtoff >= 0)
{ clientTimeZone->bias = (uint32) (local_time->tm_gmtoff / 60);
sbias = local_time->tm_gmtoff / 60;
clientTimeZone->bias = (uint32) sbias;
}
else else
{ clientTimeZone->bias = (uint32) (1440 + (sint32) (local_time->tm_gmtoff / 60));
sbias = local_time->tm_gmtoff / 60;
clientTimeZone->bias = (uint32) (1440 + sbias);
}
#elif sun #elif sun
if (local_time->tm_isdst > 0) if (local_time->tm_isdst > 0)
clientTimeZone->bias = (uint32) (altzone / 3600); clientTimeZone->bias = (uint32) (altzone / 3600);

View File

@ -303,16 +303,20 @@ static void* audin_server_thread_func(void* arg)
while (ready) while (ready)
{ {
freerdp_thread_wait(thread); freerdp_thread_wait(thread);
if (freerdp_thread_is_stopped(thread)) if (freerdp_thread_is_stopped(thread))
break; break;
stream_set_pos(s, 0); stream_set_pos(s, 0);
if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s), if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s),
stream_get_size(s), &bytes_returned) == false) stream_get_size(s), &bytes_returned) == false)
{ {
if (bytes_returned == 0) if (bytes_returned == 0)
break; break;
stream_check_size(s, bytes_returned);
stream_check_size(s, (int) bytes_returned);
if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s), if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s),
stream_get_size(s), &bytes_returned) == false) stream_get_size(s), &bytes_returned) == false)
break; break;

View File

@ -125,6 +125,7 @@ static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
if (rdpsnd->context.num_client_formats > 0) if (rdpsnd->context.num_client_formats > 0)
{ {
rdpsnd->context.client_formats = xzalloc(rdpsnd->context.num_client_formats * sizeof(rdpsndFormat)); rdpsnd->context.client_formats = xzalloc(rdpsnd->context.num_client_formats * sizeof(rdpsndFormat));
for (i = 0; i < rdpsnd->context.num_client_formats; i++) for (i = 0; i < rdpsnd->context.num_client_formats; i++)
{ {
if (stream_get_left(s) < 18) 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].nBlockAlign);
stream_read_uint16(s, rdpsnd->context.client_formats[i].wBitsPerSample); stream_read_uint16(s, rdpsnd->context.client_formats[i].wBitsPerSample);
stream_read_uint16(s, rdpsnd->context.client_formats[i].cbSize); stream_read_uint16(s, rdpsnd->context.client_formats[i].cbSize);
if (rdpsnd->context.client_formats[i].cbSize > 0) if (rdpsnd->context.client_formats[i].cbSize > 0)
{ {
stream_seek(s, rdpsnd->context.client_formats[i].cbSize); 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; return true;
} }
static void* rdpsnd_server_thread_func(void* arg) static void* rdpsnd_server_thread_func(void* arg)
{ {
void* fd; void* fd;
@ -178,16 +178,20 @@ static void* rdpsnd_server_thread_func(void* arg)
while (1) while (1)
{ {
freerdp_thread_wait(thread); freerdp_thread_wait(thread);
if (freerdp_thread_is_stopped(thread)) if (freerdp_thread_is_stopped(thread))
break; break;
stream_set_pos(s, 0); stream_set_pos(s, 0);
if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s), if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s),
stream_get_size(s), &bytes_returned) == false) stream_get_size(s), &bytes_returned) == false)
{ {
if (bytes_returned == 0) if (bytes_returned == 0)
break; break;
stream_check_size(s, bytes_returned);
stream_check_size(s, (int) bytes_returned);
if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s), if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s),
stream_get_size(s), &bytes_returned) == false) stream_get_size(s), &bytes_returned) == false)
break; break;
@ -196,10 +200,12 @@ static void* rdpsnd_server_thread_func(void* arg)
stream_read_uint8(s, msgType); stream_read_uint8(s, msgType);
stream_seek_uint8(s); /* bPad */ stream_seek_uint8(s); /* bPad */
stream_read_uint16(s, BodySize); stream_read_uint16(s, BodySize);
if (BodySize + 4 > bytes_returned)
if (BodySize + 4 > (int) bytes_returned)
continue; continue;
switch (msgType) { switch (msgType)
{
case SNDC_FORMATS: case SNDC_FORMATS:
if (rdpsnd_server_recv_formats(rdpsnd, s)) 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_server* rdpsnd = (rdpsnd_server*) context;
rdpsnd->rdpsnd_channel = WTSVirtualChannelOpenEx(context->vcm, "rdpsnd", 0); rdpsnd->rdpsnd_channel = WTSVirtualChannelOpenEx(context->vcm, "rdpsnd", 0);
if (rdpsnd->rdpsnd_channel != NULL) if (rdpsnd->rdpsnd_channel != NULL)
{ {
rdpsnd->rdpsnd_pdu = stream_new(4096); 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; context->selected_client_format = client_format_index;
format = &context->client_formats[client_format_index]; format = &context->client_formats[client_format_index];
if (format->wFormatTag == 0x11) if (format->wFormatTag == 0x11)
{ {
bs = (format->nBlockAlign - 4 * format->nChannels) * 4; 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; rdpsnd->out_frames = 0x4000 / rdpsnd->src_bytes_per_frame;
} }
if (format->nSamplesPerSec != context->src_format.nSamplesPerSec) if (format->nSamplesPerSec != context->src_format.nSamplesPerSec)
{ {
rdpsnd->out_frames = (rdpsnd->out_frames * context->src_format.nSamplesPerSec + format->nSamplesPerSec - 100) / 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; rdpsnd->out_pending_frames = 0;
out_buffer_size = rdpsnd->out_frames * rdpsnd->src_bytes_per_frame; out_buffer_size = rdpsnd->out_frames * rdpsnd->src_bytes_per_frame;
if (rdpsnd->out_buffer_size < out_buffer_size) if (rdpsnd->out_buffer_size < out_buffer_size)
{ {
rdpsnd->out_buffer = xrealloc(rdpsnd->out_buffer, out_buffer_size); rdpsnd->out_buffer = xrealloc(rdpsnd->out_buffer, out_buffer_size);