mirror of
https://github.com/esphome/esphome.git
synced 2026-02-18 15:35:59 -07:00
fixes
This commit is contained in:
@@ -1149,7 +1149,7 @@ void ExecuteServiceResponse::calculate_size(ProtoSize &size) const {
|
||||
size.add_bool(1, this->success);
|
||||
size.add_length(1, this->error_message_ref_.size());
|
||||
#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES_JSON
|
||||
size.add_length(4, this->response_data_len);
|
||||
size.add_length(1, this->response_data_len);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -3399,7 +3399,7 @@ void ZWaveProxyRequest::encode(ProtoWriteBuffer buffer) const {
|
||||
}
|
||||
void ZWaveProxyRequest::calculate_size(ProtoSize &size) const {
|
||||
size.add_uint32(1, static_cast<uint32_t>(this->type));
|
||||
size.add_length(2, this->data_len);
|
||||
size.add_length(1, this->data_len);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -907,7 +907,7 @@ class PointerToBytesBufferType(PointerToBufferTypeBase):
|
||||
)
|
||||
|
||||
def get_size_calculation(self, name: str, force: bool = False) -> str:
|
||||
return f"size.add_length({self.number}, this->{self.field_name}_len);"
|
||||
return f"size.add_length({self.calculate_field_id_size()}, this->{self.field_name}_len);"
|
||||
|
||||
|
||||
class PointerToStringBufferType(PointerToBufferTypeBase):
|
||||
@@ -932,7 +932,6 @@ class PointerToStringBufferType(PointerToBufferTypeBase):
|
||||
@property
|
||||
def decode_length_content(self) -> str | None:
|
||||
return f"""case {self.number}: {{
|
||||
// Use raw data directly via StringRef to avoid allocation
|
||||
this->{self.field_name} = StringRef(reinterpret_cast<const char *>(value.data()), value.size());
|
||||
break;
|
||||
}}"""
|
||||
|
||||
Reference in New Issue
Block a user