[PATCH 2/2] python: Fix -Wsign-compare

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A few functions are comparing signed and unsigned values, basically
because some of the loop indexes are signed values. Casting it to
unsigned seems harmless and makes GCC happier.
---
 python_modules/codegen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python_modules/codegen.py b/python_modules/codegen.py
index 009cf95..603531f 100644
--- a/python_modules/codegen.py
+++ b/python_modules/codegen.py
@@ -266,7 +266,7 @@ class CodeWriter:
         return self.block()
 
     def for_loop(self, index, limit):
-        return self.block("for (%s = 0; %s < %s; %s++)" % (index, index, limit, index))
+        return self.block("for (%s = 0; %s < (unsigned) %s; %s++)" % (index, index, limit, index))
 
     def while_loop(self, expr):
         return self.block("while (%s)" % (expr))
-- 
1.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]