diff --git a/esphome/components/api/api_frame_helper_plaintext.cpp b/esphome/components/api/api_frame_helper_plaintext.cpp index 1335ae5e60..793cece3b8 100644 --- a/esphome/components/api/api_frame_helper_plaintext.cpp +++ b/esphome/components/api/api_frame_helper_plaintext.cpp @@ -138,7 +138,8 @@ APIError APIPlaintextFrameHelper::try_read_frame_() { if (msg_size_varint.value > MAX_MESSAGE_SIZE) { state_ = State::FAILED; - HELPER_LOG("Bad packet: message size %" PRIu32 " exceeds maximum %u", msg_size_varint.value, MAX_MESSAGE_SIZE); + HELPER_LOG("Bad packet: message size %" PRIu32 " exceeds maximum %u", + static_cast(msg_size_varint.value), MAX_MESSAGE_SIZE); return APIError::BAD_DATA_PACKET; } rx_header_parsed_len_ = static_cast(msg_size_varint.value); @@ -153,8 +154,8 @@ APIError APIPlaintextFrameHelper::try_read_frame_() { } if (msg_type_varint.value > std::numeric_limits::max()) { state_ = State::FAILED; - HELPER_LOG("Bad packet: message type %" PRIu32 " exceeds maximum %u", msg_type_varint.value, - std::numeric_limits::max()); + HELPER_LOG("Bad packet: message type %" PRIu32 " exceeds maximum %u", + static_cast(msg_type_varint.value), std::numeric_limits::max()); return APIError::BAD_DATA_PACKET; } rx_header_parsed_type_ = static_cast(msg_type_varint.value); diff --git a/script/api_protobuf/api_protobuf.py b/script/api_protobuf/api_protobuf.py index e7fdbfd896..1c2a3e5cc2 100755 --- a/script/api_protobuf/api_protobuf.py +++ b/script/api_protobuf/api_protobuf.py @@ -193,7 +193,6 @@ class TypeInfo(ABC): return f"case {self.number}: this->{self.field_name} = {content}; break;" decode_varint = None - is_varint64 = False @property def decode_length_content(self) -> str: @@ -463,7 +462,6 @@ class Int64Type(TypeInfo): cpp_type = "int64_t" default_value = "0" decode_varint = "static_cast(value)" - is_varint64 = True encode_func = "encode_int64" wire_type = WireType.VARINT # Uses wire type 0 @@ -484,7 +482,6 @@ class UInt64Type(TypeInfo): cpp_type = "uint64_t" default_value = "0" decode_varint = "value" - is_varint64 = True encode_func = "encode_uint64" wire_type = WireType.VARINT # Uses wire type 0 @@ -1286,7 +1283,6 @@ class SInt64Type(TypeInfo): cpp_type = "int64_t" default_value = "0" decode_varint = "decode_zigzag64(value)" - is_varint64 = True encode_func = "encode_sint64" wire_type = WireType.VARINT # Uses wire type 0 @@ -1624,10 +1620,6 @@ class RepeatedTypeInfo(TypeInfo): """ return self._ti.wire_type - @property - def is_varint64(self): - return self._ti.is_varint64 - @property def decode_varint_content(self) -> str: # Pointer fields don't support decoding