ipc: Const correctness

This commit is contained in:
Ryan Pavlik 2020-08-06 09:43:09 -05:00
parent d27044a18d
commit f1432789ee
2 changed files with 8 additions and 3 deletions

View file

@ -367,7 +367,7 @@ ipc_handle_swapchain_import(volatile struct ipc_client_state *ics,
const struct xrt_swapchain_create_info *info,
struct ipc_arg_swapchain_from_native *args,
uint32_t *out_id,
xrt_graphics_buffer_handle_t *handles,
const xrt_graphics_buffer_handle_t *handles,
uint32_t num_handles)
{
xrt_result_t xret = XRT_SUCCESS;

View file

@ -149,6 +149,11 @@ class HandleType:
self.count_arg_type + ' ')
return (x + y for x, y in zip(types, self.arg_names))
@property
def const_arg_decls(self):
"""Get the const argument declarations for the client proxy."""
return ("const {}".format(x) for x in self.arg_decls)
@property
def handler_arg_names(self):
"""Get the argument names for the server handler."""
@ -185,7 +190,7 @@ class Call:
args = ["struct ipc_connection *ipc_c"]
args.extend(arg.get_func_argument_in() for arg in self.in_args)
if self.in_handles:
args.extend(self.in_handles.arg_decls)
args.extend(self.in_handles.const_arg_decls)
args.extend(arg.get_func_argument_out() for arg in self.out_args)
if self.out_handles:
args.extend(self.out_handles.arg_decls)
@ -199,7 +204,7 @@ class Call:
if self.out_handles:
args.extend(self.out_handles.handler_arg_decls)
if self.in_handles:
args.extend(self.in_handles.arg_decls)
args.extend(self.in_handles.const_arg_decls)
write_decl(f, 'xrt_result_t', 'ipc_handle_' + self.name, args)
@property