libchromeos: Replace char with std::string in string_utils API
std::string version of functions is enough to cover char use cases.
C library was replaced with STL in Split and SplitAtFirst implementations.
Added support of splitting by empty string. Uses but reasonable implementation
is simple.
BUG=none
TEST=unittests
Change-Id: I0778722d31a7b06eea2227b4d94991ab194195cb
Reviewed-on: https://chromium-review.googlesource.com/258640
Reviewed-by: Vitaly Buka <vitalybuka@chromium.org>
Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
Tested-by: Vitaly Buka <vitalybuka@chromium.org>
diff --git a/buffet/commands/command_dictionary.cc b/buffet/commands/command_dictionary.cc
index 1dd0407..14bead8 100644
--- a/buffet/commands/command_dictionary.cc
+++ b/buffet/commands/command_dictionary.cc
@@ -64,8 +64,8 @@
return false;
}
// Construct the compound command name as "pkg_name.cmd_name".
- std::string full_command_name = chromeos::string_utils::Join(
- '.', package_name, command_name);
+ std::string full_command_name =
+ chromeos::string_utils::Join(".", package_name, command_name);
const ObjectSchema* base_parameters_def = nullptr;
const ObjectSchema* base_results_def = nullptr;
@@ -186,7 +186,7 @@
dict.reset();
return dict;
}
- auto cmd_name_parts = chromeos::string_utils::SplitAtFirst(pair.first, '.');
+ auto cmd_name_parts = chromeos::string_utils::SplitAtFirst(pair.first, ".");
std::string package_name = cmd_name_parts.first;
std::string command_name = cmd_name_parts.second;
base::DictionaryValue* package = nullptr;