From 1641356df82a687861203567b59af657343129ee Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 4 Oct 2022 10:51:26 -0400 Subject: [PATCH] Make more idl generator data types as unsigned (#23017) * Make more types unsigned * percent is also unsigned (basic-types.h) * Update one more unsigned --- scripts/idl/generators/types.py | 41 +++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/scripts/idl/generators/types.py b/scripts/idl/generators/types.py index 58743e865ba710..e96e852dac6b96 100644 --- a/scripts/idl/generators/types.py +++ b/scripts/idl/generators/types.py @@ -189,31 +189,32 @@ def is_struct(self) -> bool: "int8s": BasicInteger(idl_name="int8s", byte_count=1, is_signed=True), "int8u": BasicInteger(idl_name="int8u", byte_count=1, is_signed=False), # Derived types - "action_id": BasicInteger(idl_name="action_id", byte_count=1, is_signed=True), - "attrib_id": BasicInteger(idl_name="attrib_id", byte_count=4, is_signed=True), - "cluster_id": BasicInteger(idl_name="cluster_id", byte_count=4, is_signed=True), - "command_id": BasicInteger(idl_name="command_id", byte_count=4, is_signed=True), - "data_ver": BasicInteger(idl_name="data_ver", byte_count=4, is_signed=True), - "date": BasicInteger(idl_name="date", byte_count=4, is_signed=True), - "devtype_id": BasicInteger(idl_name="devtype_id", byte_count=4, is_signed=True), - "endpoint_no": BasicInteger(idl_name="endpoint_no", byte_count=2, is_signed=True), + # Size and signdness should generally follow DataModelTypes.h or basic-types.h + "action_id": BasicInteger(idl_name="action_id", byte_count=1, is_signed=False), + "attrib_id": BasicInteger(idl_name="attrib_id", byte_count=4, is_signed=False), + "cluster_id": BasicInteger(idl_name="cluster_id", byte_count=4, is_signed=False), + "command_id": BasicInteger(idl_name="command_id", byte_count=4, is_signed=False), + "data_ver": BasicInteger(idl_name="data_ver", byte_count=4, is_signed=False), + "date": BasicInteger(idl_name="date", byte_count=4, is_signed=False), + "devtype_id": BasicInteger(idl_name="devtype_id", byte_count=4, is_signed=False), + "endpoint_no": BasicInteger(idl_name="endpoint_no", byte_count=2, is_signed=False), "epoch_s": BasicInteger(idl_name="epoch_s", byte_count=4, is_signed=False), "epoch_us": BasicInteger(idl_name="epoch_us", byte_count=8, is_signed=False), - "event_id": BasicInteger(idl_name="event_id", byte_count=4, is_signed=True), - "event_no": BasicInteger(idl_name="event_no", byte_count=8, is_signed=True), - "fabric_id": BasicInteger(idl_name="fabric_id", byte_count=8, is_signed=True), - "fabric_idx": BasicInteger(idl_name="fabric_idx", byte_count=1, is_signed=True), - "field_id": BasicInteger(idl_name="field_id", byte_count=4, is_signed=True), - "group_id": BasicInteger(idl_name="group_id", byte_count=2, is_signed=True), - "node_id": BasicInteger(idl_name="node_id", byte_count=8, is_signed=True), - "percent": BasicInteger(idl_name="percent", byte_count=1, is_signed=True), - "percent100ths": BasicInteger(idl_name="percent100ths", byte_count=2, is_signed=True), - "status": BasicInteger(idl_name="status", byte_count=2, is_signed=True), + "event_id": BasicInteger(idl_name="event_id", byte_count=4, is_signed=False), + "event_no": BasicInteger(idl_name="event_no", byte_count=8, is_signed=False), + "fabric_id": BasicInteger(idl_name="fabric_id", byte_count=8, is_signed=False), + "fabric_idx": BasicInteger(idl_name="fabric_idx", byte_count=1, is_signed=False), + "field_id": BasicInteger(idl_name="field_id", byte_count=4, is_signed=False), + "group_id": BasicInteger(idl_name="group_id", byte_count=2, is_signed=False), + "node_id": BasicInteger(idl_name="node_id", byte_count=8, is_signed=False), + "percent": BasicInteger(idl_name="percent", byte_count=1, is_signed=False), + "percent100ths": BasicInteger(idl_name="percent100ths", byte_count=2, is_signed=False), + "status": BasicInteger(idl_name="status", byte_count=2, is_signed=False), "systime_us": BasicInteger(idl_name="systime_us", byte_count=8, is_signed=True), "tod": BasicInteger(idl_name="tod", byte_count=4, is_signed=True), "trans_id": BasicInteger(idl_name="trans_id", byte_count=4, is_signed=True), - "utc": BasicInteger(idl_name="utc", byte_count=4, is_signed=True), - "vendor_id": BasicInteger(idl_name="vendor_id", byte_count=2, is_signed=True), + "utc": BasicInteger(idl_name="utc", byte_count=4, is_signed=False), + "vendor_id": BasicInteger(idl_name="vendor_id", byte_count=2, is_signed=False), }