mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 09:19:51 +03:00
minor std::string optimizations
This commit is contained in:
@@ -75,7 +75,7 @@ void WebCustomization::read(WebCustomization & customizations, JsonObject root)
|
||||
|
||||
// entries are in the form <XX><shortname>[optional customname] e.g "08heatingactive|heating is on"
|
||||
JsonArray masked_entityJson = entityJson["entity_ids"].to<JsonArray>();
|
||||
for (std::string entity_id : entityCustomization.entity_ids) {
|
||||
for (const std::string & entity_id : entityCustomization.entity_ids) {
|
||||
masked_entityJson.add(entity_id);
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ void WebCustomizationService::customization_entities(AsyncWebServerRequest * req
|
||||
read([&](WebCustomization & settings) {
|
||||
for (EntityCustomization entityCustomization : settings.entityCustomizations) {
|
||||
if (entityCustomization.device_id == device_id) {
|
||||
for (std::string entity_id : entityCustomization.entity_ids) {
|
||||
for (const std::string & entity_id : entityCustomization.entity_ids) {
|
||||
uint8_t mask = Helpers::hextoint(entity_id.substr(0, 2).c_str());
|
||||
std::string name = DeviceValue::get_name(entity_id);
|
||||
if (mask & 0x80) {
|
||||
|
||||
@@ -152,7 +152,7 @@ void WebStatusService::checkUpgrade(AsyncWebServerRequest * request, JsonVariant
|
||||
JsonObject root = response->getRoot();
|
||||
|
||||
version::Semver200_version settings_version(EMSESP_APP_VERSION);
|
||||
std::string latest_version = json["version"] | EMSESP_APP_VERSION;
|
||||
const std::string latest_version = json["version"] | EMSESP_APP_VERSION;
|
||||
version::Semver200_version this_version(latest_version);
|
||||
|
||||
#ifdef EMSESP_DEBUG
|
||||
@@ -170,7 +170,8 @@ void WebStatusService::exportData(AsyncWebServerRequest * request) {
|
||||
auto * response = new AsyncJsonResponse();
|
||||
JsonObject root = response->getRoot();
|
||||
|
||||
String type = request->getParam("type")->value();
|
||||
String type = request->getParam("type")->value();
|
||||
root["type"] = type;
|
||||
|
||||
if (type == "settings") {
|
||||
JsonObject node = root["System"].to<JsonObject>();
|
||||
@@ -192,7 +193,6 @@ void WebStatusService::exportData(AsyncWebServerRequest * request) {
|
||||
return;
|
||||
}
|
||||
|
||||
root["type"] = type;
|
||||
response->setLength();
|
||||
request->send(response);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user