diff options
-rw-r--r-- | base/i18n/file_util_icu.cc | 2 | ||||
-rw-r--r-- | base/i18n/time_formatting.cc | 4 | ||||
-rw-r--r-- | base/json/string_escape_unittest.cc | 7 | ||||
-rw-r--r-- | base/stats_table_unittest.cc | 18 | ||||
-rw-r--r-- | base/string_util_unittest.cc | 7 | ||||
-rw-r--r-- | base/sys_string_conversions_linux.cc | 2 | ||||
-rw-r--r-- | base/sys_string_conversions_unittest.cc | 14 | ||||
-rw-r--r-- | base/utf_string_conversions_unittest.cc | 6 | ||||
-rw-r--r-- | ipc/ipc_message_utils.h | 4 |
9 files changed, 35 insertions, 29 deletions
diff --git a/base/i18n/file_util_icu.cc b/base/i18n/file_util_icu.cc index f62a05e..0e9c2cd 100644 --- a/base/i18n/file_util_icu.cc +++ b/base/i18n/file_util_icu.cc @@ -7,9 +7,11 @@ #include "base/i18n/file_util_icu.h" #include "base/file_path.h" +#include "base/logging.h" #include "base/scoped_ptr.h" #include "base/singleton.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "base/sys_string_conversions.h" #include "build/build_config.h" #include "unicode/coll.h" diff --git a/base/i18n/time_formatting.cc b/base/i18n/time_formatting.cc index f031cf7..406145d 100644 --- a/base/i18n/time_formatting.cc +++ b/base/i18n/time_formatting.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "base/scoped_ptr.h" -#include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "base/time.h" #include "unicode/datefmt.h" @@ -27,7 +27,7 @@ std::wstring TimeFormat(const icu::DateFormat* formatter, return output; } -} +} // namespace namespace base { diff --git a/base/json/string_escape_unittest.cc b/base/json/string_escape_unittest.cc index a3d6262..29e5a38 100644 --- a/base/json/string_escape_unittest.cc +++ b/base/json/string_escape_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/json/string_escape.h" -#include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { @@ -20,7 +20,7 @@ const struct json_narrow_test_data { {"b\x0f\x7f\xf0\xff!", "b\\u000F\\u007F\\u00F0\\u00FF!"}, }; -} +} // namespace TEST(StringEscapeTest, JsonDoubleQuoteNarrow) { for (size_t i = 0; i < arraysize(json_narrow_cases); ++i) { @@ -64,10 +64,9 @@ const struct json_wide_test_data { {L"b\x0f\x7f\xf0\xff!", "b\\u000F\\u007F\\u00F0\\u00FF!"}, }; -} +} // namespace TEST(StringEscapeTest, JsonDoubleQuoteWide) { - for (size_t i = 0; i < arraysize(json_wide_cases); ++i) { std::string out; string16 in = WideToUTF16(json_wide_cases[i].to_escape); diff --git a/base/stats_table_unittest.cc b/base/stats_table_unittest.cc index a91d70e..0793351 100644 --- a/base/stats_table_unittest.cc +++ b/base/stats_table_unittest.cc @@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#if defined(OS_WIN) +#include <process.h> +#include <windows.h> +#endif + #include "base/multiprocess_test.h" #include "base/platform_thread.h" #include "base/simple_thread.h" #include "base/shared_memory.h" #include "base/stats_table.h" #include "base/stats_counters.h" -#include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/multiprocess_func_list.h" -#if defined(OS_WIN) -#include <process.h> -#include <windows.h> -#endif - namespace base { class StatsTableTest : public MultiProcessTest { @@ -43,7 +43,7 @@ TEST_F(StatsTableTest, VerifySlots) { // Fill up the table with counters. std::string counter_base_name = "counter"; - for (int index=0; index < kMaxCounter; index++) { + for (int index = 0; index < kMaxCounter; index++) { std::string counter_name = counter_base_name; StringAppendF(&counter_name, "counter.ctr%d", index); int counter_id = table.FindCounter(counter_name); @@ -76,11 +76,11 @@ const std::string kCounterMixed = "CounterMixed"; const int kThreadLoops = 1000; class StatsTableThread : public base::SimpleThread { -public: + public: StatsTableThread(std::string name, int id) : base::SimpleThread(name), id_(id) { } virtual void Run(); -private: + private: int id_; }; diff --git a/base/string_util_unittest.cc b/base/string_util_unittest.cc index d75104c..78939f5 100644 --- a/base/string_util_unittest.cc +++ b/base/string_util_unittest.cc @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { @@ -30,7 +31,7 @@ string16 BuildString16(const wchar_t* s) { #elif defined(WCHAR_T_IS_UTF32) string16 u16; while (*s != 0) { - DCHECK(static_cast<unsigned int>(*s) <= 0xFFFFu); + DCHECK_LE(static_cast<unsigned int>(*s), 0xFFFFu); u16.push_back(*s++); } return u16; @@ -455,7 +456,7 @@ struct IntToStringTest { const char* uexpected; }; -} +} // namespace TEST(StringUtilTest, IntToString) { static const IntToStringTest<int> int_tests[] = { @@ -1491,4 +1492,4 @@ TEST(StringUtilTest, ContainsOnlyChars) { EXPECT_FALSE(ContainsOnlyChars("123a", "4321")); } -} // namaspace base +} // base diff --git a/base/sys_string_conversions_linux.cc b/base/sys_string_conversions_linux.cc index 4c4f5ed..26bc78b 100644 --- a/base/sys_string_conversions_linux.cc +++ b/base/sys_string_conversions_linux.cc @@ -7,7 +7,7 @@ #include <wchar.h> #include "base/string_piece.h" -#include "base/string_util.h" +#include "base/utf_string_conversions.h" namespace base { diff --git a/base/sys_string_conversions_unittest.cc b/base/sys_string_conversions_unittest.cc index dd94258..708da09 100644 --- a/base/sys_string_conversions_unittest.cc +++ b/base/sys_string_conversions_unittest.cc @@ -8,7 +8,7 @@ #include "base/basictypes.h" #include "base/string_piece.h" -#include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "base/sys_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" @@ -32,8 +32,8 @@ TEST(SysStrings, SysWideToUTF8) { // // This is what XP does, but Vista has different behavior, so we don't bother // verifying it: - //EXPECT_EQ("\xE4\xBD\xA0\xED\xA0\x80zyxw", - // SysWideToUTF8(L"\x4f60\xd800zyxw")); + // EXPECT_EQ("\xE4\xBD\xA0\xED\xA0\x80zyxw", + // SysWideToUTF8(L"\x4f60\xd800zyxw")); // Test embedded NULLs. std::wstring wide_null(L"a"); @@ -59,7 +59,7 @@ TEST(SysStrings, SysUTF8ToWide) { // // This is what XP does, but Vista has different behavior, so we don't bother // verifying it: - //EXPECT_EQ(L"\x4f60zyxw", SysUTF8ToWide("\xe4\xbd\xa0\xe5\xa5zyxw")); + // EXPECT_EQ(L"\x4f60zyxw", SysUTF8ToWide("\xe4\xbd\xa0\xe5\xa5zyxw")); // Test embedded NULLs. std::string utf8_null("a"); @@ -107,8 +107,8 @@ TEST(SysStrings, SysWideToNativeMB) { // // This is what XP does, but Vista has different behavior, so we don't bother // verifying it: - //EXPECT_EQ("\xE4\xBD\xA0\xED\xA0\x80zyxw", - // SysWideToNativeMB(L"\x4f60\xd800zyxw")); + // EXPECT_EQ("\xE4\xBD\xA0\xED\xA0\x80zyxw", + // SysWideToNativeMB(L"\x4f60\xd800zyxw")); // Test embedded NULLs. std::wstring wide_null(L"a"); @@ -136,7 +136,7 @@ TEST(SysStrings, SysNativeMBToWide) { // // This is what XP does, but Vista has different behavior, so we don't bother // verifying it: - //EXPECT_EQ(L"\x4f60zyxw", SysNativeMBToWide("\xe4\xbd\xa0\xe5\xa5zyxw")); + // EXPECT_EQ(L"\x4f60zyxw", SysNativeMBToWide("\xe4\xbd\xa0\xe5\xa5zyxw")); // Test embedded NULLs. std::string utf8_null("a"); diff --git a/base/utf_string_conversions_unittest.cc b/base/utf_string_conversions_unittest.cc index 6ba0b5b..01a4125 100644 --- a/base/utf_string_conversions_unittest.cc +++ b/base/utf_string_conversions_unittest.cc @@ -3,7 +3,9 @@ // found in the LICENSE file. #include "base/basictypes.h" +#include "base/logging.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { @@ -24,7 +26,7 @@ string16 BuildString16(const wchar_t* s) { #elif defined(WCHAR_T_IS_UTF32) string16 u16; while (*s != 0) { - DCHECK(static_cast<unsigned int>(*s) <= 0xFFFFu); + DCHECK_LE(static_cast<unsigned int>(*s), 0xFFFFu); u16.push_back(*s++); } return u16; @@ -226,4 +228,4 @@ TEST(UTFStringConversionsTest, ConvertMultiString) { EXPECT_EQ(expected, converted); } -} // namaspace base +} // base diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 670ce87..dd3d63e 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -5,6 +5,7 @@ #ifndef IPC_IPC_MESSAGE_UTILS_H_ #define IPC_IPC_MESSAGE_UTILS_H_ +#include <algorithm> #include <string> #include <vector> #include <map> @@ -14,6 +15,7 @@ #include "base/nullable_string16.h" #include "base/string16.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "base/time.h" #include "base/tuple.h" #include "base/values.h" @@ -713,7 +715,7 @@ struct ParamTraits<base::FileDescriptor> { } } }; -#endif // defined(OS_POSIX) +#endif // defined(OS_POSIX) // A ChannelHandle is basically a platform-inspecific wrapper around the // fact that IPC endpoints are handled specially on POSIX. See above comments |