From 3784d63a26c052e3dbe09d653913a87bbb8a6b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 18 Dec 2023 22:30:13 +0100 Subject: [PATCH] vrclient: Remove unnecessary struct_needs_size_adjustment. CW-Bug-Id: #22729 CW-Bug-Id: #23147 --- vrclient_x64/gen_wrapper.py | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/vrclient_x64/gen_wrapper.py b/vrclient_x64/gen_wrapper.py index 85883985..adcd0706 100755 --- a/vrclient_x64/gen_wrapper.py +++ b/vrclient_x64/gen_wrapper.py @@ -772,11 +772,6 @@ def handle_method_cpp(method, classname, out): next_name, next_param = params[i + 1] if not next_param or next_param.type.spelling != "uint32_t": size_param[name] = ', -1' - elif struct_needs_size_adjustment(real_type.get_canonical()): - real_name = real_type.spelling - out(f' uint32_t u_{next_name} = std::min( params->{next_name}, (uint32_t)sizeof({real_name}) );\n') - size_param[name] = f', params->{next_name}' - size_fixup[next_name] = True elif name in need_convert: assert name not in STRUCTS_NEXT_IS_SIZE_UNHANDLED out(f' uint32_t u_{next_name} = params->{next_name} ? sizeof(u_{name}) : 0;\n') @@ -1052,29 +1047,6 @@ def struct_needs_conversion(struct): return False -def struct_needs_size_adjustment(struct): - name = canonical_typename(struct) - if name in EXEMPT_STRUCTS: - return False - - abis = find_struct_abis(name) - if abis is None: - return False - if abis['w32'].needs_conversion(abis['u32']): - return False - if abis['w64'].needs_conversion(abis['u64']): - return False - - assert abis['u32'].size <= abis['w32'].size - if abis['u32'].size < abis['w32'].size: - return True - assert abis['u64'].size <= abis['w64'].size - if abis['u64'].size < abis['w64'].size: - return True - - return False - - def get_field_attribute_str(field): ftype = field.type.get_canonical() if ftype.kind != TypeKind.RECORD: