From 5ffa5ef3a6b2c8689c7d12cd67b6823ba25783a5 Mon Sep 17 00:00:00 2001 From: "P.Y. Laligand" Date: Fri, 16 Jun 2017 14:32:09 -0700 Subject: [PATCH] Revert "Update switches to use StringView." (flutter/engine#3784) * Revert "Initial integration of libtxt with Flutter alongside Blink. (#3771)" This reverts commit b4a9f9c6d5008f677400826dfa3a0ab30de3db23. * Revert "Call Selection.removeSelection if the framework has cleared the selection (#3782)" This reverts commit 2a34ee9a676b0049a18fc9e131ad1b311e1ea848. * Revert "Update switches to use StringView. (#3781)" This reverts commit 6adf58135e16dfb0ff04b00672abe6f0876c91b4. --- engine/src/flutter/shell/common/switches.cc | 12 +++++------- engine/src/flutter/shell/common/switches.h | 4 +--- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/engine/src/flutter/shell/common/switches.cc b/engine/src/flutter/shell/common/switches.cc index 6ea1bb3dbc..9a3168f735 100644 --- a/engine/src/flutter/shell/common/switches.cc +++ b/engine/src/flutter/shell/common/switches.cc @@ -7,8 +7,6 @@ #include #include -#include "lib/ftl/strings/string_view.h" - // Include once for the default enum definition. #include "flutter/shell/common/switches.h" @@ -16,7 +14,7 @@ struct SwitchDesc { shell::Switch sw; - const ftl::StringView flag; + const char* flag; const char* help; }; @@ -48,7 +46,7 @@ void PrintUsage(const std::string& executable_name) { uint32_t max_width = 2; for (uint32_t i = 0; i < flags_count; i++) { auto desc = gSwitchDescs[i]; - max_width = std::max(desc.flag.size() + 2, max_width); + max_width = std::max(strlen(desc.flag) + 2, max_width); } const uint32_t help_width = column_width - max_width - 3; @@ -58,7 +56,7 @@ void PrintUsage(const std::string& executable_name) { auto desc = gSwitchDescs[i]; std::cerr << std::setw(max_width) - << std::string("--") + desc.flag.ToString() << " : "; + << std::string("--") + std::string(desc.flag) << " : "; std::istringstream stream(desc.help); int32_t remaining = help_width; @@ -80,13 +78,13 @@ void PrintUsage(const std::string& executable_name) { std::cerr << std::string(column_width, '-') << std::endl; } -const ftl::StringView FlagForSwitch(Switch swtch) { +const char* FlagForSwitch(Switch swtch) { for (uint32_t i = 0; i < static_cast(Switch::Sentinel); i++) { if (gSwitchDescs[i].sw == swtch) { return gSwitchDescs[i].flag; } } - return ftl::StringView(); + return nullptr; } } // namespace shell diff --git a/engine/src/flutter/shell/common/switches.h b/engine/src/flutter/shell/common/switches.h index 696918c285..ac43b92126 100644 --- a/engine/src/flutter/shell/common/switches.h +++ b/engine/src/flutter/shell/common/switches.h @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "lib/ftl/strings/string_view.h" - #ifndef SHELL_COMMON_SWITCHES_H_ #define SHELL_COMMON_SWITCHES_H_ @@ -111,7 +109,7 @@ DEF_SWITCHES_END void PrintUsage(const std::string& executable_name); -const ftl::StringView FlagForSwitch(Switch sw); +const char* FlagForSwitch(Switch sw); } // namespace shell