This commit is contained in:
J. Nick Koston
2025-12-24 22:07:35 -10:00
parent 8b72c3c0ef
commit 7f4fad74c2
2 changed files with 3 additions and 4 deletions

View File

@@ -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

View File

@@ -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;
}}"""