summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 20:42:11 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 20:42:11 +0000
commitef920717d0468a2ece3abcf78ccd57b2f05f7773 (patch)
tree4eacd646f0180ca9ea07066063cb0863177ea0b0
parent9866888c0589ab1f63bb3ecb1d71dc028e72e81e (diff)
downloadchromium_src-ef920717d0468a2ece3abcf78ccd57b2f05f7773.zip
chromium_src-ef920717d0468a2ece3abcf78ccd57b2f05f7773.tar.gz
chromium_src-ef920717d0468a2ece3abcf78ccd57b2f05f7773.tar.bz2
wstring: remove SplitStringAlongWhitespace for wchar
There was only one user, which did a bunch of nonsense. BUG=23581 Review URL: http://codereview.chromium.org/8008003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102563 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/string_split.cc7
-rw-r--r--base/string_split.h2
-rw-r--r--base/string_split_unittest.cc34
-rw-r--r--chrome/browser/themes/theme_service.cc20
4 files changed, 25 insertions, 38 deletions
diff --git a/base/string_split.cc b/base/string_split.cc
index 2b1a037..cb9ee7a 100644
--- a/base/string_split.cc
+++ b/base/string_split.cc
@@ -200,17 +200,10 @@ void SplitStringAlongWhitespaceT(const STR& str, std::vector<STR>* result) {
}
}
-void SplitStringAlongWhitespace(const std::wstring& str,
- std::vector<std::wstring>* result) {
- SplitStringAlongWhitespaceT(str, result);
-}
-
-#if !defined(WCHAR_T_IS_UTF16)
void SplitStringAlongWhitespace(const string16& str,
std::vector<string16>* result) {
SplitStringAlongWhitespaceT(str, result);
}
-#endif
void SplitStringAlongWhitespace(const std::string& str,
std::vector<std::string>* result) {
diff --git a/base/string_split.h b/base/string_split.h
index eb0c219..6c7895d 100644
--- a/base/string_split.h
+++ b/base/string_split.h
@@ -72,8 +72,6 @@ BASE_EXPORT void SplitStringDontTrim(const std::string& str,
// Splits the string along whitespace (where whitespace is the five space
// characters defined by HTML 5). Each contiguous block of non-whitespace
// characters is added to result.
-BASE_EXPORT void SplitStringAlongWhitespace(const std::wstring& str,
- std::vector<std::wstring>* result);
BASE_EXPORT void SplitStringAlongWhitespace(const string16& str,
std::vector<string16>* result);
BASE_EXPORT void SplitStringAlongWhitespace(const std::string& str,
diff --git a/base/string_split_unittest.cc b/base/string_split_unittest.cc
index ee5877b..83e4d74 100644
--- a/base/string_split_unittest.cc
+++ b/base/string_split_unittest.cc
@@ -283,27 +283,27 @@ TEST(StringSplitTest, StringSplitDontTrim) {
TEST(StringSplitTest, SplitStringAlongWhitespace) {
struct TestData {
- const std::wstring input;
+ const char* input;
const size_t expected_result_count;
- const std::wstring output1;
- const std::wstring output2;
+ const char* output1;
+ const char* output2;
} data[] = {
- { L"a", 1, L"a", L"" },
- { L" ", 0, L"", L"" },
- { L" a", 1, L"a", L"" },
- { L" ab ", 1, L"ab", L"" },
- { L" ab c", 2, L"ab", L"c" },
- { L" ab c ", 2, L"ab", L"c" },
- { L" ab cd", 2, L"ab", L"cd" },
- { L" ab cd ", 2, L"ab", L"cd" },
- { L" \ta\t", 1, L"a", L"" },
- { L" b\ta\t", 2, L"b", L"a" },
- { L" b\tat", 2, L"b", L"at" },
- { L"b\tat", 2, L"b", L"at" },
- { L"b\t at", 2, L"b", L"at" },
+ { "a", 1, "a", "" },
+ { " ", 0, "", "" },
+ { " a", 1, "a", "" },
+ { " ab ", 1, "ab", "" },
+ { " ab c", 2, "ab", "c" },
+ { " ab c ", 2, "ab", "c" },
+ { " ab cd", 2, "ab", "cd" },
+ { " ab cd ", 2, "ab", "cd" },
+ { " \ta\t", 1, "a", "" },
+ { " b\ta\t", 2, "b", "a" },
+ { " b\tat", 2, "b", "at" },
+ { "b\tat", 2, "b", "at" },
+ { "b\t at", 2, "b", "at" },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
- std::vector<std::wstring> results;
+ std::vector<std::string> results;
SplitStringAlongWhitespace(data[i].input, &results);
ASSERT_EQ(data[i].expected_result_count, results.size());
if (data[i].expected_result_count > 0)
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index e35558c..69f6338 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -385,23 +385,19 @@ std::string ThemeService::AlignmentToString(int alignment) {
// static
int ThemeService::StringToAlignment(const std::string& alignment) {
- std::vector<std::wstring> split;
- base::SplitStringAlongWhitespace(UTF8ToWide(alignment), &split);
+ std::vector<std::string> split;
+ base::SplitStringAlongWhitespace(alignment, &split);
int alignment_mask = 0;
- for (std::vector<std::wstring>::iterator alignments(split.begin());
- alignments != split.end(); ++alignments) {
- std::string comp = WideToUTF8(*alignments);
- const char* component = comp.c_str();
-
- if (base::strcasecmp(component, kAlignmentTop) == 0)
+ for (std::vector<std::string>::iterator component(split.begin());
+ component != split.end(); ++component) {
+ if (LowerCaseEqualsASCII(*component, kAlignmentTop))
alignment_mask |= ThemeService::ALIGN_TOP;
- else if (base::strcasecmp(component, kAlignmentBottom) == 0)
+ else if (LowerCaseEqualsASCII(*component, kAlignmentBottom))
alignment_mask |= ThemeService::ALIGN_BOTTOM;
-
- if (base::strcasecmp(component, kAlignmentLeft) == 0)
+ else if (LowerCaseEqualsASCII(*component, kAlignmentLeft))
alignment_mask |= ThemeService::ALIGN_LEFT;
- else if (base::strcasecmp(component, kAlignmentRight) == 0)
+ else if (LowerCaseEqualsASCII(*component, kAlignmentRight))
alignment_mask |= ThemeService::ALIGN_RIGHT;
}
return alignment_mask;