[Spice-commits] 24 commits - client/application.cpp client/cmd_line_parser.cpp client/common.h client/controller.cpp client/display_channel.cpp client/hot_keys.cpp client/jpeg_decoder.cpp client/mjpeg_decoder.cpp client/mjpeg_decoder.h client/process_loop.cpp client/process_loop.h client/red_client.cpp client/red_client.h client/red_peer.cpp client/tunnel_channel.h client/windows client/zlib_decoder.h common/canvas_base.c common/gdi_canvas.c common/lz.c common/sw_canvas.c configure.ac python_modules/marshal.py server/tests

Alon Levy alon at kemper.freedesktop.org
Wed Dec 8 08:00:52 PST 2010


 client/application.cpp             |   12 +-
 client/cmd_line_parser.cpp         |    2 
 client/common.h                    |   12 ++
 client/controller.cpp              |    2 
 client/display_channel.cpp         |    2 
 client/hot_keys.cpp                |    2 
 client/jpeg_decoder.cpp            |    6 -
 client/mjpeg_decoder.cpp           |    8 +
 client/mjpeg_decoder.h             |    6 -
 client/process_loop.cpp            |    6 -
 client/process_loop.h              |    4 
 client/red_client.cpp              |   10 -
 client/red_client.h                |    2 
 client/red_peer.cpp                |    8 -
 client/tunnel_channel.h            |    2 
 client/windows/Makefile.am         |  199 +++++++++++++++++++++++++++++++++++++
 client/windows/event_sources_p.cpp |    2 
 client/windows/main.cpp            |   10 -
 client/windows/platform.cpp        |   59 ++++++----
 client/windows/platform_utils.h    |    3 
 client/windows/playback.cpp        |    3 
 client/windows/record.cpp          |    2 
 client/windows/red_pixmap_gdi.cpp  |    6 -
 client/windows/red_pixmap_sw.cpp   |    4 
 client/windows/red_window.cpp      |    7 -
 client/windows/red_window_p.h      |    2 
 client/zlib_decoder.h              |    4 
 common/canvas_base.c               |   10 -
 common/gdi_canvas.c                |    8 -
 common/lz.c                        |    2 
 common/sw_canvas.c                 |    4 
 configure.ac                       |   97 +++++++++++++-----
 python_modules/marshal.py          |    2 
 server/tests/Makefile.am           |    2 
 34 files changed, 403 insertions(+), 107 deletions(-)

New commits:
commit 3f2997411ec57b4d31e99d4b333d7919741d8968
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Thu Jul 8 11:40:55 2010 +0200

    mingw32 build: disable -fvisibility test for unsupported mingw32 target
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
    
    v2: only disable for os_win32 (Hans)

diff --git a/configure.ac b/configure.ac
index 5b20e5b..72b377a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -435,7 +435,7 @@ error Need GCC 4.0 for visibility
 int main () { return 0; }
 ], have_gcc4=yes)
 
-if test "x$have_gcc4" = "xyes"; then
+if test "x$have_gcc4" = "xyes" -a ! "$os_win32" = "yes" ; then
    VISIBILITY_HIDDEN_CFLAGS="-fvisibility=hidden"
 fi
 AC_MSG_RESULT($have_gcc4)
commit 1bb1bcb9a0e369b9663951d9ec944f31984ffdf7
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 17:59:09 2010 +0200

    mingw32 build: check for CXImage, disable if not found (only on mingw32)
    
    v2:
     + simplify (Hans)
     + also report presence of cximage for mingw32 target

diff --git a/client/windows/Makefile.am b/client/windows/Makefile.am
index 0bd6e42..ae104ff 100644
--- a/client/windows/Makefile.am
+++ b/client/windows/Makefile.am
@@ -21,6 +21,7 @@ INCLUDES = \
 	$(CEGUI_CFLAGS)					\
 	$(WARN_CFLAGS)                                  \
 	$(SPICE_NONPKGCONFIG_CFLAGS)			\
+	$(CXIMAGE_CFLAGS)               \
 	$(NULL)
 
 
diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index b6f1918..c41c39a 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -32,7 +32,14 @@
 #include "playback.h"
 #include "cursor.h"
 #include "named_pipe.h"
+
+#ifndef DISABLE_CXIMAGE
+#define USE_CXIMAGE
+#endif
+
+#ifdef USE_CXIMAGE
 #include "ximage.h"
+#endif
 #include <spice/vd_agent.h>
 
 int gdi_handlers = 0;
