1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-17 15:26:01 +00:00

[api] Align ProtoSize API design with ProtoWriteBuffer pattern (#9920)

This commit is contained in:
J. Nick Koston
2025-07-28 12:28:32 -10:00
committed by GitHub
parent 68f388f78e
commit 2c9987869e
5 changed files with 795 additions and 865 deletions

View File

@@ -276,8 +276,9 @@ uint16_t APIConnection::encode_message_to_buffer(ProtoMessage &msg, uint8_t mess
#endif
// Calculate size
uint32_t calculated_size = 0;
msg.calculate_size(calculated_size);
ProtoSize size_calc;
msg.calculate_size(size_calc);
uint32_t calculated_size = size_calc.get_size();
// Cache frame sizes to avoid repeated virtual calls
const uint8_t header_padding = conn->helper_->frame_header_padding();