From 94161ccff85b1afda1f42474c26a948af06bfa45 Mon Sep 17 00:00:00 2001 From: "hbono@chromium.org" Date: Wed, 19 Aug 2009 09:22:56 +0000 Subject: Lands for thiago.farina@gmail.com. R=me From Thiago: Replaces some TrimWhitespace with TrimWhitespaceASCII or TrimWhitespaceUTF8. BUG=9851 TEST=run base_unittests.exe, unit_tests.exe and ui_tests.exe Review URL: http://codereview.chromium.org/172039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23703 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/extension_file_util.cc | 2 +- chrome/browser/extensions/user_script_master.cc | 2 +- chrome/browser/net/url_fixer_upper.cc | 6 ++++-- chrome/test/chrome_process_util_linux.cc | 2 +- chrome/test/selenium/selenium_test.cc | 2 +- chrome/tools/convert_dict/hunspell_reader.cc | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/chrome/browser/extensions/extension_file_util.cc b/chrome/browser/extensions/extension_file_util.cc index 6c86965..07ef77f 100644 --- a/chrome/browser/extensions/extension_file_util.cc +++ b/chrome/browser/extensions/extension_file_util.cc @@ -80,7 +80,7 @@ bool ReadCurrentVersion(const FilePath& dir, std::string* version_string) { FilePath current_version = dir.AppendASCII(kCurrentVersionFileName); if (file_util::PathExists(current_version)) { if (file_util::ReadFileToString(current_version, version_string)) { - TrimWhitespace(*version_string, TRIM_ALL, version_string); + TrimWhitespaceASCII(*version_string, TRIM_ALL, version_string); return true; } } diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index 5200e41..e49dfa1 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -31,7 +31,7 @@ static bool GetDeclarationValue(const StringPiece& line, std::string temp(line.data() + prefix.length(), line.length() - prefix.length()); - TrimWhitespace(temp, TRIM_ALL, value); + TrimWhitespaceASCII(temp, TRIM_ALL, value); return true; } diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc index fa572c3..498bd6c 100644 --- a/chrome/browser/net/url_fixer_upper.cc +++ b/chrome/browser/net/url_fixer_upper.cc @@ -75,9 +75,11 @@ void UTF8PartsToWideParts(const string& text_utf8, // does some basic fixes for input that we want to test for file-ness static void PrepareStringForFileOps(const FilePath& text, FilePath::StringType* output) { - TrimWhitespace(text.value(), TRIM_ALL, output); #if defined(OS_WIN) + TrimWhitespace(text.value(), TRIM_ALL, output); replace(output->begin(), output->end(), '/', '\\'); +#else + TrimWhitespaceUTF8(text.value(), TRIM_ALL, output); #endif } @@ -430,7 +432,7 @@ string URLFixerUpper::SegmentURL(const string& text, string URLFixerUpper::FixupURL(const string& text, const string& desired_tld) { string trimmed; - TrimWhitespace(text, TRIM_ALL, &trimmed); + TrimWhitespaceUTF8(text, TRIM_ALL, &trimmed); if (trimmed.empty()) return string(); // Nothing here. diff --git a/chrome/test/chrome_process_util_linux.cc b/chrome/test/chrome_process_util_linux.cc index f1c7601..8905c8c 100644 --- a/chrome/test/chrome_process_util_linux.cc +++ b/chrome/test/chrome_process_util_linux.cc @@ -27,7 +27,7 @@ base::ProcessId ChromeBrowserProcessId(const FilePath& data_dir) { return -1; std::string trimmed_output; - TrimWhitespace(fuser_output, TRIM_ALL, &trimmed_output); + TrimWhitespaceASCII(fuser_output, TRIM_ALL, &trimmed_output); if (trimmed_output.find(' ') != std::string::npos) { LOG(FATAL) << "Expected exactly 1 process to have socket open: " << diff --git a/chrome/test/selenium/selenium_test.cc b/chrome/test/selenium/selenium_test.cc index bf0be73..f2ef32d 100644 --- a/chrome/test/selenium/selenium_test.cc +++ b/chrome/test/selenium/selenium_test.cc @@ -50,7 +50,7 @@ class SeleniumTest : public UITest { std::vector tokens; SplitString(input, ',', &tokens); for (size_t i = 0; i < tokens.size(); ++i) { - TrimWhitespace(tokens[i], TRIM_ALL, &tokens[i]); + TrimWhitespaceASCII(tokens[i], TRIM_ALL, &tokens[i]); output->insert(tokens[i]); } } diff --git a/chrome/tools/convert_dict/hunspell_reader.cc b/chrome/tools/convert_dict/hunspell_reader.cc index c04b165..52e3117 100644 --- a/chrome/tools/convert_dict/hunspell_reader.cc +++ b/chrome/tools/convert_dict/hunspell_reader.cc @@ -20,7 +20,7 @@ void TrimLine(std::string* line) { static_cast((*line)[2]) == 0xbf) *line = line->substr(3); - TrimWhitespace(*line, TRIM_ALL, line); + TrimWhitespaceUTF8(*line, TRIM_ALL, line); } std::string ReadLine(FILE* file) { -- cgit v1.1