@@ -82,6 +89,7 @@ static ClipboardFormat clipboard_formats[] = {
 
 #define clipboard_formats_count (sizeof(clipboard_formats) / sizeof(clipboard_formats[0]))
 
+#ifdef USE_CXIMAGE
 typedef struct ImageType {
     uint32_t type;
     DWORD cximage_format;
@@ -91,6 +99,7 @@ static ImageType image_types[] = {
     {VD_AGENT_CLIPBOARD_IMAGE_PNG, CXIMAGE_FORMAT_PNG},
     {VD_AGENT_CLIPBOARD_IMAGE_BMP, CXIMAGE_FORMAT_BMP},
 };
+#endif
 
 static std::set<uint32_t> grab_types;
 
@@ -154,6 +163,7 @@ static int get_available_clipboard_types(uint32_t** types)
     return count;
 }
 
+#ifdef USE_CXIMAGE
 static DWORD get_cximage_format(uint32_t type)
 {
     for (size_t i = 0; i < sizeof(image_types) / sizeof(image_types[0]); i++) {
@@ -163,6 +173,7 @@ static DWORD get_cximage_format(uint32_t type)
     }
     return 0;
 }
+#endif
 
 static LRESULT CALLBACK PlatformWinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
@@ -1005,6 +1016,7 @@ bool Platform::on_clipboard_notify(uint32_t type, const uint8_t* data, int32_t s
     case VD_AGENT_CLIPBOARD_UTF8_TEXT:
         clip_data = utf8_alloc((LPCSTR)data, size);
         break;
+#ifdef USE_CXIMAGE
     case VD_AGENT_CLIPBOARD_IMAGE_PNG:
     case VD_AGENT_CLIPBOARD_IMAGE_BMP: {
         DWORD cximage_format = get_cximage_format(type);
@@ -1013,6 +1025,7 @@ bool Platform::on_clipboard_notify(uint32_t type, const uint8_t* data, int32_t s
         clip_data = image.CopyToHandle();
         break;
     }
+#endif
     default:
         LOG_INFO("Unsupported clipboard type %u", type);
         return true;
@@ -1072,6 +1085,7 @@ bool Platform::on_clipboard_request(uint32_t type)
         GlobalUnlock(clip_data);
         break;
     }
+#ifdef USE_CXIMAGE
     case VD_AGENT_CLIPBOARD_IMAGE_PNG:
     case VD_AGENT_CLIPBOARD_IMAGE_BMP: {
         DWORD cximage_format = get_cximage_format(type);
@@ -1091,6 +1105,7 @@ bool Platform::on_clipboard_request(uint32_t type)
         ret = true;
         break;
     }
+#endif
     default:
         LOG_INFO("Unsupported clipboard type %u", type);
     }
diff --git a/configure.ac b/configure.ac
index e92d7d8..5b20e5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -378,6 +378,33 @@ AC_CACHE_CHECK([for supported warning flags], spice_cv_warn_cflags, [
 WARN_CFLAGS="$spice_cv_warn_cflags"
 SPICE_CFLAGS="$SPICE_CFLAGS $WARN_CFLAGS"
 
+# use ximage.h for win32 build if it is found (no package for mingw32 atm)
+if test $os_win32 == "yes" ; then
+    AC_MSG_CHECKING([for cximage])
+    AC_TRY_CPP(
+[#include <ximage.h>
+int main()
+{
+ return CXIMAGE_FORMAT_RAW;
+)}
+],[
+ AC_MSG_RESULT([found])
+ have_cximage="yes"
+]
+,[AC_MSG_RESULT([missing])
+ CXIMAGE_CFLAGS='-DDISABLE_CXIMAGE'
+ have_cximage="no"
+ ]
+)
+fi
+AC_SUBST(CXIMAGE_CFLAGS)
+
+# check for windres for mingw32 builds
+if test $os_win32 == "yes" ; then
+    AC_CHECK_PROGS(WINDRES,i686-pc-mingw32-windres mingw-windres mingw32-windres,false)
+    AC_SUBST(WINDRES)
+fi
+
 # We only wish to enable attribute(warn_unused_result) if we can prevent
 # gcc from generating thousands of warnings about the misapplication of the
 # attribute to void functions and variables.
@@ -459,6 +486,14 @@ echo "
         GUI:                      ${use_gui}
 
         Smartcard:                ${have_smartcard}
+"
+
+if test $os_win32 == "yes" ; then
+echo \
+"        Copy & Paste Images:     ${have_cximage}
+"
+fi
 
-        Now type 'make' to build $PACKAGE
+echo \
+"        Now type 'make' to build $PACKAGE
 "
commit 0449d0520c1173ca70eaf011f69de6123e5c2a48
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 17:52:26 2010 +0200

    mingw32 build: use PRIu64 instead of ll

diff --git a/client/application.cpp b/client/application.cpp
index 3f1ae71..8f41ccf 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -15,6 +15,8 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
 #include "common.h"
 #ifdef WIN32
 #include <io.h>
@@ -2499,8 +2501,10 @@ void spice_log(unsigned int type, const char *function, const char *format, ...)
     va_end(ap);
 
     if (type >= log_level && log_file != NULL) {
-        fprintf(log_file, "%ld %s [%llu:%llu] %s: %s\n", (long)time(NULL), type_as_char[type],
-                (long long int)Platform::get_process_id(), (long long int)Platform::get_thread_id(),
+        fprintf(log_file,"%ld %s [%" PRIu64 ":%" PRIu64 "] %s: %s\n",
+                (long)time(NULL), type_as_char[type],
+                Platform::get_process_id(),
+                Platform::get_thread_id(),
                 function_to_func_name(function).c_str(),
                 formated_message.c_str());
 		fflush(log_file);
commit 3cc0fb24ce1473717021c4dc2c3c9789ca87e310
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 18:02:34 2010 +0200

    mingw32 build: python_modules/marshal: use unsigned for for_loop index variable

diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index 9ee1466..a82df98 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -120,7 +120,7 @@ def write_marshal_ptr_function(writer, target_type):
     writer.header = header
     writer.out_prefix = ""
     if target_type.is_array():
-        scope = writer.function(marshal_function, "SPICE_GNUC_UNUSED static void", "SpiceMarshaller *m, %s_t *ptr, int count" % target_type.element_type.primitive_type() + names_args)
+        scope = writer.function(marshal_function, "SPICE_GNUC_UNUSED static void", "SpiceMarshaller *m, %s_t *ptr, unsigned count" % target_type.element_type.primitive_type() + names_args)
     else:
         scope = writer.function(marshal_function, "void", "SpiceMarshaller *m, %s *ptr" % target_type.c_type() + names_args)
         header.writeln("void " + marshal_function + "(SpiceMarshaller *m, %s *msg" % target_type.c_type() + names_args + ");")
commit 916863202a5c7708f7ec27e1905aab7d4999a527
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 18:02:01 2010 +0200

    mingw32 build: various fixes

diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp
index 56a757b..9f79ab3 100644
--- a/client/windows/red_window.cpp
+++ b/client/windows/red_window.cpp
@@ -366,7 +366,7 @@ void RedWindow_p::destroy(PixelsSource_p& pixels_source)
 
     ReleaseDC(_win, pixels_source.dc);
     SetWindowLongPtr(_win, GWLP_WNDPROC, (LONG_PTR)DefWindowProc);
-    SetWindowLongPtr(_win, GWLP_USERDATA, NULL);
+    SetWindowLongPtr(_win, GWLP_USERDATA, (LONG_PTR)NULL);
     DestroyWindow(_win);
 }
 
diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c
index 705a040..d57aafc 100644
--- a/common/gdi_canvas.c
+++ b/common/gdi_canvas.c
@@ -471,7 +471,7 @@ static void copy_bitmap_alpha(const uint8_t *src_alpha, int height, int width, i
 
             alphaval = src_alpha[i];
             alphaval = alphaval >> (i_count * i_offset);
-            alphaval = alphaval &= ((uint8_t)0xff >> (8 - i_offset));
+            alphaval &= ((uint8_t)0xff >> (8 - i_offset));
             alphaval = ((255 * alphaval) / ((uint8_t)0xff >> (8 - i_offset)));
 
             dest_bitmap[x * 4 + 3] = alphaval;
@@ -637,7 +637,7 @@ static HBRUSH get_brush(GdiCanvas *canvas, SpiceBrush *brush, RecurciveMutex **b
     case SPICE_BRUSH_TYPE_PATTERN: { 
         GdiCanvas *gdi_surface = NULL;
         HBRUSH hbrush;
-        pixman_image_t *surface;
+        pixman_image_t *surface = NULL;
         HDC dc;
         HBITMAP bitmap;
         HBITMAP prev_bitmap;
commit ff3fb423ed1e60dc5124e1211613c56555b6cdce
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 18:01:14 2010 +0200

    mingw32 build: fix two functions

diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp
index 6d8a70d..56a757b 100644
--- a/client/windows/red_window.cpp
+++ b/client/windows/red_window.cpp
@@ -80,11 +80,6 @@ static inline RedKey translate_key(int virtual_key, uint32_t scan, bool escape)
     }
 }
 
-static int menu_cmd_to_app(WPARAM wparam)
-{
-    return 0;
-}
-
 static inline void send_filtered_keys(RedWindow* window)
 {
     KeysList::iterator iter;
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 6d101f4..db83245 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -115,7 +115,7 @@ static inline uint32_t canvas_16bpp_to_32bpp(uint32_t color)
 
     return ret;
 }
-#ifdef WIN32
+#if defined(WIN32) && defined(GDI_CANVAS)
 static HDC create_compatible_dc()
 {
     HDC dc = CreateCompatibleDC(NULL);
commit 8bea5d6b5a8ce4fa11363ced501f7607ad12b8ba
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 18:00:52 2010 +0200

    mingw32 build: add missing switch flags (nop)

diff --git a/client/windows/red_pixmap_gdi.cpp b/client/windows/red_pixmap_gdi.cpp
index cf8190e..035618c 100644
--- a/client/windows/red_pixmap_gdi.cpp
+++ b/client/windows/red_pixmap_gdi.cpp
@@ -71,7 +71,11 @@ RedPixmapGdi::RedPixmapGdi(int width, int height, RedDrawable::Format format, bo
         pixel_format[1] = 0x07e0;
         pixel_format[2] = 0x001f;
         break;
-   }
+     case RedDrawable::ARGB32:
+     case RedDrawable::RGB32:
+     case RedDrawable::RGB16_555:
+        break;
+    }
     AutoDC dc(create_compatible_dc());
     AutoGDIObject bitmap(CreateDIBSection(dc.get(), &bitmap_info.inf, 0,
                                           (VOID **)&_data, NULL, 0));
diff --git a/client/windows/red_pixmap_sw.cpp b/client/windows/red_pixmap_sw.cpp
index 1a76530..4d74da4 100644
--- a/client/windows/red_pixmap_sw.cpp
+++ b/client/windows/red_pixmap_sw.cpp
@@ -84,6 +84,10 @@ RedPixmapSw::RedPixmapSw(int width, int height, RedDrawable::Format format,
         pixel_format[1] = 0x07e0;
         pixel_format[2] = 0x001f;
         break;
+     case RedDrawable::ARGB32:
+     case RedDrawable::RGB32:
+     case RedDrawable::RGB16_555:
+        break;
     }
     AutoDC dc(create_compatible_dc());
     AutoGDIObject bitmap(CreateDIBSection(dc.get(), &bitmap_info.inf, 0,
commit a19080980d55b8006d6322b29684717c928d9d1a
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 18:00:29 2010 +0200

    mingw32 build: eol fixes

diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index 3eb2cf6..b6f1918 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -92,7 +92,7 @@ static ImageType image_types[] = {
     {VD_AGENT_CLIPBOARD_IMAGE_BMP, CXIMAGE_FORMAT_BMP},
 };
 
-static std::set<uint32_t> grab_types;
+static std::set<uint32_t> grab_types;
 
 static const unsigned long MODAL_LOOP_TIMER_ID = 1;
 static const int MODAL_LOOP_DEFAULT_TIMEOUT = 100;
@@ -1076,16 +1076,16 @@ bool Platform::on_clipboard_request(uint32_t type)
     case VD_AGENT_CLIPBOARD_IMAGE_BMP: {
         DWORD cximage_format = get_cximage_format(type);
         ASSERT(cximage_format);
-        CxImage image;
-        if (!image.CreateFromHANDLE(clip_data)) {
-            LOG_INFO("Image create from handle failed");
-            break;
-        }
-        if (!image.Encode(new_data, new_size, cximage_format)) {
-            LOG_INFO("Image encode to type %u failed", type);
-            break;
-        }
-        LOG_INFO("Image encoded to %u bytes", new_size);
+        CxImage image;
+        if (!image.CreateFromHANDLE(clip_data)) {
+            LOG_INFO("Image create from handle failed");
+            break;
+        }
+        if (!image.Encode(new_data, new_size, cximage_format)) {
+            LOG_INFO("Image encode to type %u failed", type);
+            break;
+        }
+        LOG_INFO("Image encoded to %u bytes", new_size);
         clipboard_listener->on_clipboard_notify(type, new_data, new_size);
         image.FreeMemory(new_data);
         ret = true;
commit 78f81ec61cbaef8a8a49ef328975409a9a0d70d0
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 17:59:55 2010 +0200

    mingw32 build: windows/Makefile.am: double NULL definition

diff --git a/client/windows/Makefile.am b/client/windows/Makefile.am
index e6fc441..0bd6e42 100644
--- a/client/windows/Makefile.am
+++ b/client/windows/Makefile.am
@@ -197,7 +197,6 @@ spicec_DEPENDENCIES = redc.res
 
 redc.res: redc.rc
 	$(WINDRES) -J rc -i $< -O coff -o $@
-NULL =
 
 EXTRA_DIST = \
 	atomic_count.h		\
commit 5aba28df735644fcdb55cd7c2143bee6e6c8e67d
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 17:59:37 2010 +0200

    mingw32 build: missing linked files for spicec.exe

diff --git a/client/windows/Makefile.am b/client/windows/Makefile.am
index f673afd..e6fc441 100644
--- a/client/windows/Makefile.am
+++ b/client/windows/Makefile.am
@@ -49,6 +49,8 @@ RED_COMMON_SRCS =					\
 	$(CLIENT_DIR)/client_net_socket.cpp		\
 	$(CLIENT_DIR)/client_net_socket.h		\
 	$(CLIENT_DIR)/common.h				\
+	$(CLIENT_DIR)/controller.cpp			\
+	$(CLIENT_DIR)/controller.h			\
 	$(CLIENT_DIR)/cursor_channel.cpp		\
 	$(CLIENT_DIR)/cursor_channel.h			\
 	$(CLIENT_DIR)/cursor.cpp			\
@@ -56,6 +58,8 @@ RED_COMMON_SRCS =					\
 	$(CLIENT_DIR)/debug.h				\
 	$(CLIENT_DIR)/display_channel.cpp		\
 	$(CLIENT_DIR)/display_channel.h			\
+	$(CLIENT_DIR)/foreign_menu.cpp			\
+	$(CLIENT_DIR)/foreign_menu.h			\
 	$(CLIENT_DIR)/glz_decoded_image.h		\
 	$(CLIENT_DIR)/glz_decoder_config.h		\
 	$(CLIENT_DIR)/glz_decoder.cpp			\
commit 9728ea7f5c6807b539e2062c94636d3fdc0a0e64
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 17:57:53 2010 +0200

    mingw32 build: remove unused, initialize uninitialized, reorder constructor initializers

diff --git a/client/controller.cpp b/client/controller.cpp
index cf06aa3..329c133 100644
--- a/client/controller.cpp
+++ b/client/controller.cpp
@@ -347,7 +347,9 @@ bool ControllerConnection::handle_message(ControllerMsg *hdr)
 bool ControllerConnection::create_menu(char* resource)
 {
     bool ret = true;
+#ifndef WIN32
     char* item_state = 0;
+#endif
     char* next_item;
     const char* param;
     const char* text;
diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index 3e556fa..3eb2cf6 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -461,10 +461,10 @@ bool WinMonitor::best_display_setting(uint32_t width, uint32_t height, uint32_t
     DEVMODE mode;
     DWORD mode_id = 0;
     uint32_t mod_waste = ~0;
-    DWORD mod_width;
-    DWORD mod_height;
-    DWORD mod_depth;
-    DWORD mod_frequency;
+    DWORD mod_width = 0;
+    DWORD mod_height = 0;
+    DWORD mod_depth = 0;
+    DWORD mod_frequency = 0;
 
     mode.dmSize = sizeof(DEVMODE);
     mode.dmDriverExtra = 0;
diff --git a/client/windows/playback.cpp b/client/windows/playback.cpp
index 17d8f56..5278288 100644
--- a/client/windows/playback.cpp
+++ b/client/windows/playback.cpp
@@ -44,14 +44,13 @@ WavePlayer::WavePlayer(uint32_t sampels_per_sec, uint32_t bits_per_sample, uint3
     info.nAvgBytesPerSec = sampels_per_sec * info.nBlockAlign;
     info.wBitsPerSample = bits_per_sample;
 
-    if (waveOutOpen(&_wave_out, WAVE_MAPPER, &info, NULL, NULL, CALLBACK_NULL)
+    if (waveOutOpen(&_wave_out, WAVE_MAPPER, &info, 0, 0, CALLBACK_NULL)
                                                             != MMSYSERR_NOERROR) {
         throw Exception("can not open playback device");
     }
 
     int frame_size = WavePlaybackAbstract::FRAME_SIZE;
     _ring_size = (sampels_per_sec * RING_SIZE_MS / 1000) / frame_size;
-    int low_mark = (sampels_per_sec * LOW_MARK_MS / 1000) / frame_size;
     _start_mark = (sampels_per_sec * START_MARK_MS / 1000) / frame_size;
     _frame_bytes = frame_size * channels * bits_per_sample / 8;
     _ring_item_size = sizeof(WAVEHDR) + _frame_bytes + sample_bytes;
diff --git a/client/windows/record.cpp b/client/windows/record.cpp
index 4edc787..398b165 100644
--- a/client/windows/record.cpp
+++ b/client/windows/record.cpp
@@ -33,9 +33,9 @@ WaveRecorder::WaveRecorder(Platform::RecordClient& client, uint32_t sampels_per_
                            uint32_t bits_per_sample, uint32_t channels)
     : _client (client)
     , _ring (NULL)
-    , _frame (NULL)
     , _head (0)
     , _in_use (0)
+    , _frame (NULL)
 {
     WAVEFORMATEX info;
     uint32_t frame_align;
commit d14b720a3fd1b90ad1128374f763ecc296794736
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 17:56:26 2010 +0200

    mingw32 build: fix assignement as condition warning

diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index 06d5aa0..3e556fa 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -199,7 +199,7 @@ static LRESULT CALLBACK PlatformWinProc(HWND hWnd, UINT message, WPARAM wParam,
             int type_count;
             uint32_t* types;
             Platform::set_clipboard_owner(Platform::owner_none);
-            if (type_count = get_available_clipboard_types(&types)) {
+            if ((type_count = get_available_clipboard_types(&types))) {
                 clipboard_listener->on_clipboard_grab(types, type_count);
                 delete[] types;
             } else {
commit 1943352d6093ae27f1f4e80d786f4114be6032ac
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 17:55:45 2010 +0200

    mingw32 build: fixed using -1 as uninitialized value for unsigned variables

diff --git a/client/red_client.cpp b/client/red_client.cpp
index 4923f29..c632a21 100644
--- a/client/red_client.cpp
+++ b/client/red_client.cpp
@@ -351,7 +351,7 @@ RedClient::RedClient(Application& application)
     , _mouse_mode (SPICE_MOUSE_MODE_SERVER)
     , _notify_disconnect (false)
     , _auto_display_res (false)
-    , _agent_reply_wait_type (-1)
+    , _agent_reply_wait_type (VD_AGENT_END_MESSAGE)
     , _aborting (false)
     , _agent_connected (false)
     , _agent_mon_config_sent (false)
@@ -1060,7 +1060,7 @@ void RedClient::on_agent_reply(VDAgentReply* reply)
         if (_agent_reply_wait_type == reply->type) {
             post_message(new Message(SPICE_MSGC_MAIN_ATTACH_CHANNELS));
             _application.deactivate_interval_timer(*_agent_timer);
-            _agent_reply_wait_type = -1;
+            _agent_reply_wait_type = VD_AGENT_END_MESSAGE;
         }
         break;
     default:
diff --git a/client/red_client.h b/client/red_client.h
index ae52d9f..7b04d08 100644
--- a/client/red_client.h
+++ b/client/red_client.h
@@ -318,7 +318,7 @@ private:
     bool _notify_disconnect;
     bool _auto_display_res;
     DisplaySetting _display_setting;
-    int _agent_reply_wait_type;
+    uint32_t _agent_reply_wait_type;
 
     bool _aborting;
 
diff --git a/client/red_peer.cpp b/client/red_peer.cpp
index 08176d0..6ff5844 100644
--- a/client/red_peer.cpp
+++ b/client/red_peer.cpp
@@ -91,7 +91,7 @@ void RedPeer::connect_unsecure(const char* host, int portnr)
             THROW_ERR(SPICEC_ERROR_CODE_GETHOSTBYNAME_FAILED, "cannot resolve host address %s", host);
         }
         Lock lock(_lock);
-        _peer = -1;
+        _peer = INVALID_SOCKET;
         for (e = result; e != NULL; e = e->ai_next) {
             if ((_peer = socket(e->ai_family, e->ai_socktype, e->ai_protocol)) == INVALID_SOCKET) {
                 int err = sock_error();
@@ -112,7 +112,7 @@ void RedPeer::connect_unsecure(const char* host, int portnr)
                 LOG_INFO("Connect failed: %s (%d)",
                          sock_err_message(err), err);
                 closesocket(_peer);
-                _peer = -1;
+                _peer = INVALID_SOCKET;
                 continue;
             }
             LOG_INFO("Connected to %s %s", uaddr, uport);
@@ -120,7 +120,7 @@ void RedPeer::connect_unsecure(const char* host, int portnr)
         }
         lock.unlock();
         freeaddrinfo(result);
-        if (_peer == -1) {
+        if (_peer == INVALID_SOCKET) {
             THROW_ERR(SPICEC_ERROR_CODE_CONNECT_FAILED, "failed to connect: %s (%d)",
                       sock_err_message(err), err);
         }
commit 06749bd66bb3e689bc96be1a3739747912ee0020
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 17:55:16 2010 +0200

    mingw32 build: fix signed/unsigned warnings as errors

diff --git a/client/application.cpp b/client/application.cpp
index a484bbc..3f1ae71 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -1233,7 +1233,7 @@ ModifierKey modifier_keys[] = {
 void Application::sync_keyboard_modifiers()
 {
     uint32_t modifiers = Platform::get_keyboard_modifiers();
-    for (int i = 0; i < sizeof(modifier_keys) / sizeof(modifier_keys[0]); i++) {
+    for (size_t i = 0; i < sizeof(modifier_keys) / sizeof(modifier_keys[0]); i++) {
         if (modifiers & modifier_keys[i].modifier) {
             on_key_down(modifier_keys[i].key);
         } else {
@@ -2012,7 +2012,7 @@ bool Application::set_host_cert_subject(const char* subject, const char* arg0)
     while (true) {
         if ((iter == subject_str.end()) || (*iter == ',')) {
             RedPeer::HostAuthOptions::CertFieldValuePair entry_pair;
-            int value_pos = entry.find_first_of('=');
+            size_t value_pos = entry.find_first_of('=');
             if ((value_pos == std::string::npos) || (value_pos == (entry.length() - 1))) {
                 Platform::term_printf("%s: host_subject bad format: assignment for %s is missing\n",
                                       arg0, entry.c_str());
diff --git a/client/cmd_line_parser.cpp b/client/cmd_line_parser.cpp
index a813629..963250b 100644
--- a/client/cmd_line_parser.cpp
+++ b/client/cmd_line_parser.cpp
@@ -436,7 +436,7 @@ char* CmdLineParser::next_argument()
 void CmdLineParser::show_help()
 {
     static const int HELP_START_POS = 30;
-    static const int HELP_WIDTH = 80 - HELP_START_POS;
+    static const unsigned HELP_WIDTH = 80 - HELP_START_POS;
     std::ostringstream os;
 
     os << _argv[0] << " - " << _description.c_str() << "\n\noptions:\n\n";
diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index 1d5ebf3..5717834 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -363,7 +363,7 @@ void VideoStream::remove_dead_frames(uint32_t mm_time)
 void VideoStream::drop_one_frame()
 {
     ASSERT(MAX_VIDEO_FRAMES > 2 && (_frames_head - _frames_tail) == MAX_VIDEO_FRAMES);
-    int frame_index = _frames_head - _kill_mark++ % (MAX_VIDEO_FRAMES - 2) - 2;
+    unsigned frame_index = _frames_head - _kill_mark++ % (MAX_VIDEO_FRAMES - 2) - 2;
 
     free_frame(frame_index);
 
diff --git a/client/hot_keys.cpp b/client/hot_keys.cpp
index d6564b7..60b58a4 100644
--- a/client/hot_keys.cpp
+++ b/client/hot_keys.cpp
@@ -114,7 +114,7 @@ void HotKeysParser::add_key(HotkeySet& keys, const char* key)
         { "f12", REDKEY_F12, REDKEY_INVALID }
     };
 
-    for (int i = 0; i < (sizeof(keyboard) / sizeof(keyboard[0])); ++i) {
+    for (unsigned i = 0; i < (sizeof(keyboard) / sizeof(keyboard[0])); ++i) {
         if (strcasecmp(key, keyboard[i].name) == 0) {
             HotkeyKey hotkey;
             hotkey.main = keyboard[i].main;
diff --git a/client/mjpeg_decoder.cpp b/client/mjpeg_decoder.cpp
index f9cb603..bad90d4 100644
--- a/client/mjpeg_decoder.cpp
+++ b/client/mjpeg_decoder.cpp
@@ -108,7 +108,7 @@ void MJpegDecoder::convert_scanline(void)
     uint32_t *row;
     uint32_t c;
     uint8_t *s;
-    int x;
+    unsigned x;
 
     ASSERT(_width % 2 == 0);
     ASSERT(_height % 2 == 0);
diff --git a/client/mjpeg_decoder.h b/client/mjpeg_decoder.h
index ccafd37..8455e0d 100644
--- a/client/mjpeg_decoder.h
+++ b/client/mjpeg_decoder.h
@@ -59,13 +59,13 @@ private:
     size_t _data_end;
     size_t _extra_skip;
 
-    int _width;
-    int _height;
+    unsigned _width;
+    unsigned _height;
     int _stride;
     uint8_t *_frame;
     bool _back_compat;
 
-    int _y;
+    unsigned _y;
     uint8_t *_scanline;
 
     int _state;
diff --git a/client/process_loop.cpp b/client/process_loop.cpp
index ec9cdd2..d7e6744 100644
--- a/client/process_loop.cpp
+++ b/client/process_loop.cpp
@@ -221,7 +221,7 @@ void TimersQueue::deactivate_interval_timer(Timer* timer)
     }
 }
 
-int TimersQueue::get_soonest_timeout()
+unsigned int TimersQueue::get_soonest_timeout()
 {
     RecurciveLock lock(_timers_lock);
     TimersSet::iterator iter;
@@ -236,7 +236,7 @@ int TimersQueue::get_soonest_timeout()
     if (next_time <= now) {
         return 0;
     }
-    return (int)(next_time - now);
+    return (next_time - now);
 }
 
 
@@ -392,7 +392,7 @@ void ProcessLoop::deactivate_interval_timer(Timer* timer)
     _timers_queue.deactivate_interval_timer(timer);
 }
 
-int ProcessLoop::get_soonest_timeout()
+unsigned ProcessLoop::get_soonest_timeout()
 {
     return _timers_queue.get_soonest_timeout();
 }
diff --git a/client/process_loop.h b/client/process_loop.h
index 2d355f7..33ca2d1 100644
--- a/client/process_loop.h
+++ b/client/process_loop.h
@@ -165,7 +165,7 @@ public:
     void activate_interval_timer(Timer* timer, unsigned int millisec);
     void deactivate_interval_timer(Timer* timer);
 
-    int get_soonest_timeout();
+    unsigned int get_soonest_timeout();
     void timers_action();
 
 private:
@@ -207,7 +207,7 @@ public:
     void process_events_queue();
     /* can be used for handling timers in modal loop state in Windows (mainly,
        for updating the screen) */
-    int get_soonest_timeout();
+    unsigned int get_soonest_timeout();
     void timers_action();
 
     void* get_owner() { return _owner;}
diff --git a/client/red_client.cpp b/client/red_client.cpp
index e1f5a42..4923f29 100644
--- a/client/red_client.cpp
+++ b/client/red_client.cpp
@@ -770,8 +770,8 @@ void RedClient::calc_pixmap_cach_and_glz_window_size(uint32_t display_channels_h
 {
 #ifdef WIN32
     display_channels_hint = MAX(1, display_channels_hint);
-    int max_cache_size = display_channels_hint * MAX_DISPLAY_PIXMAP_CACHE;
-    int min_cache_size = display_channels_hint * MIN_DISPLAY_PIXMAP_CACHE;
+    uint64_t max_cache_size = display_channels_hint * MAX_DISPLAY_PIXMAP_CACHE;
+    uint64_t min_cache_size = display_channels_hint * MIN_DISPLAY_PIXMAP_CACHE;
 
     MEMORYSTATUSEX mem_status;
     mem_status.dwLength = sizeof(mem_status);
diff --git a/client/red_peer.cpp b/client/red_peer.cpp
index 88fc9ad..08176d0 100644
--- a/client/red_peer.cpp
+++ b/client/red_peer.cpp
@@ -364,7 +364,7 @@ bool RedPeer::verify_subject(X509* cert, const HostAuthOptions::CertFieldValueLi
         return false;
     }
 
-    if (X509_NAME_entry_count(cert_subject) != subject.size()) {
+    if ((size_t)X509_NAME_entry_count(cert_subject) != subject.size()) {
         DBG(0, "subject mismatch: #entries cert=%d, input=%d",
             X509_NAME_entry_count(cert_subject), subject.size());
         return false;
diff --git a/client/tunnel_channel.h b/client/tunnel_channel.h
index 553d49b..63174d8 100644
--- a/client/tunnel_channel.h
+++ b/client/tunnel_channel.h
@@ -133,7 +133,7 @@ private:
     int _in_msg_len;
 
     std::string _out_msg;  // <virtual ip>\n
-    int _out_msg_pos;
+    unsigned _out_msg_pos;
 };
 #endif
 
diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index 1676000..06d5aa0 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -108,7 +108,7 @@ void Platform::send_quit_request()
 static uint32_t get_clipboard_type(uint32_t format) {
     uint32_t* types = NULL;
 
-    for (int i = 0; i < clipboard_formats_count && !types; i++) {
+    for (size_t i = 0; i < clipboard_formats_count && !types; i++) {
         if (clipboard_formats[i].format == format) {
             types = clipboard_formats[i].types;
         }
@@ -125,7 +125,7 @@ static uint32_t get_clipboard_type(uint32_t format) {
 }
 
 static uint32_t get_clipboard_format(uint32_t type) {
-    for (int i = 0; i < clipboard_formats_count; i++) {
+    for (size_t i = 0; i < clipboard_formats_count; i++) {
         for (uint32_t* ptype = clipboard_formats[i].types; *ptype; ptype++) {
             if (*ptype == type) {
                 return clipboard_formats[i].format; 
@@ -140,7 +140,7 @@ static int get_available_clipboard_types(uint32_t** types)
     int count = 0;
 
     *types = new uint32_t[clipboard_formats_count * CLIPBOARD_FORMAT_MAX_TYPES];
-    for (int i = 0; i < clipboard_formats_count; i++) {
+    for (size_t i = 0; i < clipboard_formats_count; i++) {
         if (IsClipboardFormatAvailable(clipboard_formats[i].format)) {
             for (uint32_t* ptype = clipboard_formats[i].types; *ptype; ptype++) {
                 (*types)[count++] = *ptype;
@@ -156,7 +156,7 @@ static int get_available_clipboard_types(uint32_t** types)
 
 static DWORD get_cximage_format(uint32_t type)
 {
-    for (int i = 0; i < sizeof(image_types) / sizeof(image_types[0]); i++) {
+    for (size_t i = 0; i < sizeof(image_types) / sizeof(image_types[0]); i++) {
         if (image_types[i].type == type) {
             return image_types[i].cximage_format;
         }
@@ -503,7 +503,7 @@ bool WinMonitor::best_display_setting(uint32_t width, uint32_t height, uint32_t
             }
         }
     }
-    if (mod_waste == ~0) {
+    if (mod_waste == ~0u) {
         return false;
     }
     mode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;
@@ -882,7 +882,7 @@ void WinPlatform::enter_modal_loop()
 
 static bool set_modal_loop_timer()
 {
-    int timeout = main_loop->get_soonest_timeout();
+    unsigned timeout = main_loop->get_soonest_timeout();
     if (timeout == INFINITE) {
         timeout = MODAL_LOOP_DEFAULT_TIMEOUT; /* for cases timeouts are added after
                                                  the enterance to the loop*/
diff --git a/common/canvas_base.c b/common/canvas_base.c
index c2763bc..6d101f4 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -146,7 +146,7 @@ typedef struct QuicData {
     jmp_buf jmp_env;
     char message_buf[512];
     SpiceChunks *chunks;
-    int current_chunk;
+    uint32_t current_chunk;
 } QuicData;
 
 typedef struct CanvasBase {
@@ -809,8 +809,8 @@ static pixman_image_t *canvas_get_lz(CanvasBase *canvas, SpiceImage *image, int
         CANVAS_ERROR("unexpected LZ image type");
     }
 
-    ASSERT(width == image->descriptor.width);
-    ASSERT(height == image->descriptor.height);
+    ASSERT((unsigned)width == image->descriptor.width);
+    ASSERT((unsigned)height == image->descriptor.height);
 
     ASSERT((image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) || (n_comp_pixels == width * height));
 #ifdef WIN32
@@ -3309,7 +3309,7 @@ static void unimplemented_op(SpiceCanvas *canvas)
 inline static void canvas_base_init_ops(SpiceCanvasOps *ops)
 {
     void **ops_cast;
-    int i;
+    unsigned i;
 
     ops_cast = (void **)ops;
     for (i = 0; i < sizeof(SpiceCanvasOps) / sizeof(void *); i++) {
diff --git a/common/lz.c b/common/lz.c
index e563584..d0d9511 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -633,7 +633,7 @@ void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf)
     Encoder *encoder = (Encoder *)lz;
     size_t out_size = 0;
     size_t alpha_size = 0;
-    int size = 0;
+    size_t size = 0;
     if (IS_IMAGE_TYPE_PLT[encoder->type]) {
         if (to_type == encoder->type) {
             size = encoder->height * encoder->stride;
diff --git a/common/sw_canvas.c b/common/sw_canvas.c
index f579b4c..37083df 100644
--- a/common/sw_canvas.c
+++ b/common/sw_canvas.c
@@ -976,8 +976,8 @@ static void canvas_put_image(SpiceCanvas *spice_canvas,
 {
     SwCanvas *canvas = (SwCanvas *)spice_canvas;
     pixman_image_t *src;
-    int dest_width;
-    int dest_height;
+    uint32_t dest_width;
+    uint32_t dest_height;
     double sx, sy;
     pixman_transform_t transform;
 
commit 2cd07dd8f3dd9bf34b1725bb015aecefc93b3454
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 14:00:27 2010 +0200

    mingw32 build: fix configure.ac typo

diff --git a/configure.ac b/configure.ac
index 5fdc544..e92d7d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -154,7 +154,7 @@ for yield_func in pthread_yield pthread_yield_np sched_yield \
 		[$yield_func()],
 		[posix_yield_func="$yield_func"
 		break])
-    CPPFLAGS="spice_save_CPPFLAGS"
+    CPPFLAGS="$spice_save_CPPFLAGS"
 done
 if test x"$posix_yield_func" = xnone; then
     AC_MSG_ERROR([No posix yield function found])
commit af1bfa625063fef5d417d798432df3f73a4949e6
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 14:00:10 2010 +0200

    mingw32 build: fix various warnings

diff --git a/client/windows/event_sources_p.cpp b/client/windows/event_sources_p.cpp
index 393ea76..c357857 100644
--- a/client/windows/event_sources_p.cpp
+++ b/client/windows/event_sources_p.cpp
@@ -88,7 +88,7 @@ bool EventSources::wait_events(int timeout_ms)
         THROW("wait failed %d", GetLastError());
     }
 
-    int event_index = wait_res - WAIT_OBJECT_0;
+    size_t event_index = wait_res - WAIT_OBJECT_0;
     if (event_index == _handles.size()) {
         return process_system_events();
     } else if ((event_index >= 0) && (event_index < (int)_handles.size())) {
diff --git a/client/windows/main.cpp b/client/windows/main.cpp
index a85acec..9c40102 100644
--- a/client/windows/main.cpp
+++ b/client/windows/main.cpp
@@ -38,7 +38,7 @@ static void init_winsock()
     }
 }
 
-char* version_string = "???";
+const char* version_string = "???";
 static char _version_string[40];
 
 static void init_version_string()
@@ -59,10 +59,10 @@ static void init_version_string()
         return;
     }
     sprintf(_version_string, "%d.%d.%d.%d",
-        file_info->dwFileVersionMS >> 16,
-        file_info->dwFileVersionMS & 0x0ffff,
-        file_info->dwFileVersionLS >> 16,
-        file_info->dwFileVersionLS & 0x0ffff);
+        (int)(file_info->dwFileVersionMS >> 16),
+        (int)(file_info->dwFileVersionMS & 0x0ffff),
+        (int)(file_info->dwFileVersionLS >> 16),
+        (int)(file_info->dwFileVersionLS & 0x0ffff));
     version_string = _version_string;
 }
 
diff --git a/client/windows/red_window_p.h b/client/windows/red_window_p.h
index 38426c7..351d9b9 100644
--- a/client/windows/red_window_p.h
+++ b/client/windows/red_window_p.h
@@ -29,7 +29,7 @@ typedef HWND Window;
 
 class CommandInfo {
 public:
-    CommandInfo() : menu (0), command (NULL) {}
+    CommandInfo() : menu (0), command (0) {}
     CommandInfo(Menu* in_menu, int in_command) : menu (in_menu), command (in_command) {}
 
     Menu* menu;
commit f6cacd0e51d345e1ee8b82e420c59dfaaf95300a
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Thu Jul 8 11:40:57 2010 +0200

    mingw32 build: fix build errors
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/client/common.h b/client/common.h
index c3be656..bda7a19 100644
--- a/client/common.h
+++ b/client/common.h
@@ -37,6 +37,16 @@
 #include <string.h>
 
 #ifdef WIN32
+#ifdef __GNUC__
+#define UNICODE 1
+#define _UNICODE 1
+#define WINVER 0x0501
+#define swprintf_s(_str, _len, _fmt, ...) \
+    swprintf(_str, _fmt, ## __VA_ARGS__)
+#define vsnprintf_s(_str, _len1, _len2, _fmt, _valist) \
+    vsnprintf(_str, _len2, _fmt, _valist)
+#define _ftime_s(_t) _ftime(_t)
+#endif
 #include <winsock2.h>
 #include <windows.h>
 
diff --git a/client/windows/platform_utils.h b/client/windows/platform_utils.h
index 49f9d39..2f333f7 100644
--- a/client/windows/platform_utils.h
+++ b/client/windows/platform_utils.h
@@ -21,10 +21,11 @@
 #include <winsock.h>
 #include <winsock2.h>
 #include <ws2tcpip.h>
+#include "utils.h"
 
 #define mb() __asm {lock add [esp], 0}
 
-template<class T, class FreeRes = FreeObject<T>, T invalid = NULL >
+template<class T, class FreeRes = FreeObject<T>, intptr_t invalid = 0 >
 class AutoRes {
 public:
     AutoRes() : res(invalid) {}
diff --git a/client/zlib_decoder.h b/client/zlib_decoder.h
index 84b6f83..4444040 100644
--- a/client/zlib_decoder.h
+++ b/client/zlib_decoder.h
@@ -22,7 +22,9 @@
 #include "common.h"
 #include "canvas_base.h"
 
-#define ZLIB_WINAPI 
+#ifndef __GNUC__
+#define ZLIB_WINAPI
+#endif
 #include <zlib.h>
 
 
diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c
index eda1529..705a040 100644
--- a/common/gdi_canvas.c
+++ b/common/gdi_canvas.c
@@ -16,8 +16,8 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <Windows.h>
-#include <Wingdi.h>
+#include <windows.h>
+#include <wingdi.h>
 #include "gdi_canvas.h"
 #define GDI_CANVAS
 #include "canvas_base.c"
commit 53c808947d4d5b480d8880f69b53d4e6bac056fa
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Thu Jul 8 11:40:56 2010 +0200

    mingw32 build: disable ms compiler pragmas for gcc
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/client/common.h b/client/common.h
index e1c149c..c3be656 100644
--- a/client/common.h
+++ b/client/common.h
@@ -40,9 +40,11 @@
 #include <winsock2.h>
 #include <windows.h>
 
+#ifndef __GNUC__
 #pragma warning(disable:4355)
 #pragma warning(disable:4996)
 #pragma warning(disable:4200)
+#endif
 
 #define strcasecmp stricmp
 
commit 71aad4d7e8f639e48709bf8515dc4c96342b90e3
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Thu Jul 8 11:40:54 2010 +0200

    mingw32 build: add client/windows/Makefile, tweak configure
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/client/windows/Makefile.am b/client/windows/Makefile.am
index a9babd6..f673afd 100644
--- a/client/windows/Makefile.am
+++ b/client/windows/Makefile.am
@@ -1,5 +1,200 @@
 NULL =
 
+COMMON_DIR=$(SPICE_COMMON_SRCDIR)
+CLIENT_DIR=$(top_srcdir)/client
+
+INCLUDES = \
+	-DSW_CANVAS_CACHE				\
+	-DSW_CANVAS_NO_CHUNKS				\
+	-DUSE_GLZ					\
+	-D__STDC_LIMIT_MACROS				\
+	-I.						\
+	-I..						\
+	-I$(COMMON_DIR)					\
+	-I$(COMMON_DIR)/win				\
+	-I$(CLIENT_DIR)					\
+	$(PROTOCOL_CFLAGS)				\
+	$(GL_CFLAGS)					\
+	$(PIXMAN_CFLAGS)				\
+	$(CELT051_CFLAGS)				\
+	$(SSL_CFLAGS)					\
+	$(CEGUI_CFLAGS)					\
+	$(WARN_CFLAGS)                                  \
+	$(SPICE_NONPKGCONFIG_CFLAGS)			\
+	$(NULL)
+
+
+RED_COMMON_SRCS =					\
+	$(CLIENT_DIR)/application.cpp			\
+	$(CLIENT_DIR)/application.h			\
+	$(CLIENT_DIR)/audio_channels.h			\
+	$(CLIENT_DIR)/audio_devices.h			\
+	$(CLIENT_DIR)/cache.hpp				\
+	$(CLIENT_DIR)/demarshallers.h			\
+	$(CLIENT_DIR)/generated_demarshallers.cpp	\
+	$(CLIENT_DIR)/generated_demarshallers1.cpp	\
+	$(CLIENT_DIR)/marshaller.cpp			\
+	$(CLIENT_DIR)/marshallers.h			\
+	$(CLIENT_DIR)/generated_marshallers.cpp		\
+	$(CLIENT_DIR)/generated_marshallers1.cpp	\
+	$(CLIENT_DIR)/sw_canvas.cpp			\
+	$(CLIENT_DIR)/canvas.cpp			\
+	$(CLIENT_DIR)/gdi_canvas.cpp			\
+	$(CLIENT_DIR)/canvas.h				\
+	$(CLIENT_DIR)/canvas_utils.cpp			\
+	$(CLIENT_DIR)/red_sw_canvas.cpp			\
+	$(CLIENT_DIR)/red_sw_canvas.h			\
+	$(CLIENT_DIR)/cmd_line_parser.cpp		\
+	$(CLIENT_DIR)/cmd_line_parser.h			\
+	$(CLIENT_DIR)/client_net_socket.cpp		\
+	$(CLIENT_DIR)/client_net_socket.h		\
+	$(CLIENT_DIR)/common.h				\
+	$(CLIENT_DIR)/cursor_channel.cpp		\
+	$(CLIENT_DIR)/cursor_channel.h			\
+	$(CLIENT_DIR)/cursor.cpp			\
+	$(CLIENT_DIR)/cursor.h				\
+	$(CLIENT_DIR)/debug.h				\
+	$(CLIENT_DIR)/display_channel.cpp		\
+	$(CLIENT_DIR)/display_channel.h			\
+	$(CLIENT_DIR)/glz_decoded_image.h		\
+	$(CLIENT_DIR)/glz_decoder_config.h		\
+	$(CLIENT_DIR)/glz_decoder.cpp			\
+	$(CLIENT_DIR)/glz_decoder.h			\
+	$(CLIENT_DIR)/glz_decoder_window.cpp		\
+	$(CLIENT_DIR)/glz_decoder_window.h		\
+	$(CLIENT_DIR)/inputs_channel.cpp		\
+	$(CLIENT_DIR)/inputs_channel.h			\
+	$(CLIENT_DIR)/inputs_handler.h			\
+	$(CLIENT_DIR)/jpeg_decoder.cpp			\
+	$(CLIENT_DIR)/jpeg_decoder.h			\
+	$(CLIENT_DIR)/lz.cpp				\
+	$(CLIENT_DIR)/lines.cpp				\
+	$(CLIENT_DIR)/monitor.cpp			\
+	$(CLIENT_DIR)/monitor.h				\
+	$(CLIENT_DIR)/mem.cpp				\
+	$(CLIENT_DIR)/menu.cpp				\
+	$(CLIENT_DIR)/menu.h				\
+	$(CLIENT_DIR)/mjpeg_decoder.h			\
+	$(CLIENT_DIR)/mjpeg_decoder.cpp			\
+	$(CLIENT_DIR)/pixels_source.h			\
+	$(CLIENT_DIR)/pixman_utils.cpp			\
+	$(CLIENT_DIR)/platform.h			\
+	$(CLIENT_DIR)/playback_channel.cpp		\
+	$(CLIENT_DIR)/process_loop.cpp			\
+	$(CLIENT_DIR)/quic.cpp				\
+	$(CLIENT_DIR)/record_channel.cpp		\
+	$(CLIENT_DIR)/red_channel.cpp			\
+	$(CLIENT_DIR)/red_channel.h			\
+	$(CLIENT_DIR)/red_client.cpp			\
+	$(CLIENT_DIR)/red_client.h			\
+	$(CLIENT_DIR)/red_drawable.h			\
+	$(CLIENT_DIR)/red_key.h				\
+	$(CLIENT_DIR)/red_peer.cpp			\
+	$(CLIENT_DIR)/red_gdi_canvas.cpp		\
+	$(CLIENT_DIR)/red_peer.h			\
+	$(CLIENT_DIR)/red_pixmap_sw.h			\
+	$(CLIENT_DIR)/red_pixmap.h			\
+	$(CLIENT_DIR)/red_types.h			\
+	$(CLIENT_DIR)/red_window.h			\
+	$(CLIENT_DIR)/region.cpp			\
+	$(CLIENT_DIR)/rop3.cpp				\
+	$(CLIENT_DIR)/screen.cpp			\
+	$(CLIENT_DIR)/screen.h				\
+	$(CLIENT_DIR)/screen_layer.cpp			\
+	$(CLIENT_DIR)/screen_layer.h			\
+	$(CLIENT_DIR)/shared_cache.hpp			\
+	$(CLIENT_DIR)/hot_keys.cpp			\
+	$(CLIENT_DIR)/hot_keys.h			\
+	$(CLIENT_DIR)/threads.cpp			\
+	$(CLIENT_DIR)/tunnel_channel.cpp		\
+	$(CLIENT_DIR)/tunnel_channel.h			\
+	$(CLIENT_DIR)/utils.cpp				\
+	$(CLIENT_DIR)/utils.h				\
+	$(CLIENT_DIR)/zlib_decoder.cpp			\
+	$(CLIENT_DIR)/zlib_decoder.h			\
+	$(CLIENT_DIR)/icon.h				\
+	$(NULL)
+
+if SUPPORT_GUI
+RED_GUI_SRCS =						\
+	$(CLIENT_DIR)/gui/softrenderer.h		\
+	$(CLIENT_DIR)/gui/softrenderer.cpp		\
+	$(CLIENT_DIR)/gui/softtexture.h			\
+	$(CLIENT_DIR)/gui/softtexture.cpp		\
+	$(CLIENT_DIR)/gui/resource_provider.h		\
+	$(CLIENT_DIR)/gui/resource_provider.cpp		\
+	$(CLIENT_DIR)/gui/gui.h				\
+	$(CLIENT_DIR)/gui/gui.cpp
+else
+RED_GUI_SRCS =
+endif
+
+
+if SUPPORT_GL
+RED_OGL_SRCS =						\
+	$(CLIENT_DIR)/gl_canvas.cpp			\
+	$(CLIENT_DIR)/glc.cpp				\
+	$(CLIENT_DIR)/red_gl_canvas.cpp			\
+	$(CLIENT_DIR)/red_gl_canvas.h			\
+	$(CLIENT_DIR)/red_pixmap_gl.h			\
+	red_pixmap_gl.cpp
+else
+RED_OGL_SRCS =
+endif
+
+bin_PROGRAMS = spicec
+
+spicec_SOURCES =			\
+	atomic_count.h			\
+	event_sources_p.cpp		\
+	main.cpp			\
+	my_getopt.cpp			\
+	named_pipe.h                    \
+	named_pipe.cpp                  \
+	pixels_source.cpp		\
+	pixels_source_p.h		\
+	platform.cpp			\
+	platform_utils.h                \
+	platform_utils.cpp              \
+	playback.cpp			\
+	playback.h			\
+	record.cpp			\
+	record.h			\
+	red_drawable.cpp		\
+	red_pixmap.cpp			\
+	red_pixmap_gdi.cpp		\
+	red_pixmap_sw.cpp		\
+	red_window.cpp			\
+	red_window_p.h			\
+	resource.h			\
+	stdint.h			\
+	win_platform.h			\
+	$(RED_COMMON_SRCS)		\
+	$(RED_GUI_SRCS)			\
+	$(RED_OGL_SRCS)			\
+	$(NULL)
+
+spicec_LDFLAGS = \
+	$(SPICEC_STATIC_LINKAGE_BSTATIC)		\
+	$(CELT051_LIBS)					\
+	$(SSL_LIBS)					\
+	$(CEGUI_LIBS)					\
+	$(JPEG_LIBS)					\
+	$(Z_LIBS)					\
+	$(SPICE_NONPKGCONFIG_LIBS)
+
+spicec_LDADD =						\
+	redc.res					\
+	$(PIXMAN_LIBS)					\
+	$(GL_LIBS)					\
+	$(CEGUI_LIBS)
+
+spicec_DEPENDENCIES = redc.res
+
+redc.res: redc.rc
+	$(WINDRES) -J rc -i $< -O coff -o $@
+NULL =
+
 EXTRA_DIST = \
 	atomic_count.h		\
 	event_sources_p.cpp	\
diff --git a/configure.ac b/configure.ac
index 4b732b5..5fdc544 100644
--- a/configure.ac
+++ b/configure.ac
@@ -138,7 +138,11 @@ AC_CHECK_LIB(rt, clock_gettime,
    )
 AC_SUBST(LIBRT)
 
-SPICE_NONPKGCONFIG_LIBS+=" -pthread $LIBM $LIBRT"
+if test "$red_target" = "windows"; then
+	SPICE_NONPKGCONFIG_LIBS+=" -lpthreadGC2 -lversion -lmsimg32 $LIBM"
+else
+	SPICE_NONPKGCONFIG_LIBS+=" -pthread $LIBM $LIBRT"
+fi
 
 dnl The client needs a yield function
 AC_MSG_CHECKING(for posix yield function)
@@ -323,7 +327,11 @@ dnl MAYBE_WARN in an ignorable way (like adding whitespace)
 
 dnl MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations"
 
-MAYBE_WARN="-Wall -Wno-sign-compare -Wno-deprecated-declarations"
+if test "$red_target" = "windows"; then
+	MAYBE_WARN="-Wall -Wno-sign-compare -Wno-deprecated-declarations"
+else
+	MAYBE_WARN="-Wall -Wno-sign-compare -Werror -Wno-deprecated-declarations"
+fi
 
 AC_ARG_ENABLE(werror,
 AC_HELP_STRING([--enable-werror], [Use -Werror (if supported)]),
commit 09c0e2de2c2fb2450f056f0263a1143769d061d1
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Thu Jul 8 11:40:53 2010 +0200

    build: s/HUGE/INFINITY/
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/client/red_client.cpp b/client/red_client.cpp
index 46d5602..e1f5a42 100644
--- a/client/red_client.cpp
+++ b/client/red_client.cpp
@@ -638,7 +638,7 @@ void RedClient::send_agent_monitors_config()
         THROW(" monitors query failed");
     }
 
-    double min_distance = HUGE;
+    double min_distance = INFINITY;
     int dx = 0;
     int dy = 0;
     int i;
commit 8879a45d5611c7d9294d4e3f6d4e133094288119
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Thu Jul 8 11:40:52 2010 +0200

    build: use jpeg_boolean with more recent libjpeg versions.
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/client/jpeg_decoder.cpp b/client/jpeg_decoder.cpp
index a7824a9..f5a0198 100644
--- a/client/jpeg_decoder.cpp
+++ b/client/jpeg_decoder.cpp
@@ -20,6 +20,10 @@
 #include "debug.h"
 #include "utils.h"
 
+#if JPEG_LIB_VERSION < 70
+#define jpeg_boolean boolean
+#endif
+
 static void op_begin_decode(SpiceJpegDecoder *decoder,
                             uint8_t* data,
                             int data_size,
@@ -45,7 +49,7 @@ extern "C" {
     {
     }
 
-    static boolean jpeg_decoder_fill_input_buffer(j_decompress_ptr cinfo)
+    static jpeg_boolean jpeg_decoder_fill_input_buffer(j_decompress_ptr cinfo)
     {
         PANIC("no more data for jpeg");
         return FALSE;
diff --git a/client/mjpeg_decoder.cpp b/client/mjpeg_decoder.cpp
index 2470fb1..f9cb603 100644
--- a/client/mjpeg_decoder.cpp
+++ b/client/mjpeg_decoder.cpp
@@ -21,6 +21,10 @@
 #include "utils.h"
 #include "mjpeg_decoder.h"
 
+#if JPEG_LIB_VERSION < 70
+#define jpeg_boolean boolean
+#endif
+
 enum {
     STATE_READ_HEADER,
     STATE_START_DECOMPRESS,
@@ -34,7 +38,7 @@ extern "C" {
     {
     }
 
-    static boolean fill_input_buffer(j_decompress_ptr cinfo)
+    static jpeg_boolean fill_input_buffer(j_decompress_ptr cinfo)
     {
         return FALSE;
     }
commit bed8f911ce66b39aeaa8942a5deaa13d8481cd86
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Sun Dec 5 20:43:57 2010 +0200

    build: only check for x11 extensions when
    building for x11 platform.

diff --git a/configure.ac b/configure.ac
index 7718a6d..4b732b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -232,26 +232,32 @@ AC_SUBST(GL_CFLAGS)
 AC_SUBST(GL_LIBS)
 SPICE_NONPKGCONFIG_LIBS+=" $GL_LIBS"
 
-PKG_CHECK_MODULES(XRANDR, xrandr)
-PKG_CHECK_MODULES(XFIXES, xfixes)
-AC_SUBST(XRANDR_CFLAGS)
-AC_SUBST(XRANDR_LIBS)
-SPICE_REQUIRES+=" xrandr xfixes"
-
-PKG_CHECK_MODULES(XRANDR12,
-        xrandr >= 1.2,
-        have_xrandr12=yes,
-        have_xrandr12=no)
+if test "$red_target" = "x11"; then
+	PKG_CHECK_MODULES(XRANDR, xrandr)
+	PKG_CHECK_MODULES(XFIXES, xfixes)
+	AC_SUBST(XRANDR_CFLAGS)
+	AC_SUBST(XRANDR_LIBS)
+	SPICE_REQUIRES+=" xrandr xfixes"
+
+	PKG_CHECK_MODULES(XRANDR12,
+	        xrandr >= 1.2,
+	        have_xrandr12=yes,
+	        have_xrandr12=no)
+else
+	have_xrandr12=no
+fi
 
 AM_CONDITIONAL([HAVE_XRANDR12], [test "x$have_xrandr12" = "xyes"])
 if test "x$have_xrandr12" = "xyes" ; then
   AC_DEFINE([HAVE_XRANDR12], [], [Define if we have XRANDR 12])
 fi
 
-PKG_CHECK_MODULES(MISC_X, x11 xext xrender)
-AC_SUBST(MISC_X_CFLAGS)
-AC_SUBST(MISC_X_LIBS)
-SPICE_REQUIRES+=" x11 xext xrender"
+if test "$red_target" = "x11"; then
+	PKG_CHECK_MODULES(MISC_X, x11 xext xrender)
+	AC_SUBST(MISC_X_CFLAGS)
+	AC_SUBST(MISC_X_LIBS)
+	SPICE_REQUIRES+=" x11 xext xrender"
+fi
 
 # Add parameter for (partial) static linkage of spice client.
 # this is used to achive single binary package for all (?) distros.
commit 1c09623cc08e27ebf72b92d958dca9b95f0ec32f
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Thu Jul 8 11:40:49 2010 +0200

    build: alsa is needed on linux only.
    
    Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

diff --git a/configure.ac b/configure.ac
index 4f3b118..7718a6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -199,10 +199,12 @@ AC_SUBST(CELT051_LIBS)
 AC_SUBST(CELT051_LIBDIR)
 SPICE_REQUIRES+=" celt051 >= 0.5.1.1"
 
-PKG_CHECK_MODULES(ALSA, alsa)
-AC_SUBST(ALSA_CFLAGS)
-AC_SUBST(ALSA_LIBS)
-SPICE_REQUIRES+=" alsa"
+if test "$os_linux" = yes; then
+	PKG_CHECK_MODULES(ALSA, alsa)
+	AC_SUBST(ALSA_CFLAGS)
+	AC_SUBST(ALSA_LIBS)
+	SPICE_REQUIRES+=" alsa"
+fi
 
 PKG_CHECK_MODULES(SSL, openssl)
 AC_SUBST(SSL_CFLAGS)
commit 450278a299f2a91daec4b4fd2ca64262b5602850
Author: Alon Levy <alevy at redhat.com>
Date:   Mon Dec 6 18:02:52 2010 +0200

    server/tests: Makefile.am: use AM_LDFLAGS instead of LDFLAGS

diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
index f91dfa4..1f8817f 100644
--- a/server/tests/Makefile.am
+++ b/server/tests/Makefile.am
@@ -7,7 +7,7 @@ INCLUDES =                          \
 	$(SPICE_NONPKGCONFIG_CFLAGS)    \
 	$(NULL)
 
-LDFLAGS = -L../.libs -lspice-server
+AM_LDFLAGS = -L../.libs -lspice-server
 
 noinst_PROGRAMS = test_just_sockets_no_ssl test_empty_success test_fail_on_null_core_interface test_display_no_ssl
 


More information about the Spice-commits mailing list