[Spice-commits] 6 commits - client/canvas.cpp client/common.h client/cursor.cpp client/red_client.h client/threads.cpp client/windows common/draw.h common/mem.h common/pixman_utils.c common/ssl_verify.h

Alon Levy alon at kemper.freedesktop.org
Sun Mar 4 05:15:18 PST 2012


 client/canvas.cpp                  |    2 +-
 client/common.h                    |    2 ++
 client/cursor.cpp                  |    2 +-
 client/red_client.h                |    2 +-
 client/threads.cpp                 |    7 +++++++
 client/windows/event_sources_p.cpp |    2 +-
 client/windows/red_window.cpp      |    2 +-
 common/draw.h                      |    4 ++--
 common/mem.h                       |    2 ++
 common/pixman_utils.c              |    6 +++---
 common/ssl_verify.h                |    1 +
 11 files changed, 22 insertions(+), 10 deletions(-)

New commits:
commit 735f8e2837ac30e56efc45112841b3c71bcc85ac
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Feb 29 19:01:59 2012 +0100

    mingw: workaround weird openssl build failure
    
    If X509_NAME isn't undefined before including x509v3.h, very
    weird compilation error occurs. It seems to be caused by duplicate
    definitions for this symbols coming from wincrypto.h

diff --git a/common/ssl_verify.h b/common/ssl_verify.h
index b8306f3..067762b 100644
--- a/common/ssl_verify.h
+++ b/common/ssl_verify.h
@@ -29,6 +29,7 @@
 #include <openssl/x509.h>
 #include <openssl/ssl.h>
 #include <openssl/err.h>
+#undef X509_NAME
 #include <openssl/x509v3.h>
 
 #ifdef __cplusplus
commit 0f94e897b5226d91380f9f4838e0acb47d9b2219
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Feb 29 19:01:58 2012 +0100

    mingw: don't try to redefine alloca
    
    mingw already has a #define alloca __builtin_alloca so trying to
    redefine it triggers a warning.

