wfreerdp: fix compilation warnings on Windows
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Tue, 14 Aug 2012 22:39:07 +0000 (18:39 -0400)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Tue, 14 Aug 2012 22:39:07 +0000 (18:39 -0400)
client/Windows/CMakeLists.txt
client/Windows/wf_graphics.c
libfreerdp/channels/wtsvc.c
libfreerdp/core/capabilities.c
libfreerdp/locale/timezone.c
server/channels/audin.c
server/channels/rdpsnd.c

index 6dd1941..4b05882 100644 (file)
@@ -1,9 +1,7 @@
 # FreeRDP: A Remote Desktop Protocol Client\r
 # FreeRDP Windows cmake build script\r
 #\r
-# Copyright 2011 O.S. Systems Software Ltda.\r
-# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>\r
-# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>\r
+# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>\r
 #\r
 # Licensed under the Apache License, Version 2.0 (the "License");\r
 # you may not use this file except in compliance with the License.\r
@@ -36,9 +34,9 @@ set(FREERDP_CLIENT_WINDOWS_SRCS
 add_executable(wfreerdp WIN32 ${FREERDP_CLIENT_WINDOWS_SRCS})\r
 \r
 if(WITH_MONOLITHIC_BUILD)\r
-       set(FREERDP_CLIENT_WINDOWS_LIBS ${FREERDP_CLIENT_X11_LIBS} freerdp)\r
+       set(FREERDP_CLIENT_WINDOWS_LIBS ${FREERDP_CLIENT_WINDOWS_LIBS} freerdp)\r
 else()\r
-       set(FREERDP_CLIENT_WINDOWS_LIBS ${FREERDP_CLIENT_X11_LIBS}\r
+       set(FREERDP_CLIENT_WINDOWS_LIBS ${FREERDP_CLIENT_WINDOWS_LIBS}\r
                freerdp-core\r
                freerdp-gdi\r
                freerdp-codec\r
@@ -46,5 +44,5 @@ else()
                freerdp-utils)\r
 endif()\r
 \r
-target_link_libraries(wfreerdp ${FREERDP_CLIENT_X11_LIBS})\r
+target_link_libraries(wfreerdp ${FREERDP_CLIENT_WINDOWS_LIBS})\r
 install(TARGETS wfreerdp DESTINATION ${CMAKE_INSTALL_BINDIR})\r
index 2920c6b..17d0b85 100644 (file)
@@ -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;
 
index 2e4720f..2fb9f36 100644 (file)
@@ -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);
 }
 
index 5ea3636..7c5ed65 100644 (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)
 {
        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);
 }
index bf303db..0508fb5 100644 (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)
 {
        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);
index 9703d49..3f51f0a 100644 (file)
@@ -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;
index 48b9bb0..61a080a 100644 (file)
@@ -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);