mirror of
https://github.com/esphome/esphome.git
synced 2026-09-27 06:50:22 +00:00
Merge branch 'api-proto-max-length' into integration
# Conflicts: # esphome/components/api/api_connection.cpp # esphome/components/api/api_pb2.cpp # esphome/components/api/proto.h # esphome/core/application.h # esphome/core/component.cpp # script/api_protobuf/api_protobuf.py
This commit is contained in:
@@ -1088,13 +1088,10 @@ class PointerToStringBufferType(PointerToBufferTypeBase):
|
||||
@property
|
||||
def encode_content(self) -> str:
|
||||
max_len = self.max_data_length
|
||||
if max_len is not None and max_len < 128:
|
||||
if max_len is not None and max_len < 128 and self.force:
|
||||
tag = self.calculate_tag()
|
||||
if tag < 128:
|
||||
call = f"ProtoEncode::write_short_string(pos PROTO_ENCODE_DEBUG_ARG, {tag}, this->{self.field_name});"
|
||||
if self.force:
|
||||
return call
|
||||
return f"if (!this->{self.field_name}.empty())\n {call}"
|
||||
return f"ProtoEncode::encode_short_string_force(pos, {tag}, this->{self.field_name});"
|
||||
if result := self._encode_bytes_with_precomputed_tag(
|
||||
f"this->{self.field_name}.c_str()",
|
||||
f"this->{self.field_name}.size()",
|
||||
|
||||
Reference in New Issue
Block a user