summaryrefslogtreecommitdiff
path: root/python_modules
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2019-02-18 13:16:37 +0000
committerFrediano Ziglio <fziglio@redhat.com>2019-02-20 17:42:59 +0000
commit7fa8bda27502d7b810d30de350253eb31c7b5d10 (patch)
tree838cd61800077a358ec1b48f9c80f719cf3ceed1 /python_modules
parent7f6c55790bc9e32e4051c9a2d981ebee9927203c (diff)
codegen: Use a better type for pointer converted to integer
Although on the platform we support size_t and uintptr_t are the same, on some platform the size_t can (in theory) be smaller than the necessary integer to store a pointer. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Diffstat (limited to 'python_modules')
-rw-r--r--python_modules/demarshal.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
index 36213b1..68532a9 100644
--- a/python_modules/demarshal.py
+++ b/python_modules/demarshal.py
@@ -847,7 +847,7 @@ def write_array_parser(writer, member, nelements, array, dest, scope):
write_container_parser(writer, element_type, dest2)
if array.has_attr("ptr_array"):
writer.comment("Align ptr_array element to 4 bytes").newline()
- writer.assign("end", "(uint8_t *)SPICE_ALIGN((size_t)end, 4)")
+ writer.assign("end", "(uint8_t *)SPICE_ALIGN((uintptr_t)end, 4)")
def write_parse_pointer_core(writer, target_type, offset, at_end, dest, member_name, scope):
writer.assign("ptr_info[n_ptr].offset", offset)
@@ -968,7 +968,7 @@ def write_ptr_info_check(writer):
writer.assign("*%s" % dest, "NULL")
with writer.block(" else"):
writer.comment("Align to 32 bit").newline()
- writer.assign("end", "(uint8_t *)SPICE_ALIGN((size_t)end, 4)")
+ writer.assign("end", "(uint8_t *)SPICE_ALIGN((uintptr_t)end, 4)")
writer.assign("*%s" % dest, "(void *)end")
writer.assign("end", "%s(message_start, message_end, end, &ptr_info[%s])" % (function, index))
writer.error_check("end == NULL")