From 1b6aa986ce3143dd2fe9c9ccc180f8ea9afba1e5 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Tue, 10 Mar 2015 19:33:33 -0700 Subject: 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 Commit-Queue: Vitaly Buka Tested-by: Vitaly Buka --- chromeos-dbus-bindings/indented_text.cc | 2 +- chromeos-dbus-bindings/name_parser.cc | 2 +- chromeos-dbus-bindings/xml_interface_parser.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'chromeos-dbus-bindings') diff --git a/chromeos-dbus-bindings/indented_text.cc b/chromeos-dbus-bindings/indented_text.cc index a261fb4..97e1875 100644 --- a/chromeos-dbus-bindings/indented_text.cc +++ b/chromeos-dbus-bindings/indented_text.cc @@ -61,7 +61,7 @@ void IndentedText::AddComments(const std::string& doc_string) { // For all subsequent lines, remove the same whitespace prefix as found // at the first line of the comment but keep any additional spaces to // maintain the comment layout. - auto lines = chromeos::string_utils::Split(doc_string, '\n', false, false); + auto lines = chromeos::string_utils::Split(doc_string, "\n", false, false); vector lines_out; lines_out.reserve(lines.size()); bool first_nonempty_found = false; diff --git a/chromeos-dbus-bindings/name_parser.cc b/chromeos-dbus-bindings/name_parser.cc index f920c04..35cbb61 100644 --- a/chromeos-dbus-bindings/name_parser.cc +++ b/chromeos-dbus-bindings/name_parser.cc @@ -27,7 +27,7 @@ void AddCloseNamespace(IndentedText *text, const std::string& name) { } // anonymous namespace NameParser::NameParser(const std::string& name) - : namespaces{chromeos::string_utils::Split(name, '.')} { + : namespaces{chromeos::string_utils::Split(name, ".")} { CHECK(!namespaces.empty()) << "Empty name specified"; type_name = namespaces.back(); namespaces.pop_back(); diff --git a/chromeos-dbus-bindings/xml_interface_parser.cc b/chromeos-dbus-bindings/xml_interface_parser.cc index 3fb71a3..cb07e31 100644 --- a/chromeos-dbus-bindings/xml_interface_parser.cc +++ b/chromeos-dbus-bindings/xml_interface_parser.cc @@ -53,7 +53,7 @@ const char XmlInterfaceParser::kMethodKindRaw[] = "raw"; namespace { string GetElementPath(const vector& path) { - return chromeos::string_utils::Join('/', path); + return chromeos::string_utils::Join("/", path); } } // anonymous namespace -- cgit v1.2.3