diff --git a/common/mem.h b/common/mem.h
index 980ea13..af89ba6 100644
--- a/common/mem.h
+++ b/common/mem.h
@@ -41,7 +41,9 @@ extern "C" {
 #ifdef HAVE_ALLOCA_H
 # include <alloca.h>
 #elif defined __GNUC__
+#if !defined alloca
 # define alloca __builtin_alloca
+#endif
 #elif defined _AIX
 # define alloca __alloca
 #elif defined _MSC_VER
commit 32cd24be0a3cf1e842a2fbc440401a6bb259874f
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Feb 29 19:01:57 2012 +0100

    mingw: fix signed/unsigned comparison warnings

diff --git a/client/red_client.h b/client/red_client.h
index 8872ce8..577ccb7 100644
--- a/client/red_client.h
+++ b/client/red_client.h
@@ -375,7 +375,7 @@ private:
 
     GlzDecoderWindowDebug _glz_debug;
     GlzDecoderWindow _glz_window;
-    int _glz_window_size; // in pixels
+    unsigned int _glz_window_size; // in pixels
 
     Mutex _mm_clock_lock;
     uint64_t _mm_clock_last_update;
diff --git a/client/windows/event_sources_p.cpp b/client/windows/event_sources_p.cpp
index 7703573..bbf48d9 100644
--- a/client/windows/event_sources_p.cpp
+++ b/client/windows/event_sources_p.cpp
@@ -94,7 +94,7 @@ bool EventSources::wait_events(int timeout_ms)
     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())) {
+    } else if ((event_index >= 0) && (event_index < _handles.size())) {
         _events[event_index]->action();
         return false;
     } else {
diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp
index 89a33c9..fcb033b 100644
--- a/client/windows/red_window.cpp
+++ b/client/windows/red_window.cpp
@@ -69,7 +69,7 @@ static bool is_fake_ctrl(UINT message, WPARAM wParam, LPARAM lParam)
             LONG time = GetMessageTime();
             BOOL msg_exist = PeekMessage(&next_msg, NULL,
                 next_peek, next_peek, PM_NOREMOVE);
-            if ((msg_exist == TRUE) && (next_msg.time == time) &&
+            if ((msg_exist == TRUE) && ((LONG)next_msg.time == time) &&
                 (next_msg.wParam == VK_MENU) &&
                 (HIWORD (next_msg.lParam) & KF_EXTENDED)) {
                     return true;
commit 58b9aa98535586d024033b09a03fca6a1469334e
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Feb 29 19:01:56 2012 +0100

    mingw: add workaround for _ftime_s issue on mingw
    
    mingw has a _ftime_s prototype in its headers, but no corresponding
    symbol available at link time. Workaround this issue for now by
     #defining it to _ftime. This is untested on win64 where the workaround
    may not be needed.

diff --git a/client/threads.cpp b/client/threads.cpp
index bf499e7..e255bee 100644
--- a/client/threads.cpp
+++ b/client/threads.cpp
@@ -28,6 +28,13 @@
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
+#ifdef __MINGW32__
+//workaround for what I think is a mingw bug: it has a prototype for
+//_ftime_s in its headers, but no symbol for it at link time.
+//The #define from common.h cannot be used since it breaks other mingw
+//headers if any are included after the #define.
+#define _ftime_s _ftime
+#endif
 
 Thread::Thread(thread_main_t thread_main, void* opaque)
 {
commit 4ec9ac20fce858d7fe6769b14b521b62c64c828c
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Feb 29 19:01:55 2012 +0100

    mingw: #ifdef unneeded #define in common.h
    
    common.h has some #define when doing win32 build to workaround a few
    missing functions on these systems. However, since mingw32 has some
    of these, this causes either warnings about redefining preprocessor
    symbols or wreak havoc in mingw headers trying to use these symbols.
    This commit wraps these symbols in an #ifndef __MINGW32__ to avoid
    using them on this platform.

diff --git a/client/common.h b/client/common.h
index 268057a..e9a7ea8 100644
--- a/client/common.h
+++ b/client/common.h
@@ -44,6 +44,7 @@
 #ifdef __GNUC__
 #define UNICODE 1
 #define _UNICODE 1
+#if !defined __MINGW32__
 #define WINVER 0x0501
 #define swprintf_s(_str, _len, _fmt, ...) \
     swprintf(_str, _fmt, ## __VA_ARGS__)
@@ -51,6 +52,7 @@
     vsnprintf(_str, _len2, _fmt, _valist)
 #define _ftime_s(_t) _ftime(_t)
 #endif
+#endif
 #include <winsock2.h>
 #include <windows.h>
 
commit 5989e2d1c4fa997dc2dbd4ea331bf6e77a425aff
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Feb 29 19:01:54 2012 +0100

    mingw: use uintptr_t when converting a pointer to an int
    
    win64 uses 32 bit long, so we cannot use a long to hold a 64 bit
    pointer. Thankfully, there's a [u]intptr_t type available exactly
    for these uses.

diff --git a/client/canvas.cpp b/client/canvas.cpp
index 139b663..0986d47 100644
--- a/client/canvas.cpp
+++ b/client/canvas.cpp
@@ -70,7 +70,7 @@ void Canvas::clear()
 
 void Canvas::begin_draw(SpiceMsgDisplayBase& base, int size, size_t min_size)
 {
-    _base = (unsigned long)&base;
+    _base = (uintptr_t)&base;
 }
 
 void Canvas::draw_fill(SpiceMsgDisplayDrawFill& fill, int size)
diff --git a/client/cursor.cpp b/client/cursor.cpp
index e9e3006..0584b88 100644
--- a/client/cursor.cpp
+++ b/client/cursor.cpp
@@ -64,7 +64,7 @@ CursorData::CursorData(SpiceCursor& cursor, int data_size)
     }
 
     if (data_size < expected_size) {
-        THROW("access violation 0x%lx %u", (unsigned long)cursor.data, expected_size);
+        THROW("access violation 0x%lx %u", (uintptr_t)cursor.data, expected_size);
     }
     _data = new uint8_t[expected_size];
     memcpy(_data, cursor.data, expected_size);
diff --git a/common/draw.h b/common/draw.h
index 793169f..8b1206d 100644
--- a/common/draw.h
+++ b/common/draw.h
@@ -39,8 +39,8 @@
 extern "C" {
 #endif
 
-#define SPICE_GET_ADDRESS(addr) ((void *)(unsigned long)(addr))
-#define SPICE_SET_ADDRESS(addr, val) ((addr) = (unsigned long)(val))
+#define SPICE_GET_ADDRESS(addr) ((void *)(uintptr_t)(addr))
+#define SPICE_SET_ADDRESS(addr, val) ((addr) = (uintptr_t)(val))
 
 typedef int32_t SPICE_FIXED28_4;
 
diff --git a/common/pixman_utils.c b/common/pixman_utils.c
index c04b01f..1136aa7 100644
--- a/common/pixman_utils.c
+++ b/common/pixman_utils.c
@@ -243,19 +243,19 @@ void spice_pixman_fill_rect(pixman_image_t *dest,
         byte_line += stride;
         w = byte_width;
 
-        while (w >= 1 && ((unsigned long)d & 1)) {
+        while (w >= 1 && ((uintptr_t)d & 1)) {
             *(uint8_t *)d = (value & 0xff);
             w--;
             d++;
         }
 
-        while (w >= 2 && ((unsigned long)d & 3)) {
+        while (w >= 2 && ((uintptr_t)d & 3)) {
             *(uint16_t *)d = value;
             w -= 2;
             d += 2;
         }
 
-        while (w >= 4 && ((unsigned long)d & 7)) {
+        while (w >= 4 && ((uintptr_t)d & 7)) {
             *(uint32_t *)d = value;
 
             w -= 4;


More information about the Spice-commits mailing list