mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2025-12-26 14:18:36 +00:00
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.
This commit is contained in:
parent
9385db6875
commit
840bcfe7a2
@ -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:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user