summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2014-09-03 15:14:54 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2014-09-18 13:13:30 +0200
commitcb37de352012da27268882eb24784ba39e834712 (patch)
tree4a491ab597a51dafab92e73d8630b78fcb6e9b9d
parent744675b424a9db5e6fc26440dcfab961fd1d284e (diff)
downloadspice-protocol-cb37de352012da27268882eb24784ba39e834712.tar.gz
spice-protocol-cb37de352012da27268882eb24784ba39e834712.tar.xz
spice-protocol-cb37de352012da27268882eb24784ba39e834712.zip
python: Fix -Wsign-compare
The return of the get_array_size() is used as a limit in a loop, being compared with an unsigned index (indexes are always unsigned). To avoid the -Wsign-compare warning, let's cast the return of the get_array_size() to unsigned and make GCC happier.
-rw-r--r--python_modules/marshal.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index 97d02e9..1eda1ba 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -162,11 +162,11 @@ def get_array_size(array, container_src):
rows_v = container_src.get_ref(rows)
# TODO: Handle multiplication overflow
if bpp == 8:
- return "(%s * %s)" % (width_v, rows_v)
+ return "(unsigned) (%s * %s)" % (width_v, rows_v)
elif bpp == 1:
- return "(((%s + 7) / 8 ) * %s)" % (width_v, rows_v)
+ return "(unsigned) (((%s + 7) / 8 ) * %s)" % (width_v, rows_v)
else:
- return "(((%s * %s + 7) / 8 ) * %s)" % (bpp, width_v, rows_v)
+ return "(unsigned) (((%s * %s + 7) / 8 ) * %s)" % (bpp, width_v, rows_v)
elif array.is_bytes_length():
return container_src.get_ref(array.size[2])
else: