From e4c1ed979c973ad69ac62db2493f32e3f4db1a4d Mon Sep 17 00:00:00 2001 From: Rapsssito Date: Mon, 19 Aug 2024 17:05:53 +0200 Subject: [PATCH] Inline buffer array --- esphome/components/esp32_ble_server/ble_descriptor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/esphome/components/esp32_ble_server/ble_descriptor.cpp b/esphome/components/esp32_ble_server/ble_descriptor.cpp index d760718ae1..cc1d4ec62b 100644 --- a/esphome/components/esp32_ble_server/ble_descriptor.cpp +++ b/esphome/components/esp32_ble_server/ble_descriptor.cpp @@ -40,14 +40,13 @@ void BLEDescriptor::do_create(BLECharacteristic *characteristic) { void BLEDescriptor::set_value(ByteBuffer buffer) { size_t length = buffer.get_capacity(); - uint8_t *data = buffer.array(); if (length > this->value_.attr_max_len) { ESP_LOGE(TAG, "Size %d too large, must be no bigger than %d", length, this->value_.attr_max_len); return; } this->value_.attr_len = length; - memcpy(this->value_.attr_value, data, length); + memcpy(this->value_.attr_value, buffer.array(), length); } void BLEDescriptor::gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if,