mirror of
https://github.com/esphome/esphome.git
synced 2025-07-30 15:16:37 +00:00
dry
This commit is contained in:
parent
32edc3f062
commit
0773fc320b
@ -771,13 +771,13 @@ class ProtoSize {
|
|||||||
* @param messages Vector of message objects
|
* @param messages Vector of message objects
|
||||||
*/
|
*/
|
||||||
template<typename MessageType>
|
template<typename MessageType>
|
||||||
inline void add_force_message(uint32_t field_id_size, const std::vector<MessageType> &messages) {
|
inline void add_repeated_message(uint32_t field_id_size, const std::vector<MessageType> &messages) {
|
||||||
// Skip if the vector is empty
|
// Skip if the vector is empty
|
||||||
if (messages.empty()) {
|
if (messages.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the force version for all messages
|
// Use the force version for all messages in the repeated field
|
||||||
for (const auto &message : messages) {
|
for (const auto &message : messages) {
|
||||||
add_message_object_force(field_id_size, message);
|
add_message_object_force(field_id_size, message);
|
||||||
}
|
}
|
||||||
|
@ -1236,7 +1236,7 @@ class RepeatedTypeInfo(TypeInfo):
|
|||||||
if isinstance(self._ti, MessageType):
|
if isinstance(self._ti, MessageType):
|
||||||
# For repeated messages, use the dedicated helper that handles iteration internally
|
# For repeated messages, use the dedicated helper that handles iteration internally
|
||||||
field_id_size = self._ti.calculate_field_id_size()
|
field_id_size = self._ti.calculate_field_id_size()
|
||||||
o = f"size.add_force_message({field_id_size}, {name});"
|
o = f"size.add_repeated_message({field_id_size}, {name});"
|
||||||
return o
|
return o
|
||||||
|
|
||||||
# For other repeated types, use the underlying type's size calculation with force=True
|
# For other repeated types, use the underlying type's size calculation with force=True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user