[Spice-devel] [PATCH 11/20] mingw: fix signed/unsigned comparison warning

Christophe Fergeau cfergeau at redhat.com
Thu Mar 1 02:17:45 PST 2012


DWORD is an unsigned long, but it's assigned -1 in various places.
mingw warns when comparing a DWORD value against -1. This commit
casts the -1 to DWORD to avoid the warning.
---
 vdagent/desktop_layout.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp
index b599aa3..822a68f 100644
--- a/vdagent/desktop_layout.cpp
+++ b/vdagent/desktop_layout.cpp
@@ -284,7 +284,7 @@ bool DesktopLayout::init_dev_mode(LPCTSTR dev_name, DEVMODE* dev_mode, DisplayMo
             best = i;
         }
     }
-    if (best == -1 || !EnumDisplaySettings(dev_name, best, dev_mode)) {
+    if (best == (DWORD)-1 || !EnumDisplaySettings(dev_name, best, dev_mode)) {
         return false;
     }
     dev_mode->dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
-- 
1.7.7.6



More information about the Spice-devel mailing list