From ae7aa4c0efefd257832a9b7bf772afcb3f8ab591 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 20 Jul 2025 19:46:41 -1000 Subject: [PATCH] preen --- esphome/components/api/api_pb2.cpp | 8 -------- script/api_protobuf/api_protobuf.py | 4 +--- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/esphome/components/api/api_pb2.cpp b/esphome/components/api/api_pb2.cpp index c3814e8089..3b1f8d201f 100644 --- a/esphome/components/api/api_pb2.cpp +++ b/esphome/components/api/api_pb2.cpp @@ -831,8 +831,6 @@ bool NoiseEncryptionSetKeyRequest::decode_length(uint32_t field_id, ProtoLengthD switch (field_id) { case 1: this->key = value.as_string(); - this->key_ptr_ = reinterpret_cast(this->key.data()); - this->key_len_ = this->key.size(); break; default: return false; @@ -2001,8 +1999,6 @@ bool BluetoothGATTWriteRequest::decode_length(uint32_t field_id, ProtoLengthDeli switch (field_id) { case 4: this->data = value.as_string(); - this->data_ptr_ = reinterpret_cast(this->data.data()); - this->data_len_ = this->data.size(); break; default: return false; @@ -2039,8 +2035,6 @@ bool BluetoothGATTWriteDescriptorRequest::decode_length(uint32_t field_id, Proto switch (field_id) { case 3: this->data = value.as_string(); - this->data_ptr_ = reinterpret_cast(this->data.data()); - this->data_len_ = this->data.size(); break; default: return false; @@ -2263,8 +2257,6 @@ bool VoiceAssistantAudio::decode_length(uint32_t field_id, ProtoLengthDelimited switch (field_id) { case 1: this->data = value.as_string(); - this->data_ptr_ = reinterpret_cast(this->data.data()); - this->data_len_ = this->data.size(); break; default: return false; diff --git a/script/api_protobuf/api_protobuf.py b/script/api_protobuf/api_protobuf.py index a51fdc233b..adb103b665 100755 --- a/script/api_protobuf/api_protobuf.py +++ b/script/api_protobuf/api_protobuf.py @@ -634,12 +634,10 @@ class BytesType(TypeInfo): if not self.needs_decode: return "" # No decode needed for SOURCE_SERVER messages - # Decode into storage and update pointer/length + # Decode into storage only - pointer/length are only needed for encoding return ( f"case {self.number}:\n" f" this->{self.field_name} = value.as_string();\n" - f" this->{self.field_name}_ptr_ = reinterpret_cast(this->{self.field_name}.data());\n" - f" this->{self.field_name}_len_ = this->{self.field_name}.size();\n" f" break;" )