[mqtt] clang-tidy fixes for #7822 (#7851)

This commit is contained in:
Keith Burzinski 2024-11-26 12:07:53 -06:00 committed by GitHub
parent 53691d28a8
commit 39f3f795e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -151,11 +151,11 @@ void MQTTBackendESP32::mqtt_event_handler_(const Event &event) {
break;
case MQTT_EVENT_DATA: {
static std::string topic;
if (event.topic.length() > 0) {
if (!event.topic.empty()) {
topic = event.topic;
}
ESP_LOGV(TAG, "MQTT_EVENT_DATA %s", topic.c_str());
this->on_message_.call(event.topic.length() > 0 ? topic.c_str() : nullptr, event.data.data(), event.data.size(),
this->on_message_.call(!event.topic.empty() ? topic.c_str() : nullptr, event.data.data(), event.data.size(),
event.current_data_offset, event.total_data_len);
} break;
case MQTT_EVENT_ERROR:
@ -184,7 +184,7 @@ void MQTTBackendESP32::mqtt_event_handler(void *handler_args, esp_event_base_t b
// queue event to decouple processing
if (instance) {
auto event = *static_cast<esp_mqtt_event_t *>(event_data);
instance->mqtt_events_.push(Event(event));
instance->mqtt_events_.emplace(event);
}
}