[Spice-devel] [PATCH 09/20] mingw: use unsigned int in for loops when needed

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


gcc complains about mixed use of signed/unsigned otherwise
---
 vdagent/vdagent.cpp     |    8 ++++----
 vdservice/vdservice.cpp |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index 1cfa96d..3f56292 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -876,7 +876,7 @@ void VDAgent::on_clipboard_grab()
                                  VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) {
         return;
     }
-    for (int i = 0; i < clipboard_formats_count; i++) {
+    for (unsigned int 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;
@@ -1065,7 +1065,7 @@ void VDAgent::handle_clipboard_release()
 
 uint32_t VDAgent::get_clipboard_format(uint32_t type)
 {
-    for (int i = 0; i < clipboard_formats_count; i++) {
+    for (unsigned int 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;
@@ -1079,7 +1079,7 @@ uint32_t VDAgent::get_clipboard_type(uint32_t format)
 {
     uint32_t* types = NULL;
 
-    for (int i = 0; i < clipboard_formats_count && !types; i++) {
+    for (unsigned int i = 0; i < clipboard_formats_count && !types; i++) {
         if (clipboard_formats[i].format == format) {
             types = clipboard_formats[i].types;
         }
@@ -1097,7 +1097,7 @@ uint32_t VDAgent::get_clipboard_type(uint32_t format)
 
 DWORD VDAgent::get_cximage_format(uint32_t type)
 {
-    for (int i = 0; i < sizeof(image_types) / sizeof(image_types[0]); i++) {
+    for (unsigned int i = 0; i < sizeof(image_types) / sizeof(image_types[0]); i++) {
         if (image_types[i].type == type) {
             return image_types[i].cximage_format;
         }
diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
index ca9ac1e..4701f5a 100644
--- a/vdservice/vdservice.cpp
+++ b/vdservice/vdservice.cpp
@@ -460,7 +460,7 @@ bool VDService::init_vdi_port()
 {
     VDIPort* (*creators[])(void) = { create_virtio_vdi_port, create_pci_vdi_port };
 
-    for (int i = 0 ; i < sizeof(creators)/sizeof(creators[0]); ++i) {
+    for (unsigned int i = 0 ; i < sizeof(creators)/sizeof(creators[0]); ++i) {
         _vdi_port = creators[i]();
         if (_vdi_port->init()) {
             return true;
-- 
1.7.7.6



More information about the Spice-devel mailing list