From 188737dfe5e01135040304f42991ceb1f777c154 Mon Sep 17 00:00:00 2001 From: roynatech2544 Date: Wed, 21 Dec 2022 16:44:44 +0900 Subject: [PATCH] unuversal7885: parts-aidl: Display: format changes * Let compiler auto infer lambda's type * Change signature to clearify the usage --- .../apps/aidl-support/parts/default/Display.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/universal7885-common/apps/aidl-support/parts/default/Display.cpp b/universal7885-common/apps/aidl-support/parts/default/Display.cpp index d1e00e6..f99b341 100644 --- a/universal7885-common/apps/aidl-support/parts/default/Display.cpp +++ b/universal7885-common/apps/aidl-support/parts/default/Display.cpp @@ -16,7 +16,6 @@ #include "Display.h" -#include #include #include @@ -52,14 +51,14 @@ enum DisplayResult { constexpr const char *OK_STR = "OK"; constexpr const char *NOOP_STR = "NOOP"; -static DisplayResult parseResult(std::string *result, DisplaySys from) { +static DisplayResult parseResult(std::string *result, DisplaySys from, bool enabled) { std::stringstream ss; std::string parsed; - const std::function addEmpty = [](std::string *str) { + auto addEmpty = [](std::string *str) { if (str->empty()) *str = std::string("(empty)"); }; - ss << DisplayStrBuilder(true, from); + ss << DisplayStrBuilder(enabled, from); ss << ":"; if (result->find(ss.str()) == std::string::npos) { LOG_E("Unexpected: Failed to find built string in result string"); @@ -99,7 +98,7 @@ error: std::string res; writeDisplay(true, type); res = FileIO::readline(SEC_TSP_CMD_RESULT); - switch (parseResult(&res, type)) { + switch (parseResult(&res, type, true)) { case DisplayResult::NOOP: { *_aidl_return = true; break; @@ -107,7 +106,7 @@ error: case DisplayResult::OK: { writeDisplay(true, type); res = FileIO::readline(SEC_TSP_CMD_RESULT); - switch (parseResult(&res, type)) { + switch (parseResult(&res, type, true)) { case DisplayResult::NOOP: { *_aidl_return = false; writeDisplay(false, type);