mirror of
https://github.com/esphome/esphome.git
synced 2025-07-30 15:16:37 +00:00
fix
This commit is contained in:
parent
0155769ffe
commit
5feb891e97
@ -849,7 +849,7 @@ void HomeassistantServiceMap::encode(ProtoWriteBuffer buffer) const {
|
|||||||
}
|
}
|
||||||
void HomeassistantServiceMap::calculate_size(uint32_t &total_size) const {
|
void HomeassistantServiceMap::calculate_size(uint32_t &total_size) const {
|
||||||
ProtoSize::add_string_field(total_size, 1, this->key_ref_.size());
|
ProtoSize::add_string_field(total_size, 1, this->key_ref_.size());
|
||||||
ProtoSize::add_string_field(total_size, 1, this->value);
|
ProtoSize::add_string_field(total_size, 1, this->value.size());
|
||||||
}
|
}
|
||||||
void HomeassistantServiceResponse::encode(ProtoWriteBuffer buffer) const {
|
void HomeassistantServiceResponse::encode(ProtoWriteBuffer buffer) const {
|
||||||
buffer.encode_string(1, this->service_ref_);
|
buffer.encode_string(1, this->service_ref_);
|
||||||
|
@ -654,6 +654,10 @@ class StringType(TypeInfo):
|
|||||||
|
|
||||||
# For SOURCE_CLIENT only messages or no_zero_copy, use the string field directly
|
# For SOURCE_CLIENT only messages or no_zero_copy, use the string field directly
|
||||||
if not self._needs_encode or no_zero_copy:
|
if not self._needs_encode or no_zero_copy:
|
||||||
|
# For no_zero_copy, we need to use .size() on the string
|
||||||
|
if no_zero_copy and name != "it":
|
||||||
|
field_id_size = self.calculate_field_id_size()
|
||||||
|
return f"ProtoSize::add_string_field(total_size, {field_id_size}, this->{self.field_name}.size());"
|
||||||
return self._get_simple_size_calculation(name, force, "add_string_field")
|
return self._get_simple_size_calculation(name, force, "add_string_field")
|
||||||
|
|
||||||
# Check if this is being called from a repeated field context
|
# Check if this is being called from a repeated field context
|
||||||
|
Loading…
x
Reference in New Issue
Block a user