fix: correct error code assignment for boolean return type in generate_checked_function

This commit is contained in:
liang.he@intel.com 2025-10-28 06:57:46 +00:00
parent 170b23d27b
commit 22a969e67c

View File

@ -149,7 +149,7 @@ def generate_checked_function(func, typedefs):
if return_type == "void": if return_type == "void":
new_func.append(f" res.error_code = 0;") new_func.append(f" res.error_code = 0;")
elif return_type == "_Bool": elif return_type == "_Bool":
new_func.append(f" res.error_code = 0 ? original_result : -2;") new_func.append(f" res.error_code = original_result ? 0 : -2;")
new_func.append(f" res.value._Bool_value = original_result;") new_func.append(f" res.value._Bool_value = original_result;")
# if return type is a pointer or typedef from pointer # if return type is a pointer or typedef from pointer
elif return_pointer: elif return_pointer: